Expand my Community achievements bar.

SOLVED

Custom Versioning on Asset

Avatar

Level 1

Hi, 

I need to create custom version for Asset in which, on any check-in (modification) version should be updated like 1.0, 1.1, 1.2.......1.n. and on Publish it should change to 2.0, 3.0,4.0,.....,N.

I'm using below event handler to handle the event on version change.

Event Handler --> EventConstants.EVENT_TOPIC + "=" + DamEvent.EVENT_TOPIC.

Event : DamEvent.Type.VERSIONED.

 

I'm keeping the property "customVersion" on jcr:content node. On Version modification its properly incrementing but on restore the Event is getting triggered twice and its incrementing the value on the restored version instead of latest or current value.

 

In OOTB, versionHistory is properly creating the version and maintaining the sequence. 

 

Can anyone suggest any solution for it to distinguish the Event for Restore or how OOTB versionHistory works.

 

Thanks in Advance!!!

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello,

 

Can you please add some info/code snippet about the event listener code? I can think of a possibility that within the path that you have mentioned eg /content/dam/folder the change jcr:content of the particular asset would trigger the listener but if there is any property change in any other property within that or based on the type that is mentioned, it could still trigger event again. 

 

However, since you are looking to add a customVersion property for a change detected in publisher, you must be doing this in all publishers for any asset activation or haveing to sync this in remainign publishers (might have to check if this is/may be happening for content fragments as well). An option you can try is using  a Preprocessor - Check whether the appropriate asset is being activated, if its applicable, set the customVersion property and save, the replication will automatically set the desired versions in all publishers.

 

Hope this helps

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello,

 

Can you please add some info/code snippet about the event listener code? I can think of a possibility that within the path that you have mentioned eg /content/dam/folder the change jcr:content of the particular asset would trigger the listener but if there is any property change in any other property within that or based on the type that is mentioned, it could still trigger event again. 

 

However, since you are looking to add a customVersion property for a change detected in publisher, you must be doing this in all publishers for any asset activation or haveing to sync this in remainign publishers (might have to check if this is/may be happening for content fragments as well). An option you can try is using  a Preprocessor - Check whether the appropriate asset is being activated, if its applicable, set the customVersion property and save, the replication will automatically set the desired versions in all publishers.

 

Hope this helps