Hi all,
i have the following requirements
1) remove an aspect if the content of a document gets changed (because it is only valid for the actual document version)
2) reapply it if the document gets restored from the version history.
Part 1) works fine so far. I am using two policies ContentServicePolicies.OnContentUpdatePolicy and VersionServicePolicies.AfterCreateVersionPolicy. onContentUpdate gets called when a content property is changed - the nodeRef is then bound to the transaction. Sometimes later AfterCreateVersion gets called if the new version was created so i only need to check if the nodeRef i get as parameter was bound to the transaction which indicates that the content was modified and a new version was created - only then i can remove the aspect.
Part 2) is the problem. At first i thought that nothing else will be needed, because alfresco will automatically take care of restoring the aspect. But during a restore to a previous version, the content property of a node gets written too, so OnContentUpdatePolicy is triggered and the nodeRef is bound to the transaction. During the restore operation it also gets a new version, which triggers the aspect remove on the restored node. So thats not the outcome i want.
Regarding my requirements, has someone an idea how i could identify restore operations and distinguish them from normal versioning only by using policies?
Kind regards,
h.