Fix issue where javascript returns array of nodes, but those nodes are not converted to the appropriate type for jbpm persistence.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6815 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2007-09-18 15:50:44 +00:00
parent 989a9b0a50
commit 1747086061

View File

@@ -182,6 +182,34 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
{
// recursively convert each value in the collection
Collection<Object> collection = (Collection<Object>)value;
// Note: this needs to be cleaned up - we need to create appropriate collection type based
// on collection contents
boolean isNodeCollection = false;
for (Object obj : collection)
{
if (obj instanceof NodeRef)
{
isNodeCollection = true;
break;
}
}
if (isNodeCollection)
{
JBPMNodeList converted = new JBPMNodeList();
for (Object obj : collection)
{
if (!(obj instanceof NodeRef))
{
throw new WorkflowException("Unable to convert script collection to JBPM value - mixed node/non-node collection");
}
converted.add((JBPMNode)convertForJBPM(obj, services));
}
value = converted;
}
else
{
Collection<Object> converted = new ArrayList<Object>();
for (Object obj : collection)
{
@@ -189,6 +217,7 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
}
value = converted;
}
}
return value;
}