com.atlassian.jira.workflow
Interface WorkflowManager

All Known Implementing Classes:
OSWorkflowManager, SimpleWorkflowManager

public interface WorkflowManager

The WorkflowManager is used to interface with the workflow implementation


Method Summary
 void copyAndDeleteDraftWorkflows(com.opensymphony.user.User user, java.util.Set<JiraWorkflow> workflows)
          Provided a set of workflows, this method will check, if the passed in workflows have any draft workflows linked to them.
 JiraWorkflow copyWorkflow(java.lang.String username, java.lang.String clonedWorkflowName, java.lang.String clonedWorkflowDescription, JiraWorkflow workflowToClone)
          Clones a workflow by creating a deep copy of the workflow provided.
 JiraWorkflow createDraftWorkflow(java.lang.String username, java.lang.String parentWorkflowName)
          This will create an draft workflow of the named active workflow.
 org.ofbiz.core.entity.GenericValue createIssue(java.lang.String remoteUserName, java.util.Map<java.lang.String,java.lang.Object> fields)
          Create an issue in the database.
 void createWorkflow(java.lang.String username, JiraWorkflow workflow)
           
 void createWorkflow(com.opensymphony.user.User user, JiraWorkflow workflow)
           
 boolean deleteDraftWorkflow(java.lang.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(WorkflowProgressAware workflowProgressAware)
           
 java.util.Collection<JiraWorkflow> getActiveWorkflows()
          Retrieve all currently active workflows.
 JiraWorkflow getDefaultWorkflow()
           
 JiraWorkflow getDraftWorkflow(java.lang.String parentWorkflowName)
          Retrieve a single draft workflow by name.
 java.util.Map<com.opensymphony.workflow.loader.ActionDescriptor,java.util.Collection<com.opensymphony.workflow.loader.FunctionDescriptor>> getPostFunctionsForWorkflow(JiraWorkflow workflow)
          Retrieve a map: actions -> post functions for a workflow.
 com.opensymphony.user.User getRemoteUser(java.util.Map transientVars)
           
 java.lang.String getStepId(long actionDescriptorId, java.lang.String workflowName)
          Gets the first stepId for the given action and workflow name.
 com.opensymphony.workflow.spi.WorkflowStore getStore()
           
 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(java.lang.Long projectId, java.lang.String issueTypeId)
          Retrieve the workflow for a given project - issue type pair.
 JiraWorkflow getWorkflow(java.lang.String name)
          Retrieve a single workflow by name.
 JiraWorkflow getWorkflowClone(java.lang.String name)
          This method returns a JiraWorkflow, that contains a WorkflowDescriptor that is mutable.
 JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue scheme, java.lang.String issueTypeId)
          Return the workflow in a particular scheme for a given issue type.
 java.util.Collection<JiraWorkflow> getWorkflows()
          Retrieve all of the workflows in the system
 java.util.Collection<JiraWorkflow> getWorkflowsFromScheme(org.ofbiz.core.entity.GenericValue workflowScheme)
          Returns all workflows for a given scheme
 java.util.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(java.lang.String userName)
           
 void migrateIssueToWorkflow(org.ofbiz.core.entity.GenericValue issue, JiraWorkflow newWorkflow, org.ofbiz.core.entity.GenericValue status)
          Deprecated. Please use migrateIssueToWorkflow(com.atlassian.jira.issue.MutableIssue,JiraWorkflow,com.atlassian.jira.issue.status.Status). Since: 3.9.
 void migrateIssueToWorkflow(MutableIssue issue, JiraWorkflow newWorkflow, Status status)
          Migrates given issue to new workflow and sets new status on it.
 void overwriteActiveWorkflow(java.lang.String username, java.lang.String workflowName)
          Saves the draft workflow into the active workflow.
 void removeWorkflowEntries(org.ofbiz.core.entity.GenericValue issue)
           
 void saveWorkflowWithoutAudit(JiraWorkflow workflow)
          This method will save the workflow and it will not affect the updatedDate and updatedAuthorName meta attributes of the workflow.
 void updateWorkflow(java.lang.String username, JiraWorkflow workflow)
          Saves the given JiraWorkflow, which may be either a "live" or "draft" version.
 void updateWorkflowNameAndDescription(java.lang.String username, JiraWorkflow currentWorkflow, java.lang.String newName, java.lang.String newDescription)
          Used to change the name and description of an existing worfklow with the given name.
 boolean workflowExists(java.lang.String name)
           
 

Method Detail

getWorkflows

java.util.Collection<JiraWorkflow> getWorkflows()
Retrieve all of the workflows in the system

Returns:
A Collection of JiraWorkflow objects.

getWorkflowsIncludingDrafts

java.util.List<JiraWorkflow> getWorkflowsIncludingDrafts()
Retrieve all of the workflows in the system including drafts. We return a list as we want to keep workflows and associated drafts are adjacent.

Returns:
A List of JiraWorkflow objects.

isActive

boolean isActive(JiraWorkflow workflow)
                 throws WorkflowException
Determine whether or not a given workflow is active in the system.

Active workflows are those currently assigned to schemes and associated with projects - they cannot be edited but can be used.

Parameters:
workflow - the JiraWorkflow to check
Returns:
true if the given workflow is active
Throws:
WorkflowException - RuntimeException wrapper for any errors.

isSystemWorkflow

boolean isSystemWorkflow(JiraWorkflow workflow)
                         throws WorkflowException
Determine whether or not a given workflow is a system workflow.

Check for a system or XML based workflow - can not be edited.

Parameters:
workflow - the JiraWorkflow to check
Returns:
true if the given workflow is a system workflow
Throws:
WorkflowException - maybe - but it doesn't look like it?

getActiveWorkflows

java.util.Collection<JiraWorkflow> getActiveWorkflows()
                                                      throws WorkflowException
Retrieve all currently active workflows.

Returns:
Collection of JiraWorkflow objects.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getWorkflow

JiraWorkflow getWorkflow(java.lang.String name)
Retrieve a single workflow by name. The returned JiraWorkflow contains a descriptor that by default isn't mutable (see ImmutableWorkflowDescriptor

If you need to edit a workflow, please see getWorkflowClone(String).

Parameters:
name - The workflow name
Returns:
A JiraWorkflow that wraps an ImmutableWorkflowDescriptor or null
See Also:
getWorkflowClone(String)

getWorkflowClone

JiraWorkflow getWorkflowClone(java.lang.String name)
This method returns a JiraWorkflow, that contains a WorkflowDescriptor 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 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.

Parameters:
name - The workflow name
Returns:
A JiraWorkflow or null if it doesn't exist.
See Also:
getWorkflow(String)

getDraftWorkflow

JiraWorkflow getDraftWorkflow(java.lang.String parentWorkflowName)
                              throws java.lang.IllegalArgumentException
Retrieve a single draft workflow by name. If there is not an draft workflow associated with the name this will return null.

Parameters:
parentWorkflowName - is the name of the Saved workflow which identifies then paritally edited draft workflow to retrieve.
Returns:
a JiraWorkflow that represents an draft edited workflow. This is an instance of JiraDraftWorkflow.
Throws:
java.lang.IllegalArgumentException - if no parentWorkflow with the name provided can be found.
Since:
v3.13

createDraftWorkflow

JiraWorkflow createDraftWorkflow(java.lang.String username,
                                 java.lang.String parentWorkflowName)
                                 throws java.lang.IllegalStateException,
                                        java.lang.IllegalArgumentException
This will create an draft workflow of the named active workflow. This draft workflow can be used to edit active workflows without overwriting the active workflow immediately.
This method will not allow you to create an draft workflow if the parent workflow is not active, the method will throw an IllegalStateException in this case.

Parameters:
parentWorkflowName - identifies the parent workflow that should be used as the template for creating the draft workflow.
username - 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 thrown
Returns:
An instance of JiraDraftWorkflow that represents a copy of the parent that can be edited without overwriting the active workflow immediately.
Throws:
java.lang.IllegalStateException - thrown if the parentWorkflow is not Active or the draft already exists
java.lang.IllegalArgumentException - If the username is null
Since:
v3.13

deleteDraftWorkflow

boolean deleteDraftWorkflow(java.lang.String parentWorkflowName)
                            throws java.lang.IllegalArgumentException
Deletes all draft workflows (there should every be only one) for a given parent workflow.

Parameters:
parentWorkflowName - The parentworkflow for which the draft workflow needs to be deleted.
Returns:
true if a draft workflow as deleted, false otherwise.
Throws:
java.lang.IllegalArgumentException - if the parentWorkflowName is null
Since:
v3.13

getWorkflow

JiraWorkflow getWorkflow(org.ofbiz.core.entity.GenericValue issue)
                         throws WorkflowException
Retrieve the workflow for a given issue.

Parameters:
issue - the Issue
Returns:
the workflow for the given issue.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getWorkflow

JiraWorkflow getWorkflow(Issue issue)
                         throws WorkflowException
Retrieve the workflow for a given issue.

Parameters:
issue - the Issue
Returns:
the workflow for the given issue.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getWorkflow

JiraWorkflow getWorkflow(java.lang.Long projectId,
                         java.lang.String issueTypeId)
                         throws WorkflowException
Retrieve the workflow for a given project - issue type pair.

Parameters:
projectId - the Project
issueTypeId - the IssueType ID
Returns:
the workflow for the given project - issue type pair.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getWorkflowFromScheme

JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue scheme,
                                   java.lang.String issueTypeId)
                                   throws WorkflowException
Return the workflow in a particular scheme for a given issue type.

Parameters:
scheme - the Scheme
issueTypeId - the IssueType ID
Returns:
the workflow for the issue type in the scheme.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getWorkflowsFromScheme

java.util.Collection<JiraWorkflow> getWorkflowsFromScheme(org.ofbiz.core.entity.GenericValue workflowScheme)
                                                          throws WorkflowException
Returns all workflows for a given scheme

Parameters:
workflowScheme - the Workflow Scheme
Returns:
Collection of workflow schemes, empty collection if none exists
Throws:
WorkflowException - RuntimeException wrapper for any errors.

getDefaultWorkflow

JiraWorkflow getDefaultWorkflow()
                                throws WorkflowException
Throws:
WorkflowException

createIssue

org.ofbiz.core.entity.GenericValue createIssue(java.lang.String remoteUserName,
                                               java.util.Map<java.lang.String,java.lang.Object> fields)
                                               throws WorkflowException
Create an issue in the database.

Parameters:
remoteUserName - Issue creator
fields - 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.
Returns:
The created issue GenericValue
Throws:
WorkflowException - If any errors occur while trying to create the issue.

removeWorkflowEntries

void removeWorkflowEntries(org.ofbiz.core.entity.GenericValue issue)
                           throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

doWorkflowAction

void doWorkflowAction(WorkflowProgressAware from)

getRemoteUser

com.opensymphony.user.User getRemoteUser(java.util.Map transientVars)
                                         throws com.opensymphony.user.EntityNotFoundException
Throws:
com.opensymphony.user.EntityNotFoundException

getStore

com.opensymphony.workflow.spi.WorkflowStore getStore()
                                                     throws com.opensymphony.workflow.StoreException
Throws:
com.opensymphony.workflow.StoreException

createWorkflow

void createWorkflow(java.lang.String username,
                    JiraWorkflow workflow)
                    throws WorkflowException
Throws:
WorkflowException

createWorkflow

void createWorkflow(com.opensymphony.user.User user,
                    JiraWorkflow workflow)
                    throws WorkflowException
Throws:
WorkflowException

saveWorkflowWithoutAudit

void saveWorkflowWithoutAudit(JiraWorkflow workflow)
                              throws WorkflowException
This method will save the workflow and it will not affect the updatedDate and updatedAuthorName meta attributes of the workflow. This should only ever be invoked by system operations such as upgrade tasks. All other saves should use the method updateWorkflow(String, JiraWorkflow)

Parameters:
workflow - the workflow to save.
Throws:
WorkflowException - RuntimeException wrapper for any errors.

deleteWorkflow

void deleteWorkflow(JiraWorkflow workflow)
                    throws WorkflowException
Throws:
WorkflowException

getActionDescriptor

com.opensymphony.workflow.loader.ActionDescriptor getActionDescriptor(WorkflowProgressAware workflowProgressAware)
                                                                      throws java.lang.Exception
Throws:
java.lang.Exception

migrateIssueToWorkflow

void migrateIssueToWorkflow(MutableIssue issue,
                            JiraWorkflow newWorkflow,
                            Status status)
                            throws WorkflowException
Migrates given issue to new workflow and sets new status on it.

Parameters:
issue - issue to migrate
newWorkflow - new workflow
status - new status
Throws:
WorkflowException - if migration fails

migrateIssueToWorkflow

void migrateIssueToWorkflow(org.ofbiz.core.entity.GenericValue issue,
                            JiraWorkflow newWorkflow,
                            org.ofbiz.core.entity.GenericValue status)
                            throws WorkflowException
Deprecated. Please use migrateIssueToWorkflow(com.atlassian.jira.issue.MutableIssue,JiraWorkflow,com.atlassian.jira.issue.status.Status). Since: 3.9.

Migrates given issue to new workflow and sets new status on it.

Parameters:
issue - issue to migrate
newWorkflow - new workflow
status - new status
Throws:
WorkflowException - if migration fails

makeWorkflow

com.opensymphony.workflow.Workflow makeWorkflow(java.lang.String userName)

workflowExists

boolean workflowExists(java.lang.String name)
                       throws WorkflowException
Throws:
WorkflowException

isEditable

boolean isEditable(Issue issue)

getPostFunctionsForWorkflow

java.util.Map<com.opensymphony.workflow.loader.ActionDescriptor,java.util.Collection<com.opensymphony.workflow.loader.FunctionDescriptor>> getPostFunctionsForWorkflow(JiraWorkflow workflow)
Retrieve a map: actions -> post functions for a workflow.

Parameters:
workflow - The Workflow
Returns:
Map of actions-> post functions

getStepId

java.lang.String getStepId(long actionDescriptorId,
                           java.lang.String workflowName)
Gets the first stepId for the given action and workflow name.

Parameters:
actionDescriptorId - id of the ActionDescriptor
workflowName - name of the JiraWorkflow
Returns:
the first stepId for the given action and workflow name.

overwriteActiveWorkflow

void overwriteActiveWorkflow(java.lang.String username,
                             java.lang.String workflowName)
Saves the draft workflow into the active workflow.

Parameters:
username - User will be added to the workflows Audit trail
workflowName - The workflow to be overwritten

updateWorkflow

void updateWorkflow(java.lang.String username,
                    JiraWorkflow workflow)
Saves the given JiraWorkflow, which may be either a "live" or "draft" version. This method does not save the changes to the active workflow. Instead, this is meant to be used to make persistent changes to your working edit. Once all changes have been made you can over write the active workflow by calling overwriteActiveWorkflow(String, String)

Parameters:
username - User making the request.
workflow - The JiraWorkflow to save.
Throws:
java.lang.IllegalArgumentException - if the workflow or its descriptor is null.
Since:
v3.13

copyWorkflow

JiraWorkflow copyWorkflow(java.lang.String username,
                          java.lang.String clonedWorkflowName,
                          java.lang.String clonedWorkflowDescription,
                          JiraWorkflow workflowToClone)
Clones a workflow by creating a deep copy of the workflow provided.

Parameters:
username - The user performing the operation
clonedWorkflowName - 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.
Returns:
A cloned copy of the original workflow.

updateWorkflowNameAndDescription

void updateWorkflowNameAndDescription(java.lang.String username,
                                      JiraWorkflow currentWorkflow,
                                      java.lang.String newName,
                                      java.lang.String newDescription)
Used to change the name and description of an existing worfklow with the given name.

Parameters:
username - The user performing the operation
currentWorkflow - The workflow to update.
newName - The new name to save with the workflow
newDescription - The new descriptio to save with the workflow

copyAndDeleteDraftWorkflows

void copyAndDeleteDraftWorkflows(com.opensymphony.user.User user,
                                 java.util.Set<JiraWorkflow> workflows)
Provided a set of workflows, this method will check, if the passed in workflows have any draft workflows linked to them. If they do, it will create an inactive copy of the draft workflow, and delete the draft workflow.

Parameters:
user - The user performing the operation
workflows - A set of parent JiraWorkflows


Copyright © 2002-2010 Atlassian. All Rights Reserved.