From 088d0ff11f08f2c7ff7001dda852a841018f2e60 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Mon, 2 Dec 2013 05:31:46 +0000 Subject: [PATCH] RM-1098: Factoring of model behaviours git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@58447 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rm-model-context.xml | 74 ++-- .../rm-service-context.xml | 5 +- .../dataset/DataSetServiceImpl.java | 2 +- .../behaviour/FilePlanComponentAspect.java | 205 --------- .../RecordComponentIdentifierAspect.java | 174 -------- .../model/behaviour/RecordContainerType.java | 192 --------- .../model/behaviour/RecordCopyBehaviours.java | 408 ------------------ .../aspect/DispositionLifecycleAspect.java | 54 +++ .../rma/aspect/FilePlanComponentAspect.java | 138 +++++- .../model/rma/aspect/GhostedAspect.java | 2 +- .../model/rma/aspect/RecordAspect.java | 73 +++- .../RecordComponentIdentifierAspect.java | 182 +++++++- .../model/rma/aspect/RecordSearchAspect.java | 54 +++ .../aspect}/ScheduledAspect.java | 61 +-- .../model/rma/aspect/VitalRecordAspect.java | 54 +++ .../model/rma/type/RecordCategoryType.java | 18 +- .../model/rma/type/RecordFolderType.java | 262 +++++++++++ .../{behaviour => rma/type}/RmSiteType.java | 134 +++--- .../recordfolder/RecordFolderService.java | 6 +- .../recordfolder/RecordFolderServiceImpl.java | 90 +--- .../script/BootstrapTestDataGet.java | 4 +- .../script/DataSetPost.java | 2 +- .../script/DataSetsGet.java | 2 +- .../test/util/BaseRMTestCase.java | 2 +- .../test/util/BaseRMWebScriptTestCase.java | 2 +- 25 files changed, 944 insertions(+), 1256 deletions(-) delete mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/FilePlanComponentAspect.java delete mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordComponentIdentifierAspect.java delete mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java delete mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java create mode 100755 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java create mode 100755 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java rename rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/{behaviour => rma/aspect}/ScheduledAspect.java (55%) create mode 100755 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java create mode 100755 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java rename rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/{behaviour => rma/type}/RmSiteType.java (64%) diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index dfd2820d82..8121e7d2a9 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -37,44 +37,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -110,17 +70,31 @@ - + + + + + + + + + + + + + + + @@ -128,10 +102,24 @@ - + + + + - + + + + + + + + + + + + - + - @@ -1169,7 +1168,7 @@ org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.isRecordFolderClosed=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.createRecordFolder=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.getRecordFolders=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.initialiseRecordFolder=RM.Read.0 + org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.setupRecordFolder=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.closeRecordFolder=RM_CAP.0.rma:filePlanComponent.CloseFolders org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.*=RM_DENY ]]> diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java index 2d2cb23a1d..6701adce27 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java @@ -438,7 +438,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode { // Fire action to "set-up" the folder correctly logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.initialiseRecordFolder(recordFolder); + recordFolderService.setupRecordFolder(recordFolder); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/FilePlanComponentAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/FilePlanComponentAspect.java deleted file mode 100644 index 8d19f6143c..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/FilePlanComponentAspect.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.copy.AbstractCopyBehaviourCallback; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Behaviour associated with the file plan component aspect - * - * @author Roy Wetherall - */ -public class FilePlanComponentAspect implements RecordsManagementModel, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnMoveNodePolicy -{ - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** - * Set the policy component - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Set node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Bean initialisation method - */ - public void init() - { - policyComponent.bindClassBehaviour( - NodeServicePolicies.OnAddAspectPolicy.QNAME, - ASPECT_FILE_PLAN_COMPONENT, - new JavaBehaviour(this, "onAddAspect", NotificationFrequency.TRANSACTION_COMMIT)); - policyComponent.bindClassBehaviour( - NodeServicePolicies.OnMoveNodePolicy.QNAME, - ASPECT_FILE_PLAN_COMPONENT, - new JavaBehaviour(this, "onMoveNode", NotificationFrequency.TRANSACTION_COMMIT)); - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), - ASPECT_FILE_PLAN_COMPONENT, - new JavaBehaviour(this, "getCopyCallback")); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - if (nodeService.exists(nodeRef) == true) - { - // Look up the root and set on the aspect if found - NodeRef root = filePlanService.getFilePlan(nodeRef); - if (root != null) - { - nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root); - } - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - if (nodeService.exists(newChildAssocRef.getParentRef()) == true && - nodeService.exists(newChildAssocRef.getChildRef()) == true) - { - // Look up the root and re-set the value currently stored on the aspect - NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef()); - // NOTE: set the null value if no root found - nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Copy behaviour call back - * - * @param classRef class reference - * @param copyDetail details of the information being copied - * @return CopyBehaviourCallback - */ - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new AbstractCopyBehaviourCallback() - { - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getChildAssociationCopyAction(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails) - */ - public ChildAssocCopyAction getChildAssociationCopyAction( - QName classQName, - CopyDetails copyDetails, - CopyChildAssociationDetails childAssocCopyDetails) - { - // Do not copy the associations - return null; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getCopyProperties(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, java.util.Map) - */ - public Map getCopyProperties( - QName classQName, - CopyDetails copyDetails, - Map properties) - { - // Only copy the root node reference if the new value can be looked up via the parent - NodeRef root = filePlanService.getFilePlan(copyDetails.getTargetParentNodeRef()); - if (root != null) - { - properties.put(PROP_ROOT_NODEREF, root); - } - return properties; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails) - */ - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - // Ensure the aspect is copied - return true; - } - }; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordComponentIdentifierAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordComponentIdentifierAspect.java deleted file mode 100644 index 342e9b71c1..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordComponentIdentifierAspect.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.attributes.AttributeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyCheck; - -/** - * Record component identifier aspect behaviour - * - * @author Roy Wetherall - */ -public class RecordComponentIdentifierAspect - implements NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - RecordsManagementModel -{ - private static final String CONTEXT_VALUE = "rma:identifier"; - - private PolicyComponent policyComponent; - private NodeService nodeService; - private AttributeService attributeService; - private FilePlanService filePlanService; - - /** - * @param policyComponent the policyComponent to set - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * @param nodeService the nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the component to manage the unique properties - */ - public void setAttributeService(AttributeService attributeService) - { - this.attributeService = attributeService; - } - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Initialise method - */ - public void init() - { - PropertyCheck.mandatory(this, "policyComponent", policyComponent); - PropertyCheck.mandatory(this, "nodeService", nodeService); - PropertyCheck.mandatory(this, "attributeService", attributeService); - - policyComponent.bindClassBehaviour( - OnUpdatePropertiesPolicy.QNAME, - ASPECT_RECORD_COMPONENT_ID, - new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindClassBehaviour( - BeforeDeleteNodePolicy.QNAME, - ASPECT_RECORD_COMPONENT_ID, - new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.EVERY_EVENT)); - } - - /** - * Ensures that the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property remains - * unique within the context of the parent node. - */ - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - // Check whether the identifier property has changed - String beforeId = (String)before.get(PROP_IDENTIFIER); - String afterId = (String)after.get(PROP_IDENTIFIER); - updateUniqueness(nodeRef, beforeId, afterId); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet. - */ - public void beforeDeleteNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); - updateUniqueness(nodeRef, beforeId, null); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Updates the uniqueness check using the values provided. If the after value is null - * then this is considered to be a removal. - */ - private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId) - { - NodeRef contextNodeRef = filePlanService.getFilePlan(nodeRef); - - if (beforeId == null) - { - if (afterId != null) - { - // Just create it - attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId); - } - } - else if (afterId == null) - { - if (beforeId != null) - { - // The before value was not null, so remove it - attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId); - } - // Do a blanket removal in case this is a contextual nodes - attributeService.removeAttributes(CONTEXT_VALUE, nodeRef); - } - else - { - // This is a full update - attributeService.updateOrCreateAttribute( - CONTEXT_VALUE, contextNodeRef, beforeId, - CONTEXT_VALUE, contextNodeRef, afterId); - } - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java deleted file mode 100644 index 690c24f2c8..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Behaviour associated with the record container type - * - * @author Roy Wetherall - */ -public class RecordContainerType implements RecordsManagementModel, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy -{ - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Identity service */ - private IdentifierService recordsManagementIdentifierService; - - /** - * Set the policy component - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Set node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set dictionary service - * - * @param dictionaryService dictionary serviceS - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Set the identity service - * - * @param recordsManagementIdentifierService identity service - */ - public void setRecordsManagementIdentifierService(IdentifierService recordsManagementIdentifierService) - { - this.recordsManagementIdentifierService = recordsManagementIdentifierService; - } - - /** - * Bean initialisation method - */ - public void init() - { - this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), - TYPE_RECORDS_MANAGEMENT_CONTAINER, - ContentModel.ASSOC_CONTAINS, - new JavaBehaviour(this, "onCreateChildAssociation", NotificationFrequency.TRANSACTION_COMMIT)); - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnCreateNodePolicy.QNAME, - TYPE_FILE_PLAN, - new JavaBehaviour(this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT)); - } - - /** - * Deal with something created within a record container - */ - @Override - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - // Get the elements of the created association - final NodeRef child = childAssocRef.getChildRef(); - if (nodeService.exists(child) == true) - { - QName childType = nodeService.getType(child); - - // We only care about "folder" or sub-types - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true) - { - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true) - { - // this is a rule container, make sure it is an file plan component - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - else - { - // We need to automatically cast the created folder to RM type if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc - if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false) - { - // TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category?? - - // Assume any created folder is a rma:recordFolder - nodeService.setType(child, TYPE_RECORD_FOLDER); - } - - // Catch all to generate the rm id (assuming it doesn't already have one!) - setIdenifierProperty(child); - } - } - } - - return null; - } - }); - - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - // When a new root container is created, make sure the identifier is set - setIdenifierProperty(childAssocRef.getChildRef()); - } - - /** - * - * @param nodeRef - */ - private void setIdenifierProperty(final NodeRef nodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() throws Exception - { - if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true && - nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null) - { - String id = recordsManagementIdentifierService.generateIdentifier(nodeRef); - nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id); - } - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } -} 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 deleted file mode 100644 index 11210a51b3..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordCopyBehaviours.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -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; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Class containing behaviour for the vitalRecordDefinition aspect. - * - * @author neilm - */ -public class RecordCopyBehaviours implements RecordsManagementModel -{ - /** The policy component */ - private PolicyComponent policyComponent; - - /** The Behaviour Filter */ - private BehaviourFilter behaviourFilter; - - /** The rm service registry */ - private RecordsManagementServiceRegistry rmServiceRegistry; - - /** List of aspects to remove during move and copy */ - private List unwantedAspects = new ArrayList(5); - - /** - * Set the policy component - * - * @param policyComponent the policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Set the behaviour Filter - * - * @param behaviourFilter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * Set the rm service registry. - * - * @param recordsManagementServiceRegistry the rm service registry. - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry recordsManagementServiceRegistry) - { - this.rmServiceRegistry = recordsManagementServiceRegistry; - } - - /** - * Initialise the vitalRecord aspect policies - */ - public void init() - { - // Set up list of unwanted aspects - unwantedAspects.add(ASPECT_VITAL_RECORD); - unwantedAspects.add(ASPECT_DISPOSITION_LIFECYCLE); - unwantedAspects.add(RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH); - - // Do not copy any of the Alfresco-internal 'state' aspects - for (QName aspect : unwantedAspects) - { - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), - aspect, - new JavaBehaviour(this, "getDoNothingCopyCallback")); - } - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), - ASPECT_RECORD_COMPONENT_ID, - new JavaBehaviour(this, "getDoNothingCopyCallback")); - - //On Copy we need a new ID - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyComplete"), - ASPECT_RECORD_COMPONENT_ID, - new JavaBehaviour(this, "generateId", NotificationFrequency.TRANSACTION_COMMIT)); - - //Don't copy the Aspect Record -- it should be regenerated - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), - ASPECT_RECORD, - new JavaBehaviour(this, "onCopyRecord")); - - // Move behaviour - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"), - RecordsManagementModel.ASPECT_RECORD, - new JavaBehaviour(this, "onMoveRecordNode", NotificationFrequency.FIRST_EVENT)); - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"), - RecordsManagementModel.TYPE_RECORD_FOLDER, - new JavaBehaviour(this, "onMoveRecordFolderNode", NotificationFrequency.FIRST_EVENT)); - - //Copy Behaviour - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"), - RecordsManagementModel.TYPE_RECORD_FOLDER, - new JavaBehaviour(this, "onCopyRecordFolderNode")); - } - - /** - * onMove record behaviour - * - * @param oldChildAssocRef - * @param newChildAssocRef - */ - public void onMoveRecordNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - // check the records parent has actually changed - if (oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) == false) - { - final NodeRef newNodeRef = newChildAssocRef.getChildRef(); - final NodeService nodeService = rmServiceRegistry.getNodeService(); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - if (nodeService.exists(newNodeRef) == true) - { - // only remove the search details .. the rest will be resolved automatically - nodeService.removeAspect(newNodeRef, RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH); - } - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - } - - /** - * onMove record folder behaviour - * - * @param oldChildAssocRef - * @param newChildAssocRef - */ - public void onMoveRecordFolderNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - final NodeService nodeService = rmServiceRegistry.getNodeService(); - - if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER)) - { - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) - { - //final NodeRef oldNodeRef = oldChildAssocRef.getChildRef(); - final NodeRef newNodeRef = newChildAssocRef.getChildRef(); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - final RecordService rmRecordService = rmServiceRegistry.getRecordService(); - final RecordFolderService recordFolderService = rmServiceRegistry.getRecordFolderService(); - final DispositionService dispositionService = rmServiceRegistry.getDispositionService(); - - behaviourFilter.disableBehaviour(); - try - { - // Remove unwanted aspects - removeUnwantedAspects(nodeService, newNodeRef); - - // reinitialise the record folder - recordFolderService.initialiseRecordFolder(newNodeRef); - - // reinitialise the record folder disposition action details - dispositionService.refreshDispositionAction(newNodeRef); - - // Sort out the child records - for (NodeRef record : rmRecordService.getRecords(newNodeRef)) - { - // Remove unwanted aspects - removeUnwantedAspects(nodeService, record); - - // Re-initiate the records in the new folder. - rmRecordService.file(record); - } - } - finally - { - behaviourFilter.enableBehaviour(); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - else - { - throw new UnsupportedOperationException("Cannot move record folder into another record folder."); - } - } - - /** - * 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 - * - *
  • Do not allow copy of record folder into another record folder
  • - * - * @param classRef - * @param copyDetails - * @return - */ - public CopyBehaviourCallback onCopyRecordFolderNode(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - final NodeService nodeService = rmServiceRegistry.getNodeService(); - - @Override - public Map getCopyProperties(QName classRef, CopyDetails copyDetails, Map properties) - { - Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); - - // ensure that the 'closed' status of the record folder is not copied - if (sourceProperties.containsKey(PROP_IS_CLOSED)) - { - sourceProperties.remove(PROP_IS_CLOSED); - } - - return sourceProperties; - } - - - /** - * If the targets parent is a Record Folder -- Do Not Allow Copy - * - * @param classQName - * @param copyDetails - * @return boolean - */ - @Override - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - boolean result = true; - - if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) == true) - { - result = false; - } - else if (unwantedAspects.contains(classQName) == true) - { - result = false; - } - - return result; - } - }; - } - - /** - * Removes unwanted aspects - * - * @param nodeService - * @param nodeRef - */ - private void removeUnwantedAspects(NodeService nodeService, NodeRef nodeRef) - { - // Remove unwanted aspects - for (QName aspect : unwantedAspects) - { - if (nodeService.hasAspect(nodeRef, aspect) == true) - { - nodeService.removeAspect(nodeRef, aspect); - } - } - } - - /** - * Get the "do nothing" call back behaviour - * - * @param classRef - * @param copyDetails - * @return - */ - public CopyBehaviourCallback getDoNothingCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } - - /** - * Generate and set a new ID for copy of a record - * - * @param classRef - * @param sourceNodeRef - * @param targetNodeRef - * @param copyToNewNode - * @param copyMap - */ - @SuppressWarnings("rawtypes") - public void generateId(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap) - { - final IdentifierService rmIdentifierService = rmServiceRegistry.getIdentifierService(); - final NodeService nodeService = rmServiceRegistry.getNodeService(); - - //Generate the id for the copy - String id = rmIdentifierService.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(); - } - } - - /** - * Function to pad a string with zero '0' characters to the required length - * - * @param s String to pad with leading zero '0' characters - * @param len Length to pad to - * - * @return padded string or the original if already at >=len characters - */ - protected String padString(String s, int len) - { - String result = s; - for (int i=0; i<(len - s.length()); i++) - { - result = "0" + result; - } - return result; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java new file mode 100755 index 0000000000..82f543ff52 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2013 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:dispositionLifecycle behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:dispositionLifecycle" +) +public class DispositionLifecycleAspect extends BaseBehaviourBean +{ + /** + * Copy callback for disposition lifecycle + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java index 7557205bed..a9bcf55fd1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java @@ -25,7 +25,11 @@ import java.util.List; import java.util.Map; import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.AbstractCopyBehaviourCallback; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.annotation.Behaviour; @@ -33,6 +37,7 @@ import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.ScriptService; import org.alfresco.service.namespace.NamespaceService; @@ -50,7 +55,10 @@ import org.alfresco.util.PropertyMap; defaultType = "rma:filePlanComponent" ) public class FilePlanComponentAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy + implements NodeServicePolicies.OnUpdatePropertiesPolicy, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnMoveNodePolicy + { /** Well-known location of the scripts folder. */ @@ -62,6 +70,9 @@ public class FilePlanComponentAspect extends BaseBehaviourBean /** namespace service */ private NamespaceService namespaceService; + /** file plan service */ + private FilePlanService filePlanService; + /** * @param scriptService set script service */ @@ -78,6 +89,14 @@ public class FilePlanComponentAspect extends BaseBehaviourBean this.namespaceService = namespaceService; } + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + /** * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) */ @@ -166,4 +185,121 @@ public class FilePlanComponentAspect extends BaseBehaviourBean return result; } + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + if (nodeService.exists(nodeRef) == true) + { + // Look up the root and set on the aspect if found + NodeRef root = filePlanService.getFilePlan(nodeRef); + if (root != null) + { + nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root); + } + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + if (nodeService.exists(newChildAssocRef.getParentRef()) == true && + nodeService.exists(newChildAssocRef.getChildRef()) == true) + { + // Look up the root and re-set the value currently stored on the aspect + NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef()); + // NOTE: set the null value if no root found + nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Copy behaviour call back + * + * @param classRef class reference + * @param copyDetail details of the information being copied + * @return CopyBehaviourCallback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new AbstractCopyBehaviourCallback() + { + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getChildAssociationCopyAction(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails) + */ + public ChildAssocCopyAction getChildAssociationCopyAction( + QName classQName, + CopyDetails copyDetails, + CopyChildAssociationDetails childAssocCopyDetails) + { + // Do not copy the associations + return null; + } + + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getCopyProperties(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, java.util.Map) + */ + public Map getCopyProperties( + QName classQName, + CopyDetails copyDetails, + Map properties) + { + // Only copy the root node reference if the new value can be looked up via the parent + NodeRef root = filePlanService.getFilePlan(copyDetails.getTargetParentNodeRef()); + if (root != null) + { + properties.put(PROP_ROOT_NODEREF, root); + } + return properties; + } + + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails) + */ + public boolean getMustCopy(QName classQName, CopyDetails copyDetails) + { + // Ensure the aspect is copied + return true; + } + }; + } + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java index 168a6cfdee..cc7aa4bbb2 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2013 Alfresco Software Limited. * * This file is part of Alfresco * diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index eb4c32f17f..7e258a26af 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -18,6 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -26,7 +27,11 @@ import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.annotation.Behaviour; @@ -52,7 +57,8 @@ import org.alfresco.service.namespace.QName; public class RecordAspect extends BaseBehaviourBean implements NodeServicePolicies.OnCreateChildAssociationPolicy, RecordsManagementPolicies.OnCreateReference, - RecordsManagementPolicies.OnRemoveReference + RecordsManagementPolicies.OnRemoveReference, + NodeServicePolicies.OnMoveNodePolicy { /** Well-known location of the scripts folder. */ // TODO make configurable @@ -165,6 +171,71 @@ public class RecordAspect extends BaseBehaviourBean executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef); } + /** + * Record copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(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 move behaviour + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + // check the records parent has actually changed + if (oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) == false) + { + final NodeRef newNodeRef = newChildAssocRef.getChildRef(); + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() throws Exception + { + if (nodeService.exists(newNodeRef) == true) + { + // only remove the search details .. the rest will be resolved automatically + nodeService.removeAspect(newNodeRef, RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH); + } + + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + } + /** * Executes a reference script if present * diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java index 1c841a8d43..58d82f3eab 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java @@ -22,12 +22,22 @@ import java.io.Serializable; import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.CopyServicePolicies; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.attributes.AttributeService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.springframework.extensions.surf.util.I18NUtil; @@ -43,33 +53,183 @@ import org.springframework.extensions.surf.util.I18NUtil; defaultType = "rma:recordComponentIdentifier" ) public class RecordComponentIdentifierAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy + implements NodeServicePolicies.OnUpdatePropertiesPolicy, + NodeServicePolicies.BeforeDeleteNodePolicy, + CopyServicePolicies.OnCopyCompletePolicy { /** I18N */ private final static String MSG_SET_ID = "rm.service.set-id"; + /** attribute context value */ + private static final String CONTEXT_VALUE = "rma:identifier"; + + /** file plan service */ + private FilePlanService filePlanService; + + /** attribute service */ + private AttributeService attributeService; + + /** identifier service */ + private IdentifierService identifierService; + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param attributeService attribute service + */ + public void setAttributeService(AttributeService attributeService) + { + this.attributeService = attributeService; + } + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * Ensures that the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property remains + * unique within the context of the parent node. + * * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) */ @Override @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.EVERY_EVENT + ) + public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + String newIdValue = (String)after.get(PROP_IDENTIFIER); + if (newIdValue != null) + { + String oldIdValue = (String)before.get(PROP_IDENTIFIER); + if (oldIdValue != null && oldIdValue.equals(newIdValue) == false) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString())); + } + + // update uniqueness + updateUniqueness(nodeRef, oldIdValue, newIdValue); + } + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet. + * + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.EVERY_EVENT + ) + public void beforeDeleteNode(final NodeRef nodeRef) + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); + updateUniqueness(nodeRef, beforeId, null); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Record component identifier aspect copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } + + @SuppressWarnings("rawtypes") + @Override + @Behaviour ( kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap) { - if (nodeService.exists(nodeRef) == true) + //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 { - String newIdValue = (String)after.get(PROP_IDENTIFIER); - if (newIdValue != null) + nodeService.setProperty(targetNodeRef, PROP_IDENTIFIER, id); + } + finally + { + behaviourFilter.enableBehaviour(); + } + } + + /** + * Updates the uniqueness check using the values provided. If the after value is null + * then this is considered to be a removal. + * + * @param nodeRef node reference + * @param beforeId id before + * @param afterId id after + */ + private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId) + { + NodeRef contextNodeRef = filePlanService.getFilePlan(nodeRef); + + if (beforeId == null) + { + if (afterId != null) { - String oldIdValue = (String)before.get(PROP_IDENTIFIER); - if (oldIdValue != null && oldIdValue.equals(newIdValue) == false) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString())); - } + // Just create it + attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId); } - } + } + else if (afterId == null) + { + if (beforeId != null) + { + // The before value was not null, so remove it + attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId); + } + // Do a blanket removal in case this is a contextual nodes + attributeService.removeAttributes(CONTEXT_VALUE, nodeRef); + } + else + { + // This is a full update + attributeService.updateOrCreateAttribute( + CONTEXT_VALUE, contextNodeRef, beforeId, + CONTEXT_VALUE, contextNodeRef, afterId); + } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java new file mode 100755 index 0000000000..19d9bf71d8 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2013 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:recordSearch behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordSearch" +) +public class RecordSearchAspect extends BaseBehaviourBean +{ + /** + * Copy callback for record search + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/ScheduledAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java similarity index 55% rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/ScheduledAspect.java rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java index c4e1c004ed..6d0419e9ca 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/ScheduledAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2013 Alfresco Software Limited. * * This file is part of Alfresco * @@ -16,72 +16,51 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; /** * Behaviour associated with the scheduled aspect * * @author Roy Wetherall + * @since 2.2 */ -public class ScheduledAspect implements RecordsManagementModel, - NodeServicePolicies.OnAddAspectPolicy +@BehaviourBean +( + defaultType = "rma:scheduled" +) +public class ScheduledAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnAddAspectPolicy { - /** Policy component */ - private PolicyComponent policyComponent; - + /** disposition service */ private DispositionService dispositionService; - /** Node service */ - private NodeService nodeService; - /** - * Set the policy component - * @param policyComponent policy component + * @param dispositionService disposition service */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - public void setDispositionService(DispositionService dispositionService) { this.dispositionService = dispositionService; } - - /** - * Set node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Bean initialisation method - */ - public void init() - { - policyComponent.bindClassBehaviour( - NodeServicePolicies.OnAddAspectPolicy.QNAME, - ASPECT_SCHEDULED, - new JavaBehaviour(this, "onAddAspect", NotificationFrequency.TRANSACTION_COMMIT)); - } /** * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) */ @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) { if (nodeService.exists(nodeRef) == true && diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java new file mode 100755 index 0000000000..82f8d65c7c --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2013 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:vitalRecord behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:vitalRecord" +) +public class VitalRecordAspect extends BaseBehaviourBean +{ + /** + * Copy callback for vital record + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java index a2c4e3a01e..5b8737b449 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java @@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; import org.alfresco.repo.copy.CopyBehaviourCallback; @@ -57,6 +58,9 @@ public class RecordCategoryType extends BaseBehaviourBean /** file plan permission service */ protected FilePlanPermissionService filePlanPermissionService; + /** record folder service */ + private RecordFolderService recordFolderService; + /** * @param vitalRecordService vital record service */ @@ -73,6 +77,14 @@ public class RecordCategoryType extends BaseBehaviourBean this.filePlanPermissionService = filePlanPermissionService; } + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + /** * On every event * @@ -90,7 +102,11 @@ public class RecordCategoryType extends BaseBehaviourBean if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException("Operation failed, because you can't place content directly into a record category."); - } + } + + // setup the record folder + // TODO review + recordFolderService.setupRecordFolder(nodeRef); } /** diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java new file mode 100755 index 0000000000..4cb9207372 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.type; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.ArrayUtils; + +/** + * rma:recordFolder behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordFolder" +) +public class RecordFolderType extends BaseBehaviourBean + implements NodeServicePolicies.OnMoveNodePolicy, + NodeServicePolicies.OnCreateChildAssociationPolicy +{ + /** unwanted aspects */ + private QName[] unwantedAspects = + { + ASPECT_VITAL_RECORD, + ASPECT_DISPOSITION_LIFECYCLE, + RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH + }; + + /** record service */ + private RecordService recordService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** disposition service */ + private DispositionService dispositionService; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Record folder move behaviour + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER)) + { + if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) + { + //final NodeRef oldNodeRef = oldChildAssocRef.getChildRef(); + final NodeRef newNodeRef = newChildAssocRef.getChildRef(); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() throws Exception + { + behaviourFilter.disableBehaviour(); + try + { + // Remove unwanted aspects + removeUnwantedAspects(nodeService, newNodeRef); + + // reinitialise the record folder + recordFolderService.setupRecordFolder(newNodeRef); + + // reinitialise the record folder disposition action details + dispositionService.refreshDispositionAction(newNodeRef); + + // Sort out the child records + for (NodeRef record : recordService.getRecords(newNodeRef)) + { + // Remove unwanted aspects + removeUnwantedAspects(nodeService, record); + + // Re-initiate the records in the new folder. + recordService.file(record); + } + } + finally + { + behaviourFilter.enableBehaviour(); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + } + else + { + throw new UnsupportedOperationException("Cannot move record folder into another record folder."); + } + } + + /** + * Record folder copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(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); + + // ensure that the 'closed' status of the record folder is not copied + if (sourceProperties.containsKey(PROP_IS_CLOSED)) + { + sourceProperties.remove(PROP_IS_CLOSED); + } + + return sourceProperties; + } + + /** + * If the targets parent is a Record Folder -- Do Not Allow Copy + * + * @param classQName + * @param copyDetails + * @return boolean + */ + @Override + public boolean getMustCopy(QName classQName, CopyDetails copyDetails) + { + boolean result = true; + + if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) == true) + { + result = false; + } + else if (ArrayUtils.contains(unwantedAspects, classQName) == true) + { + result = false; + } + + return result; + } + }; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (nodeService.exists(nodeRef) == true) + { + // ensure folders are never added to a record folder + if (instanceOf(nodeRef, ContentModel.TYPE_FOLDER) == true) + { + throw new AlfrescoRuntimeException("You can't create a folder within an exisiting record folder."); + } + + // ensure nothing is being added to a closed record folder + NodeRef recordFolder = childAssocRef.getParentRef(); + Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); + if (isClosed != null && Boolean.TRUE.equals(isClosed) == true) + { + throw new AlfrescoRuntimeException("You can't add new items to a closed record folder."); + } + } + } + + /** + * Removes unwanted aspects + * + * @param nodeService + * @param nodeRef + */ + private void removeUnwantedAspects(NodeService nodeService, NodeRef nodeRef) + { + // Remove unwanted aspects + for (QName aspect : unwantedAspects) + { + if (nodeService.hasAspect(nodeRef, aspect) == true) + { + nodeService.removeAspect(nodeRef, aspect); + } + } + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RmSiteType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java similarity index 64% rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RmSiteType.java rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java index 703babff3c..0c0dd6566f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RmSiteType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2013 Alfresco Software Limited. * * This file is part of Alfresco * @@ -16,25 +16,26 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; +package org.alfresco.module.org_alfresco_module_rm.model.rma.type; import java.io.Serializable; import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.site.SiteModel; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.site.SiteInfo; @@ -47,9 +48,14 @@ import org.alfresco.util.PropertyMap; * Behaviour associated with the RM Site type * * @author Roy Wetherall + * @since 2.2 */ -public class RmSiteType implements RecordsManagementModel, - NodeServicePolicies.OnCreateNodePolicy, +@BehaviourBean +( + defaultType = "rma:rmsite" +) +public class RmSiteType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateNodePolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, NodeServicePolicies.BeforeDeleteNodePolicy { @@ -63,20 +69,12 @@ public class RmSiteType implements RecordsManagementModel, /** Site service */ protected SiteService siteService; - /** Node service */ - protected NodeService nodeService; - /** Record Management Search Service */ protected RecordsManagementSearchService recordsManagementSearchService; /** Capability service */ protected CapabilityService capabilityService; - /** Behaviour */ - JavaBehaviour onCreateNode = new JavaBehaviour(this, "onCreateNode", NotificationFrequency.FIRST_EVENT); - JavaBehaviour onUpdateProperties = new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.FIRST_EVENT); - JavaBehaviour beforeDelete = new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.FIRST_EVENT); - /** * Set the policy component * @param policyComponent policy component @@ -95,15 +93,6 @@ public class RmSiteType implements RecordsManagementModel, this.siteService = siteService; } - /** - * Set node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - /** * @param recordsManagementSearchService records management search service */ @@ -119,67 +108,46 @@ public class RmSiteType implements RecordsManagementModel, { this.capabilityService = capabilityService; } - - /** - * Bean initialisation method - */ - public void init() - { - policyComponent.bindClassBehaviour(NodeServicePolicies.OnCreateNodePolicy.QNAME, - TYPE_RM_SITE, - onCreateNode); - - policyComponent.bindClassBehaviour(NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, - TYPE_RM_SITE, - onUpdateProperties); - - policyComponent.bindClassBehaviour(NodeServicePolicies.BeforeDeleteNodePolicy.QNAME, - TYPE_RM_SITE, - beforeDelete); - } /** * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) */ @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) public void onCreateNode(ChildAssociationRef childAssocRef) - { - onCreateNode.disable(); - try - { - final NodeRef rmSite = childAssocRef.getChildRef(); - - // Do not execute behaviour if this has been created in the archive store - if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE) == true) + { + final NodeRef rmSite = childAssocRef.getChildRef(); + + // Do not execute behaviour if this has been created in the archive store + if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE) == true) + { + // This is not the spaces store - probably the archive store + return; + } + + if (nodeService.exists(rmSite) == true) + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { - // This is not the spaces store - probably the archive store - return; - } - - if (nodeService.exists(rmSite) == true) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + public Object doWork() { - public Object doWork() - { - SiteInfo siteInfo = siteService.getSite(rmSite); - if (siteInfo != null) - { - // Create the file plan component - siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); - - // Add the reports - recordsManagementSearchService.addReports(siteInfo.getShortName()); - } - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - } - finally - { - onCreateNode.enable(); - } + SiteInfo siteInfo = siteService.getSite(rmSite); + if (siteInfo != null) + { + // Create the file plan component + siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); + + // Add the reports + recordsManagementSearchService.addReports(siteInfo.getShortName()); + } + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } } /** @@ -189,7 +157,11 @@ public class RmSiteType implements RecordsManagementModel, * * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) */ - @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) { if (nodeService.exists(nodeRef) == true) @@ -208,7 +180,11 @@ public class RmSiteType implements RecordsManagementModel, /** * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) */ - @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) public void beforeDeleteNode(NodeRef nodeRef) { final SiteInfo siteInfo = siteService.getSite(nodeRef); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java index 3cc7688690..d6d72e26f0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java @@ -34,13 +34,13 @@ import org.alfresco.service.namespace.QName; public interface RecordFolderService { /** - * Initialises the a record folder from a standard folder. + * Sets up the a record folder from a standard folder. * - * @param nodeRef node reference of the folder to initialise + * @param nodeRef node reference of the folder to setup * * @since 2.2 */ - void initialiseRecordFolder(NodeRef nodeRef); + void setupRecordFolder(NodeRef nodeRef); /** * Indicates whether the given node is a record folder or not. diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java index cdf30420fc..198ef7c004 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java @@ -32,10 +32,6 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.NamespaceService; @@ -54,8 +50,8 @@ import org.springframework.extensions.surf.util.I18NUtil; */ public class RecordFolderServiceImpl extends ServiceBaseImpl implements RecordFolderService, - RecordsManagementModel, - NodeServicePolicies.OnCreateChildAssociationPolicy + RecordsManagementModel//, + //NodeServicePolicies.OnCreateChildAssociationPolicy { /** Logger */ private static Log logger = LogFactory.getLog(RecordFolderServiceImpl.class); @@ -67,9 +63,6 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl private final static String MSG_RECORD_FOLDER_TYPE = "rm.service.record-folder-type"; private final static String MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER = "rm.service.close-record-folder-not-folder"; - /** Policy component */ - private PolicyComponent policyComponent; - /** Disposition service */ private DispositionService dispositionService; @@ -79,25 +72,6 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl /** File Plan Service */ private FilePlanService filePlanService; - /** Behaviours */ - private JavaBehaviour onCreateChildAssociation - = new JavaBehaviour(this, - "onCreateChildAssociation", - NotificationFrequency.FIRST_EVENT); - - private JavaBehaviour onCreateChildAssociationInRecordFolderFolder - = new JavaBehaviour(this, - "onCreateChildAssociationInRecordFolder", - NotificationFrequency.FIRST_EVENT); - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - /** * @param dispositionService disposition service */ @@ -122,67 +96,11 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl this.filePlanService = filePlanService; } - /** - * Init method - */ - public void init() - { - - policyComponent.bindAssociationBehaviour( - NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME, - TYPE_RECORD_CATEGORY, - ContentModel.ASSOC_CONTAINS, - onCreateChildAssociation); - - policyComponent.bindAssociationBehaviour( - NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME, - TYPE_RECORD_FOLDER, - ContentModel.ASSOC_CONTAINS, - onCreateChildAssociationInRecordFolderFolder); - } - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#setupRecordFolder(org.alfresco.service.cmr.repository.NodeRef) */ @Override - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) == true) - { - initialiseRecordFolder(nodeRef); - } - } - - /** - * Prevent folders being created within existing record folders. - */ - public void onCreateChildAssociationInRecordFolder(ChildAssociationRef childAssocRef, boolean bNew) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) == true) - { - // ensure folders are never added to a record folder - if (instanceOf(nodeRef, ContentModel.TYPE_FOLDER) == true) - { - throw new AlfrescoRuntimeException("You can't create a folder within an exisiting record folder."); - } - - // ensure nothing is being added to a closed record folder - NodeRef recordFolder = childAssocRef.getParentRef(); - Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); - if (isClosed != null && Boolean.TRUE.equals(isClosed) == true) - { - throw new AlfrescoRuntimeException("You can't add new items to a closed record folder."); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#initialiseRecordFolder(NodeRef) - */ - @Override - public void initialiseRecordFolder(NodeRef nodeRef) + public void setupRecordFolder(NodeRef nodeRef) { // initialise disposition details if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) == false) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java index c9fbd66a66..65577ff6ae 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java @@ -37,7 +37,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedul import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.Role; @@ -323,7 +323,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript { // Fire action to "set-up" the folder correctly logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.initialiseRecordFolder(recordFolder); + recordFolderService.setupRecordFolder(recordFolder); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java index 19166820b8..9a3df3bfda 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java @@ -5,7 +5,7 @@ import java.util.Map; import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteService; import org.apache.commons.lang.StringUtils; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java index e36c88e53f..2e24f10df7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java @@ -7,7 +7,7 @@ import java.util.Map; import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteService; import org.apache.commons.lang.StringUtils; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index f49fef2440..106c35b205 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -36,7 +36,7 @@ import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventSe import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; import org.alfresco.module.org_alfresco_module_rm.report.ReportService; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java index 84011db718..bbeb932ffe 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java @@ -33,7 +33,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;