Package com.atlassian.jira.workflow.edit
Class Workflow
java.lang.Object
com.atlassian.jira.workflow.edit.Workflow
- All Implemented Interfaces:
JiraWorkflow,Comparable<JiraWorkflow>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionRepresents the screen id property on workflow action descriptor metadata.Fields inherited from interface com.atlassian.jira.workflow.JiraWorkflow
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 Summary
ConstructorsConstructorDescriptionWorkflow(JiraWorkflow workflow, WorkflowFunctionUtilities workflowFunctionUtilities, JiraAuthenticationContext jiraAuthenticationContext, TransitionOptions transitionOptions, OutcomeHelper outcomeHelper, ScreenNameResolver screenNameResolver) Create this workflow object wrapping the underlying JiraWorkflow object. -
Method Summary
Modifier and TypeMethodDescriptionaddCommonTransition(String sourceStatusId, int transitionId) Add a common transition to the workflow.Add a global transition to this workflow.Add a global transition to this workflow.addLoopedTransition(String name, String description, FieldScreen screen) Adds a looped transition to every status on the workflow.Add a status to the supplied workflow.Add a new transition to the named workflow created with the supplied parameters.booleancommonTransitionExistsFromSource(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?intcompareTo(JiraWorkflow workflow) deleteGlobalTransition(String globalTransitionId) Delete the global transition from the provided workflow.deleteLoopedTransition(int loopedTransitionId) Delete the looped transition from the provided 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 matchedname.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.getActionType(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) Collection<com.opensymphony.workflow.loader.ActionDescriptor> Get all the actions in this workflow, global, common and from steps.com.opensymphony.workflow.loader.WorkflowDescriptorCollection<com.opensymphony.workflow.loader.ActionDescriptor> intgetId()Returns a unique workflow id.Collection<com.opensymphony.workflow.loader.ActionDescriptor> getLinkedStatus(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get the Status associated with the given StepDescriptor.List<org.ofbiz.core.entity.GenericValue> Deprecated.getLinkedStatusId(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get the id of theStatusassociated with the givenStepDescriptorReturns all status ids for this workflowgetLinkedStatusObject(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Deprecated.Returns all statuses for this workflowcom.opensymphony.workflow.loader.StepDescriptorgetLinkedStep(Status status) Get the StepDescriptor linked to the given status for this workflow.com.opensymphony.workflow.loader.StepDescriptorgetLinkedStep(org.ofbiz.core.entity.GenericValue status) Deprecated.getMode()Returns eitherJiraWorkflow.DRAFTorJiraWorkflow.LIVEdepending on the workflow implementation.getName()intGet the next available action idCollection<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.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.getTransitionName(int transitionId) Get the transition name for the supplied id.Returns the most recent authorReturns the most recent authors username.Returns the date of the most recent update to this workflow.booleanDetermines if this workflow has a draft edit copy.booleanhasTransition(int transitionId) Has this workflow have a transition with the id?booleanisActive()Determine whether this workflow object is currently active.booleanisCommonAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) booleanisCommonTransition(int transitionId) Is the supplied transition id a common transition.booleanDetermines if the workflow is the default JIRA workflowbooleanDetermines if the workflow is an draft edit of an active workflow.booleanisDuplicateGlobalTransitionName(String transitionName) Is the supplied name already in use as a global transition name.booleanisDuplicateLoopedTransitionName(String transitionName) Is the supplied name already in use as a looped transition name.booleanisDuplicateTransitionName(String transitionName, int sourceStepId) Is the supplied name already in use as a transition name.booleanisDuplicateTransitionName(String transitionName, com.opensymphony.workflow.loader.StepDescriptor sourceStep) Is the supplied name already in use as a transition name.booleanDetermines if the workflow can be modifed within JIRA.booleanisGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) booleanisInitialAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) booleanisOrdinaryAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) booleanDetermines if the workflow is loaded from XML or the databaseremoveStatus(@NotNull Status status) Remove a status from the provided workflow.removeStatus(String statusId) Remove a status from the provided workflow.booleanremoveStep(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Remove a step from the workflow.voidreset()booleanstatusExistsOnWorkflow(Status status) Does the supplied status exist on the workflow.booleanstatusHasGlobalTransition(Status status) Does the provided status have a global transition?statusHasOutgoingTransition(Status status, int transitionId) booleanstepExists(int stepId) Does a step exist for the supplied step id.booleanstepExists(Status status) Does a step exist for the supplied status?booleantargetStatusHasExistingTransitionWithName(int transitionId, String transitionName) Does the target status represented by the transition id have an existing transition with the supplied name?updateGlobalTransition(int transitionId, String name, String description, FieldScreen screen) Update the global transition represented by the supplied transition id to have the supplied properties.updateLoopedTransition(int transitionId, String name, String description, FieldScreen screen) Update the looped transition represented by the supplied transition id to have the supplied properties.updateStatus(String statusId, String name) Update a status identified by the status id in the workflow.updateTransition(int transitionId, String name, String description, FieldScreen screen) Update the transition specified by the transitionId with the supplied parameters.updateTransitionSource(int transitionId, Status newSourceStatus, Status originalSourceStatus) Update the source of the transition specified by the transitionId.updateTransitionTarget(int transitionId, Status targetStatus) Update the target of the transition specified by the transitionId.booleanworkflowContainsStepWithStatusId(String statusId) Does the workflow contain a step with the status id?
-
Field Details
-
Constructor Details
-
Workflow
public Workflow(JiraWorkflow workflow, WorkflowFunctionUtilities workflowFunctionUtilities, JiraAuthenticationContext jiraAuthenticationContext, TransitionOptions transitionOptions, OutcomeHelper outcomeHelper, ScreenNameResolver screenNameResolver) Create this workflow object wrapping the underlying JiraWorkflow object.- Parameters:
workflow-outcomeHelper-screenNameResolver-
-
-
Method Details
-
getId
public int getId()Returns a unique workflow id.The id remains the same even after the workflow name changes.
- Returns:
- workflow id
-
getActionsByName
Description copied from interface:JiraWorkflowGet all actions in this workflow, global, common and from steps, whose name matchedname.- Specified by:
getActionsByNamein interfaceJiraWorkflow- Parameters:
name- of the action to match. This is case-insensitive.- Returns:
- A collection of
ActionDescriptorwhose name matched the givenname.
-
getLinkedStatusId
Description copied from interface:JiraWorkflowGet the id of theStatusassociated with the givenStepDescriptor- Specified by:
getLinkedStatusIdin interfaceJiraWorkflow- Parameters:
stepDescriptor- the StepDescriptor- Returns:
- the id of the status associated with the given StepDescriptor.
-
getLinkedStatusIds
Description copied from interface:JiraWorkflowReturns all status ids for this workflow- Specified by:
getLinkedStatusIdsin interfaceJiraWorkflow- Returns:
- a
SetofStringstatus id's
-
addStatus
Add a status to the supplied workflow. This method does not save the workflow.- Parameters:
status- The status.- Returns:
- ServiceOutcome A service outcome of the addition process.
-
removeStatus
Remove a status from the provided workflow. This will remove any transitions to or from that step. This method does not save the workflow.- Parameters:
status- Status to remove from workflow.- Returns:
- ServiceOutcome A service outcome of the removal process.
-
removeStatus
Remove a status from the provided workflow. This will remove any transitions to or from that step. This method does not save the workflow.- Parameters:
statusId- Id of the status.- Returns:
- ServiceOutcome A service outcome of the removal process.
-
updateStatus
Update a status identified by the status id in the workflow. This method does not save the workflow.- Parameters:
statusId- The status id.name- The status name.- Returns:
- ServiceOutcome A service outcome of the update process.
-
addGlobalTransition
Add a global transition to this workflow.- Returns:
- ServiceOutcome
-
addGlobalTransitionReturningId
public ServiceOutcome<TransitionData> addGlobalTransitionReturningId(Workflow.AddTransitionParameters params) Add a global transition to this workflow.- Returns:
- ServiceOutcome
-
updateGlobalTransition
public 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.- Returns:
- ServiceOutcome
The updated workflow, note: not saved.
-
addCommonTransition
Add a common transition to the workflow.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.
- Parameters:
sourceStatusId- The ID of the transition's source status.transitionId- The ID of the transition to use.- Returns:
- ServiceOutcome
-
addTransition
Add a new transition to the named workflow created with the supplied parameters.- Returns:
- ServiceOutcome
New transition data.
-
addLoopedTransition
public ServiceOutcome<TransitionData> addLoopedTransition(String name, String description, FieldScreen screen) Adds a looped transition to every status on the workflow. This makes use of the special case of configuring a result step with the value of -1.- Parameters:
name- The name of the looped transition.description- The description of the looped transition.screen- The screen to use for the loop.- Returns:
- ServiceOutcome
New transition data.
-
deleteLoopedTransition
Delete the looped transition from the provided workflow.- Parameters:
loopedTransitionId-- Returns:
- ServiceOutcome A service outcome with the updated workflow.
-
updateLoopedTransition
public 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.- Returns:
- ServiceOutcome
The updated workflow, note: not saved.
-
deleteTransition
Delete the transition represented by the supplied transition id, source step id.- Parameters:
transitionId-sourceStepId-- Returns:
- ServiceOutcome
-
updateTransition
public ServiceOutcome<Workflow> updateTransition(int transitionId, String name, String description, FieldScreen screen) Update the transition specified by the transitionId with the supplied parameters.- Returns:
- ServiceOutcome
-
updateTransitionTarget
Update the target of the transition specified by the transitionId.- Returns:
- ServiceOutcome
-
updateTransitionSource
public ServiceOutcome<Workflow> updateTransitionSource(int transitionId, Status newSourceStatus, Status originalSourceStatus) Update the source of the transition specified by the transitionId.- Parameters:
transitionId- The transition id to be modified.newSourceStatus- The new source status of the transition.originalSourceStatus- The original source status of the transition.- Returns:
- ServiceOutcome
An outcome representing the result of updating the source status.
-
deleteGlobalTransition
Delete the global transition from the provided workflow.- Parameters:
globalTransitionId-- Returns:
- ServiceOutcome A service outcome with the updated workflow.
-
isDuplicateGlobalTransitionName
Is the supplied name already in use as a global transition name. This will only check global actions.- Parameters:
transitionName-- Returns:
- boolean
-
isDuplicateTransitionName
Is the supplied name already in use as a transition name.- Parameters:
transitionName-- Returns:
- boolean
-
isDuplicateLoopedTransitionName
Is the supplied name already in use as a looped transition name.- Parameters:
transitionName-- Returns:
- boolean
-
targetStatusHasExistingTransitionWithName
Does the target status represented by the transition id have an existing transition with the supplied name?- Parameters:
transitionId-transitionName-- Returns:
- boolean
-
isCommonTransition
public boolean isCommonTransition(int transitionId) Is the supplied transition id a common transition.- Parameters:
transitionId-- Returns:
- boolean Indicates whether the transition is common or not.
-
commonTransitionExistsFromSource
Does a common transition already exist from this source to the destination of the transition represented by the supplied transition id?- Parameters:
transitionId-source-- Returns:
- boolean representing whether a common transition already exists.
-
hasTransition
public boolean hasTransition(int transitionId) Has this workflow have a transition with the id?- Returns:
- boolean
-
statusHasOutgoingTransition
- Parameters:
status- A status in the workflow.transitionId- The ID of a transition in the workflow.- Returns:
- Whether the transition described by transitionId is an outgoing transition of status.
-
getTransitionName
Get the transition name for the supplied id.- Parameters:
transitionId-- Returns:
- String
-
statusHasGlobalTransition
Does the provided status have a global transition?- Parameters:
status-- Returns:
- boolean
-
statusExistsOnWorkflow
Does the supplied status exist on the workflow.- Parameters:
status-- Returns:
- boolean
-
getStepIds
Get the step ids for this workflow.- Returns:
- List
-
isDuplicateTransitionName
public boolean isDuplicateTransitionName(String transitionName, com.opensymphony.workflow.loader.StepDescriptor sourceStep) Is the supplied name already in use as a transition name.- Parameters:
transitionName-- Returns:
- boolean
-
stepExists
public boolean stepExists(int stepId) Does a step exist for the supplied step id.- Parameters:
stepId-- Returns:
- boolean
-
stepExists
Does a step exist for the supplied status?- Parameters:
status-- Returns:
- boolean
-
workflowContainsStepWithStatusId
Does the workflow contain a step with the status id?- Parameters:
statusId-- Returns:
- boolean
-
getSteps
Get the steps represented in this workflow.- Returns:
- List
-
getName
- Specified by:
getNamein interfaceJiraWorkflow
-
getDisplayName
- Specified by:
getDisplayNamein interfaceJiraWorkflow
-
getDescription
- Specified by:
getDescriptionin interfaceJiraWorkflow
-
getDescriptor
public com.opensymphony.workflow.loader.WorkflowDescriptor getDescriptor()- Specified by:
getDescriptorin interfaceJiraWorkflow
-
getInitialActions
-
getGlobalActions
-
getAllActions
Get all the actions in this workflow, global, common and from steps.- Specified by:
getAllActionsin interfaceJiraWorkflow- Returns:
- A collection of
ActionDescriptors.
-
getActionsWithResult
public 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.- Specified by:
getActionsWithResultin interfaceJiraWorkflow- Returns:
- all the actions which have a particular step as their unconditional result.
-
removeStep
public boolean removeStep(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Remove a step from the workflow. This method will also remove all actions with this step ID as their unconditional result.- Specified by:
removeStepin interfaceJiraWorkflow- Returns:
trueif the remove was successful
-
getLinkedStep
public com.opensymphony.workflow.loader.StepDescriptor getLinkedStep(org.ofbiz.core.entity.GenericValue status) Deprecated.UsegetLinkedStep(com.atlassian.jira.issue.status.Status)instead. Since v5.0.Get the StepDescriptor linked to the given status for this workflow.- Specified by:
getLinkedStepin interfaceJiraWorkflow- Parameters:
status- the Status- Returns:
- The StepDescriptor linked, or null if no steps are linked to this status.
-
getLinkedStep
Get the StepDescriptor linked to the given status for this workflow.- Specified by:
getLinkedStepin interfaceJiraWorkflow- Parameters:
status- the Status- Returns:
- The StepDescriptor linked, or null if no steps are linked to this status.
-
getLinkedStatuses
Deprecated.UsegetLinkedStatusObjects()instead. Since v5.0.Returns all statuses for this workflow- Specified by:
getLinkedStatusesin interfaceJiraWorkflow- Returns:
- a
ListofGenericValue
-
getLinkedStatusObjects
Returns all statuses for this workflow- Specified by:
getLinkedStatusObjectsin interfaceJiraWorkflow- Returns:
- a
ListofStatusobjects
-
isActive
Determine whether this workflow object is currently active.- Specified by:
isActivein interfaceJiraWorkflow- Returns:
trueif this workflow object is active.- Throws:
WorkflowException- Runtime Exception indicating a problem in the WorkflowManager.
-
isSystemWorkflow
Determines if the workflow is loaded from XML or the database- Specified by:
isSystemWorkflowin interfaceJiraWorkflow- Returns:
trueif this workflow object is the uneditable system workflow.- Throws:
WorkflowException- Runtime Exception indicating a problem in the WorkflowManager.
-
isEditable
Determines if the workflow can be modifed within JIRA.System workflows are never editable. The "published" version of an active workflow is not editable, but the draft version is. Inactive workflows are editable.
- Specified by:
isEditablein interfaceJiraWorkflow- Returns:
trueif this workflow is editable.- Throws:
WorkflowException- Runtime Exception indicating a problem in the WorkflowManager.
-
isDefault
public boolean isDefault()Determines if the workflow is the default JIRA workflow- Specified by:
isDefaultin interfaceJiraWorkflow- Returns:
trueif this is the workflow is the default JIRA workflow.
-
isDraftWorkflow
public boolean isDraftWorkflow()Determines if the workflow is an draft edit of an active workflow.- Specified by:
isDraftWorkflowin interfaceJiraWorkflow- Returns:
trueif an draft workflow, false otherwise.- Since:
- v3.13
-
hasDraftWorkflow
public boolean hasDraftWorkflow()Determines if this workflow has a draft edit copy.- Specified by:
hasDraftWorkflowin interfaceJiraWorkflow- Returns:
trueif this workflow has a draft edit copy.- Since:
- v3.13
-
getNextActionId
public int getNextActionId()Get the next available action id- Specified by:
getNextActionIdin interfaceJiraWorkflow- Returns:
- The next available action id.
-
getStepsForTransition
public 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.- Specified by:
getStepsForTransitionin interfaceJiraWorkflow- Returns:
- a collection of all step descriptors that reference the given common action.
-
getPostFunctionsForTransition
public 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.- Specified by:
getPostFunctionsForTransitionin interfaceJiraWorkflow- Returns:
- all post-functions of the transition, including the ones on all conditional results, unconditional results and 'global' (non-result) postfunctions.
-
isInitialAction
public boolean isInitialAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) - Specified by:
isInitialActionin interfaceJiraWorkflow
-
isCommonAction
public boolean isCommonAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) - Specified by:
isCommonActionin interfaceJiraWorkflow
-
isGlobalAction
public boolean isGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) - Specified by:
isGlobalActionin interfaceJiraWorkflow
-
isOrdinaryAction
public boolean isOrdinaryAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) - Specified by:
isOrdinaryActionin interfaceJiraWorkflow
-
getLinkedStatus
Description copied from interface:JiraWorkflowGet the Status associated with the given StepDescriptor.- Specified by:
getLinkedStatusin interfaceJiraWorkflow- Parameters:
stepDescriptor- the StepDescriptor- Returns:
- the Status associated with the given StepDescriptor.
-
getLinkedStatusObject
@Deprecated public Status getLinkedStatusObject(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Deprecated.Get the Status associated with the given StepDescriptor.- Specified by:
getLinkedStatusObjectin interfaceJiraWorkflow- Parameters:
stepDescriptor- the StepDescriptor- Returns:
- the Status associated with the given StepDescriptor.
-
getActionType
- Specified by:
getActionTypein interfaceJiraWorkflow
-
reset
public void reset()- Specified by:
resetin interfaceJiraWorkflow
-
getActionsForScreen
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getActionsForScreen(FieldScreen fieldScreen) - Specified by:
getActionsForScreenin interfaceJiraWorkflow
-
getUpdateAuthorName
Returns the most recent authors username.- Specified by:
getUpdateAuthorNamein interfaceJiraWorkflow- Returns:
- Returns the authors username
- Since:
- v3.13
-
getUpdateAuthor
Returns the most recent author Notice: This method will also return proxy user even when is not existing. Please useUserManager.isUserExisting(com.atlassian.jira.user.ApplicationUser)if you want to check user's existence.- Specified by:
getUpdateAuthorin interfaceJiraWorkflow- Returns:
- The update author.
- Since:
- v6.0
-
getUpdatedDate
Returns the date of the most recent update to this workflow.- Specified by:
getUpdatedDatein interfaceJiraWorkflow- Returns:
- date of the most recent update to this workflow
- Since:
- v3.13
-
getMode
Returns eitherJiraWorkflow.DRAFTorJiraWorkflow.LIVEdepending on the workflow implementation.- Specified by:
getModein interfaceJiraWorkflow- Returns:
JiraWorkflow.DRAFTorJiraWorkflow.LIVE- Since:
- v3.13
-
compareTo
- Specified by:
compareToin interfaceComparable<JiraWorkflow>
-
getJiraWorkflow
-
getDistinctTransitionNames
- Returns:
- the set of all distinct transition names used by this workflow including global transition names
-
getLinkedStatusObjects()instead.