Package org.ametys.plugins.workflow.dao
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 Summary
Modifier and TypeFieldDescriptionprotected static final String
Key for "and" label in treeprotected static final String
Key for "or" label in treeprotected EnhancedConditionExtensionPoint
Extension point for Conditionsprotected ServiceManager
The service managerprotected static ModelItemTypeExtensionPoint
Extension point for workflow arguments data typeprotected WorkflowHelper
The workflow helperprotected WorkflowResultDAO
The workflow result helperprotected WorflowRightHelper
The workflow right helperprotected WorkflowSessionHelper
The workflow session helperprotected WorkflowStepDAO
The workflow step DAOprotected WorkflowTransitionDAO
The workflow transition DAOstatic final String
The "and" type of conditionstatic final String
The "or" type of conditionstatic final String
The component role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<WorkflowArgument>
_getArgumentModelItems
(Set<Pair<String, EnhancedCondition>> conditions) Get a list of workflow arguments model items with disable conditions on non related function selectedprotected com.opensymphony.workflow.loader.ConditionDescriptor
_getCondition
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Integer actionId, String conditionNodeId) Get the current condition as condition descriptorprotected I18nizableText
_getConditionLabel
(com.opensymphony.workflow.loader.ConditionDescriptor condition) Get condition's description or id_getConditionParamsValuesAsString
(Map<String, Object> params) Get the list of arguments as String, parse multiple argumentsprotected List<com.opensymphony.workflow.loader.AbstractDescriptor>
_getConditions
(String currentNode, com.opensymphony.workflow.loader.ActionDescriptor action) Get conditions below current nodeprotected 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 conditionsprotected 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 conditionsprotected List
_removeCondition
(com.opensymphony.workflow.loader.ConditionsDescriptor rootCondition, String conditionNodeId, String[] conditionPath) Remove a conditionprotected void
_removeConditionOperator
(String nodeId, com.opensymphony.workflow.loader.ActionDescriptor action, String[] path) Remove a regular condition operatorprotected void
_removeResultConditionOperator
(String nodeId, com.opensymphony.workflow.loader.ActionDescriptor action, String[] path) Remove a result condition operatoraddCondition
(String workflowName, Integer stepId, Integer actionId, String parentNodeId, Map<String, Object> arguments) Add a new conditionaddOperator
(String workflowName, Integer stepId, Integer actionId, String nodeId, String operatorType, boolean isResultCondition) Add an operatorconditionToJSON
(com.opensymphony.workflow.loader.AbstractDescriptor condition, String currentNodeId, int index, boolean rootIsAND) Get condition or condition types propertiesdeleteCondition
(String workflowName, Integer stepId, Integer actionId, String nodeId) Delete the conditiondeleteOperator
(String workflowName, Integer stepId, Integer actionId, String nodeId) Delete operator from actioneditCondition
(String workflowName, Integer stepId, Integer actionId, String conditionNodeId, Map<String, Object> arguments) Edit the conditiongetConditionLabel
(String workflowName, Integer actionId, String nodeId) Get current condition's labelgetConditionNodes
(String currentNode, String workflowName, Integer actionId) Get the tree's condition nodesgetConditionParametersValues
(String workflowName, Integer actionId, String conditionNodeId) Get current argument's values for conditionGet the condition's model items as fields to configure edition form panelboolean
hasChildConditions
(String workflowName, Integer actionId, String nodeId) Get if current operator has children conditionsvoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role -
AND
The "and" type of condition- See Also:
-
OR
The "or" type of condition- See Also:
-
__ANDI18N
Key for "and" label in tree- See Also:
-
__ORI18N
Key for "or" label in tree- See Also:
-
_workflowArgumentDataTypeExtensionPoint
Extension point for workflow arguments data type -
_workflowSessionHelper
The workflow session helper -
_workflowHelper
The workflow helper -
_workflowRightHelper
The workflow right helper -
_workflowResultDAO
The workflow result helper -
_workflowStepDAO
The workflow step DAO -
_workflowTransitionDAO
The workflow transition DAO -
_enhancedConditionExtensionPoint
Extension point for Conditions -
_manager
The service manager
-
-
Constructor Details
-
WorkflowConditionDAO
public WorkflowConditionDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- 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
protected List<WorkflowArgument> _getArgumentModelItems(Set<Pair<String, EnhancedCondition>> conditions) 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 workflowactionId
- id of current actionconditionNodeId
- 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 workflowactionId
- id of current actionconditionNodeId
- 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.WorkflowExceptionEdit the condition- Parameters:
workflowName
- unique name of current workflowstepId
- id of step parentactionId
- id of current actionconditionNodeId
- id of selected nodearguments
- 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 workflowstepId
- id of step parentactionId
- id of current actionparentNodeId
- id of selected node : can be null if no node is selectedarguments
- 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 workflowstepId
- id of step parentactionId
- id of current actionaction
- the current actionparentNodeId
- 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 workflowstepId
- id of step parentactionId
- id of current actionaction
- the current actionparentNodeId
- 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 workflowstepId
- id of step parentactionId
- id of current actionnodeId
- id of selected nodeoperatorType
- the workflow conditions' type. Can be AND or ORisResultCondition
- 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 workflowstepId
- id of step parentactionId
- id of current actionnodeId
- 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 removeaction
- current actionpath
- 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 removeaction
- current actionpath
- 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 workflowstepId
- id of step parentactionId
- id of current actionnodeId
- 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 operatorconditionNodeId
- id of the current conditionconditionPath
- 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 nodeworkflowName
- unique name of current workflowactionId
- 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 nodeaction
- 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 ConditionDescriptorcurrentNodeId
- the id of the current node in the ConditionTreePanelindex
- index of current condition in node's condition listrootIsAND
- 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
Get current condition's label- Parameters:
workflowName
- unique name of current workflowactionId
- id of current actionnodeId
- id of selected node- Returns:
- the label
-
hasChildConditions
Get if current operator has children conditions- Parameters:
workflowName
- unique name of current workflowactionId
- id of current actionnodeId
- 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
-