public class OSWorkflowManager extends Object implements WorkflowManager
| Constructor and Description |
|---|
OSWorkflowManager(com.opensymphony.workflow.config.Configuration configuration,
DraftWorkflowStore draftWorkflowStore,
com.atlassian.event.api.EventPublisher eventPublisher,
WorkflowsRepository workflowsRepository,
WorkflowCopyNameFactory workflowCopyNameFactory,
JiraAuthenticationContext context,
IssueTextFieldCharacterLengthValidator textFieldCharacterLengthValidator) |
| Modifier and Type | Method and Description |
|---|---|
void |
copyAndDeleteDraftsForInactiveWorkflowsIn(ApplicationUser user,
Iterable<JiraWorkflow> workflows)
Provided a set of workflows, this method will check, if the passed in inactive workflows have any drafts linked
to them.
|
void |
copyAndDeleteDraftWorkflows(ApplicationUser user,
Set<JiraWorkflow> workflows)
Provided a set of workflows, this method will check, if the passed in inactive workflows have any drafts linked
to them.
|
JiraWorkflow |
copyWorkflow(ApplicationUser user,
String clonedWorkflowName,
String clonedWorkflowDescription,
JiraWorkflow workflowToClone)
Clones a workflow by creating a deep copy of the workflow provided.
|
JiraWorkflow |
copyWorkflow(String username,
String clonedWorkflowName,
String clonedWorkflowDescription,
JiraWorkflow workflowToClone)
Clones a workflow by creating a deep copy of the workflow provided.
|
JiraWorkflow |
createDraftWorkflow(ApplicationUser user,
String parentWorkflowName)
This will create an draft workflow of the named active workflow.
|
JiraWorkflow |
createDraftWorkflow(String username,
String parentWorkflowName)
This will create an draft workflow of the named active workflow.
|
org.ofbiz.core.entity.GenericValue |
createIssue(String remoteUserName,
Map<String,Object> fields)
Create an issue in the database.
|
void |
createWorkflow(ApplicationUser user,
JiraWorkflow workflow) |
void |
createWorkflow(String username,
JiraWorkflow workflow) |
boolean |
deleteDraftWorkflow(String parentWorkflowName)
Deletes all draft workflows (there should every be only one) for a given parent workflow.
|
void |
deleteWorkflow(JiraWorkflow workflow) |
void |
doWorkflowAction(WorkflowProgressAware from) |
com.opensymphony.workflow.loader.ActionDescriptor |
getActionDescriptor(Issue issue,
int actionId)
Given an issue and the identifier if a workflow action, returns the ActionDescriptor associated.
|
com.opensymphony.workflow.loader.ActionDescriptor |
getActionDescriptor(WorkflowProgressAware workflowProgressAware) |
Collection<JiraWorkflow> |
getActiveWorkflows()
Retrieve all currently active workflows.
|
protected com.opensymphony.workflow.config.Configuration |
getConfiguration() |
JiraWorkflow |
getDefaultWorkflow() |
JiraWorkflow |
getDraftWorkflow(String parentWorkflowName)
Retrieve a single draft workflow by name.
|
String |
getNextStatusIdForAction(Issue issue,
int actionId)
Given an issue and the identifier of a workflow action, returns the next status object for the issue if the action gets executed.
|
Map<com.opensymphony.workflow.loader.ActionDescriptor,Collection<com.opensymphony.workflow.loader.FunctionDescriptor>> |
getPostFunctionsForWorkflow(JiraWorkflow workflow)
Retrieve a map: actions -> post functions for a workflow.
|
String |
getStepId(long actionDescriptorId,
String workflowName)
Gets the first stepId for the given action and workflow name.
|
com.opensymphony.workflow.spi.WorkflowStore |
getStore()
This is used for unit testing so we can return our own 'mock store' instead of the static
StoreFactory.getPersistence(ctx);
|
JiraWorkflow |
getWorkflow(org.ofbiz.core.entity.GenericValue issue)
Retrieve the workflow for a given issue.
|
JiraWorkflow |
getWorkflow(Issue issue)
Retrieve the workflow for a given issue.
|
JiraWorkflow |
getWorkflow(Long projectId,
String issueTypeId)
Retrieve the workflow for a given project - issue type pair.
|
JiraWorkflow |
getWorkflow(String name)
Retrieve a single workflow by name.
|
JiraWorkflow |
getWorkflowClone(String name)
This method returns a JiraWorkflow, that contains a
WorkflowDescriptor
that is mutable. |
JiraWorkflow |
getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue scheme,
String issueTypeId)
Return the workflow in a particular scheme for a given issue type.
|
JiraWorkflow |
getWorkflowFromScheme(WorkflowScheme scheme,
String issueTypeId)
Return the workflow in a particular scheme for a given issue type.
|
protected String |
getWorkflowName(Long projectId,
String issueType)
This method returns the (unique) name of the workflow which should be used for the provided projectId and
issueType
|
Collection<JiraWorkflow> |
getWorkflows()
Retrieve all of the workflows in the system
|
protected WorkflowSchemeManager |
getWorkflowSchemeManager() |
Collection<JiraWorkflow> |
getWorkflowsFromScheme(org.ofbiz.core.entity.GenericValue scheme)
Returns all workflows for a given scheme.
|
Iterable<JiraWorkflow> |
getWorkflowsFromScheme(Scheme workflowScheme)
Returns all workflows for a given scheme.
|
List<JiraWorkflow> |
getWorkflowsIncludingDrafts()
Retrieve all of the workflows in the system including drafts.
|
boolean |
isActive(JiraWorkflow workflow)
Determine whether or not a given workflow is active in the system.
|
boolean |
isEditable(Issue issue) |
boolean |
isSystemWorkflow(JiraWorkflow workflow)
Determine whether or not a given workflow is a system workflow.
|
com.opensymphony.workflow.Workflow |
makeWorkflow(ApplicationUser user)
Prepares
Workflow object with given user as caller |
com.opensymphony.workflow.Workflow |
makeWorkflow(String userName)
Prepares
Workflow object with given username as caller |
com.opensymphony.workflow.Workflow |
makeWorkflowWithUserKey(String userKey) |
com.opensymphony.workflow.Workflow |
makeWorkflowWithUserName(String userName) |
void |
migrateIssueToWorkflow(org.ofbiz.core.entity.GenericValue issue,
JiraWorkflow newWorkflow,
org.ofbiz.core.entity.GenericValue newStatus)
Migrates given issue to new workflow and sets new status on it.
|
void |
migrateIssueToWorkflow(MutableIssue issue,
JiraWorkflow newWorkflow,
Status status)
Migrates given issue to new workflow and sets new status on it.
|
boolean |
migrateIssueToWorkflowNoReindex(org.ofbiz.core.entity.GenericValue issue,
JiraWorkflow newWorkflow,
org.ofbiz.core.entity.GenericValue newStatus)
Migrates given issue to new workflow and sets new status on it.
|
void |
overwriteActiveWorkflow(ApplicationUser user,
String workflowName)
Saves the draft workflow into the active workflow.
|
void |
overwriteActiveWorkflow(String username,
String workflowName)
Saves the draft workflow into the active workflow.
|
void |
removeWorkflowEntries(org.ofbiz.core.entity.GenericValue issue) |
void |
replaceConditionInTransition(com.opensymphony.workflow.loader.ActionDescriptor transition,
Map<String,String> matchMap,
Map<String,String> newMap)
Changes the parameter map of all conditions that have the parameter map matching matchMap by adding all properties from newMap.
|
void |
saveWorkflowWithoutAudit(JiraWorkflow workflow)
This method will save the workflow and it will not affect the updatedDate and updatedAuthorName meta attributes
of the workflow.
|
protected boolean |
updateIssueStatusAndUpdatedDate(org.ofbiz.core.entity.GenericValue issue,
org.ofbiz.core.entity.GenericValue newStatus) |
void |
updateWorkflow(ApplicationUser user,
JiraWorkflow workflow)
Saves the given JiraWorkflow, which may be either a "live" or "draft" version.
|
void |
updateWorkflow(String username,
JiraWorkflow workflow)
Saves the given JiraWorkflow, which may be either a "live" or "draft" version.
|
void |
updateWorkflowNameAndDescription(ApplicationUser user,
JiraWorkflow currentWorkflow,
String newName,
String newDescription)
Used to change the name and description of an existing worfklow with the given name.
|
void |
updateWorkflowNameAndDescription(String username,
JiraWorkflow currentWorkflow,
String newName,
String newDescription)
Used to change the name and description of an existing worfklow with the given name.
|
boolean |
workflowExists(String name) |
public OSWorkflowManager(com.opensymphony.workflow.config.Configuration configuration,
DraftWorkflowStore draftWorkflowStore,
com.atlassian.event.api.EventPublisher eventPublisher,
WorkflowsRepository workflowsRepository,
WorkflowCopyNameFactory workflowCopyNameFactory,
JiraAuthenticationContext context,
IssueTextFieldCharacterLengthValidator textFieldCharacterLengthValidator)
public Collection<JiraWorkflow> getWorkflows()
getWorkflows in interface WorkflowManagerpublic List<JiraWorkflow> getWorkflowsIncludingDrafts()
WorkflowManagergetWorkflowsIncludingDrafts in interface WorkflowManagerJiraWorkflow objects.protected String getWorkflowName(Long projectId, String issueType)
public Collection<JiraWorkflow> getActiveWorkflows() throws WorkflowException
WorkflowManagergetActiveWorkflows in interface WorkflowManagerWorkflowException - RuntimeException wrapper for any errors.public boolean isActive(JiraWorkflow workflow) throws WorkflowException
WorkflowManagerActive workflows are those currently assigned to schemes and associated with projects - they cannot be edited but can be used.
isActive in interface WorkflowManagerworkflow - the JiraWorkflow to checkWorkflowException - RuntimeException wrapper for any errors.public boolean isSystemWorkflow(JiraWorkflow workflow)
WorkflowManagerCheck for a system or XML based workflow - can not be edited.
isSystemWorkflow in interface WorkflowManagerworkflow - the JiraWorkflow to checkpublic JiraWorkflow getWorkflow(String name)
WorkflowManagerJiraWorkflow contains a
descriptor that by default isn't mutable.
If you need to edit a workflow, please see WorkflowManager.getWorkflowClone(String).
getWorkflow in interface WorkflowManagername - The workflow nameJiraWorkflow that wraps an Immutable WorkflowDescriptor or nullWorkflowManager.getWorkflowClone(String)public JiraWorkflow getWorkflowClone(String name)
WorkflowManagerWorkflowDescriptor
that is mutable. This method should be called, if you require to edit the workflow.
If you only need to view a workflow, please use WorkflowManager.getWorkflow(String) as it will provide better
performance. Cloning a workflow is expensive, as it requires de-constructing and re-constructing the underlying
WorkflowDescriptor from XML.
getWorkflowClone in interface WorkflowManagername - The workflow nameJiraWorkflow or null if it doesn't exist.WorkflowManager.getWorkflow(String)public JiraWorkflow getDraftWorkflow(String parentWorkflowName) throws IllegalArgumentException
WorkflowManagergetDraftWorkflow in interface WorkflowManagerparentWorkflowName - is the name of the Saved workflow which identifies then paritally edited draft workflow
to retrieve.IllegalArgumentException - if no parentWorkflow with the name provided can be found.public JiraWorkflow createDraftWorkflow(String username, String parentWorkflowName)
WorkflowManagerIllegalStateException in
this case.createDraftWorkflow in interface WorkflowManagerusername - identifies the user performing the action so that we can keep an audit trail of who has last
saved the workflow. Empty string for anonymous user. If null an IllegalArgumentException will be thrownparentWorkflowName - identifies the parent workflow that should be used as the template for creating the
draft workflow.JiraWorkflow that represents a copy of the parent that can be edited without
overwriting the active workflow immediately.public JiraWorkflow createDraftWorkflow(ApplicationUser user, String parentWorkflowName)
WorkflowManagerIllegalStateException in
this case.createDraftWorkflow in interface WorkflowManageruser - identifies the user performing the action so that we can keep an audit trail of who has last
saved the workflow. Empty string for anonymous user. If null an IllegalArgumentException will be thrownparentWorkflowName - identifies the parent workflow that should be used as the template for creating the
draft workflow.JiraWorkflow that represents a copy of the parent that can be edited without
overwriting the active workflow immediately.public boolean deleteDraftWorkflow(String parentWorkflowName) throws IllegalArgumentException
WorkflowManagerdeleteDraftWorkflow in interface WorkflowManagerparentWorkflowName - The parentworkflow for which the draft workflow needs to be deleted.IllegalArgumentException - if the parentWorkflowName is nullpublic boolean workflowExists(String name) throws WorkflowException
workflowExists in interface WorkflowManagerWorkflowExceptionpublic JiraWorkflow getWorkflow(Issue issue) throws WorkflowException
WorkflowManagergetWorkflow in interface WorkflowManagerissue - the IssueWorkflowException - RuntimeException wrapper for any errors.public JiraWorkflow getWorkflow(Long projectId, String issueTypeId) throws WorkflowException
WorkflowManagergetWorkflow in interface WorkflowManagerprojectId - the ProjectissueTypeId - the IssueType IDWorkflowException - RuntimeException wrapper for any errors.public JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue scheme, String issueTypeId)
WorkflowManagergetWorkflowFromScheme in interface WorkflowManagerscheme - the SchemeissueTypeId - the IssueType IDpublic JiraWorkflow getWorkflowFromScheme(WorkflowScheme scheme, String issueTypeId)
WorkflowManagergetWorkflowFromScheme in interface WorkflowManagerscheme - the SchemeissueTypeId - the IssueType IDpublic Collection<JiraWorkflow> getWorkflowsFromScheme(org.ofbiz.core.entity.GenericValue scheme) throws WorkflowException
WorkflowManagergetWorkflowsFromScheme in interface WorkflowManagerscheme - the Workflow Scheme.WorkflowException - RuntimeException wrapper for any errors.public Iterable<JiraWorkflow> getWorkflowsFromScheme(Scheme workflowScheme) throws WorkflowException
WorkflowManagergetWorkflowsFromScheme in interface WorkflowManagerworkflowScheme - the Workflow Scheme.WorkflowException - RuntimeException wrapper for any errors.public void copyAndDeleteDraftWorkflows(ApplicationUser user, Set<JiraWorkflow> workflows)
WorkflowManagercopyAndDeleteDraftWorkflows in interface WorkflowManageruser - The user performing the operationworkflows - A set of parent JiraWorkflowspublic void copyAndDeleteDraftsForInactiveWorkflowsIn(ApplicationUser user, Iterable<JiraWorkflow> workflows)
WorkflowManagerThis method is only meant to be used internally in JIRA. External developers should not call this method directly.
copyAndDeleteDraftsForInactiveWorkflowsIn in interface WorkflowManageruser - The user performing the operationworkflows - A set of parent JiraWorkflows@Nonnull public String getNextStatusIdForAction(@Nonnull Issue issue, int actionId)
WorkflowManagergetNextStatusIdForAction in interface WorkflowManagerissue - The issueactionId - The identifier of a workflow action@Nonnull public com.opensymphony.workflow.loader.ActionDescriptor getActionDescriptor(@Nonnull Issue issue, int actionId)
WorkflowManagergetActionDescriptor in interface WorkflowManagerissue - The issue.actionId - The identifier of a workflow action.public void createWorkflow(String username, JiraWorkflow workflow) throws WorkflowException
createWorkflow in interface WorkflowManagerWorkflowExceptionpublic void createWorkflow(ApplicationUser user, JiraWorkflow workflow) throws WorkflowException
createWorkflow in interface WorkflowManagerWorkflowExceptionpublic void saveWorkflowWithoutAudit(JiraWorkflow workflow) throws WorkflowException
WorkflowManagerWorkflowManager.updateWorkflow(String, JiraWorkflow)saveWorkflowWithoutAudit in interface WorkflowManagerworkflow - the workflow to save.WorkflowException - RuntimeException wrapper for any errors.protected WorkflowSchemeManager getWorkflowSchemeManager()
public void deleteWorkflow(JiraWorkflow workflow) throws WorkflowException
deleteWorkflow in interface WorkflowManagerWorkflowExceptionpublic JiraWorkflow getWorkflow(org.ofbiz.core.entity.GenericValue issue) throws WorkflowException
WorkflowManagergetWorkflow in interface WorkflowManagerissue - the IssueWorkflowException - RuntimeException wrapper for any errors.public void migrateIssueToWorkflow(org.ofbiz.core.entity.GenericValue issue,
JiraWorkflow newWorkflow,
org.ofbiz.core.entity.GenericValue newStatus)
throws WorkflowException
WorkflowManagermigrateIssueToWorkflow in interface WorkflowManagerissue - issue to migratenewWorkflow - new workflownewStatus - new statusWorkflowException - if migration failspublic boolean migrateIssueToWorkflowNoReindex(org.ofbiz.core.entity.GenericValue issue,
JiraWorkflow newWorkflow,
org.ofbiz.core.entity.GenericValue newStatus)
throws WorkflowException
WorkflowManagermigrateIssueToWorkflowNoReindex in interface WorkflowManagerissue - issue to migratenewWorkflow - new workflownewStatus - new statusWorkflowException - if migration failspublic void overwriteActiveWorkflow(String username, String workflowName)
WorkflowManageroverwriteActiveWorkflow in interface WorkflowManagerusername - User will be added to the workflows Audit trailworkflowName - The workflow to be overwrittenpublic void overwriteActiveWorkflow(ApplicationUser user, String workflowName)
WorkflowManageroverwriteActiveWorkflow in interface WorkflowManageruser - User will be added to the workflows Audit trailworkflowName - The workflow to be overwrittenprotected boolean updateIssueStatusAndUpdatedDate(org.ofbiz.core.entity.GenericValue issue,
org.ofbiz.core.entity.GenericValue newStatus)
public void updateWorkflow(String username, JiraWorkflow workflow)
WorkflowManagerWorkflowManager.overwriteActiveWorkflow(String, String)updateWorkflow in interface WorkflowManagerusername - User making the request.workflow - The JiraWorkflow to save.public void updateWorkflow(ApplicationUser user, JiraWorkflow workflow)
WorkflowManagerWorkflowManager.overwriteActiveWorkflow(ApplicationUser, String)updateWorkflow in interface WorkflowManageruser - User making the request.workflow - The JiraWorkflow to save.public JiraWorkflow copyWorkflow(String username, String clonedWorkflowName, String clonedWorkflowDescription, JiraWorkflow workflowToClone)
WorkflowManagercopyWorkflow in interface WorkflowManagerusername - The user performing the operationclonedWorkflowName - The name to store the new workflow with.clonedWorkflowDescription - The description to store with the cloned workflow. Can be null.workflowToClone - The workflow to copy.public JiraWorkflow copyWorkflow(ApplicationUser user, String clonedWorkflowName, String clonedWorkflowDescription, JiraWorkflow workflowToClone)
WorkflowManagercopyWorkflow in interface WorkflowManageruser - The user performing the operationclonedWorkflowName - The name to store the new workflow with.clonedWorkflowDescription - The description to store with the cloned workflow. Can be null.workflowToClone - The workflow to copy.public void updateWorkflowNameAndDescription(String username, JiraWorkflow currentWorkflow, String newName, String newDescription)
WorkflowManagerupdateWorkflowNameAndDescription in interface WorkflowManagerusername - The user performing the operationcurrentWorkflow - The workflow to update.newName - The new name to save with the workflownewDescription - The new description to save with the workflowpublic void updateWorkflowNameAndDescription(ApplicationUser user, JiraWorkflow currentWorkflow, String newName, String newDescription)
WorkflowManagerupdateWorkflowNameAndDescription in interface WorkflowManageruser - The user performing the operationcurrentWorkflow - The workflow to update.newName - The new name to save with the workflownewDescription - The new description to save with the workflowpublic JiraWorkflow getDefaultWorkflow() throws WorkflowException
getDefaultWorkflow in interface WorkflowManagerWorkflowExceptionpublic org.ofbiz.core.entity.GenericValue createIssue(String remoteUserName, Map<String,Object> fields) throws WorkflowException
WorkflowManagercreateIssue in interface WorkflowManagerremoteUserName - Issue creatorfields - Map of fields. The key is the name of the field, and the type of the value depends on the key. Must
include a key "issue", which contains MutableIssue object (holding values, not
yet persisted to disk). May include other fields (eg "pkey"->String key of project, "originalissueobject"->Issue
object) passed onto the workflow engine.WorkflowException - If any errors occur while trying to create the issue.public void removeWorkflowEntries(org.ofbiz.core.entity.GenericValue issue)
removeWorkflowEntries in interface WorkflowManagerpublic void doWorkflowAction(WorkflowProgressAware from)
doWorkflowAction in interface WorkflowManagerpublic com.opensymphony.workflow.spi.WorkflowStore getStore()
throws com.opensymphony.workflow.StoreException
Also used in the migrateIssueToWorkflow method.
getStore in interface WorkflowManagercom.opensymphony.workflow.StoreExceptionpublic com.opensymphony.workflow.loader.ActionDescriptor getActionDescriptor(WorkflowProgressAware workflowProgressAware) throws Exception
getActionDescriptor in interface WorkflowManagerExceptionpublic void migrateIssueToWorkflow(MutableIssue issue, JiraWorkflow newWorkflow, Status status) throws WorkflowException
migrateIssueToWorkflow in interface WorkflowManagerissue - issue to migratenewWorkflow - new workflowstatus - new statusWorkflowException - if migration failspublic com.opensymphony.workflow.Workflow makeWorkflow(String userName)
WorkflowManagerWorkflow object with given username as callermakeWorkflow in interface WorkflowManageruserName - caller usernameWorkflowpublic com.opensymphony.workflow.Workflow makeWorkflowWithUserName(String userName)
makeWorkflowWithUserName in interface WorkflowManagerpublic com.opensymphony.workflow.Workflow makeWorkflowWithUserKey(String userKey)
makeWorkflowWithUserKey in interface WorkflowManagerpublic com.opensymphony.workflow.Workflow makeWorkflow(ApplicationUser user)
WorkflowManagerWorkflow object with given user as callermakeWorkflow in interface WorkflowManageruser - callerWorkflowpublic boolean isEditable(Issue issue)
isEditable in interface WorkflowManagerprotected com.opensymphony.workflow.config.Configuration getConfiguration()
public Map<com.opensymphony.workflow.loader.ActionDescriptor,Collection<com.opensymphony.workflow.loader.FunctionDescriptor>> getPostFunctionsForWorkflow(JiraWorkflow workflow)
WorkflowManagergetPostFunctionsForWorkflow in interface WorkflowManagerworkflow - The Workflowpublic String getStepId(long actionDescriptorId, String workflowName)
WorkflowManagergetStepId in interface WorkflowManageractionDescriptorId - id of the ActionDescriptorworkflowName - name of the JiraWorkflowpublic void replaceConditionInTransition(com.opensymphony.workflow.loader.ActionDescriptor transition,
Map<String,String> matchMap,
Map<String,String> newMap)
WorkflowManagerreplaceConditionInTransition in interface WorkflowManagertransition - transition to change the conditions inmatchMap - the map used to determine if the condition should be modifiednewMap - a map of properties to be added to the parameter mapCopyright © 2002-2019 Atlassian. All Rights Reserved.