diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties index f940e8bed9..198c0465e7 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties @@ -28,10 +28,11 @@ rm.action.no-open-record-folder=The record folder couldn't be opened because it' rm.action.not-hold-type=The hold couldn't be relinquished, because the node isn't of type {0}. (actionedUponNodeRef={1}) rm.action.no-read-mime-message=The mimetype message couldn't be read, because {0}. rm.action.email-declared=The email couldn't be split, because the record is complete. (actionedUponNodeRef={0}) -rm.action.email-not-record=The email couldn't be split, because the node isn't a record. (actionedUponNodeRef={0}) +rm.action.email-not-record=The email couldn't be split, because the node isn't a record. (actionedUponNodeRef={0}) rm.action.email-create-child-assoc=Couldn't create custom child association. rm.action.node-already-transfer=The node is already being transferred. rm.action.node-not-transfer=The node is not a transfer object. rm.action.undo-not-last=The cut off can't be undone, because the last disposition action was not cut off. rm.action.records_only_undeclared=Only records can be completed. -rm.action.event-not-undone=The event {0} can't be undone, because it's not defined on the disposition lifecycle. \ No newline at end of file +rm.action.event-not-undone=The event {0} can't be undone, because it's not defined on the disposition lifecycle. +rm.action.actioned-upon-has-aspect=The node {0} has already the aspect {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties index 357adc1f1c..fb1c0b51be 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties @@ -31,7 +31,7 @@ isVital.description=Is the record or record folder vital. # Have Disposition Action hasDispositionAction.title=Has disposition action -hasDispositionAction.description=Have the nodes got the specified associated disposition action at the specified relative position. +hasDispositionAction.description=Have the nodes got the specified associated disposition action at the specified relative position. # Are kind isKind.title=Type of records management item @@ -40,7 +40,7 @@ isKind.kind.display-label=Kind # Are Record Type isRecordType.title=Has record type -isRecordType.description=Are the records of the specified type. +isRecordType.description=Are the records of the specified type. # @@ -133,7 +133,7 @@ createDispositionSchedule.description=Create disposition schedule # File Destruction Report fileDestructionReport.title=File destruction report fileDestructionReport.description=File destruction report -# Cut off +# Cut off cutoff.title=Cut off cutoff.description=Cut off # Destroy @@ -157,6 +157,9 @@ accession.description=Accession # Retain retain.title=Retain retain.description=Retain +# Add Record Types +addRecordTypes.title=Add record types +addRecordTypes.description=Adds the selected type(s) to the record # Action parameter constraints diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml index c948e7743b..e89bbe1f26 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml @@ -267,7 +267,7 @@ - + @@ -275,7 +275,7 @@ - + @@ -916,4 +916,31 @@ + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java new file mode 100644 index 0000000000..fe2c8074b3 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java @@ -0,0 +1,93 @@ +/* + * 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.action.impl; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Action to add types to a record + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class AddRecordTypeAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(AddRecordTypeAction.class); + + /** I18N */ + private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; + private static final String MSG_ACTIONED_UPON_HAS_ASPECT = "rm.action.actioned-upon-has-aspect"; + + /** Parameter names */ + public static final String PARAM_ADD_RECORD_TYPES = "recordTypes"; + + /** Action name */ + public static final String NAME = "addRecordTypes"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (recordService.isRecord(actionedUponNodeRef)) + { + String recordTypes = (String) action.getParameterValue(PARAM_ADD_RECORD_TYPES); + String[] types = recordTypes.split(","); + for (String type : types) + { + QName aspectTypeQName = QName.createQName(type, namespaceService); + if (nodeService.hasAspect(actionedUponNodeRef, aspectTypeQName) == false) + { + nodeService.addAspect(actionedUponNodeRef, aspectTypeQName, null); + } + else + { + logger.info(I18NUtil.getMessage(MSG_ACTIONED_UPON_HAS_ASPECT, actionedUponNodeRef.toString(), aspectTypeQName.toString())); + } + } + } + else if (logger.isWarnEnabled() == true) + { + logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_ADD_RECORD_TYPES, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_ADD_RECORD_TYPES))); + } +}