Package org.ametys.plugins.workflow.dao
Class WorkflowsDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.dao.WorkflowsDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class WorkflowsDAO
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable
DAO for managing workflows
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The Cocoon contextprotected Context
The contextprotected CurrentUserProvider
The current user providerprotected I18nHelper
The helper for i18n translations and catalogsprotected I18nUtils
I18n Utilsprotected ObservationManager
The observation managerprotected final String
The regex pattern for workflow namesprotected SourceResolver
The source resolverprotected WorkflowDefinitionExtensionPoint
The Workflow Definition Extension Pointprotected WorkflowHelper
The workflow helperprotected WorkflowLanguageManager
The workflow language managerprotected WorflowRightHelper
The workflow right helperprotected WorkflowSessionHelper
The workflow session helperprotected WorkflowTransitionDAO
The workflow transition DAOstatic final String
Meta to set in new workflowsstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_getWorkflowLabels
(String workflowName) Get multilingual labels for current workflowprotected boolean
_hasEmptyConditionalResult
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Map<String, Object> results, Set<Integer> transitionIds) Check for result without condition or operators without conditionsprotected boolean
_hasEmptyOperator
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Set<Integer> transitionIds, Map<String, Object> results) Check for operators without conditionsprotected boolean
_setErrors
(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Map<String, Object> results) Check for invalid components in workflow, return true if there is anyvoid
contextualize
(Context context) createWorkflow
(Map<String, String> labels, String id) Create a new workflowDuplicate a workflowgetWorkflowInfos
(String workflowName) Get workflow infosgetWorkflowRootProperties
(String workflowName) Get the workflow propertiesGet the list of all workflowsRestore last version of current workflow if existrenameWorkflow
(String workflowName, Map<String, String> labels) Rename the workflowsaveChanges
(String workflowName) Overwrite the current workflow in a XML filevoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
META_NEW_WORKFLOW
Meta to set in new workflows- See Also:
-
_workflowHelper
The workflow helper -
_workflowSessionHelper
The workflow session helper -
_workflowRightHelper
The workflow right helper -
_workflowLanguageManager
The workflow language manager -
_i18nHelper
The helper for i18n translations and catalogs -
_cocoonContext
The Cocoon context -
_i18nUtils
I18n Utils -
_context
The context -
_regexPattern
The regex pattern for workflow names- See Also:
-
_workflowDefinitionEP
The Workflow Definition Extension Point -
_workflowTransitionDAO
The workflow transition DAO -
_observationManager
The observation manager -
_currentUserProvider
The current user provider -
_sourceResolver
The source resolver
-
-
Constructor Details
-
WorkflowsDAO
public WorkflowsDAO()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getWorkflowRootProperties
Get the workflow properties- Parameters:
workflowName
- the name of the workflow to get- Returns:
- the workflow properties
-
getWorkflowsList
Get the list of all workflows- Returns:
- a map with workflow's list as value
-
saveChanges
Overwrite the current workflow in a XML file- Parameters:
workflowName
- id of current workflow- Returns:
- an empty map if all went well, an error message if not
-
reinit
Restore last version of current workflow if exist- Parameters:
workflowName
- name of current workflow- Returns:
- map of result
-
_setErrors
protected boolean _setErrors(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Map<String, Object> results) Check for invalid components in workflow, return true if there is any- Parameters:
workflowDescriptor
- the workflow to checkresults
- a map to fill with error message and invalid component's labels- Returns:
- true if there are errors
-
_hasEmptyConditionalResult
protected boolean _hasEmptyConditionalResult(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Map<String, Object> results, Set<Integer> transitionIds) Check for result without condition or operators without conditions- Parameters:
workflowDescriptor
- the workflow to checkresults
- a map to fill with error message and invalid transition's labelstransitionIds
- a list of all the workflow's transitions ids- Returns:
- true if there are invalid conditional results
-
_hasEmptyOperator
protected boolean _hasEmptyOperator(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor, Set<Integer> transitionIds, Map<String, Object> results) Check for operators without conditions- Parameters:
workflowDescriptor
- the workflow to checktransitionIds
- a list of all the workflow's transitions idsresults
- a map to fill with error message and invalid transition's labels- Returns:
- true if there are operator without conditions
-
_getWorkflowLabels
Get multilingual labels for current workflow- Parameters:
workflowName
- name of current workflow- Returns:
- a map of labels, key is language and value is translation
-
getWorkflowInfos
Get workflow infos- Parameters:
workflowName
- the name of the workflow- Returns:
- a map of the list of workflow names and the workflow's labels
-
createWorkflow
Create a new workflow- Parameters:
labels
- the multilingual labelsid
- the unique name- Returns:
- map of error message or workflow name if creation went well
-
renameWorkflow
Rename the workflow- Parameters:
workflowName
- unique name of current workflowlabels
- the new multilingual labels- Returns:
- the workflow name
-
duplicateWorkflow
public Map<String,Object> duplicateWorkflow(String workflowName, Map<String, String> labels, String duplicateId) Duplicate a workflow- Parameters:
workflowName
- the workflow to duplicate's namelabels
- the new labels for the workflowduplicateId
- the new id for the clone- Returns:
- map of results
-