Class 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 Detail

      • INTERNAL_PROPERTIES

        public static final Set<String> INTERNAL_PROPERTIES
    • Constructor Detail

      • RestVariableHelper

        public RestVariableHelper()
    • Method Detail

      • setNodeService

        public void setNodeService​(NodeService nodeService)
      • setNamespaceService

        public void setNamespaceService​(NamespaceService namespaceService)
      • setDictionaryService

        public void setDictionaryService​(DictionaryService dictionaryService)
      • 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 - TypeDefinition
        taskTypeDefinition - 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 variables
        typeDefinition - the typê definition for the start-task of the process, used to extract types.
        Returns:
        list of Variable, representing the given raw variables
      • 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 the TypeDefinition, 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.
      • getSafePropertyValue

        protected Object getSafePropertyValue​(Object value)
      • extractTypeFromValue

        public QName extractTypeFromValue​(Object value)
      • extractTypeStringFromValue

        public String extractTypeStringFromValue​(Object value)