MNT-9318: CLONE - It's impossible to update comment for the content after version revert

Merged V4.1-BUG-FIX (4.1.7) to HEAD (4.2)
    55265: Merged DEV to V4.1-BUG-FIX (4.1.7)
       55184: MNT-6334: It's impossible to update comment for the content after version revert
        - Restore association if it was removed in older document version.
        - Extend unit test.
       55221: MNT-6334: It's impossible to update comment for the content after version revert
        - Make corrections to the code.
        - Extend unit test. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55326 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Pavel Yurke
2013-09-16 10:53:10 +00:00
parent ed839dcbe0
commit 47436a8477
7 changed files with 158 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ import org.alfresco.repo.version.VersionRevertCallback.RevertAssocAction;
import org.alfresco.repo.version.VersionRevertDetails;
import org.alfresco.repo.version.VersionServicePolicies;
import org.alfresco.repo.version.VersionServicePolicies.AfterCreateVersionPolicy;
import org.alfresco.repo.version.VersionServicePolicies.AfterVersionRevertPolicy;
import org.alfresco.repo.version.VersionServicePolicies.BeforeCreateVersionPolicy;
import org.alfresco.repo.version.VersionServicePolicies.CalculateVersionLabelPolicy;
import org.alfresco.repo.version.VersionServicePolicies.OnCreateVersionPolicy;
@@ -76,6 +77,7 @@ public abstract class AbstractVersionServiceImpl
private ClassPolicyDelegate<OnCreateVersionPolicy> onCreateVersionDelegate;
private ClassPolicyDelegate<CalculateVersionLabelPolicy> calculateVersionLabelDelegate;
private ClassPolicyDelegate<OnRevertVersionPolicy> onRevertVersionDelegate;
private ClassPolicyDelegate<AfterVersionRevertPolicy> afterVersionRevertDelegate;
/**
* Sets the general node service
@@ -118,6 +120,24 @@ public abstract class AbstractVersionServiceImpl
this.onCreateVersionDelegate = this.policyComponent.registerClassPolicy(VersionServicePolicies.OnCreateVersionPolicy.class);
this.calculateVersionLabelDelegate = this.policyComponent.registerClassPolicy(VersionServicePolicies.CalculateVersionLabelPolicy.class);
this.onRevertVersionDelegate = this.policyComponent.registerClassPolicy(VersionServicePolicies.OnRevertVersionPolicy.class);
this.afterVersionRevertDelegate = this.policyComponent.registerClassPolicy(VersionServicePolicies.AfterVersionRevertPolicy.class);
}
/**
* Invokes after version has been reverted
*
* @param nodeRef the node that has been reverted
* @param version the reverted version
*/
protected void invokeAfterVersionRevert(NodeRef nodeRef,Version version)
{
// invoke for node type
QName nodeTypeQName = nodeService.getType(nodeRef);
this.afterVersionRevertDelegate.get(nodeTypeQName).afterVersionRevert(nodeRef, version);
// invoke for node aspects
Set<QName> nodeAspectQNames = nodeService.getAspects(nodeRef);
this.afterVersionRevertDelegate.get(nodeAspectQNames).afterVersionRevert(nodeRef, version);
}
/**