com.atlassian.jira.workflow
Class DefaultWorkflowSchemeManager

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by 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, projectManager, schemeFactory, securityTypeManager
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
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)
           
 
Method Summary
 void addSchemeToProject(org.ofbiz.core.entity.GenericValue project, org.ofbiz.core.entity.GenericValue scheme)
          Adds a scheme to a particular project
 void addSchemeToProject(Project project, Scheme scheme)
          Adds a scheme to a particular project
 void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId)
           
 AssignableWorkflowScheme.Builder assignableBuilder()
          Return a builder that can be used to create a new AssignableWorkflowScheme.
 AssignableWorkflowScheme cleanUpSchemeDraft(Project project, com.atlassian.crowd.embedded.api.User 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 clearWorkflowCache()
           
 AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft, com.atlassian.crowd.embedded.api.User user, String newDescription)
           
 DraftWorkflowScheme createDraft(ApplicationUser creator, DraftWorkflowScheme workflowScheme)
          Create the passed draft workflow scheme.
 DraftWorkflowScheme createDraftOf(ApplicationUser creator, AssignableWorkflowScheme workflowScheme)
          Create a draft for the passed workflow scheme.
 AssignableWorkflowScheme createScheme(AssignableWorkflowScheme workflowScheme)
          Create a new workflow scheme.
 org.ofbiz.core.entity.GenericValue createScheme(String name, String description)
          Creates a new scheme
protected  AbstractSchemeCopiedEvent createSchemeCopiedEvent(Scheme oldScheme, Scheme newScheme)
           
protected  AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
           
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
 org.ofbiz.core.entity.GenericValue createSchemeEntity(long schemeId, 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  WorkflowSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Long schemeId, Long projectId)
           
protected  AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme, Scheme originalScheme)
           
 void deleteEntity(Long id)
          Deletes an entity with the given id from the database.
 void deleteScheme(Long id)
          Deletes a scheme from the database
 boolean deleteWorkflowScheme(WorkflowScheme scheme)
          Delete the passed workflow scheme.
 DraftWorkflowScheme.Builder draftBuilder(AssignableWorkflowScheme parent)
          Return a builder that can be used to create a new DraftWorkflowScheme for the passed workflow scheme.
protected  void flushProjectSchemes()
           
 Collection<String> getActiveWorkflowNames()
           
protected  List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()
           
 Iterable<AssignableWorkflowScheme> getAssignableSchemes()
          Return all the assignable workflow schemes.
 String getDefaultDescriptionKey()
           
 org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme)
           
 String getDefaultNameKey()
           
 AssignableWorkflowScheme getDefaultWorkflowScheme()
           
 DraftWorkflowScheme getDraft(long id)
          Return the draft workflow scheme with the given id.
 DraftWorkflowScheme getDraftForParent(AssignableWorkflowScheme scheme)
          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)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String issuetype)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId)
           
 String getEntityName()
           
 List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme)
           
 AssignableWorkflowScheme getParentForDraft(long draftSchemeId)
          Return the original workflow scheme for the passed draft workflow scheme.
 List<Project> getProjectsUsing(AssignableWorkflowScheme workflowScheme)
          Return the list of projects that use the passed workflow scheme.
 String getSchemeDesc()
           
 String getSchemeEntityName()
           
 Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
          Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.
 Iterable<WorkflowScheme> getSchemesForWorkflowIncludingDrafts(JiraWorkflow workflow)
          Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.
protected  JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue workflowScheme, String issueTypeId)
           
 Map<String,String> getWorkflowMap(Project project)
          Returns a map representation of a workflow scheme for a passed project.
 String getWorkflowName(org.ofbiz.core.entity.GenericValue scheme, String issueType)
          Get the name of the workflow from the passed scheme associated with the passed issue type.
 String getWorkflowName(Project project, String issueType)
          Get the name of the workflow associated with the passed project and issue type.
 org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project)
           
 AssignableWorkflowScheme getWorkflowSchemeObj(long id)
          Return the workflow scheme with the passed id.
 AssignableWorkflowScheme getWorkflowSchemeObj(Project project)
          Return the workflow scheme associated with the passed project.
 AssignableWorkflowScheme 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 hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue entity)
          Checks anonymous permission of the given permission type for the given entity.
 boolean hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue entity, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Checks the given user's permission of the given permission type for the given entity.
 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 replaceSchemeWithDraft(DraftWorkflowScheme draft)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 DraftWorkflowScheme 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 updateSchemesForRenamedWorkflow(String oldWorkflowName, String newWorkflowName)
          Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.
 AssignableWorkflowScheme 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, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, getAssociatedSchemes, getAssociationType, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntities, getEntity, getGroups, getGroups, getNameForCopy, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme
 
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.workflow.WorkflowSchemeManager
getAssociationType
 
Methods inherited from interface com.atlassian.jira.scheme.SchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeObject, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntities, getEntity, getGroups, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme
 

Constructor Detail

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)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)
Overrides:
onClearCache in class AbstractSchemeManager

getSchemeEntityName

public String getSchemeEntityName()
Specified by:
getSchemeEntityName in interface WorkflowSchemeManager
Specified by:
getSchemeEntityName in class AbstractSchemeManager

getEntityName

public String getEntityName()
Specified by:
getEntityName in interface WorkflowSchemeManager
Specified by:
getEntityName in class AbstractSchemeManager

clearWorkflowCache

public void clearWorkflowCache()
Specified by:
clearWorkflowCache in interface WorkflowSchemeManager

getSchemeDesc

public String getSchemeDesc()
Specified by:
getSchemeDesc in interface WorkflowSchemeManager
Specified by:
getSchemeDesc in class AbstractSchemeManager

getDefaultNameKey

public String getDefaultNameKey()
Specified by:
getDefaultNameKey in class AbstractSchemeManager

getDefaultDescriptionKey

public String getDefaultDescriptionKey()
Specified by:
getDefaultDescriptionKey in class AbstractSchemeManager

getWorkflowScheme

public org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getWorkflowScheme in interface WorkflowSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

hasDraft

public boolean hasDraft(@Nonnull
                        AssignableWorkflowScheme scheme)
Description copied from interface: WorkflowSchemeManager
Tells the caller if the passed workflow scheme has a draft.

Specified by:
hasDraft in interface WorkflowSchemeManager
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 interface WorkflowSchemeManager
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 interface SchemeManager
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 class AbstractSchemeManager
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
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getWorkflowMap

public Map<String,String> getWorkflowMap(Project project)
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 interface WorkflowSchemeManager
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

public String getWorkflowName(Project project,
                              String issueType)
Description copied from interface: WorkflowSchemeManager
Get the name of the workflow associated with the passed project and issue type.

Specified by:
getWorkflowName in interface WorkflowSchemeManager
Parameters:
project - the project used in the search.
issueType - the issue type used in the search.
Returns:
the name of the workflow associated with the passed project and issue type.

getWorkflowName

public String getWorkflowName(org.ofbiz.core.entity.GenericValue scheme,
                              String issueType)
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 interface WorkflowSchemeManager
Parameters:
scheme - the scheme to search.
issueType - the issue type used in the search.
Returns:
the name of the workflow associated with the scheme and issue type.

isUsingDefaultScheme

public boolean isUsingDefaultScheme(Project project)
Description copied from interface: WorkflowSchemeManager
Tells the caller if the passed project is using the default workflow scheme.

Specified by:
isUsingDefaultScheme in interface WorkflowSchemeManager
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
Specified by:
getEntities in interface SchemeManager
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
Specified by:
getEntities in interface SchemeManager
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
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

hasSchemeAuthority

public boolean hasSchemeAuthority(Long entityType,
                                  org.ofbiz.core.entity.GenericValue entity)
Description copied from interface: SchemeManager
Checks anonymous permission of the given permission type for the given entity.

Specified by:
hasSchemeAuthority in interface SchemeManager
Parameters:
entityType - permission type.
entity - the entity to which permission is being checked.
Returns:
true only if the anonymous user is permitted.

hasSchemeAuthority

public boolean hasSchemeAuthority(Long entityType,
                                  org.ofbiz.core.entity.GenericValue entity,
                                  com.atlassian.crowd.embedded.api.User user,
                                  boolean issueCreation)
Description copied from interface: SchemeManager
Checks the given user's permission of the given permission type for the given entity.

Specified by:
hasSchemeAuthority in interface SchemeManager
Parameters:
entityType - permission type.
entity - the entity to which permission is being checked.
user - the user.
issueCreation - whether the permission is for creating an issue.
Returns:
true only if the user is permitted.

getDefaultEntity

public org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme)
                                                    throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getDefaultEntity in interface WorkflowSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getDefaultWorkflowScheme

public AssignableWorkflowScheme getDefaultWorkflowScheme()
Specified by:
getDefaultWorkflowScheme in interface WorkflowSchemeManager

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 interface WorkflowSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getActiveWorkflowNames

public Collection<String> getActiveWorkflowNames()
                                          throws org.ofbiz.core.entity.GenericEntityException,
                                                 WorkflowException
Specified by:
getActiveWorkflowNames in interface WorkflowSchemeManager
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 interface WorkflowSchemeManager
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:

Specified by:
createDraftOf in interface WorkflowSchemeManager
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 the WorkflowSchemeManager.draftBuilder(AssignableWorkflowScheme) method.

Specified by:
createDraft in interface WorkflowSchemeManager
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

@Nonnull
public Iterable<AssignableWorkflowScheme> getAssignableSchemes()
Description copied from interface: WorkflowSchemeManager
Return all the assignable workflow schemes.

Specified by:
getAssignableSchemes in interface WorkflowSchemeManager
Returns:
a list of all the assignable workflow schemes.

updateSchemesForRenamedWorkflow

public void updateSchemesForRenamedWorkflow(String oldWorkflowName,
                                            String newWorkflowName)
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 interface WorkflowSchemeManager
Parameters:
oldWorkflowName - name of the workflow to re-assign all its associated schemes from
newWorkflowName - name of the workflow to assign all the schemes associated to targetWorkflow

getSchemesForWorkflow

public Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
Description copied from interface: WorkflowSchemeManager
Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.

Specified by:
getSchemesForWorkflow in interface WorkflowSchemeManager
Parameters:
workflow - the workflow whose schemes must be returned
Returns:
workflow schemes that the passed workflow is assigned to, not including draft schemes.

getSchemesForWorkflowIncludingDrafts

public Iterable<WorkflowScheme> getSchemesForWorkflowIncludingDrafts(JiraWorkflow workflow)
Description copied from interface: WorkflowSchemeManager
Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.

Specified by:
getSchemesForWorkflowIncludingDrafts in interface WorkflowSchemeManager
Parameters:
workflow - the workflow whose schemes must be returned
Returns:
workflow schemes that the passed workflow is assigned to, including draft schemes.

deleteEntity

public void deleteEntity(Long id)
                  throws DataAccessException
Description copied from interface: SchemeManager
Deletes an entity with the given id from the database.

Specified by:
deleteEntity in interface SchemeManager
Overrides:
deleteEntity in class AbstractSchemeManager
Parameters:
id - The id of the entity to be deleted
Throws:
DataAccessException

makeSchemeEntity

protected SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue entity)
Specified by:
makeSchemeEntity in class AbstractSchemeManager

createSchemeEntityDeletedEvent

protected Object createSchemeEntityDeletedEvent(org.ofbiz.core.entity.GenericValue entity)
Specified by:
createSchemeEntityDeletedEvent in class AbstractSchemeManager

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 interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
scheme - to remove entites from must NOT be null
entityTypeId - 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 interface SchemeManager
Overrides:
createScheme in class AbstractSchemeManager
Parameters:
name - The name of the new scheme
description - The description of the new scheme
Returns:
The new scheme object
Throws:
org.ofbiz.core.entity.GenericEntityException - If a DB error occurs

createSchemeCreatedEvent

protected AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
Specified by:
createSchemeCreatedEvent in class AbstractSchemeManager

createSchemeCopiedEvent

protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull
                                                            Scheme oldScheme,
                                                            @Nonnull
                                                            Scheme newScheme)
Specified by:
createSchemeCopiedEvent in class AbstractSchemeManager

deleteScheme

public void deleteScheme(Long id)
Description copied from interface: SchemeManager
Deletes a scheme from the database

Specified by:
deleteScheme in interface SchemeManager
Overrides:
deleteScheme in class AbstractSchemeManager
Parameters:
id - Id of the scheme to be deleted

addSchemeToProject

public void addSchemeToProject(org.ofbiz.core.entity.GenericValue project,
                               org.ofbiz.core.entity.GenericValue scheme)
                        throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: SchemeManager
Adds a scheme to a particular project

Specified by:
addSchemeToProject in interface SchemeManager
Overrides:
addSchemeToProject in class AbstractSchemeManager
Parameters:
project - The project that the scheme is to be added to
scheme - The scheme to be added
Throws:
org.ofbiz.core.entity.GenericEntityException - If a DB error occurs

addSchemeToProject

public void addSchemeToProject(Project project,
                               Scheme scheme)
                        throws DataAccessException
Description copied from interface: SchemeManager
Adds a scheme to a particular project

Specified by:
addSchemeToProject in interface SchemeManager
Overrides:
addSchemeToProject in class AbstractSchemeManager
Parameters:
project - The project that the scheme is to be added to
scheme - The scheme to be added
Throws:
DataAccessException

flushProjectSchemes

protected void flushProjectSchemes()
Overrides:
flushProjectSchemes in class AbstractSchemeManager

getAllIssueTypes

protected List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()

getWorkflowFromScheme

protected JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue workflowScheme,
                                             String issueTypeId)

getWorkflowSchemeObj

@Nullable
public AssignableWorkflowScheme getWorkflowSchemeObj(long id)
Description copied from interface: WorkflowSchemeManager
Return the workflow scheme with the passed id.

Specified by:
getWorkflowSchemeObj in interface WorkflowSchemeManager
Parameters:
id - the id to search.
Returns:
the workflow scheme with the given id or null if no such scheme exists.

getWorkflowSchemeObj

public AssignableWorkflowScheme getWorkflowSchemeObj(String name)
Description copied from interface: WorkflowSchemeManager
Return the workflow scheme with the passed name.

Specified by:
getWorkflowSchemeObj in interface WorkflowSchemeManager
Parameters:
name - the name to search.
Returns:
the workflow scheme with the given name or null if no such scheme exists.

getDraftForParent

public DraftWorkflowScheme getDraftForParent(@Nonnull
                                             AssignableWorkflowScheme scheme)
Description copied from interface: WorkflowSchemeManager
Return the draft workflow scheme for the passed workflow scheme.

Specified by:
getDraftForParent in interface WorkflowSchemeManager
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

public DraftWorkflowScheme getDraft(long id)
Description copied from interface: WorkflowSchemeManager
Return the draft workflow scheme with the given id.

Specified by:
getDraft in interface WorkflowSchemeManager
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

public AssignableWorkflowScheme getParentForDraft(long draftSchemeId)
Description copied from interface: WorkflowSchemeManager
Return the original workflow scheme for the passed draft workflow scheme.

Specified by:
getParentForDraft in interface WorkflowSchemeManager
Parameters:
draftSchemeId - the id of the draft workflow scheme whose parent is being sought.
Returns:
the parent of the passed draft workflow scheme.

isActive

public boolean isActive(@Nonnull
                        WorkflowScheme scheme)
Description copied from interface: WorkflowSchemeManager
Return true if the passed workflow scheme is being used by a project.

Specified by:
isActive in interface WorkflowSchemeManager
Parameters:
scheme - the workflow scheme to test.
Returns:
true if the passed workflow scheme us being used by a project; false otherwise.

deleteWorkflowScheme

public boolean deleteWorkflowScheme(@Nonnull
                                    WorkflowScheme scheme)
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 interface WorkflowSchemeManager
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 interface WorkflowSchemeManager
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 interface WorkflowSchemeManager
Parameters:
workflowScheme - the scheme to change.
Returns:
the scheme that is now stored in the database.

updateScheme

public void updateScheme(Scheme scheme)
                  throws DataAccessException
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 interface SchemeManager
Overrides:
updateScheme in class AbstractSchemeManager
Parameters:
scheme - The modified scheme object
Throws:
DataAccessException

createSchemeRemovedFromProjectEvent

protected WorkflowSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Long schemeId,
                                                                                    Long projectId)
Specified by:
createSchemeRemovedFromProjectEvent in class AbstractSchemeManager

createSchemeUpdatedEvent

protected AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme,
                                                              Scheme originalScheme)
Specified by:
createSchemeUpdatedEvent in class AbstractSchemeManager

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 it's result. Workflow scheme editing will be blocked until the task execution finishes.

Specified by:
waitForUpdatesToFinishAndExecute in interface WorkflowSchemeManager
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

@Nonnull
public AssignableWorkflowScheme getWorkflowSchemeObj(@Nonnull
                                                             Project project)
Description copied from interface: WorkflowSchemeManager
Return the workflow scheme associated with the passed project.

Specified by:
getWorkflowSchemeObj in interface WorkflowSchemeManager
Parameters:
project - the project whose scheme is to be returned.
Returns:
the scheme the passed project is using. Never null.

getProjectsUsing

@Nonnull
public List<Project> getProjectsUsing(@Nonnull
                                              AssignableWorkflowScheme workflowScheme)
Description copied from interface: WorkflowSchemeManager
Return the list of projects that use the passed workflow scheme.

Specified by:
getProjectsUsing in interface WorkflowSchemeManager
Parameters:
workflowScheme - the workflow scheme to check.
Returns:
the list of projects that use the passed workflow scheme.

cleanUpSchemeDraft

public AssignableWorkflowScheme cleanUpSchemeDraft(Project project,
                                                   com.atlassian.crowd.embedded.api.User user)
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 interface WorkflowSchemeManager
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,
                                          com.atlassian.crowd.embedded.api.User user,
                                          String newDescription)
Specified by:
copyDraft in interface WorkflowSchemeManager

replaceSchemeWithDraft

public void replaceSchemeWithDraft(DraftWorkflowScheme draft)
Specified by:
replaceSchemeWithDraft in interface WorkflowSchemeManager

assignableBuilder

public AssignableWorkflowScheme.Builder assignableBuilder()
Description copied from interface: WorkflowSchemeManager
Return a builder that can be used to create a new AssignableWorkflowScheme.

Specified by:
assignableBuilder in interface WorkflowSchemeManager
Returns:
the builder that can be used to create the new workflow scheme.

draftBuilder

public DraftWorkflowScheme.Builder draftBuilder(AssignableWorkflowScheme parent)
Description copied from interface: WorkflowSchemeManager
Return a builder that can be used to create a new DraftWorkflowScheme for the passed workflow scheme.

Specified by:
draftBuilder in interface WorkflowSchemeManager
Returns:
the builder that can be used to create the new workflow scheme.


Copyright © 2002-2014 Atlassian. All Rights Reserved.