Package com.atlassian.jira.workflow
Class DefaultWorkflowSchemeManager
java.lang.Object
com.atlassian.jira.scheme.AbstractSchemeManager
com.atlassian.jira.workflow.DefaultWorkflowSchemeManager
- All Implemented Interfaces:
Startable
,SchemeManager
,WorkflowSchemeManager
public class DefaultWorkflowSchemeManager
extends AbstractSchemeManager
implements WorkflowSchemeManager, Startable
-
Field Summary
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
eventPublisher, groupManager, projectManager, schemeFactory, securityTypeManager
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWorkflowSchemeManager
(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, WorkflowManager workflowManager, ConstantsManager constantsManager, OfBizDelegator ofBizDelegator, com.atlassian.event.api.EventPublisher eventPublisher, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, DraftWorkflowSchemeStore draftWorkflowSchemeStore, JiraAuthenticationContext context, UserManager userManager, I18nHelper.BeanFactory i18nFactory, AssignableWorkflowSchemeStore assignableWorkflowSchemeStore, com.atlassian.cache.CacheManager cacheManager, com.atlassian.beehive.ClusterLockService clusterLockService) -
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.org.ofbiz.core.entity.GenericValue
createScheme
(String name, String description) Creates a new schemeprotected AbstractSchemeAddedToProjectEvent
createSchemeAddedToProjectEvent
(Scheme scheme, Project project) protected AbstractSchemeCopiedEvent
createSchemeCopiedEvent
(Scheme oldScheme, Scheme newScheme) protected AbstractSchemeEvent
createSchemeCreatedEvent
(Scheme scheme) org.ofbiz.core.entity.GenericValue
createSchemeEntity
(long schemeId, SchemeEntity schemeEntity) org.ofbiz.core.entity.GenericValue
createSchemeEntity
(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) protected Object
createSchemeEntityDeletedEvent
(org.ofbiz.core.entity.GenericValue entity) protected org.ofbiz.core.entity.GenericValue
createSchemeEntityNoEvent
(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) protected AbstractSchemeRemovedFromProjectEvent
createSchemeRemovedFromProjectEvent
(Scheme scheme, Project project) protected AbstractSchemeUpdatedEvent
createSchemeUpdatedEvent
(Scheme scheme, Scheme originalScheme) void
deleteEntities
(Iterable<Long> ids) Deletes a collection of entities from the database.void
deleteEntity
(Long id) Deletes an entity with the given id from the database.void
deleteScheme
(Long id) Deletes a scheme from the databaseboolean
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.protected void
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.Return the draft workflow scheme for the passed workflow scheme.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String issuetype) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId) Inherited from SchemeManager.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 scheme) Tells the caller if the passed workflow scheme has a draft.boolean
isActive
(WorkflowScheme scheme) 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.protected SchemeEntity
makeSchemeEntity
(org.ofbiz.core.entity.GenericValue entity) void
onClearCache
(ClearCacheEvent event) boolean
removeEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) Retrieves all the entites for this permission and then removes them.void
void
start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.updateDraftWorkflowScheme
(ApplicationUser user, DraftWorkflowScheme scheme) Save changes to the passed draft workflow scheme.void
updateScheme
(Scheme scheme) Updates any changes to the scheme object.void
updateScheme
(org.ofbiz.core.entity.GenericValue entity) Updates any changes to the given schemevoid
updateSchemesForRenamedWorkflow
(String oldWorkflowName, String newWorkflowName) Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.updateWorkflowScheme
(AssignableWorkflowScheme workflowScheme) 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 class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, getApplicationI18n, getAssociatedSchemes, getAssociationType, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntities, getEntitiesByIds, getEntity, getGroups, getGroups, getNameForCopy, getProjects, getScheme, getScheme, getSchemeFor, getSchemeIdFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, swapParameterForEntitiesOfType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.scheme.SchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeObject, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getGroups, getGroups, getProjects, getScheme, getScheme, getSchemeFor, getSchemeIdFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, swapParameterForEntitiesOfType
Methods inherited from interface com.atlassian.jira.workflow.WorkflowSchemeManager
getAssociationType, getEntities
-
Constructor Details
-
DefaultWorkflowSchemeManager
public DefaultWorkflowSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, WorkflowManager workflowManager, ConstantsManager constantsManager, OfBizDelegator ofBizDelegator, com.atlassian.event.api.EventPublisher eventPublisher, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, DraftWorkflowSchemeStore draftWorkflowSchemeStore, JiraAuthenticationContext context, UserManager userManager, I18nHelper.BeanFactory i18nFactory, AssignableWorkflowSchemeStore assignableWorkflowSchemeStore, com.atlassian.cache.CacheManager cacheManager, com.atlassian.beehive.ClusterLockService clusterLockService)
-
-
Method Details
-
start
public void start()Description copied from interface:Startable
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework. -
onClearCache
- Overrides:
onClearCache
in classAbstractSchemeManager
-
getSchemeEntityName
- Specified by:
getSchemeEntityName
in interfaceWorkflowSchemeManager
- Specified by:
getSchemeEntityName
in classAbstractSchemeManager
-
getEntityName
- Specified by:
getEntityName
in interfaceWorkflowSchemeManager
- Specified by:
getEntityName
in classAbstractSchemeManager
-
clearWorkflowCache
public void clearWorkflowCache()- Specified by:
clearWorkflowCache
in interfaceWorkflowSchemeManager
-
getSchemeDesc
- Specified by:
getSchemeDesc
in interfaceWorkflowSchemeManager
- Specified by:
getSchemeDesc
in classAbstractSchemeManager
-
getDefaultNameKey
- Specified by:
getDefaultNameKey
in classAbstractSchemeManager
-
getDefaultDescriptionKey
- Specified by:
getDefaultDescriptionKey
in classAbstractSchemeManager
-
getWorkflowScheme
public org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
getWorkflowScheme
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getWorkflowScheme
public org.ofbiz.core.entity.GenericValue getWorkflowScheme(Project project) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
getWorkflowScheme
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
hasDraft
Description copied from interface:WorkflowSchemeManager
Tells the caller if the passed workflow scheme has a draft.- Specified by:
hasDraft
in interfaceWorkflowSchemeManager
- Parameters:
scheme
- 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.
-
createScheme
@Nonnull public AssignableWorkflowScheme createScheme(@Nonnull AssignableWorkflowScheme workflowScheme) Description copied from interface:WorkflowSchemeManager
Create a new workflow scheme.- Specified by:
createScheme
in interfaceWorkflowSchemeManager
- 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.
-
createSchemeEntity
public org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
createSchemeEntity
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
createSchemeEntityNoEvent
protected org.ofbiz.core.entity.GenericValue createSchemeEntityNoEvent(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
createSchemeEntityNoEvent
in classAbstractSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
createSchemeEntity
public org.ofbiz.core.entity.GenericValue createSchemeEntity(long schemeId, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException - Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String issuetype) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:WorkflowSchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Specified by:
getEntities
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getWorkflowMap
Description copied from interface:WorkflowSchemeManager
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.- Specified by:
getWorkflowMap
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Get the name of the workflow associated with the passed project and issue type.- Specified by:
getWorkflowName
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Get the name of the workflow from the passed scheme associated with the passed issue type.- Specified by:
getWorkflowName
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Tells the caller if the passed project is using the default workflow scheme.- Specified by:
isUsingDefaultScheme
in interfaceWorkflowSchemeManager
- Parameters:
project
- the project to check.- Returns:
- true if the passed project is using the default scheme, false otherwise.
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:WorkflowSchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Specified by:
getEntities
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:WorkflowSchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Specified by:
getEntities
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:WorkflowSchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceSchemeManager
- Specified by:
getEntities
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getDefaultEntity
public org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
getDefaultEntity
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getDefaultWorkflowScheme
- Specified by:
getDefaultWorkflowScheme
in interfaceWorkflowSchemeManager
-
getNonDefaultEntities
public List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
getNonDefaultEntities
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getActiveWorkflowNames
public Collection<String> getActiveWorkflowNames() throws org.ofbiz.core.entity.GenericEntityException, WorkflowException- Specified by:
getActiveWorkflowNames
in interfaceWorkflowSchemeManager
- Returns:
- A collection of all workflow names currently active (ie assigned to schemes & associated with projects).
- Throws:
org.ofbiz.core.entity.GenericEntityException
WorkflowException
-
addWorkflowToScheme
public void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
addWorkflowToScheme
in interfaceWorkflowSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
createDraftOf
@Nonnull public DraftWorkflowScheme createDraftOf(ApplicationUser creator, @Nonnull AssignableWorkflowScheme workflowScheme) Description copied from interface:WorkflowSchemeManager
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.
- Specified by:
createDraftOf
in interfaceWorkflowSchemeManager
- 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 public DraftWorkflowScheme createDraft(ApplicationUser creator, @Nonnull DraftWorkflowScheme workflowScheme) Description copied from interface:WorkflowSchemeManager
Create the passed draft workflow scheme. A draft can be created using theWorkflowSchemeManager.draftBuilder(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.
- Specified by:
createDraft
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Return all the assignable workflow schemes.- Specified by:
getAssignableSchemes
in interfaceWorkflowSchemeManager
- Returns:
- a list of all the assignable workflow schemes.
-
updateSchemesForRenamedWorkflow
Description copied from interface:WorkflowSchemeManager
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.
- Specified by:
updateSchemesForRenamedWorkflow
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.- Specified by:
getSchemesForWorkflow
in interfaceWorkflowSchemeManager
- Parameters:
workflow
- the workflow whose schemes must be returned- Returns:
- workflow schemes that the passed workflow is assigned to, not including draft schemes.
-
getSchemesForWorkflowIncludingDrafts
Description copied from interface:WorkflowSchemeManager
Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.- Specified by:
getSchemesForWorkflowIncludingDrafts
in interfaceWorkflowSchemeManager
- Parameters:
workflow
- the workflow whose schemes must be returned- Returns:
- workflow schemes that the passed workflow is assigned to, including draft schemes.
-
deleteEntity
Description copied from interface:SchemeManager
Deletes an entity with the given id from the database.- Specified by:
deleteEntity
in interfaceSchemeManager
- Overrides:
deleteEntity
in classAbstractSchemeManager
- Parameters:
id
- The id of the entity to be deleted- Throws:
DataAccessException
-
deleteEntities
Description copied from interface:SchemeManager
Deletes a collection of entities from the database.- Specified by:
deleteEntities
in interfaceSchemeManager
- Overrides:
deleteEntities
in classAbstractSchemeManager
- Parameters:
ids
- a collection entity ids to be deleted.
-
makeSchemeEntity
- Specified by:
makeSchemeEntity
in classAbstractSchemeManager
-
createSchemeEntityDeletedEvent
- Specified by:
createSchemeEntityDeletedEvent
in classAbstractSchemeManager
-
removeEntities
public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) throws RemoveException Description copied from interface:SchemeManager
Retrieves all the entites for this permission and then removes them.- Specified by:
removeEntities
in interfaceSchemeManager
- Overrides:
removeEntities
in classAbstractSchemeManager
- Parameters:
scheme
- to remove entites from must NOT be nullentityTypeId
- to remove- Returns:
- True all the time (legacy)
- Throws:
RemoveException
- if the delete fails (DB error)
-
createScheme
public org.ofbiz.core.entity.GenericValue createScheme(String name, String description) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:SchemeManager
Creates a new scheme- Specified by:
createScheme
in interfaceSchemeManager
- Overrides:
createScheme
in classAbstractSchemeManager
- Parameters:
name
- The name of the new schemedescription
- The description of the new scheme- Returns:
- The new scheme object
- Throws:
org.ofbiz.core.entity.GenericEntityException
- If a DB error occurs
-
createSchemeCreatedEvent
- Specified by:
createSchemeCreatedEvent
in classAbstractSchemeManager
-
createSchemeCopiedEvent
@Nonnull protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull Scheme oldScheme, @Nonnull Scheme newScheme) - Specified by:
createSchemeCopiedEvent
in classAbstractSchemeManager
-
deleteScheme
Description copied from interface:SchemeManager
Deletes a scheme from the database- Specified by:
deleteScheme
in interfaceSchemeManager
- Overrides:
deleteScheme
in classAbstractSchemeManager
- Parameters:
id
- Id of the scheme to be deleted
-
createSchemeAddedToProjectEvent
@Nonnull protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project) - Specified by:
createSchemeAddedToProjectEvent
in classAbstractSchemeManager
-
flushProjectSchemes
protected void flushProjectSchemes()- Overrides:
flushProjectSchemes
in classAbstractSchemeManager
-
getWorkflowSchemeObj
Description copied from interface:WorkflowSchemeManager
Return the workflow scheme with the passed id.- Specified by:
getWorkflowSchemeObj
in interfaceWorkflowSchemeManager
- Parameters:
id
- the id to search.- Returns:
- the workflow scheme with the given id or null if no such scheme exists.
-
getWorkflowSchemeObj
Description copied from interface:WorkflowSchemeManager
Return the workflow scheme with the passed name.- Specified by:
getWorkflowSchemeObj
in interfaceWorkflowSchemeManager
- Parameters:
name
- the name to search.- Returns:
- the workflow scheme with the given name or null if no such scheme exists.
-
getDraftForParent
Description copied from interface:WorkflowSchemeManager
Return the draft workflow scheme for the passed workflow scheme.- Specified by:
getDraftForParent
in interfaceWorkflowSchemeManager
- Parameters:
scheme
- the workflow scheme whose draft is being sought.- Returns:
- the draft of the passed workflow scheme or null if it does not exist.
-
getDraft
Description copied from interface:WorkflowSchemeManager
Return the draft workflow scheme with the given id.- Specified by:
getDraft
in interfaceWorkflowSchemeManager
- 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
Description copied from interface:WorkflowSchemeManager
Return the original workflow scheme for the passed draft workflow scheme.- Specified by:
getParentForDraft
in interfaceWorkflowSchemeManager
- Parameters:
draftSchemeId
- the id of the draft workflow scheme whose parent is being sought.- Returns:
- the parent of the passed draft workflow scheme.
-
isActive
Description copied from interface:WorkflowSchemeManager
Return true if the passed workflow scheme is being used by a project.- Specified by:
isActive
in interfaceWorkflowSchemeManager
- Parameters:
scheme
- the workflow scheme to test.- Returns:
- true if the passed workflow scheme us being used by a project; false otherwise.
-
deleteWorkflowScheme
Description copied from interface:WorkflowSchemeManager
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.- Specified by:
deleteWorkflowScheme
in interfaceWorkflowSchemeManager
- 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
public DraftWorkflowScheme updateDraftWorkflowScheme(ApplicationUser user, @Nonnull DraftWorkflowScheme scheme) Description copied from interface:WorkflowSchemeManager
Save changes to the passed draft workflow scheme.- Specified by:
updateDraftWorkflowScheme
in interfaceWorkflowSchemeManager
- Parameters:
user
- the user making the changes.scheme
- the draft scheme to change.- Returns:
- the draft scheme as now stored in the database.
-
updateWorkflowScheme
public AssignableWorkflowScheme updateWorkflowScheme(@Nonnull AssignableWorkflowScheme workflowScheme) Description copied from interface:WorkflowSchemeManager
Save changes to the passed workflow scheme.- Specified by:
updateWorkflowScheme
in interfaceWorkflowSchemeManager
- Parameters:
workflowScheme
- the scheme to change.- Returns:
- the scheme that is now stored in the database.
-
updateScheme
public void updateScheme(org.ofbiz.core.entity.GenericValue entity) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:SchemeManager
Updates any changes to the given scheme- Specified by:
updateScheme
in interfaceSchemeManager
- Overrides:
updateScheme
in classAbstractSchemeManager
- Parameters:
entity
- The modified scheme- Throws:
org.ofbiz.core.entity.GenericEntityException
- If a DB error occurs
-
updateScheme
Description copied from interface:SchemeManager
Updates any changes to the scheme object. This does not include changes to the scheme entities.- Specified by:
updateScheme
in interfaceSchemeManager
- Overrides:
updateScheme
in classAbstractSchemeManager
- Parameters:
scheme
- The modified scheme object- Throws:
DataAccessException
-
createSchemeRemovedFromProjectEvent
@Nonnull protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project) - Specified by:
createSchemeRemovedFromProjectEvent
in classAbstractSchemeManager
-
createSchemeUpdatedEvent
- Specified by:
createSchemeUpdatedEvent
in classAbstractSchemeManager
-
waitForUpdatesToFinishAndExecute
public <T> T waitForUpdatesToFinishAndExecute(AssignableWorkflowScheme scheme, Callable<T> task) throws Exception Description copied from interface:WorkflowSchemeManager
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.- Specified by:
waitForUpdatesToFinishAndExecute
in interfaceWorkflowSchemeManager
- 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.
-
getWorkflowSchemeObj
Description copied from interface:WorkflowSchemeManager
Return the workflow scheme associated with the passed project.- Specified by:
getWorkflowSchemeObj
in interfaceWorkflowSchemeManager
- Parameters:
project
- the project whose scheme is to be returned.- Returns:
- the scheme the passed project is using. Never null.
-
getProjectsUsing
Description copied from interface:WorkflowSchemeManager
Return the list of projects that use the passed workflow scheme.- Specified by:
getProjectsUsing
in interfaceWorkflowSchemeManager
- Parameters:
workflowScheme
- the workflow scheme to check.- Returns:
- the list of projects that use the passed workflow scheme.
-
cleanUpSchemeDraft
Description copied from interface:WorkflowSchemeManager
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.- Specified by:
cleanUpSchemeDraft
in interfaceWorkflowSchemeManager
- 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
public AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft, ApplicationUser user, String newDescription) - Specified by:
copyDraft
in interfaceWorkflowSchemeManager
-
replaceSchemeWithDraft
- Specified by:
replaceSchemeWithDraft
in interfaceWorkflowSchemeManager
-
assignableBuilder
Description copied from interface:WorkflowSchemeManager
Return a builder that can be used to create a newAssignableWorkflowScheme
.- Specified by:
assignableBuilder
in interfaceWorkflowSchemeManager
- Returns:
- the builder that can be used to create the new workflow scheme.
-
draftBuilder
Description copied from interface:WorkflowSchemeManager
Return a builder that can be used to create a newDraftWorkflowScheme
for the passed workflow scheme.- Specified by:
draftBuilder
in interfaceWorkflowSchemeManager
- Returns:
- the builder that can be used to create the new workflow scheme.
-