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
projectManager, schemeFactory
 
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, AssociationManager associationManager, GroupManager groupManager)
           
 
Method Summary
 void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId)
           
 void clearWorkflowCache()
           
 org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme, org.ofbiz.core.entity.GenericValue entity)
           
 org.ofbiz.core.entity.GenericValue createScheme(String name, String description)
          Creates a new scheme
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
 Scheme createSchemeObject(String name, String description)
          Creates a new scheme
 void deleteEntity(Long id)
          Deletes an entity with the given id from the database.
protected  void flushProjectSchemes()
           
 Collection<String> getActiveWorkflowNames()
           
protected  List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()
           
 String getDefaultDescriptionKey()
           
 org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme)
           
 String getDefaultNameKey()
           
 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)
           
 String getSchemeDesc()
           
 String getSchemeEntityName()
           
 Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
           
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)
           
 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.
 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 start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 void updateSchemesForRenamedWorkflow(String oldWorkflowName, String newWorkflowName)
          Updates Workflow Schemes's such that schemes asscoiated to the workflow with name oldWorkflowName will be changed to newWorkflowName.
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, deleteScheme, getAssociatedSchemes, getAssociationType, 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, 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, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createSchemeAndEntities, deleteScheme, 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, 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,
                                    AssociationManager associationManager,
                                    GroupManager groupManager)
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

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

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.

copySchemeEntity

public org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme,
                                                           org.ofbiz.core.entity.GenericValue entity)
                                                    throws org.ofbiz.core.entity.GenericEntityException
Specified by:
copySchemeEntity in class AbstractSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

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

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

updateSchemesForRenamedWorkflow

public void updateSchemesForRenamedWorkflow(String oldWorkflowName,
                                            String newWorkflowName)
Description copied from interface: WorkflowSchemeManager
Updates Workflow Schemes's such that schemes asscoiated 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)
Specified by:
getSchemesForWorkflow in interface WorkflowSchemeManager

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

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

createSchemeObject

public Scheme createSchemeObject(String name,
                                 String description)
Description copied from interface: SchemeManager
Creates a new scheme

Specified by:
createSchemeObject in interface SchemeManager
Overrides:
createSchemeObject in class AbstractSchemeManager
Parameters:
name - The name of the new scheme
description - The description of the new scheme
Returns:
The new scheme object

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)


Copyright © 2002-2012 Atlassian. All Rights Reserved.