Package org.ametys.plugins.workflow.dao
Class WorkflowFunctionDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.dao.WorkflowFunctionDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
DAO for workflow element's pre and pos functions
-
Field Summary
Modifier and TypeFieldDescriptionprotected EnhancedFunctionExtensionPoint
Extension point for EnhancedFunctionsprotected ServiceManager
The service managerprotected static ModelItemTypeExtensionPoint
Extension point for workflow arguments data typeprotected WorflowRightHelper
The workflow right helperprotected WorkflowSessionHelper
The workflow session helperprotected WorkflowStepDAO
The workflow step DAOprotected WorkflowTransitionDAO
The workflow transition DAO -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<ElementDefinition>
_getArgumentsAndTypeModelItems
(Set<Pair<String, EnhancedFunction>> enhancedFunctions) Get a list of workflow arguments model items with disable conditions on non related function selectedprotected ElementDefinition<String>
_getFunctionListModelItem
(Set<Pair<String, EnhancedFunction>> enhancedFunctions) Get the model item for the list of functions_getFunctionParamsValuesAsString
(EnhancedFunction enhancedFunction, String functionId, Map<String, Object> params) Get the list of arguments as String, parse multiple argumentsprotected ElementDefinition<String>
_getFunctionTypeModelItem
(String functionId, DisableCondition disableCondition) Get the view item for the fonctions typesprotected List<com.opensymphony.workflow.loader.FunctionDescriptor>
_getTypedFunctions
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Integer stepId, Integer actionId, String functionType) Get the list where belong a function can be either the prefunction list or the postfunctionsprotected boolean
Check if function can have bigger index in its parent's pre/post function listAdd a function to the workflow elementdeleteFunction
(String workflowName, Integer stepId, Integer actionId, String functionType, String id, int indexToRemove) Remove the function from its parenteditFunction
(String workflowName, Integer stepId, Integer actionId, String oldType, Map<String, Object> params, int indexOfFunction) Edit the functiongetActionFunctions
(String workflowName, Integer actionId) Get pre and postfunctions of current actiongetFunctionDescription
(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index) Get the function's descriptiongetFunctionParametersValues
(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index) Get the function's parameters as a json view and their current valuesGet the function's parameters as fields to configure edition form panelgetStepFunctions
(String workflowName, Integer stepId) Get pre and postfunctions of current stepmoveDown
(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex) Swap the function with the one after it in the parent's pre/post function listmoveUp
(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex) Swap the function with the one before it in the parent's pre/post function listvoid
service
(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_workflowArgumentDataTypeExtensionPoint
Extension point for workflow arguments data type -
_workflowSessionHelper
The workflow session helper -
_workflowRightHelper
The workflow right helper -
_workflowStepDAO
The workflow step DAO -
_workflowTransitionDAO
The workflow transition DAO -
_manager
The service manager -
_enhancedFunctionExtensionPoint
Extension point for EnhancedFunctions
-
-
Constructor Details
-
WorkflowFunctionDAO
public WorkflowFunctionDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getFunctionsModel
Get the function's parameters as fields to configure edition form panel- Returns:
- the parameters field as Json readable map
- Throws:
ProcessingException
- exception while saxing view to json
-
_getArgumentsAndTypeModelItems
protected List<ElementDefinition> _getArgumentsAndTypeModelItems(Set<Pair<String, EnhancedFunction>> enhancedFunctions) Get a list of workflow arguments model items with disable conditions on non related function selected- Parameters:
enhancedFunctions
- a list of Pair with id and enhanced function- Returns:
- the list of model items
-
_getFunctionListModelItem
protected ElementDefinition<String> _getFunctionListModelItem(Set<Pair<String, EnhancedFunction>> enhancedFunctions) Get the model item for the list of functions- Parameters:
enhancedFunctions
- the list of enhanced functions- Returns:
- an enum of the functions as a model item
-
_getFunctionTypeModelItem
protected ElementDefinition<String> _getFunctionTypeModelItem(String functionId, DisableCondition disableCondition) Get the view item for the fonctions types- Parameters:
functionId
- id of current functiondisableCondition
- the condition for disabling the field- Returns:
- the view element
-
getFunctionParametersValues
public Map<String,Object> getFunctionParametersValues(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index) Get the function's parameters as a json view and their current values- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nulltype
- whether the function is a pre of post functionid
- the function's idindex
- the function's index in the pre/post function list- Returns:
- map of the function's infos
-
addFunction
public Map<String,Object> addFunction(String workflowName, Integer stepId, Integer actionId, Map<String, Object> params) Add a function to the workflow element- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nullparams
- Map of the function arguments- Returns:
- map of the function's infos
-
_getFunctionParamsValuesAsString
protected Map<String,String> _getFunctionParamsValuesAsString(EnhancedFunction enhancedFunction, String functionId, Map<String, Object> params) Get the list of arguments as String, parse multiple arguments- Parameters:
enhancedFunction
- the current function classfunctionId
- the function's idparams
- List of function arguments with values- Returns:
- the map of arguments formated for condition descriptor
-
_getTypedFunctions
protected List<com.opensymphony.workflow.loader.FunctionDescriptor> _getTypedFunctions(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Integer stepId, Integer actionId, String functionType) Get the list where belong a function can be either the prefunction list or the postfunctions- Parameters:
workflowDescriptor
- the current workflowstepId
- id of current stepactionId
- id of current action can be null if selection is a stepfunctionType
- the type of function- Returns:
- the typed list
-
editFunction
public Map<String,Object> editFunction(String workflowName, Integer stepId, Integer actionId, String oldType, Map<String, Object> params, int indexOfFunction) Edit the function- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nulloldType
- the saved type for this fonctionparams
- Map of the function argumentsindexOfFunction
- the function's index in the pre/post function list- Returns:
- map of the function's infos
-
deleteFunction
public Map<String,Object> deleteFunction(String workflowName, Integer stepId, Integer actionId, String functionType, String id, int indexToRemove) Remove the function from its parent- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nullfunctionType
- whether the function is a pre of post functionid
- the function's idindexToRemove
- the function's index in the pre/post function list- Returns:
- map of the function's infos
-
moveUp
public Map<String,Object> moveUp(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex) Swap the function with the one before it in the parent's pre/post function list- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nullfunctionType
- whether the function is a pre of post functionfunctionIndex
- the function's index in the pre/post function list- Returns:
- map of the function's infos
-
moveDown
public Map<String,Object> moveDown(String workflowName, Integer stepId, Integer actionId, String functionType, int functionIndex) Swap the function with the one after it in the parent's pre/post function list- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nullfunctionType
- whether the function is a pre of post functionfunctionIndex
- the function's index in the pre/post function list- Returns:
- map of the function's infos
-
_isLast
protected boolean _isLast(List<com.opensymphony.workflow.loader.FunctionDescriptor> functions, int functionIndex) Check if function can have bigger index in its parent's pre/post function list- Parameters:
functions
- the current list of functionsfunctionIndex
- the function's index in the pre/post function list- Returns:
- true if the function can move down
-
getStepFunctions
Get pre and postfunctions of current step- Parameters:
workflowName
- the workflow unique namestepId
- id of the current step- Returns:
- a list of the step's functions
-
getActionFunctions
Get pre and postfunctions of current action- Parameters:
workflowName
- the workflow unique nameactionId
- id of the current action- Returns:
- a list of the action's functions
-
getFunctionDescription
public I18nizableText getFunctionDescription(String workflowName, Integer stepId, Integer actionId, String type, String id, Integer index) Get the function's description- Parameters:
workflowName
- the workflow's unique namestepId
- the parent step's idactionId
- the parent action's id can be nulltype
- whether the function is a pre of post functionid
- the enhanced function's idindex
- the function's index in the pre/post function list- Returns:
- the function's description
-