Class WorkflowFunctionDAO

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.dao.WorkflowFunctionDAO
All Implemented Interfaces:
LogEnabled, Component, Serviceable

DAO for workflow element's pre and pos functions
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getFunctionsModel

      Get the function's parameters as fields to configure edition form panel
      Returns:
      the parameters field as Json readable map
      Throws:
      ProcessingException - exception while saxing view to json
    • _getArgumentsAndTypeModelItems

      Get a list of workflow arguments model items with disable conditions on non related function selected
      Parameters:
      enhancedFunctions - a list of Pair with id and enhanced function
      Returns:
      the list of model items
    • _getFunctionListModelItem

      Get the model item for the list of functions
      Parameters:
      enhancedFunctions - the list of enhanced functions
      Returns:
      an enum of the functions as a model item
    • _getFunctionTypeModelItem

      protected ElementDefinition<String> _getFunctionTypeModelItem(String functionId, DisableCondition disableCondition)
      Get the view item for the fonctions types
      Parameters:
      functionId - id of current function
      disableCondition - the condition for disabling the field
      Returns:
      the view element
    • getFunctionParametersValues

      public Map<String,Object> getFunctionParametersValues(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index)
      Get the function's parameters as a json view and their current values
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      type - whether the function is a pre of post function
      id - the function's id
      index - the function's index in the pre/post function list
      Returns:
      map of the function's infos
    • addFunction

      public Map<String,Object> addFunction(String workflowName, Integer stepId, Integer actionId, Map<String,Object> params)
      Add a function to the workflow element
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      params - Map of the function arguments
      Returns:
      map of the function's infos
    • _getFunctionParamsValuesAsString

      protected Map<String,String> _getFunctionParamsValuesAsString(EnhancedFunction enhancedFunction, String functionId, Map<String,Object> params)
      Get the list of arguments as String, parse multiple arguments
      Parameters:
      enhancedFunction - the current function class
      functionId - the function's id
      params - List of function arguments with values
      Returns:
      the map of arguments formated for condition descriptor
    • _getTypedFunctions

      protected List<com.opensymphony.workflow.loader.FunctionDescriptor> _getTypedFunctions(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Integer stepId, Integer actionId, String functionType)
      Get the list where belong a function can be either the prefunction list or the postfunctions
      Parameters:
      workflowDescriptor - the current workflow
      stepId - id of current step
      actionId - id of current action can be null if selection is a step
      functionType - the type of function
      Returns:
      the typed list
    • editFunction

      public Map<String,Object> editFunction(String workflowName, Integer stepId, Integer actionId, String oldType, Map<String,Object> params, int indexOfFunction)
      Edit the function
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      oldType - the saved type for this fonction
      params - Map of the function arguments
      indexOfFunction - the function's index in the pre/post function list
      Returns:
      map of the function's infos
    • deleteFunction

      public Map<String,Object> deleteFunction(String workflowName, Integer stepId, Integer actionId, String functionType, String id, int indexToRemove)
      Remove the function from its parent
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      functionType - whether the function is a pre of post function
      id - the function's id
      indexToRemove - the function's index in the pre/post function list
      Returns:
      map of the function's infos
    • moveUp

      public Map<String,Object> moveUp(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex)
      Swap the function with the one before it in the parent's pre/post function list
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      functionType - whether the function is a pre of post function
      functionIndex - the function's index in the pre/post function list
      Returns:
      map of the function's infos
    • moveDown

      public Map<String,Object> moveDown(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex)
      Swap the function with the one after it in the parent's pre/post function list
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      functionType - whether the function is a pre of post function
      functionIndex - the function's index in the pre/post function list
      Returns:
      map of the function's infos
    • _isLast

      protected boolean _isLast(List<com.opensymphony.workflow.loader.FunctionDescriptor> functions, int functionIndex)
      Check if function can have bigger index in its parent's pre/post function list
      Parameters:
      functions - the current list of functions
      functionIndex - the function's index in the pre/post function list
      Returns:
      true if the function can move down
    • getStepFunctions

      public Map<String,Object> getStepFunctions(String workflowName, Integer stepId)
      Get pre and postfunctions of current step
      Parameters:
      workflowName - the workflow unique name
      stepId - id of the current step
      Returns:
      a list of the step's functions
    • getActionFunctions

      public Map<String,Object> getActionFunctions(String workflowName, Integer actionId)
      Get pre and postfunctions of current action
      Parameters:
      workflowName - the workflow unique name
      actionId - id of the current action
      Returns:
      a list of the action's functions
    • getFunctionDescription

      public I18nizableText getFunctionDescription(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index)
      Get the function's description
      Parameters:
      workflowName - the workflow's unique name
      stepId - the parent step's id
      actionId - the parent action's id can be null
      type - whether the function is a pre of post function
      id - the enhanced function's id
      index - the function's index in the pre/post function list
      Returns:
      the function's description