From c142ab7699a9904986038f614c3b06c7dda60e55 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Fri, 14 Jun 2019 13:44:44 +0100 Subject: [PATCH] RM-6865 adding extra param for declare to --- .../action/dm/CreateRecordAction.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) 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 f668e41e28..3d51e9552a 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 @@ -71,6 +71,8 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase public static final String PARAM_FILE_PLAN = "file-plan"; public static final String PARAM_HIDE_RECORD = "hide-record"; public static final String PARAM_PATH = "path"; + public static final String PARAM_ENCODED = "encoded"; + /** Node service */ private NodeService nodeService; @@ -127,10 +129,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase // resolve destination record folder if path supplied NodeRef destinationRecordFolder = null; String pathParameter = (String) action.getParameterValue(PARAM_PATH); - if (pathParameter != null && !pathParameter.isEmpty()) - { - destinationRecordFolder = resolvePath(filePlan, pathParameter); - } // indicate whether the record should be hidden or not (default not) boolean hideRecord = false; @@ -140,6 +138,18 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase hideRecord = hideRecordValue.booleanValue(); } + if (pathParameter != null && !pathParameter.isEmpty()) + { + if ((Boolean) action.getParameterValue(PARAM_ENCODED)) + { + destinationRecordFolder = resolvePath(filePlan, decode(pathParameter)); + } + else + { + destinationRecordFolder = resolvePath(filePlan, pathParameter); + } + } + synchronized (this) { // create record from existing document @@ -162,19 +172,18 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); params.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); + params.add(new ParameterDefinitionImpl(PARAM_ENCODED, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_ENCODED))); } /** * Helper method to get the target record folder node reference from the action path parameter * - * @param filePlan The filePlan containing the path + * @param filePlan The filePlan containing the path * @param pathParameter The path * @return The NodeRef of the resolved path */ private NodeRef resolvePath(NodeRef filePlan, final String pathParameter) { - String decodedPathParameter = decode(pathParameter); - NodeRef destinationFolder; if (filePlan == null) @@ -182,7 +191,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase filePlan = getDefaultFilePlan(); } - final String[] pathElementsArray = StringUtils.tokenizeToStringArray(decodedPathParameter, "/", false, true); + final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); if ((pathElementsArray != null) && (pathElementsArray.length > 0)) { destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray));