Package org.ametys.plugins.workflow.dao
Class WorkflowTransitionDAO
java.lang.Object
org.ametys.plugins.workflow.dao.WorkflowTransitionDAO
- All Implemented Interfaces:
Component
,Serviceable
The workflow action DAO
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The contextprotected I18nHelper
The helper for i18n translations and catalogsprotected WorkflowHelper
The workflow helperprotected WorkflowLanguageManager
The Workflow Language Managerprotected WorflowRightHelper
The workflow right helperprotected WorkflowSessionHelper
The workflow session helperprotected WorkflowStepDAO
The workflow step DAOstatic final I18nizableText
The default label for actionsstatic final String
The component's role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_manageCommonAction
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, com.opensymphony.workflow.loader.ActionDescriptor action) Verify that the action is still used by multiple steps.protected void
_updateWorkflowCommonAction
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int actionId, com.opensymphony.workflow.loader.ActionDescriptor action) Set action as 'common' in steps using itaddTransitions
(String workflowName, Integer parentStepId, List<Integer> transitionIds) Add an existing transition to current stepcreateTransition
(String workflowName, Integer parentStepId, int transitionId, Map<String, String> labels, int finalStepId) Create a new transitioneditTransition
(String workflowName, Integer stepId, Integer oldId, Integer newId, Map<String, String> labels, Integer finalStepId) Edit the transitioneditTransitionLabel
(String workflowName, Integer stepId, Integer actionId, String newMainLabel) Rename the transitiongetActionIconPath
(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action) Get the action's icon pathgetActionIconPathAsBase64
(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action) Get the action's icon path as base 64 for svg's linksgetActionLabel
(com.opensymphony.workflow.loader.ActionDescriptor action) Get the action label as i18ngetActionLabel
(String workflowName, com.opensymphony.workflow.loader.ActionDescriptor action) Get the translated action labelgetAvailableActions
(String workflowName, Integer parentStepId) Get a set of transitions already defined in current workflow beside initialActionsint
getNumberOfUse
(String workflowName, Integer actionId) Get the number of steps using the actiongetTransitionInfos
(String workflowName, Integer transitionId) Get the transition infos to initialize creation/edition form fieldsremoveTransition
(String workflowName, Integer parentStepId, Integer transitionId) Remove transition from stepvoid
service
(ServiceManager smanager)
-
Field Details
-
ROLE
The component's role -
DEFAULT_ACTION_NAME
The default label for actions -
_workflowSessionHelper
The workflow session helper -
_workflowRightHelper
The workflow right helper -
_workflowLanguageManager
The Workflow Language Manager -
_workflowHelper
The workflow helper -
_workflowStepDAO
The workflow step DAO -
_i18nHelper
The helper for i18n translations and catalogs -
_context
The context
-
-
Constructor Details
-
WorkflowTransitionDAO
public WorkflowTransitionDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getTransitionInfos
Get the transition infos to initialize creation/edition form fields- Parameters:
workflowName
- the current workflow nametransitionId
- the current transition's id, can be null- Returns:
- the transition values and a list of taken ids
-
getAvailableActions
Get a set of transitions already defined in current workflow beside initialActions- Parameters:
workflowName
- the current workflow nameparentStepId
- 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 nameparentStepId
- the parent step idtransitionId
- the id for the transition to createlabels
- the multilinguals labels for the transitionfinalStepId
- 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 nameparentStepId
- the current selected step idtransitionIds
- 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 workflowactionId
- id of current actionaction
- the action
-
editTransitionLabel
public Map<String,Object> editTransitionLabel(String workflowName, Integer stepId, Integer actionId, String newMainLabel) Rename the transition- Parameters:
workflowName
- the workflow namestepId
- id of selected stepactionId
- the transition's idnewMainLabel
- 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 namestepId
- id of selected stepoldId
- the transition's former idnewId
- the transition's new idlabels
- the transition's multilingual labelsfinalStepId
- 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 nameparentStepId
- the parent step id to remove the transition fromtransitionId
- 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 workflowaction
- the action removed
-
getNumberOfUse
Get the number of steps using the action- Parameters:
workflowName
- the current workflow's nameactionId
- 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 nameaction
- 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 workflowaction
- 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 workflowaction
- current action- Returns:
- the icon's path as base 64
-
getActionLabel
Get the action label as i18n- Parameters:
action
- the current action- Returns:
- the label as i18n
-