From a9e2d6a5939447512a3d89e2a4b8fae98f1a1b0d Mon Sep 17 00:00:00 2001 From: Dave Ward Date: Sun, 3 Mar 2013 12:36:29 +0000 Subject: [PATCH] Merged V4.1-BUG-FIX to HEAD 47423: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47381: ALF-15903 : form.getFieldLabel(field.id) sometimes returns the wrong label Added a check for the overridden id with the ending "-cntrl" 47424: Fixes: ALF-17950: Content I'm Editing dashlet runs relativeDate parsing twice. Removes duplicate code and also prevents relativeTime parsing from breaking if called multiple times. 47425: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47386: ALF-15873: Form field validators not executed for NON mandatory date fields Add to context all form constraints defined in custom config. 47426: Merged V4.1-BUG-FIX-2013_02_26 to V4.1-BUG-FIX 47418: ALF-16385 : When the 'My activites' dashlet is narrow enough, vertical sizing of the content box is wrong. Recalculate a height of dashlet, when it was resized 47427: ALF-18092: fixed issue with hidden-transitions field JSON 47428: Merge DEV to V4.1-BUG-FIX 46336 : ALF-16747 changing type of the root node of replicated set of nodes is not propagated to target. 47437: Fixes ALF-17145: Pagination did not play nicely with back button. 47439: Implements suggested fix for: ALF-16603 47443: Fixed ALF-17255: AUDIT_PATH_REGEX regex pattern recompiled at runtime - Switch to pre-compiled Pattern 47473: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2013_02_26 to BRANCHES/DEV/V4.1-BUG-FIX: 47313: ALF-18006 : Sending a PUT request without a Content-Type header resets the contents mimetype to application/octet-stream fix unit test 47475: ALF-18092: Fixed unit test fallout from hidden transitions property serialization changes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47476 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../AbstractCalendarListingWebScript.java | 2 +- .../web/scripts/workflow/TaskInstancePut.java | 16 ++++++++++-- .../workflow/WorkflowModelBuilder.java | 26 ++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/repo/web/scripts/calendar/AbstractCalendarListingWebScript.java b/source/java/org/alfresco/repo/web/scripts/calendar/AbstractCalendarListingWebScript.java index c27f97f1f7..4b09adac63 100644 --- a/source/java/org/alfresco/repo/web/scripts/calendar/AbstractCalendarListingWebScript.java +++ b/source/java/org/alfresco/repo/web/scripts/calendar/AbstractCalendarListingWebScript.java @@ -195,7 +195,7 @@ public abstract class AbstractCalendarListingWebScript extends AbstractCalendarW Date newEnd = new Date(newStart.getTime() + duration); result.put(RESULT_START, ISO8601DateFormat.format(newStart)); result.put(RESULT_END, ISO8601DateFormat.format(newEnd)); - String legacyDateFormat = "M/d/yyyy"; + String legacyDateFormat = "yyyy-MM-dd"; SimpleDateFormat ldf = new SimpleDateFormat(legacyDateFormat); String legacyTimeFormat ="HH:mm"; SimpleDateFormat ltf = new SimpleDateFormat(legacyTimeFormat); diff --git a/source/java/org/alfresco/repo/web/scripts/workflow/TaskInstancePut.java b/source/java/org/alfresco/repo/web/scripts/workflow/TaskInstancePut.java index 6681fe45bf..0263788510 100644 --- a/source/java/org/alfresco/repo/web/scripts/workflow/TaskInstancePut.java +++ b/source/java/org/alfresco/repo/web/scripts/workflow/TaskInstancePut.java @@ -130,8 +130,20 @@ public class TaskInstancePut extends AbstractWorkflowWebscript if (prop != null) { - // convert property using its data type specified in model - value = (Serializable) DefaultTypeConverter.INSTANCE.convert(prop.getDataType(), jsonValue); + if (prop.isMultiValued() && jsonValue instanceof JSONArray) + { + value = new ArrayList(); + + for (int i = 0; i < ((JSONArray)jsonValue).length(); i++) + { + ((List)value).add((Serializable) DefaultTypeConverter.INSTANCE.convert(prop.getDataType(),((JSONArray)jsonValue).get(i))); + } + } + else + { + // convert property using its data type specified in model + value = (Serializable) DefaultTypeConverter.INSTANCE.convert(prop.getDataType(), jsonValue); + } } else { diff --git a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java index 848b40530f..a8e3ba4814 100644 --- a/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java +++ b/source/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -414,12 +415,24 @@ public class WorkflowModelBuilder keys.addAll(propDefs.keySet()); keys.addAll(assocDefs.keySet()); keys.addAll(propKeys); + keys.add(WorkflowModel.PROP_HIDDEN_TRANSITIONS); } else { keys = buildQNameKeys(propertyFilters); } - return buildQNameProperties(properties, keys); + + Map result = buildQNameProperties(properties, keys); + // ALF-18092: Special handling for the "hiddenTransitions" property, as it can be an empty string + if (keys.contains(WorkflowModel.PROP_HIDDEN_TRANSITIONS)) + { + List hiddenTransitions = getHiddenTransitions(properties); + if (hiddenTransitions != null) + { + result.put(qNameConverter.mapQNameToName(WorkflowModel.PROP_HIDDEN_TRANSITIONS), hiddenTransitions); + } + } + return result; } private Map buildPropertyLabels(WorkflowTask task, Map properties) @@ -595,8 +608,15 @@ public class WorkflowModelBuilder } else if (hiddenSer instanceof String) { - String hiddenStr = (String) hiddenSer; - return Arrays.asList(hiddenStr.split(",")); + if(((String) hiddenSer).isEmpty()) + { + return Collections.emptyList(); + } + else + { + String hiddenStr = (String) hiddenSer; + return Arrays.asList(hiddenStr.split(",")); + } } return null; }