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
 
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)
           
 
Method Summary
 void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, java.lang.String workflowName, java.lang.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(java.lang.String name, java.lang.String description)
          Creates a new scheme
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
 void deleteEntity(java.lang.Long id)
          Deletes an entity from the database
protected  void flushProjectSchemes()
           
 java.util.Collection<java.lang.String> getActiveWorkflowNames()
           
protected  java.util.List<org.ofbiz.core.entity.GenericValue> getAllIssueTypes()
           
 java.lang.String getAssociationType()
           
 java.lang.String getDefaultDescriptionKey()
           
 org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme)
           
 java.lang.String getDefaultNameKey()
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long entityTypeId)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long entityTypeId, java.lang.String parameter)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String issuetype)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String type, java.lang.Long entityTypeId)
           
 java.lang.String getEntityName()
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme)
           
 java.lang.String getSchemeDesc()
           
 java.lang.String getSchemeEntityName()
           
 java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
           
protected  JiraWorkflow getWorkflowFromScheme(org.ofbiz.core.entity.GenericValue workflowScheme, java.lang.String issueTypeId)
           
 java.util.Map<java.lang.String,java.lang.String> getWorkflowMap(Project project)
          Returns a map representation of a workflow scheme for a passed project.
 java.lang.String getWorkflowName(org.ofbiz.core.entity.GenericValue scheme, java.lang.String issueType)
          Get the name of the workflow from the passed scheme associated with the passed issue type.
 java.lang.String getWorkflowName(Project project, java.lang.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(java.lang.Long entityType, org.ofbiz.core.entity.GenericValue entity)
          Checks anonymous permission of the given permission type for the given entity.
 boolean hasSchemeAuthority(java.lang.Long entityType, org.ofbiz.core.entity.GenericValue entity, com.opensymphony.user.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, java.lang.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(java.lang.String oldWorkflowName, java.lang.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, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, deleteScheme, getAssociatedSchemes, getDefaultScheme, getEntities, getEntities, getEntity, getGroups, getProjectAndValidate, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, 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.scheme.SchemeManager
addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createSchemeAndEntities, deleteScheme, getAssociatedSchemes, getDefaultScheme, getEntities, getEntities, getEntity, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, 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)
Method Detail

start

public void start()
           throws java.lang.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:
java.lang.Exception - Allows implementations to throw an Exception.

onClearCache

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

getSchemeEntityName

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

getEntityName

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

getAssociationType

public java.lang.String getAssociationType()
Specified by:
getAssociationType in interface WorkflowSchemeManager
Specified by:
getAssociationType in class AbstractSchemeManager

clearWorkflowCache

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

getSchemeDesc

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

getDefaultNameKey

public java.lang.String getDefaultNameKey()
Specified by:
getDefaultNameKey in class AbstractSchemeManager

getDefaultDescriptionKey

public java.lang.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 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.String issuetype)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getWorkflowMap

public java.util.Map<java.lang.String,java.lang.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 java.lang.String getWorkflowName(Project project,
                                        java.lang.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 java.lang.String getWorkflowName(org.ofbiz.core.entity.GenericValue scheme,
                                        java.lang.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 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.Long entityTypeId)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.Long entityTypeId,
                                                                      java.lang.String parameter)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.String type,
                                                                      java.lang.Long entityTypeId)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

hasSchemeAuthority

public boolean hasSchemeAuthority(java.lang.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(java.lang.Long entityType,
                                  org.ofbiz.core.entity.GenericValue entity,
                                  com.opensymphony.user.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 java.util.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 java.util.Collection<java.lang.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,
                                java.lang.String workflowName,
                                java.lang.String issueTypeId)
                         throws org.ofbiz.core.entity.GenericEntityException
Specified by:
addWorkflowToScheme in interface WorkflowSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

updateSchemesForRenamedWorkflow

public void updateSchemesForRenamedWorkflow(java.lang.String oldWorkflowName,
                                            java.lang.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 java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
Specified by:
getSchemesForWorkflow in interface WorkflowSchemeManager

deleteEntity

public void deleteEntity(java.lang.Long id)
                  throws org.ofbiz.core.entity.GenericEntityException
Description copied from class: AbstractSchemeManager
Deletes an entity 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:
org.ofbiz.core.entity.GenericEntityException

removeEntities

public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme,
                              java.lang.Long entityTypeId)
                       throws RemoveException
Description copied from class: AbstractSchemeManager
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 is all the entities are removed
Throws:
RemoveException

createScheme

public org.ofbiz.core.entity.GenericValue createScheme(java.lang.String name,
                                                       java.lang.String description)
                                                throws org.ofbiz.core.entity.GenericEntityException
Description copied from class: AbstractSchemeManager
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

flushProjectSchemes

protected void flushProjectSchemes()
Overrides:
flushProjectSchemes in class AbstractSchemeManager

getAllIssueTypes

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

getWorkflowFromScheme

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


Copyright © 2002-2010 Atlassian. All Rights Reserved.