Class RestVariableHelper
- java.lang.Object
-
- org.alfresco.rest.workflow.api.impl.RestVariableHelper
-
public class RestVariableHelper extends Object
Helper class for handling conversion between variable representations in rest and raw values used in the Activiti-engine.- Author:
- Frederik Heremans
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
INTERNAL_PROPERTIES
-
Constructor Summary
Constructors Constructor Description RestVariableHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTaskVariables(List<TaskVariable> result, Map<String,Object> variables, TypeDefinitionContext context, VariableScope scope)
Converts the raw variables toTaskVariable
s and adds them to the given result-list.QName
extractTypeFromValue(Object value)
String
extractTypeStringFromValue(Object value)
protected Object
getAssociationRepresentation(Object value, AssociationDefinition assocDef)
protected WorkflowQNameConverter
getQNameConverter()
protected String
getRepresentationForNodeRef(Object value, ClassDefinition classDefinition)
protected Object
getSafePropertyValue(Object value)
List<TaskVariable>
getTaskVariables(Map<String,Object> localVariables, Map<String,Object> globalVariables, TypeDefinition startFormTypeDefinition, TypeDefinition taskTypeDefinition)
List<Variable>
getVariables(Map<String,Object> variables, TypeDefinition typeDefinition)
void
setDictionaryService(DictionaryService dictionaryService)
void
setNamespaceService(NamespaceService namespaceService)
void
setNodeService(NodeService nodeService)
protected void
setVariableValueAndType(Variable variable, Object value, TypeDefinitionContext context)
Sets the variable value with possible conversion to the correct format to be used in the response and sets the type accordingly.
-
-
-
Method Detail
-
setNodeService
public void setNodeService(NodeService nodeService)
-
setNamespaceService
public void setNamespaceService(NamespaceService namespaceService)
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
-
getQNameConverter
protected WorkflowQNameConverter getQNameConverter()
-
getTaskVariables
public List<TaskVariable> getTaskVariables(Map<String,Object> localVariables, Map<String,Object> globalVariables, TypeDefinition startFormTypeDefinition, TypeDefinition taskTypeDefinition)
- Parameters:
localVariables
- raw local task variables, can be null.globalVariables
- raw global taks variables, can be null.startFormTypeDefinition
- TypeDefinitiontaskTypeDefinition
- the typê definition for this task, used to extract types.- Returns:
- list of
TaskVariable
, representing the given raw variables
-
getVariables
public List<Variable> getVariables(Map<String,Object> variables, TypeDefinition typeDefinition)
- Parameters:
variables
- raw variablestypeDefinition
- the typê definition for the start-task of the process, used to extract types.- Returns:
- list of
Variable
, representing the given raw variables
-
addTaskVariables
public void addTaskVariables(List<TaskVariable> result, Map<String,Object> variables, TypeDefinitionContext context, VariableScope scope)
Converts the raw variables toTaskVariable
s and adds them to the given result-list.
-
setVariableValueAndType
protected void setVariableValueAndType(Variable variable, Object value, TypeDefinitionContext context)
Sets the variable value with possible conversion to the correct format to be used in the response and sets the type accordingly. If the variables is defined on theTypeDefinition
, the data-type is used. If it's not defined, the type is deducted from the raw variable value.
-
getAssociationRepresentation
protected Object getAssociationRepresentation(Object value, AssociationDefinition assocDef)
- Returns:
- object that represents the association value.
-
getRepresentationForNodeRef
protected String getRepresentationForNodeRef(Object value, ClassDefinition classDefinition)
-
-