mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -1310,6 +1310,8 @@ public class Version2ServiceImpl extends VersionServiceImpl implements VersionSe
|
||||
// Turn auto-version policies back on
|
||||
this.policyBehaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
|
||||
}
|
||||
|
||||
invokeAfterVersionRevert(nodeRef, version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -125,4 +125,21 @@ public interface VersionServicePolicies
|
||||
int versionNumber,
|
||||
Map<String, Serializable>verisonProperties);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* After create version policy interface
|
||||
*
|
||||
*/
|
||||
public interface AfterVersionRevertPolicy extends ClassPolicy
|
||||
{
|
||||
public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "afterVersionRevert");
|
||||
/**
|
||||
* Called after the version has been reverted
|
||||
*
|
||||
* @param nodeRef the node that has been reverted
|
||||
* @param version the reverted version
|
||||
*/
|
||||
public void afterVersionRevert(NodeRef nodeRef, Version version);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user