Class WorkflowTransitionDAO

java.lang.Object
org.ametys.plugins.workflow.dao.WorkflowTransitionDAO
All Implemented Interfaces:
Component, Serviceable

public class WorkflowTransitionDAO extends Object implements Component, Serviceable
The workflow action DAO
  • Field Details

  • Constructor Details

  • Method Details

    • service

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

      public Map<String,Object> getTransitionInfos(String workflowName, Integer transitionId)
      Get the transition infos to initialize creation/edition form fields
      Parameters:
      workflowName - the current workflow name
      transitionId - the current transition's id, can be null
      Returns:
      the transition values and a list of taken ids
    • getAvailableActions

      public Set<Map<String,Object>> getAvailableActions(String workflowName, Integer parentStepId)
      Get a set of transitions already defined in current workflow beside initialActions
      Parameters:
      workflowName - the current workflow name
      parentStepId - the current selected step
      Returns:
      a set containing maps of actions properties
    • createTransition

      public Map<String,Object> createTransition(String workflowName, Integer parentStepId, int transitionId, Map<String,String> labels, int finalStepId)
      Create a new transition
      Parameters:
      workflowName - the current workflow name
      parentStepId - the parent step id
      transitionId - the id for the transition to create
      labels - the multilinguals labels for the transition
      finalStepId - the id for the transition's unconditional result
      Returns:
      a map with error message or with transition's id if succesfull
    • addTransitions

      public Map<String,Object> addTransitions(String workflowName, Integer parentStepId, List<Integer> transitionIds)
      Add an existing transition to current step
      Parameters:
      workflowName - the current workflow name
      parentStepId - the current selected step id
      transitionIds - a list of ids corresponding to the transitions to add to current step
      Returns:
      the first transition id and its parent sted id
    • _updateWorkflowCommonAction

      protected void _updateWorkflowCommonAction(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int actionId, com.opensymphony.workflow.loader.ActionDescriptor action)
      Set action as 'common' in steps using it
      Parameters:
      workflowDescriptor - the current workflow
      actionId - id of current action
      action - the action
    • editTransitionLabel

      public Map<String,Object> editTransitionLabel(String workflowName, Integer stepId, Integer actionId, String newMainLabel)
      Rename the transition
      Parameters:
      workflowName - the workflow name
      stepId - id of selected step
      actionId - the transition's id
      newMainLabel - the new label in current language
      Returns:
      a map with error message or with transition's infos if succesfull
    • editTransition

      public Map<String,Object> editTransition(String workflowName, Integer stepId, Integer oldId, Integer newId, Map<String,String> labels, Integer finalStepId)
      Edit the transition
      Parameters:
      workflowName - the workflow name
      stepId - id of selected step
      oldId - the transition's former id
      newId - the transition's new id
      labels - the transition's multilingual labels
      finalStepId - the transition's unconditional result id
      Returns:
      a map with error message or with transition's infos if succesfull
    • removeTransition

      public Map<String,Object> removeTransition(String workflowName, Integer parentStepId, Integer transitionId)
      Remove transition from step
      Parameters:
      workflowName - the current workflow name
      parentStepId - the parent step id to remove the transition from
      transitionId - the id for the transition to remove
      Returns:
      empty map if successfull
    • _manageCommonAction

      protected void _manageCommonAction(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.ActionDescriptor action)
      Verify that the action is still used by multiple steps. If not anymore, replace the action by a non common copy
      Parameters:
      workflowDescriptor - the current workflow
      action - the action removed
    • getNumberOfUse

      public int getNumberOfUse(String workflowName, Integer actionId)
      Get the number of steps using the action
      Parameters:
      workflowName - the current workflow's name
      actionId - the current action's id
      Returns:
      the number of steps using the action
    • getActionLabel

      public String getActionLabel(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action)
      Get the translated action label
      Parameters:
      workflowName - the workflow's unique name
      action - current action
      Returns:
      the action label
    • getActionIconPath

      public String getActionIconPath(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action)
      Get the action's icon path
      Parameters:
      workflowName - name of current workflow
      action - current action
      Returns:
      the icon's path
    • getActionIconPathAsBase64

      public String getActionIconPathAsBase64(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action)
      Get the action's icon path as base 64 for svg's links
      Parameters:
      workflowName - name of current workflow
      action - current action
      Returns:
      the icon's path as base 64
    • getActionLabel

      public I18nizableText getActionLabel(com.opensymphony.workflow.loader.ActionDescriptor action)
      Get the action label as i18n
      Parameters:
      action - the current action
      Returns:
      the label as i18n