mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -182,6 +182,34 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
|
|||||||
{
|
{
|
||||||
// recursively convert each value in the collection
|
// recursively convert each value in the collection
|
||||||
Collection<Object> collection = (Collection<Object>)value;
|
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>();
|
Collection<Object> converted = new ArrayList<Object>();
|
||||||
for (Object obj : collection)
|
for (Object obj : collection)
|
||||||
{
|
{
|
||||||
@@ -189,6 +217,7 @@ public class AlfrescoJavaScript extends JBPMSpringActionHandler
|
|||||||
}
|
}
|
||||||
value = converted;
|
value = converted;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user