diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
index c1f310dd4d..176cf86aad 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml
@@ -1052,6 +1052,7 @@
+
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java
index b0e8821e7a..d7e2589c54 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java
@@ -68,7 +68,7 @@ public interface HoldService
/**
* Gets the list of item node references which are in the given hold
*
- * @param ndoeRef {@link NodeRef} of the hold
+ * @param hold {@link NodeRef} of the hold
* @return Lost of item {@link NodeRef}s which are in the given hold
*/
List getHeld(NodeRef hold);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
index 2759216410..e88f9cfb27 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java
@@ -625,7 +625,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
afterCal.set(Calendar.MILLISECOND, 0);
propertyUnchanged = (beforeCal.compareTo(afterCal) == 0);
}
- else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue == Boolean.FALSE))
+ else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE)))
{
propertyUnchanged = true;
}
@@ -1281,17 +1281,17 @@ public class RecordServiceImpl extends BaseBehaviourBean
try
{
// get record property values
- Map properties = nodeService.getProperties(nodeRef);
- String recordId = (String)properties.get(PROP_IDENTIFIER);
- String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID);
- String origionalName = (String)properties.get(PROP_ORIGIONAL_NAME);
- NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION);
+ final Map properties = nodeService.getProperties(nodeRef);
+ final String recordId = (String)properties.get(PROP_IDENTIFIER);
+ final String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID);
+ final String originalName = (String)properties.get(PROP_ORIGIONAL_NAME);
+ final NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION);
// we can only reject if the originating location is present
if (originatingLocation != null)
{
// first remove the secondary link association
- List parentAssocs = nodeService.getParentAssocs(nodeRef);
+ final List parentAssocs = nodeService.getParentAssocs(nodeRef);
for (ChildAssociationRef childAssociationRef : parentAssocs)
{
if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
@@ -1301,37 +1301,28 @@ public class RecordServiceImpl extends BaseBehaviourBean
}
}
- // remove all RM related aspects from the node
- Set aspects = nodeService.getAspects(nodeRef);
- for (QName aspect : aspects)
- {
- if (RM_URI.equals(aspect.getNamespaceURI()))
- {
- // remove the aspect
- nodeService.removeAspect(nodeRef, aspect);
- }
- }
+ removeRmAspectsFrom(nodeRef);
// get the records primary parent association
- ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
+ final ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
// move the record into the collaboration site
nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
- // rename to the origional name
- if (origionalName != null)
+ // rename to the original name
+ if (originalName != null)
{
- fileFolderService.rename(nodeRef, origionalName);
+ fileFolderService.rename(nodeRef, originalName);
if (logger.isDebugEnabled())
{
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
- logger.debug("Rename " + name + " to " + origionalName);
+ logger.debug("Rename " + name + " to " + originalName);
}
}
// save the information about the rejection details
- Map aspectProperties = new HashMap(3);
+ final Map aspectProperties = new HashMap<>(3);
aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date());
aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
@@ -1361,6 +1352,34 @@ public class RecordServiceImpl extends BaseBehaviourBean
return null;
}
+
+ /** Removes all RM related aspects from the specified node and any rendition children. */
+ private void removeRmAspectsFrom(NodeRef nodeRef)
+ {
+ // Note that when folder records are supported, we will need to recursively
+ // remove aspects from their descendants.
+ final Set aspects = nodeService.getAspects(nodeRef);
+ for (QName aspect : aspects)
+ {
+ if (RM_URI.equals(aspect.getNamespaceURI()))
+ {
+ nodeService.removeAspect(nodeRef, aspect);
+ }
+ }
+ for (ChildAssociationRef renditionAssoc : renditionService.getRenditions(nodeRef))
+ {
+ final NodeRef renditionNode = renditionAssoc.getChildRef();
+
+ // Do not attempt to clean up rendition nodes which are not children of their source node.
+ final boolean renditionRequiresCleaning = nodeService.exists(renditionNode) &&
+ renditionAssoc.isPrimary();
+
+ if (renditionRequiresCleaning)
+ {
+ removeRmAspectsFrom(renditionNode);
+ }
+ }
+ }
});
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java
index f2d9b38525..4f5c6f9b9c 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java
@@ -28,6 +28,7 @@ import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.transaction.TransactionalResourceHelper;
import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.cmr.rendition.RenditionService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -51,6 +52,9 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
/** Dictionary service */
protected DictionaryService dictionaryService;
+ /** Rendition service */
+ protected RenditionService renditionService;
+
/** Application context */
protected ApplicationContext applicationContext;
@@ -77,6 +81,14 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte
this.nodeService = nodeService;
}
+ /**
+ * @param service service
+ */
+ public void setRenditionService(RenditionService service)
+ {
+ this.renditionService = service;
+ }
+
/**
* @param dictionaryService dictionary service
*/