Package org.ametys.plugins.workflow.dao
Class WorkflowStepDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.dao.WorkflowStepDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
DAO for workflow steps
-
Field Summary
Modifier and TypeFieldDescriptionprotected I18nHelper
The helper for i18n translations and catalogsprotected I18nUtils
I18n Utilsprotected WorkflowConditionDAO
The workflow condition DAOprotected WorkflowHelper
The workflow helperprotected WorkflowLanguageManager
The workflow language managerprotected WorkflowResultDAO
The workflow result DAOprotected WorflowRightHelper
The workflow right helperprotected WorkflowSessionHelper
The workflow session helperprotected WorkflowTransitionDAO
The workflow transition DAOstatic final I18nizableText
The default label for stepsstatic final String
Id for initial stepstatic final String
The component's role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_action2JSON
(String stepId, com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, boolean canWrite) Get the action infos for tree panel nodeprotected Set<org.ametys.plugins.workflow.dao.WorkflowStepDAO.StepWithIcon>
_getActionFinalSteps
(com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the conditional and unconditional results of current actionprotected Set<com.opensymphony.workflow.loader.ActionDescriptor>
_getIncomingActionsFromList
(int stepId, List<com.opensymphony.workflow.loader.ActionDescriptor> actions) Get a set of incoming actions if present in actions list_step2JSON
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId, boolean hasChildren, boolean showId, boolean canWrite) Get step infosCreate a new step and add it to current workflowdeleteStep
(String workflowName, Integer stepId) Delete the step from workflowEdit the stepeditStepLabel
(String workflowName, Integer stepId, String newMainLabel) Edit the step labelgetFinalSteps
(String currentNode, String workflowName, Integer actionId) Get current action's final steps and associated conditionsgetFirstParentStepId
(int stepId, List<com.opensymphony.workflow.loader.StepDescriptor> steps, Integer actionId) Get id of the first step having current action, INITIAL_STEP_ID if current action is an initial actionSet<com.opensymphony.workflow.loader.ActionDescriptor>
getIncomingActions
(int stepId, com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Get a set of actions incoming to current stepSet<com.opensymphony.workflow.loader.StepDescriptor>
getIncomingSteps
(int actionId, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get possible incoming steps for actionList<com.opensymphony.workflow.loader.ActionDescriptor>
getOutgoingActions
(int stepId, com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Get a list of actions outgoing from current stepSet<com.opensymphony.workflow.loader.StepDescriptor>
getOutgoingSteps
(com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get possible outgoing steps for actiongetStatesToJson
(String workflowName, Integer actionId, Boolean isInitialState) Get the workflow's steps available as unconditional result for actionsgetStepIconPath
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step's icon pathgetStepIconPathAsBase64
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step's icon path as base 64 for svg linksgetStepInfos
(String workflowName, Integer stepId) Get the step editable infosgetStepLabel
(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get the step label as new I18nizableTextgetStepLabel
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step i18n labelgetStepLabelAsString
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId, boolean showId) Get the translated step labelgetStepNodes
(String currentNode, String workflowName) Get the workflow editor tree's nodesboolean
Verify that current workflow has stepsvoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component's role -
INITIAL_STEP_ID
Id for initial step- See Also:
-
DEFAULT_STEP_NAME
The default label for steps -
_workflowHelper
The workflow helper -
_i18nHelper
The helper for i18n translations and catalogs -
_workflowSessionHelper
The workflow session helper -
_workflowRightHelper
The workflow right helper -
_workflowConditionDAO
The workflow condition DAO -
_workflowResultDAO
The workflow result DAO -
_workflowTransitionDAO
The workflow transition DAO -
_workflowLanguageManager
The workflow language manager -
_i18nUtils
I18n Utils
-
-
Constructor Details
-
WorkflowStepDAO
public WorkflowStepDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
hasSteps
Verify that current workflow has steps- Parameters:
workflowName
- the workflow's unique name- Returns:
- true if worflow has steps
-
getStepInfos
Get the step editable infos- Parameters:
workflowName
- current workflow's idstepId
- current step's id- Returns:
- a map of step infos and non-available ids
-
createStep
public Map<String,Object> createStep(String workflowName, Integer stepId, Map<String, String> labels) Create a new step and add it to current workflow- Parameters:
workflowName
- current workflow's idstepId
- the new step idlabels
- the new step labels- Returns:
- map of the step infos
-
editStepLabel
Edit the step label- Parameters:
workflowName
- current workflow's idstepId
- the step's idnewMainLabel
- the new label in the current application's language- Returns:
- map of the step infos if edit worked, contain error message else
-
editStep
public Map<String,Object> editStep(String workflowName, Integer oldId, Integer id, Map<String, String> labels) Edit the step- Parameters:
workflowName
- current workflow's idoldId
- the step's last idid
- the step's new idlabels
- the new step labels- Returns:
- map of the step infos if edit worked, contain error message else
-
deleteStep
Delete the step from workflow- Parameters:
workflowName
- current workflow's idstepId
- current step's id- Returns:
- an error message if deleting couldn't proceed
-
getStepLabel
Get the step label as new I18nizableText- Parameters:
stepDescriptor
- the current step- Returns:
- the step label
-
getStepNodes
Get the workflow editor tree's nodes- Parameters:
currentNode
- id of the current nodeworkflowName
- unique name of current workflow- Returns:
- a map of the current node's children
-
_action2JSON
protected Map<String,Object> _action2JSON(String stepId, com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, boolean canWrite) Get the action infos for tree panel node- Parameters:
stepId
- id of current step nodeaction
- currently processed actionworkflowDescriptor
- current workflowcanWrite
- true if current user has edition right on current workflow- Returns:
- map of the action infos
-
_getActionFinalSteps
protected Set<org.ametys.plugins.workflow.dao.WorkflowStepDAO.StepWithIcon> _getActionFinalSteps(com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get the conditional and unconditional results of current action- Parameters:
action
- the current actionworkflowDescriptor
- the current workflow- Returns:
- a list of the final steps as (stepId, stepLabel, StepIconPath)
-
getOutgoingSteps
public Set<com.opensymphony.workflow.loader.StepDescriptor> getOutgoingSteps(com.opensymphony.workflow.loader.ActionDescriptor action, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get possible outgoing steps for action- Parameters:
action
- the current actionworkflowDescriptor
- the current workflow- Returns:
- a set of the outgoing steps
-
getIncomingSteps
public Set<com.opensymphony.workflow.loader.StepDescriptor> getIncomingSteps(int actionId, com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Get possible incoming steps for action- Parameters:
actionId
- the current action's idworkflowDescriptor
- the current workflow- Returns:
- a set of the action's incoming steps
-
getFinalSteps
Get current action's final steps and associated conditions- Parameters:
currentNode
- id of current nodeworkflowName
- unique name of current workflowactionId
- id of current action- Returns:
- a map of current node's children
-
_step2JSON
protected Map<String,Object> _step2JSON(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId, boolean hasChildren, boolean showId, boolean canWrite) Get step infos- Parameters:
workflowDescriptor
- current workflowstepId
- id of current stephasChildren
- true if step has actionsshowId
- true if id needs to be displayed in the labelcanWrite
- true if current user has edition right on current workflow- Returns:
- a map of the step infos
-
getStatesToJson
public Map<String,Object> getStatesToJson(String workflowName, Integer actionId, Boolean isInitialState) Get the workflow's steps available as unconditional result for actions- Parameters:
workflowName
- the current workflow nameactionId
- id of current action if exist, can be nullisInitialState
- true if current selected state is the initial state- Returns:
- a map of the workflow steps
-
getStepLabelAsString
public String getStepLabelAsString(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId, boolean showId) Get the translated step label- Parameters:
workflowDescriptor
- current workflowstepId
- id of current stepshowId
- true if id needs to be displayed in the label- Returns:
- the step label as string
-
getStepIconPath
public String getStepIconPath(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step's icon path- Parameters:
workflowDescriptor
- current worklfowstepId
- id of current step- Returns:
- the icon path
-
getStepIconPathAsBase64
public String getStepIconPathAsBase64(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step's icon path as base 64 for svg links- Parameters:
workflowDescriptor
- current worklfowstepId
- id of current step- Returns:
- the icon path as base 64
-
getStepLabel
public I18nizableText getStepLabel(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, int stepId) Get the step i18n label- Parameters:
workflowDescriptor
- current workflowstepId
- id of current step- Returns:
- the i18n step label
-
getOutgoingActions
public List<com.opensymphony.workflow.loader.ActionDescriptor> getOutgoingActions(int stepId, com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Get a list of actions outgoing from current step- Parameters:
stepId
- id of current stepworkflow
- current workflow- Returns:
- the list of outgoing actions
-
getIncomingActions
public Set<com.opensymphony.workflow.loader.ActionDescriptor> getIncomingActions(int stepId, com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Get a set of actions incoming to current step- Parameters:
stepId
- id of current stepworkflow
- current workflow- Returns:
- the set of outgoing actions
-
_getIncomingActionsFromList
protected Set<com.opensymphony.workflow.loader.ActionDescriptor> _getIncomingActionsFromList(int stepId, List<com.opensymphony.workflow.loader.ActionDescriptor> actions) Get a set of incoming actions if present in actions list- Parameters:
stepId
- id of current stepactions
- list of other step's actions- Returns:
- a list containing other step's outgoing actions that are incoming to current step
-
getFirstParentStepId
public String getFirstParentStepId(int stepId, List<com.opensymphony.workflow.loader.StepDescriptor> steps, Integer actionId) Get id of the first step having current action, INITIAL_STEP_ID if current action is an initial action- Parameters:
stepId
- id of current stepsteps
- list of all the steps in current workflowactionId
- id of current action- Returns:
- the id of the first found step having current action
-