diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java index d3572729e9..5446305bcf 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java @@ -179,24 +179,24 @@ public class RecordsManagementServiceImpl implements RecordsManagementService, public void init() { // Register the association behaviours - this.policyComponent.bindAssociationBehaviour( + policyComponent.bindAssociationBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), TYPE_RECORD_FOLDER, ContentModel.ASSOC_CONTAINS, new JavaBehaviour(this, "onFileContent", NotificationFrequency.TRANSACTION_COMMIT)); - this.policyComponent.bindAssociationBehaviour( + policyComponent.bindAssociationBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), TYPE_FILE_PLAN, ContentModel.ASSOC_CONTAINS, new JavaBehaviour(this, "onAddContentToContainer", NotificationFrequency.EVERY_EVENT)); - this.policyComponent.bindAssociationBehaviour( + policyComponent.bindAssociationBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), TYPE_RECORD_CATEGORY, ContentModel.ASSOC_CONTAINS, new JavaBehaviour(this, "onAddContentToContainer", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindAssociationBehaviour( + policyComponent.bindAssociationBehaviour( QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), ASPECT_RECORD, RenditionModel.ASSOC_RENDITION, @@ -204,7 +204,7 @@ public class RecordsManagementServiceImpl implements RecordsManagementService, ); // Register script execution behaviour on RM property update. - this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), + policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), ASPECT_FILE_PLAN_COMPONENT, new JavaBehaviour(this, "onChangeToAnyRmProperty", NotificationFrequency.TRANSACTION_COMMIT)); @@ -266,14 +266,10 @@ public class RecordsManagementServiceImpl implements RecordsManagementService, */ public void onAddContentToContainer(ChildAssociationRef childAssocRef, boolean bNew) { - if (childAssocRef.getTypeQName().equals(ContentModel.ASSOC_CONTAINS)) + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { - QName childType = nodeService.getType(childAssocRef.getChildRef()); - - if(childType.equals(ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); - } + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java index 55d1b2756e..7e9464d573 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java @@ -47,7 +47,9 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef assoc : assocs) { - if (rmService.isRecordFolderClosed(assoc.getParentRef()) == true) + NodeRef parent = assoc.getParentRef(); + if (rmService.isRecordFolder(parent) == true && + rmService.isRecordFolderClosed(parent) == true) { result = true; break;