Package org.ametys.plugins.bpm
Class BPMWorkflowManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.bpm.BPMWorkflowManager
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Initializable
,Component
,Contextualizable
,Serviceable
public class BPMWorkflowManager
extends AbstractLogEnabled
implements Component, Serviceable, Initializable, Contextualizable, PluginAware
Manager for retrieving, creation, edition and suppression of workflows, and retrieving information on workflows definitions
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The plugin root node namestatic final String
The processes node name under each workflowstatic final String
The BPM Workflows node namestatic final String
Tag for the create process pagestatic final String
Tag for the process dashboard pagestatic final String
Right to create a new workflowstatic final String
Right to delete any workflowstatic final String
Right to edit any workflowstatic final String
Right to manage processesstatic final String
Avalon Rolestatic final int
The fixed id for the edit workflow action on processus -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ModifiableTraversableAmetysObject
_getProcessesRootNode
(JCRWorkflow workflow, boolean create) Gets the root of processes of a workflow_getWorkflowDefinitionData
(String workflowDefId) Get the list of variables and their properties for a workflow definitionprotected ModifiableTraversableAmetysObject
_getWorkflowsRootNode
(boolean create) Gets the root of contentsaddWorkflow
(Map<String, Object> values) Add a new workflowboolean
canDelete
(JCRWorkflowProcess process) Determines if the process can be deleted by the current uservoid
contextualize
(Context context) createProcess
(String workflowId, String title, String site, String description, List<PartOnDisk> uploadedAttachments) Create a new processvoid
deleteProcess
(JCRWorkflowProcess process) Delete a processdeleteProcesses
(List<String> processes) Delete a list of processesdeleteWorkflow
(List<String> workflowIds) Delete a list of workflowvoid
editProcess
(String processId, String title, String description, List<PartOnDisk> uploadedAttachments, List<String> attachmentsUntouched) Edit a processeditWorkflow
(String workflowId, Map<String, Object> values) Edit a workflow valuesgetCreateProcessPage
(String siteName, String lang) Get the page with CREATE_PROCESS taggetDashboardPage
(String siteName, String lang) Get the page with PROCESS_DASHBOARD taggetProcess
(String workflowName, String processName) Retrieve a processgetProcessPageUrl
(JCRWorkflowProcess process, String siteName, String lang, boolean absolute) Get the url of a process pagegetTemplateForProcessPage
(String siteName, String lang) Get the template to use for process renderingGet the list of processes accessibles to the current usergetWorkflowData
(String workflowId) Retrieve the data of a workflow, in JSON format.Get the list of workflow definitionsgetWorkflowDefinitionVariables
(String workflowDefId) Retrieve the list of variables from a workflow definitiongetWorkflowProcesses
(String workflowId) Retrieve the list of process created from a workflowgetWorkflowProcessus
(JCRWorkflow workflow) Retrieve the list of process created from a workflowRetrieve the list of workflowsRetrieve the list of workflows availables to the current user, in JSON formatgetWorkflowVariable
(String workflowId, String variableName) Retrieve the value of a variable from a workflowvoid
boolean
isComplete
(JCRWorkflowProcess process) Determines if the process is completeboolean
isUserAllowedOnWorkflow
(JCRWorkflow workflow) Check if the current user is allowed to create a process from the workflowboolean
isUserInWorkflowVariables
(JCRWorkflow workflow) Test if the current user is present in any variable of the workflowvoid
service
(ServiceManager manager) void
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
RIGHT_WORKFLOW_CREATE
Right to create a new workflow- See Also:
-
RIGHT_WORKFLOW_EDIT
Right to edit any workflow- See Also:
-
RIGHT_WORKFLOW_DELETE
Right to delete any workflow- See Also:
-
RIGHTS_PROCESS_MANAGE_PROCESSES
Right to manage processes- See Also:
-
PAGE_TAG_CREATEPROCESS
Tag for the create process page- See Also:
-
PAGE_TAG_PROCESS_DASHBOARD
Tag for the process dashboard page- See Also:
-
WORKFLOW_ACTION_EDIT
The fixed id for the edit workflow action on processus- See Also:
-
BPM_ROOT_NODE
The plugin root node name- See Also:
-
BPMWORKFLOW_ROOT_NODE
The BPM Workflows node name- See Also:
-
BPMPROCESSES_ROOT_NODE
The processes node name under each workflow- See Also:
-
-
Constructor Details
-
BPMWorkflowManager
public BPMWorkflowManager()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
getWorkflowDefinitions
Get the list of workflow definitions- Returns:
- The list of workflow definitions, mapped by name and label
-
getWorkflowVariable
Retrieve the value of a variable from a workflow- Parameters:
workflowId
- The workflow idvariableName
- The variable name- Returns:
- The value
-
getWorkflowDefinitionVariables
Retrieve the list of variables from a workflow definition- Parameters:
workflowDefId
- The workflow definition id- Returns:
- The list of variables, with their attributes such as the label, type, multiple, if defined
-
getWorkflows
Retrieve the list of workflows- Returns:
- The list of workflows
-
getWorkflowsAvailables
Retrieve the list of workflows availables to the current user, in JSON format- Returns:
- The list of workflows
-
getWorkflowData
Retrieve the data of a workflow, in JSON format. Contains both the values of the workflow, and the workflow variables definitions- Parameters:
workflowId
- The workflow id- Returns:
- The data of a workflow
-
addWorkflow
Add a new workflow- Parameters:
values
- The values for the new workflow. Must contains a "name", "workflowDef" and any variables mandatory for the workflowDef- Returns:
- The result, with the new workflow id if successful
- Throws:
IllegalAccessException
- If a user with insufficient rights try to execute this method
-
editWorkflow
public Map<String,Object> editWorkflow(String workflowId, Map<String, Object> values) throws IllegalAccessExceptionEdit a workflow values- Parameters:
workflowId
- The workflowvalues
- The values- Returns:
- The result, with the workflow id if successful
- Throws:
IllegalAccessException
- If a user with insufficient rights try to execute this method
-
deleteWorkflow
Delete a list of workflow- Parameters:
workflowIds
- The workflows- Returns:
- The result
-
getWorkflowProcesses
Retrieve the list of process created from a workflow- Parameters:
workflowId
- The workflow- Returns:
- The list of process
-
getWorkflowProcessus
Retrieve the list of process created from a workflow- Parameters:
workflow
- The workflow- Returns:
- The list of process
-
createProcess
public JCRWorkflowProcess createProcess(String workflowId, String title, String site, String description, List<PartOnDisk> uploadedAttachments) throws com.opensymphony.workflow.WorkflowException, IllegalAccessException Create a new process- Parameters:
workflowId
- The workflow used by the processtitle
- The process titlesite
- The site on which the process was createddescription
- The process descriptionuploadedAttachments
- The process attachments- Returns:
- The new process
- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred creating the workflowIllegalAccessException
- If the user is not allowed
-
editProcess
public void editProcess(String processId, String title, String description, List<PartOnDisk> uploadedAttachments, List<String> attachmentsUntouched) throws com.opensymphony.workflow.WorkflowException Edit a process- Parameters:
processId
- The process idtitle
- The titledescription
- The descriptionuploadedAttachments
- The list of new attachments uploadedattachmentsUntouched
- The list of untouched attachments names- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred while executing the workflow action
-
getProcess
Retrieve a process- Parameters:
workflowName
- The workflow nameprocessName
- The process name- Returns:
- The process
-
isComplete
Determines if the process is complete- Parameters:
process
- The process- Returns:
- True if the process is complete
-
canDelete
Determines if the process can be deleted by the current user- Parameters:
process
- The process- Returns:
- True if the process can be deleted
-
deleteProcess
Delete a process- Parameters:
process
- The process to delete- Throws:
IllegalAccessException
- If a user tries to delete a process without being allowed
-
deleteProcesses
Delete a list of processes- Parameters:
processes
- The processes to delete- Returns:
- The result
- Throws:
IllegalAccessException
- If a user tries to delete a process without being allowed
-
getProcessPageUrl
public String getProcessPageUrl(JCRWorkflowProcess process, String siteName, String lang, boolean absolute) Get the url of a process page- Parameters:
process
- The processsiteName
- The current site name. Can not be null.lang
- The current language. Can not be null.absolute
- true to get absolute url.- Returns:
- the url of process page
-
getDashboardPage
Get the page with PROCESS_DASHBOARD tag- Parameters:
siteName
- The current site namelang
- The language- Returns:
- The page or null if not found.
-
getCreateProcessPage
Get the page with CREATE_PROCESS tag- Parameters:
siteName
- The current site namelang
- The language- Returns:
- The page or null if not found.
-
getTemplateForProcessPage
Get the template to use for process rendering- Parameters:
siteName
- The site containing the pagelang
- The sitemap of the page- Returns:
- The template to use for process rendering
-
isUserInWorkflowVariables
Test if the current user is present in any variable of the workflow- Parameters:
workflow
- The workflow- Returns:
- True if the user is in the workflow variables
-
getUserProcesses
Get the list of processes accessibles to the current user- Returns:
- The list of processes
-
isUserAllowedOnWorkflow
Check if the current user is allowed to create a process from the workflow- Parameters:
workflow
- The workflow- Returns:
- True if the user is allowed
-
_getWorkflowsRootNode
Gets the root of contents- Parameters:
create
-true
to create automatically the root when missing.- Returns:
- the root of workflows
- Throws:
UnknownAmetysObjectException
- If root node does not exist
-
_getProcessesRootNode
protected ModifiableTraversableAmetysObject _getProcessesRootNode(JCRWorkflow workflow, boolean create) Gets the root of processes of a workflow- Parameters:
workflow
- The workflowcreate
-true
to create automatically the root when missing.- Returns:
- the root of processes
- Throws:
UnknownAmetysObjectException
- If root node does not exist
-
_getWorkflowDefinitionData
Get the list of variables and their properties for a workflow definition- Parameters:
workflowDefId
- The workflow definition id- Returns:
- The list of variables properties, mapped by variable id
-