Package com.atlassian.jira.workflow
Interface WorkflowSchemeManager
- All Superinterfaces:
SchemeManager
- All Known Implementing Classes:
DefaultWorkflowSchemeManager
,EagerWorkflowSchemeManager
-
Field Summary
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addWorkflowToScheme
(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId) Return a builder that can be used to create a newAssignableWorkflowScheme
.cleanUpSchemeDraft
(Project project, ApplicationUser user) If the project's workflow scheme is only used by one project and if this scheme has a draft, then the draft is copied to a separate scheme and deleted.void
copyDraft
(DraftWorkflowScheme draft, ApplicationUser user, String newDescription) createDraft
(ApplicationUser creator, DraftWorkflowScheme workflowScheme) Create the passed draft workflow scheme.createDraftOf
(ApplicationUser creator, AssignableWorkflowScheme workflowScheme) Create a draft for the passed workflow scheme.createScheme
(AssignableWorkflowScheme workflowScheme) Create a new workflow scheme.boolean
deleteWorkflowScheme
(WorkflowScheme scheme) Delete the passed workflow scheme.draftBuilder
(AssignableWorkflowScheme parent) Return a builder that can be used to create a newDraftWorkflowScheme
for the passed workflow scheme.Return all the assignable workflow schemes.org.ofbiz.core.entity.GenericValue
getDefaultEntity
(org.ofbiz.core.entity.GenericValue scheme) getDraft
(long id) Return the draft workflow scheme with the given id.getDraftForParent
(AssignableWorkflowScheme workflowScheme) Return the draft workflow scheme for the passed workflow scheme.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme) Get all Scheme entity records for a particular scheme.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) Deprecated.Workflows have a String ID.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter) Deprecated.Workflows have a String ID.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId) Deprecated.Workflows have a String ID.List<org.ofbiz.core.entity.GenericValue>
getNonDefaultEntities
(org.ofbiz.core.entity.GenericValue scheme) getParentForDraft
(long draftSchemeId) Return the original workflow scheme for the passed draft workflow scheme.getProjectsUsing
(AssignableWorkflowScheme workflowScheme) Return the list of projects that use the passed workflow scheme.Collection<org.ofbiz.core.entity.GenericValue>
getSchemesForWorkflow
(JiraWorkflow workflow) Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.getWorkflowMap
(Project project) Returns a map representation of a workflow scheme for a passed project.getWorkflowName
(Project project, String issueTypeId) Get the name of the workflow associated with the passed project and issue type.getWorkflowName
(org.ofbiz.core.entity.GenericValue scheme, String issueTypeId) Get the name of the workflow from the passed scheme associated with the passed issue type.org.ofbiz.core.entity.GenericValue
getWorkflowScheme
(Project project) org.ofbiz.core.entity.GenericValue
getWorkflowScheme
(org.ofbiz.core.entity.GenericValue project) getWorkflowSchemeObj
(long id) Return the workflow scheme with the passed id.getWorkflowSchemeObj
(Project project) Return the workflow scheme associated with the passed project.getWorkflowSchemeObj
(String name) Return the workflow scheme with the passed name.boolean
hasDraft
(AssignableWorkflowScheme workflowScheme) Tells the caller if the passed workflow scheme has a draft.boolean
isActive
(WorkflowScheme workflowScheme) Return true if the passed workflow scheme is being used by a project.boolean
isUsingDefaultScheme
(Project project) Tells the caller if the passed project is using the default workflow scheme.void
updateDraftWorkflowScheme
(ApplicationUser user, DraftWorkflowScheme scheme) Save changes to the passed draft workflow scheme.void
updateSchemesForRenamedWorkflow
(String oldWorkflowName, String newWorkflowName) Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.Save changes to the passed workflow scheme.<T> T
waitForUpdatesToFinishAndExecute
(AssignableWorkflowScheme scheme, Callable<T> task) If the passed workflow scheme is currently being edited, then this method blocks until the editing is finished.Methods inherited from interface com.atlassian.jira.scheme.SchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, createSchemeEntity, createSchemeObject, deleteEntities, deleteEntity, deleteScheme, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getGroups, getGroups, getProjects, getScheme, getScheme, getSchemeFor, getSchemeIdFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, swapParameterForEntitiesOfType, updateScheme, updateScheme
-
Method Details
-
getEntities
List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException Get all Scheme entity records for a particular scheme. Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Parameters:
scheme
- The scheme that the entities belong to- Returns:
- List of (GenericValue) entities
- Throws:
org.ofbiz.core.entity.GenericEntityException
- If a DB error occurs
-
getEntities
List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Deprecated.Workflows have a String ID. Since v6.4.Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter) throws org.ofbiz.core.entity.GenericEntityException Deprecated.Workflows have a String ID. Since v6.4.Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Deprecated.Workflows have a String ID. Since v6.4.Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getSchemeEntityName
String getSchemeEntityName() -
getEntityName
String getEntityName() -
getAssociationType
String getAssociationType() -
getSchemeDesc
String getSchemeDesc() -
getWorkflowScheme
org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
getWorkflowScheme
org.ofbiz.core.entity.GenericValue getWorkflowScheme(Project project) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
getDefaultEntity
org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
getDefaultWorkflowScheme
AssignableWorkflowScheme getDefaultWorkflowScheme() -
getNonDefaultEntities
List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
getActiveWorkflowNames
Collection<String> getActiveWorkflowNames() throws org.ofbiz.core.entity.GenericEntityException, WorkflowException- Returns:
- A collection of all workflow names currently active (ie assigned to schemes & associated with projects).
- Throws:
org.ofbiz.core.entity.GenericEntityException
WorkflowException
-
addWorkflowToScheme
void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
updateSchemesForRenamedWorkflow
Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.Note: There is no validation performed by this method to determine if the provided oldWorkflowName or newWorkflowName are valid workflow names or if the workflow is active/inactive. These validations must be done by the caller.
- Parameters:
oldWorkflowName
- name of the workflow to re-assign all its associated schemes fromnewWorkflowName
- name of the workflow to assign all the schemes associated to targetWorkflow
-
getSchemesForWorkflow
Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.- Parameters:
workflow
- the workflow whose schemes must be returned- Returns:
- workflow schemes that the passed workflow is assigned to, not including draft schemes.
-
getSchemesForWorkflowIncludingDrafts
Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.- Parameters:
workflow
- the workflow whose schemes must be returned- Returns:
- workflow schemes that the passed workflow is assigned to, including draft schemes.
-
clearWorkflowCache
void clearWorkflowCache() -
getWorkflowMap
Returns a map representation of a workflow scheme for a passed project. The returned map stores {issuetype -> workflowName}. A null issuetype points out the default workflow for the scheme.- Parameters:
project
- the project whose scheme should be returned.- Returns:
- the map representation of a workflow scheme. Each key represents an issuetype which its associated value the name of the workflow assigned to that issue type. A null issuetype points out the default workflow for that scheme.
-
getWorkflowName
Get the name of the workflow associated with the passed project and issue type.- Parameters:
project
- the project used in the search.issueTypeId
- the ID of issue type used in the search.- Returns:
- the name of the workflow associated with the passed project and issue type.
-
getWorkflowName
Get the name of the workflow from the passed scheme associated with the passed issue type.- Parameters:
scheme
- the scheme to search.issueTypeId
- the ID of issue type used in the search.- Returns:
- the name of the workflow associated with the scheme and issue type.
-
isUsingDefaultScheme
Tells the caller if the passed project is using the default workflow scheme.- Parameters:
project
- the project to check.- Returns:
- true if the passed project is using the default scheme, false otherwise.
-
hasDraft
Tells the caller if the passed workflow scheme has a draft.- Parameters:
workflowScheme
- the workflow scheme to check. It is illegal to pass a draft workflow scheme to this method.- Returns:
- true if the passed workflow has a draft false otherwise.
-
assignableBuilder
AssignableWorkflowScheme.Builder assignableBuilder()Return a builder that can be used to create a newAssignableWorkflowScheme
.- Returns:
- the builder that can be used to create the new workflow scheme.
-
draftBuilder
Return a builder that can be used to create a newDraftWorkflowScheme
for the passed workflow scheme.- Returns:
- the builder that can be used to create the new workflow scheme.
-
createScheme
Create a new workflow scheme.- Parameters:
workflowScheme
- the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).- Returns:
- the new draft scheme.
-
createDraftOf
@Nonnull DraftWorkflowScheme createDraftOf(ApplicationUser creator, @Nonnull AssignableWorkflowScheme workflowScheme) Create a draft for the passed workflow scheme. It is illegal to pass:- A scheme that already has a draft.
- A scheme that is not currently in the database.
- The default workflow scheme
- A draft workflow scheme.
- Parameters:
creator
- the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.workflowScheme
- the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).- Returns:
- the new draft scheme.
-
createDraft
@Nonnull DraftWorkflowScheme createDraft(ApplicationUser creator, @Nonnull DraftWorkflowScheme workflowScheme) Create the passed draft workflow scheme. A draft can be created using thedraftBuilder(AssignableWorkflowScheme)
method.- A scheme that already has a draft.
- A scheme that is not currently in the database.
- The default workflow scheme
- A draft workflow scheme.
- Parameters:
creator
- the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.workflowScheme
- the workflow scheme to create.- Returns:
- the new draft scheme.
-
getAssignableSchemes
Return all the assignable workflow schemes.- Returns:
- a list of all the assignable workflow schemes.
-
getWorkflowSchemeObj
Return the workflow scheme with the passed id.- Parameters:
id
- the id to search.- Returns:
- the workflow scheme with the given id or null if no such scheme exists.
-
getWorkflowSchemeObj
Return the workflow scheme with the passed name.- Parameters:
name
- the name to search.- Returns:
- the workflow scheme with the given name or null if no such scheme exists.
-
getWorkflowSchemeObj
Return the workflow scheme associated with the passed project.- Parameters:
project
- the project whose scheme is to be returned.- Returns:
- the scheme the passed project is using. Never null.
-
getDraftForParent
Return the draft workflow scheme for the passed workflow scheme.- Parameters:
workflowScheme
- the workflow scheme whose draft is being sought.- Returns:
- the draft of the passed workflow scheme or null if it does not exist.
-
getDraft
Return the draft workflow scheme with the given id.- Parameters:
id
- the id of the draft workflow scheme to be returned- Returns:
- the draft with the given id or null if it does not exist.
-
getParentForDraft
Return the original workflow scheme for the passed draft workflow scheme.- Parameters:
draftSchemeId
- the id of the draft workflow scheme whose parent is being sought.- Returns:
- the parent of the passed draft workflow scheme.
-
isActive
Return true if the passed workflow scheme is being used by a project.- Parameters:
workflowScheme
- the workflow scheme to test.- Returns:
- true if the passed workflow scheme us being used by a project; false otherwise.
-
deleteWorkflowScheme
Delete the passed workflow scheme. It is illegal to delete an active scheme, the default scheme or a scheme that is not already in the database.- Parameters:
scheme
- the scheme to delete. Cannot be the default scheme, active scheme or a scheme that is not already in the database.- Returns:
- true if the scheme was deleted; false otherwise.
-
updateDraftWorkflowScheme
DraftWorkflowScheme updateDraftWorkflowScheme(ApplicationUser user, @Nonnull DraftWorkflowScheme scheme) Save changes to the passed draft workflow scheme.- Parameters:
user
- the user making the changes.scheme
- the draft scheme to change.- Returns:
- the draft scheme as now stored in the database.
-
updateWorkflowScheme
Save changes to the passed workflow scheme.- Parameters:
scheme
- the scheme to change.- Returns:
- the scheme that is now stored in the database.
-
getProjectsUsing
Return the list of projects that use the passed workflow scheme.- Parameters:
workflowScheme
- the workflow scheme to check.- Returns:
- the list of projects that use the passed workflow scheme.
-
cleanUpSchemeDraft
If the project's workflow scheme is only used by one project and if this scheme has a draft, then the draft is copied to a separate scheme and deleted.- Parameters:
project
- project who's workflow scheme draft is to be copied to a separate scheme.user
- the user making the changes.- Returns:
- copied scheme or null if it was not created.
-
copyDraft
AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft, ApplicationUser user, String newDescription) -
replaceSchemeWithDraft
-
waitForUpdatesToFinishAndExecute
<T> T waitForUpdatesToFinishAndExecute(AssignableWorkflowScheme scheme, Callable<T> task) throws Exception If the passed workflow scheme is currently being edited, then this method blocks until the editing is finished. Executes the passed Callable task in the end and returns its result. Workflow scheme editing will be blocked until the task execution finishes.- Type Parameters:
T
- return type of the task.- Parameters:
scheme
- the workflow scheme.task
- task to execute.- Returns:
- the value returned by the passed task.
- Throws:
Exception
- any exception occurred during task execution.
-