Package com.atlassian.jira.workflow
Class MockJiraWorkflow
java.lang.Object
com.atlassian.jira.workflow.MockJiraWorkflow
- All Implemented Interfaces:
JiraWorkflow,Comparable<JiraWorkflow>
New Mock for JiraWorkflow.
Note that there is another existing MockJiraWorkflow, but it relies on the underlying OSWorkflow implementation.
- Since:
- v3.13
-
Field Summary
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) com.opensymphony.workflow.loader.StepDescriptorAdds a step to this fake workflow with the given statusvoidclear()intCollection<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.WorkflowDescriptorgetLinkedStatus(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Get the Status associated with the given StepDescriptor.List<org.ofbiz.core.entity.GenericValue> Returns all statuses for this workflowgetLinkedStatusId(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) Get the Status associated with the given StepDescriptor.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) Get the StepDescriptor linked to the given status for this workflow.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.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.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.booleanisActive()Determine whether this workflow object is currently active.booleanisCommonAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) booleanDetermines if the workflow is the default JIRA workflowbooleanDetermines if the workflow is an draft edit of an active workflow.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 databasebooleanremoveStep(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Remove a step from the workflow.voidreset()voidsetDraftWorkflow(boolean draftWorkflow) voidsetGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) voidvoidsetStepsForTransition(com.opensymphony.workflow.loader.ActionDescriptor action, Collection<com.opensymphony.workflow.loader.StepDescriptor> steps) voidsetWorkflowDescriptor(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) toString()
-
Constructor Details
-
MockJiraWorkflow
public MockJiraWorkflow() -
MockJiraWorkflow
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceJiraWorkflow
-
getDisplayName
- Specified by:
getDisplayNamein interfaceJiraWorkflow
-
setName
-
getDescription
- Specified by:
getDescriptionin interfaceJiraWorkflow
-
getDescriptor
public com.opensymphony.workflow.loader.WorkflowDescriptor getDescriptor()- Specified by:
getDescriptorin interfaceJiraWorkflow
-
setWorkflowDescriptor
public void setWorkflowDescriptor(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) -
getAllActions
Description copied from interface:JiraWorkflowGet all the actions in this workflow, global, common and from steps.- Specified by:
getAllActionsin interfaceJiraWorkflow- Returns:
- A collection of
ActionDescriptors.
-
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.
-
addAction
public MockJiraWorkflow addAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) -
getActionsWithResult
public Collection<com.opensymphony.workflow.loader.ActionDescriptor> getActionsWithResult(com.opensymphony.workflow.loader.StepDescriptor stepDescriptor) Description copied from interface:JiraWorkflowGet 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) Description copied from interface:JiraWorkflowRemove 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) Description copied from interface:JiraWorkflowGet 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
Description copied from interface:JiraWorkflowGet 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
Description copied from interface:JiraWorkflowReturns all statuses for this workflow- Specified by:
getLinkedStatusesin interfaceJiraWorkflow- Returns:
- a
ListofGenericValue
-
getLinkedStatusObjects
Description copied from interface:JiraWorkflowReturns all statuses for this workflow- Specified by:
getLinkedStatusObjectsin interfaceJiraWorkflow- Returns:
- a
ListofStatusobjects
-
getLinkedStatusIds
Description copied from interface:JiraWorkflowReturns all status ids for this workflow- Specified by:
getLinkedStatusIdsin interfaceJiraWorkflow- Returns:
- a
SetofStringstatus id's
-
isActive
Description copied from interface:JiraWorkflowDetermine 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
Description copied from interface:JiraWorkflowDetermines 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
Description copied from interface:JiraWorkflowDetermines 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()Description copied from interface:JiraWorkflowDetermines if the workflow is the default JIRA workflow- Specified by:
isDefaultin interfaceJiraWorkflow- Returns:
trueif this is the workflow is the default JIRA workflow.
-
hasDraftWorkflow
public boolean hasDraftWorkflow()Description copied from interface:JiraWorkflowDetermines if this workflow has a draft edit copy.- Specified by:
hasDraftWorkflowin interfaceJiraWorkflow- Returns:
trueif this workflow has a draft edit copy.
-
getNextActionId
public int getNextActionId()Description copied from interface:JiraWorkflowGet the next available action id- Specified by:
getNextActionIdin interfaceJiraWorkflow- Returns:
- The next available action id.
-
setStepsForTransition
public void setStepsForTransition(com.opensymphony.workflow.loader.ActionDescriptor action, Collection<com.opensymphony.workflow.loader.StepDescriptor> steps) -
getStepsForTransition
public Collection<com.opensymphony.workflow.loader.StepDescriptor> getStepsForTransition(com.opensymphony.workflow.loader.ActionDescriptor action) Description copied from interface:JiraWorkflowReturns 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) Description copied from interface:JiraWorkflowReturns 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
-
setGlobalAction
public void setGlobalAction(com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor) -
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
Description copied from interface:JiraWorkflowGet the Status associated with the given StepDescriptor.- Specified by:
getLinkedStatusObjectin interfaceJiraWorkflow- Parameters:
stepDescriptor- the StepDescriptor- Returns:
- the Status associated with the given StepDescriptor.
-
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.
-
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
Description copied from interface:JiraWorkflowReturns the most recent authors username.- Specified by:
getUpdateAuthorNamein interfaceJiraWorkflow- Returns:
- Returns the authors username
-
getUpdateAuthor
Description copied from interface:JiraWorkflowReturns 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.
-
getUpdatedDate
Description copied from interface:JiraWorkflowReturns the date of the most recent update to this workflow.- Specified by:
getUpdatedDatein interfaceJiraWorkflow- Returns:
- date of the most recent update to this workflow
-
getMode
Description copied from interface:JiraWorkflowReturns eitherJiraWorkflow.DRAFTorJiraWorkflow.LIVEdepending on the workflow implementation.- Specified by:
getModein interfaceJiraWorkflow- Returns:
JiraWorkflow.DRAFTorJiraWorkflow.LIVE
-
compareTo
- Specified by:
compareToin interfaceComparable<JiraWorkflow>
-
addStep
Adds a step to this fake workflow with the given status -
clear
public void clear() -
isDraftWorkflow
public boolean isDraftWorkflow()Description copied from interface:JiraWorkflowDetermines if the workflow is an draft edit of an active workflow.- Specified by:
isDraftWorkflowin interfaceJiraWorkflow- Returns:
trueif an draft workflow, false otherwise.
-
setDraftWorkflow
public void setDraftWorkflow(boolean draftWorkflow) -
toString
-