Version history does not include property updates

cancel
Showing results for 
Search instead for 
Did you mean: 
sepgs2004
Established Member

Version history does not include property updates

Jump to solution

Alfresco 5.1, CMIS.

Let us say we upload/index a document (v1.0). Let us say we update its custom properties afterwards.

Then, we upload a new version (v1.1) of the document.

Now when I see the history, the old version (v1.0) does not have the updated custom properties.

Before making a new version (v1.1), does it not make sense for v1.0 to have all that was before v1.1

In a way, I lost all the update values in between 1.0 and 1.1

For example, we store the user ids of users, who have viewed the content of the document, into a array/list property called "viewers". This array/list property is a custom property on the document.

Let us say, the users u1 and u2, have viewed respectively the document so far after it has been created.

Now before creating a new version of the same document, if I see the values of the properties, I can see the value for the viewers property as "u2, u1".

Now once I upload a new version of the document, the new (and the latest) version (v1.1) does not have any viewers and it is correct. However, if I view the version history, and look into version (v1.0), I see the viewers property empty. And now the latest version (v1.1) also do not have any viewers, which is actually correct. However, there are users who viewed the earlier version v1.0. You see, I lost the viewers on the initial version.

How do I go about maintaining the viewers for version v1.0?

We do not have our custom model defined with mandatory aspect:versionable. I do not know if we have to do this. Even without this, when we checkout and checkin, I see the versions getting created.

I read this online:

Any properties that you set on a file are saved with the current version of a file, and written to the Version History after a major update; for example, when a new file is uploaded. This means that if you save properties in version 1.0, they are saved in the Version History of version 1.1.

The property version.store.enableAutoVersionOnUpdateProps is set to false by default. This means that the version history is not incremented when using Edit Properties in Share. Set this property to version.store.enableAutoVersionOnUpdateProps=true in alfresco-global.properties to enable this property.

I have a hard time understanding the above.

Does anyone have this problem?

Or am I seeing things incorrectly?

Gnanasekaran Sakthivel
2 Solutions

Accepted Solutions
afaust
Master

Re: Version history does not include property updates

Jump to solution

The version 1.0 is created when the document is initially created and only with the properties set at this time. If you update the properties / metadata only, the behaviour is dependent on a metadata property called "cm:autoVersionOnUpdateProps" which can be set on any node. Depending on how you create the document (via which API), there may be different default values. Provided that the specific API you are using to create the document does not set a value, the default will be determined by version.store.enableAutoVersionOnUpdateProps, or it will be set to true (if that config variable has not been set).

If that property is set to true, any property updates on a node will trigger creation of a new version.

The same concept also applies to automatic version creation on content change. There is "cm:autoVersion", which can have its default defined via version.store.enableAutoVersioning, unless a specific API already sets a default value on its own.

The behaviour you observe as the intended default, which avoids creating excessive "waste" versions unless specifically configured to version on every minute property change...

Via CMIS you have the explicit option to specify how an update should be treated as to the versioning state.

View solution in original post

abhinavmishra14
Advanced

Re: Version history does not include property updates

Jump to solution

@VipulSwarup  What you see is expected AFAIK..

Default behavior:

When you upload a file via share or by any means, cm:versionable aspect is applied on it. It by default sets following properties on the uploaded node:

cm:autoVersion => true - Tells that when the cm:versionable aspect is applied and initial snap shot of the node was taken.

cm:initialVersion => true - Tells that when ever a change is made to the "content of a node" that has the versionable aspect applied a new version will be created.

cm:autoVersionOnUpdateProps => false - Tells that version won't be incremented when properties are updated on a node.

This can be verified via node browser.

This is the default configuration at repo level:

version.store.initialVersion=true
version.store.enableAutoVersioning=true
version.store.enableAutoVersionOnUpdateProps=false

At this point the node is still at version 1.0. Note that version 1.0 snapshot which was taken initially have empty title and description.

Now, you updated the properties such as Title (cm:title) and Description (cm:description). Version of the node won't be incremented (Look at the statements above) considering the default behavior. Updated values are persisted at the work in progress copy i.e. workspace node.

Next, you uploaded a new version of content, which triggers autoversion and a new version will be created. You updated the property Title (cm:title) again, Now you are at version 1.1. This version 1.1 snapshot would keep the previously updated title and description. Newly made updates are still on workspace node and not part of version snapshot.

Next, you decided to revert the version to 1.0 after property update.
Your result is expected, and you won't see the updated title and description because when 1.0 version snapshot was taken, these properties were not set.


Next, you went ahead and set the following properties in your global properties file:

version.store.enableAutoVersioning=true (It is default true already, ideally not required to re-set unless you want to disable the behavior)
version.store.enableAutoVersionOnUpdateProps=true

Tried to repeat the same process and updated the properties on the same object which you uploaded earlier. You don't see any updates even after the global properties change. Point to note here that when you created the object for the first time the "cm:autoVersionOnUpdateProps" property was set to "false". It is still intact and value remained false, hence global properties updates did not took effect.

If you upload a new file, then this time the properties will be set like this, you can check it via node browser:

cm:autoVersion => true
cm:initialVersion => true
cm:autoVersionOnUpdateProps => true - Tells that version would be incremented when properties are updated on a node, taking congnizance of global properties file updates.

When you try to update the properties now on this newly uploaded node, the version will be auto incremented.

If you want that, existing nodes to auto version on properties update, then you would have to write a script to reset the already set "cm:autoVersionOnUpdateProps" property value to "true".

For newly uploaded nodes, you are good to go anyway.

 

Refer to this post to understand the versioning behaviour, its is old post but gives a good insight of versioning behavior:

https://hub.alfresco.com/t5/alfresco-content-services-hub/versioning-behaviour/ba-p/291554

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View solution in original post

6 Replies
afaust
Master

Re: Version history does not include property updates

Jump to solution

The version 1.0 is created when the document is initially created and only with the properties set at this time. If you update the properties / metadata only, the behaviour is dependent on a metadata property called "cm:autoVersionOnUpdateProps" which can be set on any node. Depending on how you create the document (via which API), there may be different default values. Provided that the specific API you are using to create the document does not set a value, the default will be determined by version.store.enableAutoVersionOnUpdateProps, or it will be set to true (if that config variable has not been set).

If that property is set to true, any property updates on a node will trigger creation of a new version.

The same concept also applies to automatic version creation on content change. There is "cm:autoVersion", which can have its default defined via version.store.enableAutoVersioning, unless a specific API already sets a default value on its own.

The behaviour you observe as the intended default, which avoids creating excessive "waste" versions unless specifically configured to version on every minute property change...

Via CMIS you have the explicit option to specify how an update should be treated as to the versioning state.

VipulSwarup
Active Member

Re: Version history does not include property updates

Jump to solution

Hi 

We are seeing a similar issue.

Step 1: Create a new document

At this point the Title and Descriptions are blank, as expected.

Step 2: Add a title and description via edit properties (Let's say "Title A" and "Description A")

Step 3: Upload new version of document

At this point the document is at version 1.1

Step 4: Edit the title to a new text (Let's say "Title B")

Step 5: Revert document to older version 

Now the Title and Description are Blank. But we expect them to be "Title A" and "Description A".

Any ideas? I have tried setting the below properties in Alfresco Global Properties file, but it makes no difference:


version.store.enableAutoVersionOnUpdateProps=true
version.store.enableAutoVersioning=true

 

We are on Alfresco Community Edition 5.2 (201707) on Ubuntu server.

Thanks

Vipul

abhinavmishra14
Advanced

Re: Version history does not include property updates

Jump to solution

@VipulSwarup  What you see is expected AFAIK..

Default behavior:

When you upload a file via share or by any means, cm:versionable aspect is applied on it. It by default sets following properties on the uploaded node:

cm:autoVersion => true - Tells that when the cm:versionable aspect is applied and initial snap shot of the node was taken.

cm:initialVersion => true - Tells that when ever a change is made to the "content of a node" that has the versionable aspect applied a new version will be created.

cm:autoVersionOnUpdateProps => false - Tells that version won't be incremented when properties are updated on a node.

This can be verified via node browser.

This is the default configuration at repo level:

version.store.initialVersion=true
version.store.enableAutoVersioning=true
version.store.enableAutoVersionOnUpdateProps=false

At this point the node is still at version 1.0. Note that version 1.0 snapshot which was taken initially have empty title and description.

Now, you updated the properties such as Title (cm:title) and Description (cm:description). Version of the node won't be incremented (Look at the statements above) considering the default behavior. Updated values are persisted at the work in progress copy i.e. workspace node.

Next, you uploaded a new version of content, which triggers autoversion and a new version will be created. You updated the property Title (cm:title) again, Now you are at version 1.1. This version 1.1 snapshot would keep the previously updated title and description. Newly made updates are still on workspace node and not part of version snapshot.

Next, you decided to revert the version to 1.0 after property update.
Your result is expected, and you won't see the updated title and description because when 1.0 version snapshot was taken, these properties were not set.


Next, you went ahead and set the following properties in your global properties file:

version.store.enableAutoVersioning=true (It is default true already, ideally not required to re-set unless you want to disable the behavior)
version.store.enableAutoVersionOnUpdateProps=true

Tried to repeat the same process and updated the properties on the same object which you uploaded earlier. You don't see any updates even after the global properties change. Point to note here that when you created the object for the first time the "cm:autoVersionOnUpdateProps" property was set to "false". It is still intact and value remained false, hence global properties updates did not took effect.

If you upload a new file, then this time the properties will be set like this, you can check it via node browser:

cm:autoVersion => true
cm:initialVersion => true
cm:autoVersionOnUpdateProps => true - Tells that version would be incremented when properties are updated on a node, taking congnizance of global properties file updates.

When you try to update the properties now on this newly uploaded node, the version will be auto incremented.

If you want that, existing nodes to auto version on properties update, then you would have to write a script to reset the already set "cm:autoVersionOnUpdateProps" property value to "true".

For newly uploaded nodes, you are good to go anyway.

 

Refer to this post to understand the versioning behaviour, its is old post but gives a good insight of versioning behavior:

https://hub.alfresco.com/t5/alfresco-content-services-hub/versioning-behaviour/ba-p/291554

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
VipulSwarup
Active Member

Re: Version history does not include property updates

Jump to solution

Hi Abhinav

Thanks for the very detailed and useful reply.

After setting the Alfresco Global properties to have this:

version.store.enableAutoVersionOnUpdateProps=true

And then restarting Alfresco.

Even on new documents, still the property "cm:autoVersionOnUpdateProps" is FALSE, as verified via node browser. And the document still doesn't version on property update.

Any ideas? I am on Community 5.2

Thanks

Vipul.

VipulSwarup
Active Member

Re: Version history does not include property updates

Jump to solution

@abhinavmishra14 I have actually gotten around it by putting a rule on a folder to automatically set cm:autoVersionOnUpdateProps=true for each new document.

But is there a way to make the actual version 1.0 of the document store the filled out metadata values (without versioning on each metadata edit)? 

We use this popular extension to force user to enter properties while uploading documents - https://hub.alfresco.com/t5/alfresco-content-services-add/uploader-plus/td-p/291849

But still version 1.0 has blank properties, as per the default behaviour.

abhinavmishra14
Advanced

Re: Version history does not include property updates

Jump to solution

It is very unlikely that you have enabled 

version.store.enableAutoVersionOnUpdateProps=true

in your global properties file and you still see "cm:autoVersionOnUpdateProps" as FALSE. This works perfectly OOTB. Check if you have any behaviors or rules that might be re-setting the values. Or your global properties changes are not getting loaded properly. 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)