ALF-9727: Querying using NodeRef type now uses ActivitiScriptNodeVariableType insead of ByteArrayVariableType (which isn't queryable) + fixed activiti components text-context

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30848 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Frederik Heremans
2011-09-29 12:07:46 +00:00
parent 5866905265
commit c3fe5d4b53

View File

@@ -584,6 +584,40 @@ public class ActivitiPropertyConverter
String msg = messageService.getMessage(ERR_CONVERT_VALUE, value);
throw new WorkflowException(msg);
}
/**
* Performs basic conversion from a property to a
* value that can be uses as activiti variable. If the type of the
* property is known, use {@link #convertValueToPropertyType(Task, Serializable, QName)}
*
* @param property the property to be converted
*
* @return the value
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object convertPropertyToValue(Object property) {
if(property instanceof NodeRef) {
return nodeConverter.convertNode((NodeRef) property);
} else if(property instanceof Collection) {
boolean allNodes = true;
// Check if collection contains node-refs
for(Object item : ((Collection)property)) {
if(!(item instanceof NodeRef)) {
allNodes = false;
break;
}
}
if(allNodes) {
return nodeConverter.convertNodes((Collection<NodeRef>) property);
} else {
return property;
}
} else {
// No conversion needed, property can be used.
return property;
}
}
/**
* Converts a {@link Serializable} value to the type of the specified property.