com.atlassian.jira.scheme
Class AbstractSchemeManager

java.lang.Object
  extended bycom.atlassian.jira.scheme.AbstractSchemeManager
All Implemented Interfaces:
SchemeManager
Direct Known Subclasses:
DefaultNotificationSchemeManager, DefaultPermissionSchemeManager, IssueSecuritySchemeManagerImpl

public abstract class AbstractSchemeManager
extends java.lang.Object
implements SchemeManager


Field Summary
protected static java.lang.String PROJECT_ASSOCIATION
           
 
Constructor Summary
AbstractSchemeManager()
           
 
Method Summary
 void addDefaultSchemeToProject(GenericValue project)
          Adds the default scheme to a particular project
 void addSchemeToProject(GenericValue project, GenericValue scheme)
          Adds a scheme to a particular project
 GenericValue copyScheme(GenericValue scheme)
          Copys a scheme, giving the new scheme the same entities as the original one
abstract  GenericValue copySchemeEntity(GenericValue scheme, GenericValue entity)
           
 GenericValue createDefaultScheme()
          Creates a default scheme, with an id of 0
 GenericValue createScheme(java.lang.String name, java.lang.String description)
          Creates a new scheme
 void deleteEntity(java.lang.Long id)
          Deletes an entity from the database
 void deleteScheme(java.lang.Long id)
          Deletes a scheme from the database
abstract  java.lang.String getAssociationType()
           
 GenericValue getDefaultScheme()
          Gets the default scheme.
 java.util.List getEntities(java.lang.String parameter)
          Get all entity records with a particular parameter
 GenericValue getEntity(java.lang.Long id)
          Gets a scheme entity based on the id of the entity
abstract  java.lang.String getEntityName()
           
 java.util.Collection getGroups(java.lang.Long entityTypeId, GenericValue project)
           
 java.util.List getProjects(GenericValue scheme)
          Gets all projects that are associated with that scheme
 GenericValue getScheme(java.lang.Long id)
          Gets a scheme based on the Id of the scheme
 GenericValue getScheme(java.lang.String name)
          Gets a scheme based on the name of the scheme
abstract  java.lang.String getSchemeDesc()
           
abstract  java.lang.String getSchemeEntityName()
           
 java.util.List getSchemes()
          Gets all the Schemes of a certain type in the database
 java.util.List getSchemes(GenericValue project)
          Get all schemes of a certain type attached to a project.
 java.util.Collection getUsers(java.lang.Long permissionId, GenericValue project)
          Retrieves a list of users that have current permission in a project (e.g.
 boolean removeEntities(GenericValue scheme, java.lang.Long entityTypeId)
          Retrieves all the entites for this permissio and then removes them.
 boolean removeEntities(java.lang.String parameter)
          Removes all scheme entities with this parameter
 void removeSchemesFromProject(GenericValue project)
          Removes all schemes from a project
 boolean schemeExists(java.lang.String name)
          Determine if the scheme exists
 void updateScheme(GenericValue entity)
          Updates any changes to the scheme
 
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
createSchemeEntity, getEntities, getEntities, getEntities, getEntities, getEntities, hasSchemeAuthority, hasSchemeAuthority
 

Field Detail

PROJECT_ASSOCIATION

protected static final java.lang.String PROJECT_ASSOCIATION
See Also:
Constant Field Values
Constructor Detail

AbstractSchemeManager

public AbstractSchemeManager()
Method Detail

getSchemeEntityName

public abstract java.lang.String getSchemeEntityName()

getEntityName

public abstract java.lang.String getEntityName()

getSchemeDesc

public abstract java.lang.String getSchemeDesc()

getAssociationType

public abstract java.lang.String getAssociationType()

copySchemeEntity

public abstract GenericValue copySchemeEntity(GenericValue scheme,
                                              GenericValue entity)
                                       throws GenericEntityException
Throws:
GenericEntityException

getScheme

public GenericValue getScheme(java.lang.Long id)
                       throws GenericEntityException
Gets a scheme based on the Id of the scheme

Specified by:
getScheme in interface SchemeManager
Parameters:
id - Id of the scheme
Returns:
The scheme
Throws:
GenericEntityException

getScheme

public GenericValue getScheme(java.lang.String name)
                       throws GenericEntityException
Gets a scheme based on the name of the scheme

Specified by:
getScheme in interface SchemeManager
Parameters:
name - Name of the scheme
Returns:
The scheme
Throws:
GenericEntityException

getSchemes

public java.util.List getSchemes()
                          throws GenericEntityException
Gets all the Schemes of a certain type in the database

Specified by:
getSchemes in interface SchemeManager
Returns:
List of schemes
Throws:
GenericEntityException

getSchemes

public java.util.List getSchemes(GenericValue project)
                          throws GenericEntityException
Get all schemes of a certain type attached to a project.

This method may be overridden if you want to return a default value for projects without a scheme associated.

Specified by:
getSchemes in interface SchemeManager
Parameters:
project - The project that the schemes are attached to
Returns:
List of schemes
Throws:
GenericEntityException

getEntity

public GenericValue getEntity(java.lang.Long id)
                       throws GenericEntityException
Gets a scheme entity based on the id of the entity

Specified by:
getEntity in interface SchemeManager
Parameters:
id - The id of the entity
Returns:
The scheme entity object
Throws:
GenericEntityException

getEntities

public java.util.List getEntities(java.lang.String parameter)
                           throws GenericEntityException
Get all entity records with a particular parameter

Parameters:
parameter - The parameter in the entity
Returns:
List of (GenericValue) entities
Throws:
GenericEntityException

schemeExists

public boolean schemeExists(java.lang.String name)
                     throws GenericEntityException
Determine if the scheme exists

Specified by:
schemeExists in interface SchemeManager
Parameters:
name - The name of the scheme
Returns:
True / False
Throws:
GenericEntityException

createScheme

public GenericValue createScheme(java.lang.String name,
                                 java.lang.String description)
                          throws GenericEntityException
Creates a new scheme

Specified by:
createScheme in interface SchemeManager
Parameters:
name - The name of the new scheme
description - The description of the new scheme
Returns:
The new scheme object
Throws:
GenericEntityException

updateScheme

public void updateScheme(GenericValue entity)
                  throws GenericEntityException
Updates any changes to the scheme

Specified by:
updateScheme in interface SchemeManager
Parameters:
entity - The modified scheme
Throws:
GenericEntityException

deleteScheme

public void deleteScheme(java.lang.Long id)
                  throws GenericEntityException
Deletes a scheme from the database

Specified by:
deleteScheme in interface SchemeManager
Parameters:
id - Id of the scheme to be deleted
Throws:
GenericEntityException

addSchemeToProject

public void addSchemeToProject(GenericValue project,
                               GenericValue scheme)
                        throws GenericEntityException
Adds a scheme to a particular project

Specified by:
addSchemeToProject in interface SchemeManager
Parameters:
project - The project that the scheme is to be added to
scheme - The scheme to be added
Throws:
GenericEntityException

removeSchemesFromProject

public void removeSchemesFromProject(GenericValue project)
                              throws GenericEntityException
Removes all schemes from a project

Specified by:
removeSchemesFromProject in interface SchemeManager
Parameters:
project - The project that all schemes are to be deleted from
Throws:
GenericEntityException

deleteEntity

public void deleteEntity(java.lang.Long id)
                  throws GenericEntityException
Deletes an entity from the database

Specified by:
deleteEntity in interface SchemeManager
Parameters:
id - The id of the entity to be deleted
Throws:
GenericEntityException

getProjects

public java.util.List getProjects(GenericValue scheme)
                           throws GenericEntityException
Gets all projects that are associated with that scheme

Specified by:
getProjects in interface SchemeManager
Parameters:
scheme - The scheme used to get all projects
Returns:
List of (GenericValue) projects
Throws:
GenericEntityException

createDefaultScheme

public GenericValue createDefaultScheme()
                                 throws GenericEntityException
Creates a default scheme, with an id of 0

Specified by:
createDefaultScheme in interface SchemeManager
Returns:
The new permission scheme object
Throws:
GenericEntityException

removeEntities

public boolean removeEntities(java.lang.String parameter)
                       throws RemoveException
Removes all scheme entities with this parameter

Specified by:
removeEntities in interface SchemeManager
Parameters:
parameter - must NOT be null
Returns:
Throws:
RemoveException

removeEntities

public boolean removeEntities(GenericValue scheme,
                              java.lang.Long entityTypeId)
                       throws RemoveException
Retrieves all the entites for this permissio and then removes them.

Specified by:
removeEntities in interface SchemeManager
Parameters:
scheme - to remove entites from must NOT be null
entityTypeId - to remove
Returns:
True is all the entities are removed
Throws:
RemoveException

getDefaultScheme

public GenericValue getDefaultScheme()
                              throws GenericEntityException
Gets the default scheme. This should have an id of 0

Specified by:
getDefaultScheme in interface SchemeManager
Returns:
The default scheme
Throws:
GenericEntityException

addDefaultSchemeToProject

public void addDefaultSchemeToProject(GenericValue project)
                               throws GenericEntityException
Adds the default scheme to a particular project

Specified by:
addDefaultSchemeToProject in interface SchemeManager
Parameters:
project - The project that the scheme is to be added to
Throws:
GenericEntityException

copyScheme

public GenericValue copyScheme(GenericValue scheme)
                        throws GenericEntityException
Copys a scheme, giving the new scheme the same entities as the original one

Specified by:
copyScheme in interface SchemeManager
Parameters:
scheme - The permission scheme to be copied
Returns:
The new permission scheme
Throws:
GenericEntityException

getGroups

public java.util.Collection getGroups(java.lang.Long entityTypeId,
                                      GenericValue project)
Specified by:
getGroups in interface SchemeManager

getUsers

public java.util.Collection getUsers(java.lang.Long permissionId,
                                     GenericValue project)
Retrieves a list of users that have current permission in a project (e.g. projects schemes)

Specified by:
getUsers in interface SchemeManager
Parameters:
permissionId -
project -
Returns: