Bug fixes for handling mapping of users

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-08-11 11:44:31 +00:00
parent ffb20843c4
commit cb40050bcd

View File

@@ -910,16 +910,23 @@ public class JBPMEngine extends BPMEngine
// perform data conversions // perform data conversions
// NOTE: Only convert Authority name to NodeRef for now // NOTE: Only convert Authority name to NodeRef for now
QName qname = QName.createQName(key); QName qname = QName.createQName(key, this.namespaceService);
AssociationDefinition assocDef = taskAssocs.get(qname); AssociationDefinition assocDef = taskAssocs.get(qname);
if (assocDef != null && assocDef.getTargetClass().equals(ContentModel.TYPE_PERSON)) if (assocDef != null && assocDef.getTargetClass().equals(ContentModel.TYPE_PERSON))
{ {
// TODO: Also support group authorities // TODO: Also support group authorities
if (!(value instanceof String[])) if (value instanceof String[])
{
value = mapNameToAuthority((String[])value);
}
else if (value instanceof String)
{
value = mapNameToAuthority(new String[] {(String)value});
}
else
{ {
throw new WorkflowException("Task variable '" + qname + "' value is invalid format"); throw new WorkflowException("Task variable '" + qname + "' value is invalid format");
} }
value = mapNameToAuthority((String[])value);
} }
// place task variable in map to return // place task variable in map to return
@@ -1020,9 +1027,10 @@ public class JBPMEngine extends BPMEngine
{ {
// if association is to people, map them to authority names // if association is to people, map them to authority names
// TODO: support group authorities // TODO: support group authorities
if (assocDef.getTargetClass().equals(ContentModel.TYPE_PERSON)) if (assocDef.getTargetClass().getName().equals(ContentModel.TYPE_PERSON))
{ {
value = mapAuthorityToName((List<NodeRef>)value); String[] authorityNames = mapAuthorityToName((List<NodeRef>)value);
value = ((assocDef.isTargetMany()) ? authorityNames : authorityNames[0]);
} }
// map association to specific jBPM task instance field // map association to specific jBPM task instance field
@@ -1043,7 +1051,7 @@ public class JBPMEngine extends BPMEngine
} }
else else
{ {
name = key.toString(); name = key.toPrefixString(this.namespaceService);
} }
instance.setVariableLocally(name, value); instance.setVariableLocally(name, value);
} }