mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-5970 - Removed onCopyComplete method from RecordComponentIdentifierAspect because it was overwriting the existing unique id for a record on copy to action
This commit is contained in:
@@ -63,8 +63,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
)
|
)
|
||||||
public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||||
implements NodeServicePolicies.OnUpdatePropertiesPolicy,
|
implements NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
NodeServicePolicies.BeforeDeleteNodePolicy
|
||||||
CopyServicePolicies.OnCopyCompletePolicy
|
|
||||||
{
|
{
|
||||||
/** I18N */
|
/** I18N */
|
||||||
private static final String MSG_SET_ID = "rm.service.set-id";
|
private static final String MSG_SET_ID = "rm.service.set-id";
|
||||||
@@ -177,31 +176,6 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
|||||||
return new DoNothingCopyBehaviourCallback();
|
return new DoNothingCopyBehaviourCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
|
||||||
@Behaviour
|
|
||||||
(
|
|
||||||
kind = BehaviourKind.CLASS,
|
|
||||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
|
||||||
)
|
|
||||||
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap)
|
|
||||||
{
|
|
||||||
//Generate the id for the copy
|
|
||||||
String id = identifierService.generateIdentifier(
|
|
||||||
nodeService.getType(nodeService.getPrimaryParent(targetNodeRef).getParentRef()),
|
|
||||||
nodeService.getPrimaryParent(targetNodeRef).getParentRef());
|
|
||||||
|
|
||||||
//We need to allow the id to be overwritten disable the policy protecting changes to the id
|
|
||||||
behaviourFilter.disableBehaviour();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
nodeService.setProperty(targetNodeRef, PROP_IDENTIFIER, id);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
behaviourFilter.enableBehaviour();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the uniqueness check using the values provided. If the after value is <tt>null</tt>
|
* Updates the uniqueness check using the values provided. If the after value is <tt>null</tt>
|
||||||
|
Reference in New Issue
Block a user