diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index ef9245ed29..2a6ab6942f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -27,6 +27,8 @@ package org.alfresco.module.org_alfresco_module_rm.action.dm; +import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordActionUtils.resolvePath; + import java.util.List; import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; @@ -128,13 +130,13 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase Boolean hideRecordValue = ((Boolean) action.getParameterValue(PARAM_HIDE_RECORD)); if (hideRecordValue != null) { - hideRecord = hideRecordValue.booleanValue(); + hideRecord = hideRecordValue; } if (pathParameter != null && !pathParameter.isEmpty()) { RecordActionUtils.Services services = new Services(nodeService, filePlanService, authenticationUtil); - destinationRecordFolder = RecordActionUtils.resolvePath(services, filePlan, pathParameter, NAME); + destinationRecordFolder = resolvePath(services, filePlan, pathParameter, NAME); } synchronized (this) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java index a05b3eddd4..2a3fc4faf4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java @@ -181,7 +181,7 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type."); } } - else if (!isActionEligible(actionedUponNodeRef)) + else if (isActionEligible(actionedUponNodeRef)) { NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); if (filePlan == null) @@ -261,7 +261,7 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac { logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + aspect.getValue()); } - return true; + return false; } } if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)) @@ -270,8 +270,8 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac { logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied."); } - return true; + return false; } - return false; + return true; } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java index 3a350b940d..de087d4edd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java @@ -37,8 +37,8 @@ import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; /** @@ -50,7 +50,7 @@ public class RecordActionUtils /** * Logger */ - private static final Log LOGGER = LogFactory.getLog(RecordActionUtils.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RecordActionUtils.class); /** Private constructor to prevent instantiation. */ private RecordActionUtils() @@ -139,15 +139,12 @@ public class RecordActionUtils { throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path could not be found."); } - else + QName nodeType = nodeService.getType(nodeRef); + if (nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || + nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || + nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) { - QName nodeType = nodeService.getType(nodeRef); - if (nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) - { - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is invalid."); - } + throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is invalid."); } if (pathElements.size() > 1) { @@ -168,11 +165,10 @@ public class RecordActionUtils // if the file plan is still null, raise an exception if (filePlan == null) { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Unable to execute " + actionName + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created."); - } - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the fileplan path could not be determined."); + final String logMessage = + String.format("Unable to execute %s action, because the fileplan path could not be determined. Make sure at least one file plan has been created.", actionName); + LOGGER.debug(logMessage); + throw new AlfrescoRuntimeException(logMessage); } return filePlan; }