public class Workflow extends Object implements JiraWorkflow
Modifier and Type | Class and Description |
---|---|
static class |
Workflow.AddTransitionParameters |
static class |
Workflow.AddTransitionParametersBuilder |
Modifier and Type | Field and Description |
---|---|
static java.util.function.Supplier<Map<Integer,com.opensymphony.workflow.loader.FunctionDescriptor>> |
NO_ADDITIONAL_POSTFUNCTIONS
Represents the screen id property on workflow action descriptor metadata.
|
ACTION_ORIGIN_STEP_ID, ACTION_SCREEN_ATTRIBUTE, ACTION_TYPE_ALL, ACTION_TYPE_COMMON, ACTION_TYPE_GLOBAL, ACTION_TYPE_INITIAL, ACTION_TYPE_ORDINARY, DEFAULT_WORKFLOW_NAME, DRAFT, JIRA_META_ATTRIBUTE_ALLOWED_LIST, JIRA_META_ATTRIBUTE_EDIT_ALLOWED, JIRA_META_ATTRIBUTE_EXCLUDE_RESOLUTION, JIRA_META_ATTRIBUTE_I18N, JIRA_META_ATTRIBUTE_I18N_SUBMIT, JIRA_META_ATTRIBUTE_INCLUDE_RESOLUTION, JIRA_META_ATTRIBUTE_KEY_PREFIX, JIRA_META_ATTRIBUTE_PERMISSION, JIRA_META_UPDATE_AUTHOR_KEY, JIRA_META_UPDATE_AUTHOR_NAME, JIRA_META_UPDATED_DATE, LIVE, STEP_STATUS_KEY, WORKFLOW_DESCRIPTION_ATTRIBUTE, WORKFLOW_VIEW_FIELDLAYOUT_KEY_ATTRIBUTE
Constructor and Description |
---|
Workflow(JiraWorkflow workflow,
WorkflowFunctionUtilities workflowFunctionUtilities,
JiraAuthenticationContext jiraAuthenticationContext,
TransitionOptions transitionOptions,
OutcomeHelper outcomeHelper,
ScreenNameResolver screenNameResolver)
Create this workflow object wrapping the underlying JiraWorkflow object.
|
Modifier and Type | Method and Description |
---|---|
ServiceOutcome<Workflow> |
addCommonTransition(String sourceStatusId,
int transitionId)
Add a common transition to the workflow.
|
ServiceOutcome<Workflow> |
addGlobalTransition(Workflow.AddTransitionParameters params)
Add a global transition to this workflow.
|
ServiceOutcome<TransitionData> |
addGlobalTransitionReturningId(Workflow.AddTransitionParameters params)
Add a global transition to this workflow.
|
ServiceOutcome<TransitionData> |
addLoopedTransition(String name,
String description,
FieldScreen screen)
Adds a looped transition to every status on the workflow.
|
ServiceOutcome<Workflow> |
addStatus(Status status)
Add a status to the supplied workflow.
|
ServiceOutcome<TransitionData> |
addTransition(Workflow.AddTransitionParameters params)
Add a new transition to the named workflow created with the supplied parameters.
|
boolean |
commonTransitionExistsFromSource(int transitionId,
Status source)
Does a common transition already exist from this source to the destination of the transition represented
by the supplied transition id?
|
int |
compareTo(JiraWorkflow workflow) |
ServiceOutcome<Workflow> |
deleteGlobalTransition(String globalTransitionId)
Delete the global transition from the provided workflow.
|
ServiceOutcome<Workflow> |
deleteLoopedTransition(int loopedTransitionId)
Delete the looped transition from the provided workflow.
|
ServiceOutcome<Workflow> |
deleteTransition(int transitionId,
int sourceStepId)
Delete the transition represented by the supplied transition id, source step id.
|
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getActionsByName(String name)
Get all actions in this workflow, global, common and from steps, whose name matched
name . |
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getActionsForScreen(FieldScreen fieldScreen) |
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getActionsWithResult(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
Get all the actions which have a particular step as their unconditional result.
|
String |
getActionType(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) |
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getAllActions()
Get all the actions in this workflow, global, common and from steps.
|
String |
getDescription() |
com.opensymphony.workflow.loader.WorkflowDescriptor |
getDescriptor() |
String |
getDisplayName() |
Set<String> |
getDistinctTransitionNames() |
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getGlobalActions() |
int |
getId()
Returns a unique workflow id.
|
Collection<com.opensymphony.workflow.loader.ActionDescriptor> |
getInitialActions() |
JiraWorkflow |
getJiraWorkflow() |
Status |
getLinkedStatus(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
Get the Status associated with the given StepDescriptor.
|
List<org.ofbiz.core.entity.GenericValue> |
getLinkedStatuses()
Deprecated.
Use
getLinkedStatusObjects() instead. Since v5.0. |
String |
getLinkedStatusId(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
Get the id of the
Status associated with the given StepDescriptor |
Set<String> |
getLinkedStatusIds()
Returns all status ids for this workflow
|
Status |
getLinkedStatusObject(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
Deprecated.
|
List<Status> |
getLinkedStatusObjects()
Returns all statuses for this workflow
|
com.opensymphony.workflow.loader.StepDescriptor |
getLinkedStep(org.ofbiz.core.entity.GenericValue status)
Deprecated.
Use
getLinkedStep(com.atlassian.jira.issue.status.Status) instead. Since v5.0. |
com.opensymphony.workflow.loader.StepDescriptor |
getLinkedStep(Status status)
Get the StepDescriptor linked to the given status for this workflow.
|
String |
getMode()
Returns either
JiraWorkflow.DRAFT or JiraWorkflow.LIVE depending on the workflow implementation. |
String |
getName() |
int |
getNextActionId()
Get the next available action id
|
Collection<com.opensymphony.workflow.loader.FunctionDescriptor> |
getPostFunctionsForTransition(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
Returns all post-functions of the transition, including the ones on all conditional results,
unconditional results and 'global' (non-result) postfunctions.
|
List<Integer> |
getStepIds()
Get the step ids for this workflow.
|
List<com.opensymphony.workflow.loader.StepDescriptor> |
getSteps()
Get the steps represented in this workflow.
|
Collection<com.opensymphony.workflow.loader.StepDescriptor> |
getStepsForTransition(com.opensymphony.workflow.loader.ActionDescriptor action)
Returns a collection of all step descriptors that reference the given common action.
|
String |
getTransitionName(int transitionId)
Get the transition name for the supplied id.
|
ApplicationUser |
getUpdateAuthor()
Returns the most recent author
|
String |
getUpdateAuthorName()
Returns the most recent authors username.
|
Date |
getUpdatedDate()
Returns the date of the most recent update to this workflow.
|
boolean |
hasDraftWorkflow()
Determines if this workflow has a draft edit copy.
|
boolean |
hasTransition(int transitionId)
Has this workflow have a transition with the id?
|
boolean |
isActive()
Determine whether this workflow object is currently active.
|
boolean |
isCommonAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) |
boolean |
isCommonTransition(int transitionId)
Is the supplied transition id a common transition.
|
boolean |
isDefault()
Determines if the workflow is the default JIRA workflow
|
boolean |
isDraftWorkflow()
Determines if the workflow is an draft edit of an active workflow.
|
boolean |
isDuplicateGlobalTransitionName(String transitionName)
Is the supplied name already in use as a global transition name.
|
boolean |
isDuplicateLoopedTransitionName(String transitionName)
Is the supplied name already in use as a looped transition name.
|
boolean |
isDuplicateTransitionName(String transitionName,
int sourceStepId)
Is the supplied name already in use as a transition name.
|
boolean |
isDuplicateTransitionName(String transitionName,
com.opensymphony.workflow.loader.StepDescriptor sourceStep)
Is the supplied name already in use as a transition name.
|
boolean |
isEditable()
Determines if the workflow can be modifed within JIRA.
|
boolean |
isGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) |
boolean |
isInitialAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) |
boolean |
isOrdinaryAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) |
boolean |
isSystemWorkflow()
Determines if the workflow is loaded from XML or the database
|
ServiceOutcome<Workflow> |
removeStatus(Status status)
Remove a status from the provided workflow.
|
ServiceOutcome<Workflow> |
removeStatus(String statusId)
Remove a status from the provided workflow.
|
boolean |
removeStep(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
Remove a step from the workflow.
|
void |
reset() |
boolean |
statusExistsOnWorkflow(Status status)
Does the supplied status exist on the workflow.
|
boolean |
statusHasGlobalTransition(Status status)
Does the provided status have a global transition?
|
ServiceOutcome<Boolean> |
statusHasOutgoingTransition(Status status,
int transitionId) |
boolean |
stepExists(int stepId)
Does a step exist for the supplied step id.
|
boolean |
stepExists(Status status)
Does a step exist for the supplied status?
|
boolean |
targetStatusHasExistingTransitionWithName(int transitionId,
String transitionName)
Does the target status represented by the transition id have an existing transition with the supplied name?
|
ServiceOutcome<Workflow> |
updateGlobalTransition(int transitionId,
String name,
String description,
FieldScreen screen)
Update the global transition represented by the supplied transition id to have the supplied properties.
|
ServiceOutcome<Workflow> |
updateLoopedTransition(int transitionId,
String name,
String description,
FieldScreen screen)
Update the looped transition represented by the supplied transition id to have the supplied properties.
|
ServiceOutcome<Workflow> |
updateStatus(String statusId,
String name)
Update a status identified by the status id in the workflow.
|
ServiceOutcome<Workflow> |
updateTransition(int transitionId,
String name,
String description,
FieldScreen screen)
Update the transition specified by the transitionId with the supplied parameters.
|
ServiceOutcome<Workflow> |
updateTransitionSource(int transitionId,
Status newSourceStatus,
Status originalSourceStatus)
Update the source of the transition specified by the transitionId.
|
ServiceOutcome<Workflow> |
updateTransitionTarget(int transitionId,
Status targetStatus)
Update the target of the transition specified by the transitionId.
|
boolean |
workflowContainsStepWithStatusId(String statusId)
Does the workflow contain a step with the status id?
|
public static final java.util.function.Supplier<Map<Integer,com.opensymphony.workflow.loader.FunctionDescriptor>> NO_ADDITIONAL_POSTFUNCTIONS
public Workflow(JiraWorkflow workflow, WorkflowFunctionUtilities workflowFunctionUtilities, JiraAuthenticationContext jiraAuthenticationContext, TransitionOptions transitionOptions, OutcomeHelper outcomeHelper, ScreenNameResolver screenNameResolver)
workflow
- outcomeHelper
- screenNameResolver
- public int getId()
The id remains the same even after the workflow name changes.
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getActionsByName(String name)
JiraWorkflow
name
.getActionsByName
in interface JiraWorkflow
name
- of the action to match. This is case-insensitive.ActionDescriptor
whose name matched the given name
.public String getLinkedStatusId(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
JiraWorkflow
Status
associated with the given StepDescriptor
getLinkedStatusId
in interface JiraWorkflow
stepDescriptor
- the StepDescriptorpublic Set<String> getLinkedStatusIds()
JiraWorkflow
getLinkedStatusIds
in interface JiraWorkflow
Set
of String
status id'spublic ServiceOutcome<Workflow> addStatus(Status status)
status
- The status.public ServiceOutcome<Workflow> removeStatus(@NotNull Status status)
status
- Status to remove from workflow.public ServiceOutcome<Workflow> removeStatus(String statusId)
statusId
- Id of the status.public ServiceOutcome<Workflow> updateStatus(String statusId, String name)
statusId
- The status id.name
- The status name.public ServiceOutcome<Workflow> addGlobalTransition(Workflow.AddTransitionParameters params)
public ServiceOutcome<TransitionData> addGlobalTransitionReturningId(Workflow.AddTransitionParameters params)
public ServiceOutcome<Workflow> updateGlobalTransition(int transitionId, String name, String description, FieldScreen screen)
public ServiceOutcome<Workflow> addCommonTransition(String sourceStatusId, int transitionId)
If the transition to be shared isn't common yet, we make it a common transition. This is done by removing it from its parent status, adding it to the workflow, then adding back to the status as a common transition.
sourceStatusId
- The ID of the transition's source status.transitionId
- The ID of the transition to use.public ServiceOutcome<TransitionData> addTransition(Workflow.AddTransitionParameters params)
public ServiceOutcome<TransitionData> addLoopedTransition(String name, String description, FieldScreen screen)
name
- The name of the looped transition.description
- The description of the looped transition.screen
- The screen to use for the loop.public ServiceOutcome<Workflow> deleteLoopedTransition(int loopedTransitionId)
loopedTransitionId
- public ServiceOutcome<Workflow> updateLoopedTransition(int transitionId, String name, String description, FieldScreen screen)
public ServiceOutcome<Workflow> deleteTransition(int transitionId, int sourceStepId)
transitionId
- sourceStepId
- public ServiceOutcome<Workflow> updateTransition(int transitionId, String name, String description, FieldScreen screen)
public ServiceOutcome<Workflow> updateTransitionTarget(int transitionId, Status targetStatus)
public ServiceOutcome<Workflow> updateTransitionSource(int transitionId, Status newSourceStatus, Status originalSourceStatus)
transitionId
- The transition id to be modified.newSourceStatus
- The new source status of the transition.originalSourceStatus
- The original source status of the transition.public ServiceOutcome<Workflow> deleteGlobalTransition(String globalTransitionId)
globalTransitionId
- public boolean isDuplicateGlobalTransitionName(String transitionName)
transitionName
- public boolean isDuplicateTransitionName(String transitionName, int sourceStepId)
transitionName
- public boolean isDuplicateLoopedTransitionName(String transitionName)
transitionName
- public boolean targetStatusHasExistingTransitionWithName(int transitionId, String transitionName)
transitionId
- transitionName
- public boolean isCommonTransition(int transitionId)
transitionId
- public boolean commonTransitionExistsFromSource(int transitionId, Status source)
transitionId
- source
- public boolean hasTransition(int transitionId)
public ServiceOutcome<Boolean> statusHasOutgoingTransition(Status status, int transitionId)
status
- A status in the workflow.transitionId
- The ID of a transition in the workflow.public String getTransitionName(int transitionId)
transitionId
- public boolean statusHasGlobalTransition(Status status)
status
- public boolean statusExistsOnWorkflow(Status status)
status
- public boolean isDuplicateTransitionName(String transitionName, com.opensymphony.workflow.loader.StepDescriptor sourceStep)
transitionName
- public boolean stepExists(int stepId)
stepId
- public boolean stepExists(Status status)
status
- public boolean workflowContainsStepWithStatusId(String statusId)
statusId
- public List<com.opensymphony.workflow.loader.StepDescriptor> getSteps()
public String getName()
getName
in interface JiraWorkflow
public String getDisplayName()
getDisplayName
in interface JiraWorkflow
public String getDescription()
getDescription
in interface JiraWorkflow
public com.opensymphony.workflow.loader.WorkflowDescriptor getDescriptor()
getDescriptor
in interface JiraWorkflow
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getInitialActions()
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getGlobalActions()
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getAllActions()
getAllActions
in interface JiraWorkflow
ActionDescriptor
s.public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getActionsWithResult(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
getActionsWithResult
in interface JiraWorkflow
public boolean removeStep(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
removeStep
in interface JiraWorkflow
true
if the remove was successfulpublic com.opensymphony.workflow.loader.StepDescriptor getLinkedStep(org.ofbiz.core.entity.GenericValue status)
getLinkedStep(com.atlassian.jira.issue.status.Status)
instead. Since v5.0.getLinkedStep
in interface JiraWorkflow
status
- the Statuspublic com.opensymphony.workflow.loader.StepDescriptor getLinkedStep(Status status)
getLinkedStep
in interface JiraWorkflow
status
- the Statuspublic List<org.ofbiz.core.entity.GenericValue> getLinkedStatuses()
getLinkedStatusObjects()
instead. Since v5.0.getLinkedStatuses
in interface JiraWorkflow
List
of GenericValue
public List<Status> getLinkedStatusObjects()
getLinkedStatusObjects
in interface JiraWorkflow
List
of Status
objectspublic boolean isActive() throws WorkflowException
isActive
in interface JiraWorkflow
true
if this workflow object is active.WorkflowException
- Runtime Exception indicating a problem in the WorkflowManager.public boolean isSystemWorkflow() throws WorkflowException
isSystemWorkflow
in interface JiraWorkflow
true
if this workflow object is the uneditable system workflow.WorkflowException
- Runtime Exception indicating a problem in the WorkflowManager.public boolean isEditable() throws WorkflowException
System workflows are never editable. The "published" version of an active workflow is not editable, but the draft version is. Inactive workflows are editable.
isEditable
in interface JiraWorkflow
true
if this workflow is editable.WorkflowException
- Runtime Exception indicating a problem in the WorkflowManager.public boolean isDefault()
isDefault
in interface JiraWorkflow
true
if this is the workflow is the default JIRA workflow.public boolean isDraftWorkflow()
isDraftWorkflow
in interface JiraWorkflow
true
if an draft workflow, false otherwise.public boolean hasDraftWorkflow()
hasDraftWorkflow
in interface JiraWorkflow
true
if this workflow has a draft edit copy.public int getNextActionId()
getNextActionId
in interface JiraWorkflow
public Collection<com.opensymphony.workflow.loader.StepDescriptor> getStepsForTransition(com.opensymphony.workflow.loader.ActionDescriptor action)
getStepsForTransition
in interface JiraWorkflow
public Collection<com.opensymphony.workflow.loader.FunctionDescriptor> getPostFunctionsForTransition(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
getPostFunctionsForTransition
in interface JiraWorkflow
public boolean isInitialAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
isInitialAction
in interface JiraWorkflow
public boolean isCommonAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
isCommonAction
in interface JiraWorkflow
public boolean isGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
isGlobalAction
in interface JiraWorkflow
public boolean isOrdinaryAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
isOrdinaryAction
in interface JiraWorkflow
public Status getLinkedStatus(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
JiraWorkflow
getLinkedStatus
in interface JiraWorkflow
stepDescriptor
- the StepDescriptor@Deprecated public Status getLinkedStatusObject(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor)
getLinkedStatusObject
in interface JiraWorkflow
stepDescriptor
- the StepDescriptorpublic String getActionType(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
getActionType
in interface JiraWorkflow
public void reset()
reset
in interface JiraWorkflow
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getActionsForScreen(FieldScreen fieldScreen)
getActionsForScreen
in interface JiraWorkflow
public String getUpdateAuthorName()
getUpdateAuthorName
in interface JiraWorkflow
public ApplicationUser getUpdateAuthor()
UserManager.isUserExisting(com.atlassian.jira.user.ApplicationUser)
if you want to check user's existence.getUpdateAuthor
in interface JiraWorkflow
public Date getUpdatedDate()
getUpdatedDate
in interface JiraWorkflow
public String getMode()
JiraWorkflow.DRAFT
or JiraWorkflow.LIVE
depending on the workflow implementation.getMode
in interface JiraWorkflow
JiraWorkflow.DRAFT
or JiraWorkflow.LIVE
public int compareTo(JiraWorkflow workflow)
compareTo
in interface Comparable<JiraWorkflow>
public JiraWorkflow getJiraWorkflow()
Copyright © 2002-2018 Atlassian. All Rights Reserved.