RM-6865 adding extra param for declare to

This commit is contained in:
Ross Gale
2019-06-14 13:44:44 +01:00
parent 36ba457cfa
commit c142ab7699

View File

@@ -71,6 +71,8 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
public static final String PARAM_FILE_PLAN = "file-plan"; public static final String PARAM_FILE_PLAN = "file-plan";
public static final String PARAM_HIDE_RECORD = "hide-record"; public static final String PARAM_HIDE_RECORD = "hide-record";
public static final String PARAM_PATH = "path"; public static final String PARAM_PATH = "path";
public static final String PARAM_ENCODED = "encoded";
/** Node service */ /** Node service */
private NodeService nodeService; private NodeService nodeService;
@@ -127,10 +129,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
// resolve destination record folder if path supplied // resolve destination record folder if path supplied
NodeRef destinationRecordFolder = null; NodeRef destinationRecordFolder = null;
String pathParameter = (String) action.getParameterValue(PARAM_PATH); 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) // indicate whether the record should be hidden or not (default not)
boolean hideRecord = false; boolean hideRecord = false;
@@ -140,6 +138,18 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
hideRecord = hideRecordValue.booleanValue(); 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) synchronized (this)
{ {
// create record from existing document // create record from existing document
@@ -162,6 +172,7 @@ 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_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_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_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD)));
params.add(new ParameterDefinitionImpl(PARAM_ENCODED, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_ENCODED)));
} }
/** /**
@@ -173,8 +184,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
*/ */
private NodeRef resolvePath(NodeRef filePlan, final String pathParameter) private NodeRef resolvePath(NodeRef filePlan, final String pathParameter)
{ {
String decodedPathParameter = decode(pathParameter);
NodeRef destinationFolder; NodeRef destinationFolder;
if (filePlan == null) if (filePlan == null)
@@ -182,7 +191,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
filePlan = getDefaultFilePlan(); filePlan = getDefaultFilePlan();
} }
final String[] pathElementsArray = StringUtils.tokenizeToStringArray(decodedPathParameter, "/", false, true); final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true);
if ((pathElementsArray != null) && (pathElementsArray.length > 0)) if ((pathElementsArray != null) && (pathElementsArray.length > 0))
{ {
destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray)); destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray));