diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java index bff880a762..55850aaed6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java @@ -18,6 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.model.behaviour; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -124,7 +125,7 @@ public class RecordCopyBehaviours implements RecordsManagementModel this.policyComponent.bindClassBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), ASPECT_RECORD, - new JavaBehaviour(this, "getDoNothingCopyCallback")); + new JavaBehaviour(this, "onCopyRecord")); // Move behaviour this.policyComponent.bindClassBehaviour( @@ -225,6 +226,38 @@ public class RecordCopyBehaviours implements RecordsManagementModel } } + /** + * Handle the copying of the record aspect. + * Excludes the Date Filed property. The Date Filed will be generated on copy. + * + * @param classRef + * @param copyDetails + * @return + */ + public CopyBehaviourCallback onCopyRecord(final QName classRef, final CopyDetails copyDetails) + { + return new DefaultCopyBehaviourCallback() + { + + @Override + public Map getCopyProperties(QName classRef, CopyDetails copyDetails, + Map properties) + { + Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); + + // Remove the Date Filed property from record properties on copy. + // It will be generated for the copy + if (sourceProperties.containsKey(PROP_DATE_FILED)) + { + sourceProperties.remove(PROP_DATE_FILED); + } + + return sourceProperties; + } + + }; + } + /** * Record Folder Copy Behaviour *