How to upload properties without losing it after new version upload?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

How to upload properties without losing it after new version upload?

Hello,

I'm working on application which connects to Alfresco 5.1 over CMIS (using Apache Chemistry). This app provides:

- creation of a new document (own type) with specified metadata - method "createDocument" of Apache Chemistry is used

- edit metadata (without creation of new version) - method "updateProperties" of Apache Chemistry is used

- upload new version of document - method "checkIn" of Apache Chemistry is used

 

New document creation with initial metadata set works fine. When I update metadata (edit) all changes are correctly vissible, new version is not created - I check it on web share and by CMIS.

Upload of a new version of document creates correctly new version. When I check metadata of previous document version there are not metadata values which were in the moment just before new version but the values are initial metadata.

 

Is it possible to not lost metadata change when new version is uploaded? I don't prefere to create new version of document when metadata property is updated (autoVersionOnUpdateProps).

 

Thanks

8 Replies
Highlighted
Intermediate

Re: How to upload properties without losing it after new version upload?

Can you please confirm the exact build/version of Alfresco 5.1 ? Is it a Community or Enterprise release ?

Also, can you refine your steps with some example data (or ideally provide a standalone CMIS test script as well) ?

To paraphrase your steps ...

1. upload new text document with "abc" (=> version 1.0)

2. check content is "abc" and "cm:title" is not set

3. upload new version of document with "def" using checkout / checkin (1.1)

4. check content  is "def" and "cm:title" is not set

5. update "cm:title" to "t0" (version stays at 1.1)

6. check content  is "def" and "cm:title" is "t0"

7. update "cm:title" to "t1" (version stays at 1.1)

8. check content  is "def" and "cm:title" is "t1"

9. upload new version of document with "ghi" using checkout / checkin (1.2)

10. check content  is "ghi" and "cm:title" is "t1"

11. update "cm:title" to "t2" (version stays at 1.2)

12. check content  is "ghi" and "cm:title" is "t2"

13. update "cm:title" to "t3" (version stays at 1.2)

14. check content  is "ghi" and "cm:title" is "t3"

15. etc ... if you check version history at this point, you have three versions 1.0 (abc, null), 1.1 (def, t1), 1.2 (ghi, t3)

... is that right ?

Thanks,

Jan

Highlighted
Active Member

Re: How to upload properties without losing it after new version upload?

Firstly thanks for your fast response.

I´m working with Alfresco Community v5.1.0 (r127059-b7) schema 10001.

To your example:

Based on our experiences with Alfresco (with own defined data type) I got following result for your step 15:

1.0   (abc, null), 1.1 (def, null), 1.2 (ghi, t3) – however I haven’t tested.

Let me describe the steps for our situation. We have created own type "web:webDocument" which contains for example a property like "web:WebDocumentYearFor".

1. upload new text document (content "abc") with property "web:WebDocumentYearFor" "2010" (=> version 1.0)
2. check content is "abc" and "web:WebDocumentYearFor" is "2010"
3. update "web:WebDocumentYearFor" with "2011" - (version stays at 1.0)
4. check content is "abc" and "web:WebDocumentYearFor" is "2011"
5. upload new version of document "def" and "web:WebDocumentYearFor" "2012" with using checkout / checkin (created new version 1.1)
6. check actual content is "def" and "web:WebDocumentYearFor" is "2012" (version 1.1) - still expected behaviour
7. check older version content is "abc" and "web:WebDocumentYearFor" is "2010" (version 1.0) - why?

Do you have any idea of this behaviour? Is it possible to change it? I will be grateful for any solution.

Thanks,

Zdenek

Highlighted
Active Member

Re: How to upload properties without losing it after new version upload?

Hello again,
when we test behaviour by using your steps by CMIS in step 15 we obtain this result:

1.2: cm:title = t3

1.1: cm:title = null

1.0: cm:title = null

Although in Alfresco Share provide this metadata

metadata in alfresco share

I hope this helps.

Zdenek

Highlighted
Member II

Re: How to upload properties without losing it after new version upload?

Hello,

We also have the same problem with the properties. Did you solve it?

Thanks

Highlighted
Intermediate

Re: How to upload properties without losing it after new version upload?

Can you please try the exact same steps with latest Community 201702 GA (includes Content Services 5.2.f) ?

Highlighted
Active Member

Re: How to upload properties without losing it after new version upload?

Hello,

I have Alfresco Community version 201702. I made very similar tests as described above. I got the same results as Zdeněk Gold.

Highlighted
Member II

Re: How to upload properties without losing it after new version upload?

Hi,

My version is Enterprise - 5.1.2, and after the tests I also got Zdenek's results

Highlighted
Established Member

Re: How to upload properties without losing it after new version upload?

I had the same problem. I am using 5.1.x community edition, and integrating through CMIS1.1.

By default, as far as I know, Alfresco does not turn on the versioning of property updates. With respect to versioning, there are flags (versionable, autoVersionOnUpdateProps, etc.) that one can set Alfresco system level, or at a custom model level, etc. Or even something like a rule can be set on a folder (using Share) to turn these on.

Anyways, if we manage to turn this flag [cm:autoVersionOnUpdateProps] on, then each minor updates to any (meta) properties would trigger a new (minor/major) version.

Now if this is what you desire, you could pursue this route.

I do not desire the behavior of auto versioning on each and every meta property updates.

This is what I ended up doing.

So, before every time, a user creates a new version (except for the first time), I compare the create date and modified date of the document, and if it has been modified, I create a version manually through code only to persist the latest (meta) properties update. Then I will create the new version the user initiated. I have a post related to this couple days ago.