Class WorkflowConditionDAO

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

DAO for workflow conditions
  • Field Details

  • Constructor Details

  • Method Details

    • service

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

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

      Get a list of workflow arguments model items with disable conditions on non related function selected
      Parameters:
      conditions - a list of all the conditions with their ids
      Returns:
      the list of model items
    • getConditionParametersValues

      public Map<String,Object> getConditionParametersValues(String workflowName, Integer actionId, String conditionNodeId) throws ProcessingException
      Get current argument's values for condition
      Parameters:
      workflowName - unique name of current workflow
      actionId - id of current action
      conditionNodeId - id of selected node
      Returns:
      a map of the condition's arguments and their current values
      Throws:
      ProcessingException - exception while resolving condition
    • _getCondition

      protected com.opensymphony.workflow.loader.ConditionDescriptor _getCondition(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Integer actionId, String conditionNodeId)
      Get the current condition as condition descriptor
      Parameters:
      workflowDescriptor - current workflow
      actionId - id of current action
      conditionNodeId - id of current node
      Returns:
      the conditions
    • editCondition

      public Map<String,Object> editCondition(String workflowName, Integer stepId, Integer actionId, String conditionNodeId, Map<String,Object> arguments) throws com.opensymphony.workflow.WorkflowException
      Edit the condition
      Parameters:
      workflowName - unique name of current workflow
      stepId - id of step parent
      actionId - id of current action
      conditionNodeId - id of selected node
      arguments - map of arguments name and values
      Returns:
      map of condition's info
      Throws:
      com.opensymphony.workflow.WorkflowException - exception while resolving condition
    • addCondition

      public Map<String,Object> addCondition(String workflowName, Integer stepId, Integer actionId, String parentNodeId, Map<String,Object> arguments)
      Add a new condition
      Parameters:
      workflowName - unique name of current workflow
      stepId - id of step parent
      actionId - id of current action
      parentNodeId - id of selected node : can be null if no node is selected
      arguments - map of arguments name and values
      Returns:
      map of condition's info
    • _getConditionParamsValuesAsString

      Get the list of arguments as String, parse multiple arguments
      Parameters:
      params - List of condition arguments with values
      Returns:
      the map of arguments formated for condition descriptor
    • _getConditionsRootOperator

      protected com.opensymphony.workflow.loader.ConditionsDescriptor _getConditionsRootOperator(String workflowName, Integer stepId, Integer actionId, com.opensymphony.workflow.loader.ActionDescriptor action, String parentNodeId)
      Get the root operator for regular conditions
      Parameters:
      workflowName - name of current workflow
      stepId - id of step parent
      actionId - id of current action
      action - the current action
      parentNodeId - id of the parent node
      Returns:
      the root conditions operator
    • _getResultConditionsRootOperator

      protected com.opensymphony.workflow.loader.ConditionsDescriptor _getResultConditionsRootOperator(String workflowName, Integer stepId, Integer actionId, String parentNodeId, com.opensymphony.workflow.loader.ActionDescriptor action)
      Get the root operator for result conditions
      Parameters:
      workflowName - name of current workflow
      stepId - id of step parent
      actionId - id of current action
      action - the current action
      parentNodeId - id of the parent node
      Returns:
      the root conditions operator
    • addOperator

      public Map<String,Object> addOperator(String workflowName, Integer stepId, Integer actionId, String nodeId, String operatorType, boolean isResultCondition)
      Add an operator
      Parameters:
      workflowName - unique name of current workflow
      stepId - id of step parent
      actionId - id of current action
      nodeId - id of selected node
      operatorType - the workflow conditions' type. Can be AND or OR
      isResultCondition - true if parent is a conditional result
      Returns:
      map of the operator's infos
    • deleteOperator

      public Map<String,Object> deleteOperator(String workflowName, Integer stepId, Integer actionId, String nodeId)
      Delete operator from action
      Parameters:
      workflowName - unique name of current workflow
      stepId - id of step parent
      actionId - id of current action
      nodeId - id of selected node
      Returns:
      map of operator's infos
    • _removeConditionOperator

      protected void _removeConditionOperator(String nodeId, com.opensymphony.workflow.loader.ActionDescriptor action, String[] path)
      Remove a regular condition operator
      Parameters:
      nodeId - id of operator to remove
      action - current action
      path - the path to current node
    • _removeResultConditionOperator

      protected void _removeResultConditionOperator(String nodeId, com.opensymphony.workflow.loader.ActionDescriptor action, String[] path)
      Remove a result condition operator
      Parameters:
      nodeId - id of operator to remove
      action - current action
      path - the path to current node
    • deleteCondition

      public Map<String,Object> deleteCondition(String workflowName, Integer stepId, Integer actionId, String nodeId)
      Delete the condition
      Parameters:
      workflowName - unique name of current workflow
      stepId - id of step parent
      actionId - id of current action
      nodeId - id of selected node
      Returns:
      map of the condition's infos
    • _removeCondition

      protected List _removeCondition(com.opensymphony.workflow.loader.ConditionsDescriptor rootCondition, String conditionNodeId, String[] conditionPath)
      Remove a condition
      Parameters:
      rootCondition - the first parent condition operator
      conditionNodeId - id of the current condition
      conditionPath - the full path to the condition
      Returns:
      the list of conditions after removal
    • getConditionNodes

      public Map<String,Object> getConditionNodes(String currentNode, String workflowName, Integer actionId)
      Get the tree's condition nodes
      Parameters:
      currentNode - id of the current node
      workflowName - unique name of current workflow
      actionId - id of current action
      Returns:
      a map of current node's children
    • _getConditions

      protected List<com.opensymphony.workflow.loader.AbstractDescriptor> _getConditions(String currentNode, com.opensymphony.workflow.loader.ActionDescriptor action)
      Get conditions below current node
      Parameters:
      currentNode - id of the current node
      action - current action
      Returns:
      a list of childnodes condition
    • conditionToJSON

      public Map<String,Object> conditionToJSON(com.opensymphony.workflow.loader.AbstractDescriptor condition, String currentNodeId, int index, boolean rootIsAND)
      Get condition or condition types properties
      Parameters:
      condition - current condition, can be ConditionsDescriptor or ConditionDescriptor
      currentNodeId - the id of the current node in the ConditionTreePanel
      index - index of current condition in node's condition list
      rootIsAND - true if root node is an "AND" condition (in which case it's hidden and has no id)
      Returns:
      a map of the condition infos
    • getConditionLabel

      public I18nizableText getConditionLabel(String workflowName, Integer actionId, String nodeId)
      Get current condition's label
      Parameters:
      workflowName - unique name of current workflow
      actionId - id of current action
      nodeId - id of selected node
      Returns:
      the label
    • hasChildConditions

      public boolean hasChildConditions(String workflowName, Integer actionId, String nodeId)
      Get if current operator has children conditions
      Parameters:
      workflowName - unique name of current workflow
      actionId - id of current action
      nodeId - id of selected operator node
      Returns:
      true if operator has children
    • _getConditionLabel

      protected I18nizableText _getConditionLabel(com.opensymphony.workflow.loader.ConditionDescriptor condition)
      Get condition's description or id
      Parameters:
      condition - the current condition
      Returns:
      the condition description if exist, or its id if not