Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

63064: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3)
      62673: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.2)
         62610: MNT-9587: Workflows task properties values are not compliant with data-dictionary-property-definitions.
         Add default name as "Task" for bpm:workflowTasks and fix WorkflowModelBuilder to return default property values if no were set


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64252 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-03-14 15:31:03 +00:00
parent 957c03475d
commit 2bbf9c822e

View File

@@ -422,7 +422,8 @@ public class WorkflowModelBuilder
keys = buildQNameKeys(propertyFilters); keys = buildQNameKeys(propertyFilters);
} }
Map<String, Object> result = buildQNameProperties(properties, keys); Map<String, Object> result = buildQNameProperties(properties, keys, task);
// ALF-18092: Special handling for the "hiddenTransitions" property, as it can be an empty string // ALF-18092: Special handling for the "hiddenTransitions" property, as it can be an empty string
if (keys.contains(WorkflowModel.PROP_HIDDEN_TRANSITIONS)) if (keys.contains(WorkflowModel.PROP_HIDDEN_TRANSITIONS))
{ {
@@ -434,7 +435,7 @@ public class WorkflowModelBuilder
} }
return result; return result;
} }
private Map<String, String> buildPropertyLabels(WorkflowTask task, Map<String, Object> properties) private Map<String, String> buildPropertyLabels(WorkflowTask task, Map<String, Object> properties)
{ {
TypeDefinition taskType = task.getDefinition().getMetadata(); TypeDefinition taskType = task.getDefinition().getMetadata();
@@ -465,13 +466,20 @@ public class WorkflowModelBuilder
}); });
} }
private Map<String, Object> buildQNameProperties(Map<QName, Serializable> properties, Collection<QName> keys) private Map<String, Object> buildQNameProperties(Map<QName, Serializable> properties, Collection<QName> keys,
WorkflowTask task)
{ {
Map<QName, PropertyDefinition> propDefs = task.getDefinition().getMetadata().getProperties();
Map<String, Object> model = new HashMap<String, Object>(); Map<String, Object> model = new HashMap<String, Object>();
for (QName key : keys) for (QName key : keys)
{ {
Object value = convertValue(properties.get(key)); Object value = convertValue(properties.get(key));
String strKey = qNameConverter.mapQNameToName(key); String strKey = qNameConverter.mapQNameToName(key);
PropertyDefinition propDef = propDefs.get(key);
if ((value == null) && (propDef != null))
{
value = propDef.getDefaultValue();
}
model.put(strKey, value); model.put(strKey, value);
} }
return model; return model;