com.atlassian.jira.permission
Class PermissionSchemeManager

java.lang.Object
  extended bycom.atlassian.jira.scheme.AbstractSchemeManager
      extended bycom.atlassian.jira.permission.PermissionSchemeManager
All Implemented Interfaces:
SchemeManager

public class PermissionSchemeManager
extends AbstractSchemeManager

This class is used to handle Permission Schemes. Permission Schemes are created, removed and edited through this class


Field Summary
 
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
PermissionSchemeManager()
           
 
Method Summary
 GenericValue copySchemeEntity(GenericValue scheme, GenericValue entity)
           
 GenericValue createSchemeEntity(GenericValue scheme, SchemeEntity schemeEntity)
          Create a new permission record in the database
 void deleteEntity(java.lang.Long id)
          Deletes a permission from the database
 java.lang.String getAssociationType()
           
 java.util.List getEntities(GenericValue scheme)
           
 java.util.List getEntities(GenericValue scheme, java.lang.Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List getEntities(GenericValue scheme, java.lang.Long permissionId, java.lang.String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List getEntities(GenericValue scheme, java.lang.Long permissionId, java.lang.String type, java.lang.String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List getEntities(GenericValue scheme, java.lang.String entityTypeId)
           
 java.util.List getEntities(GenericValue scheme, java.lang.String type, java.lang.Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.lang.String getEntityName()
           
 java.util.Collection getGroups(java.lang.Long entityTypeId, GenericValue project)
           
 java.lang.String getSchemeDesc()
           
 java.lang.String getSchemeEntityName()
           
 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 hasSchemeAuthority(java.lang.Long permissionId, GenericValue project)
          Checks to see if there is an anyone permission for that permission type.
 boolean hasSchemeAuthority(java.lang.Long permissionId, GenericValue project, User user)
          Checks to see if the user has any specific permissions for that permission type.
 boolean removeEntities(GenericValue scheme, java.lang.Long permissionId)
          Retrieves all the entites for this permission and then removes them.
 boolean removeEntities(java.lang.String parameter)
          Removes all scheme entities with this parameter
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createScheme, deleteScheme, getDefaultScheme, getEntities, getEntity, getProjects, getScheme, getScheme, getSchemes, getSchemes, removeSchemesFromProject, schemeExists, updateScheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermissionSchemeManager

public PermissionSchemeManager()
Method Detail

getSchemeEntityName

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

getEntityName

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

getAssociationType

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

getSchemeDesc

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

getEntities

public java.util.List getEntities(GenericValue scheme,
                                  java.lang.Long permissionId)
                           throws GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

Parameters:
scheme - The scheme that the permissions belong to
permissionId - The Id of the permission
Returns:
List of (GenericValue) permissions
Throws:
GenericEntityException

getEntities

public java.util.List getEntities(GenericValue scheme,
                                  java.lang.Long permissionId,
                                  java.lang.String parameter)
                           throws GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

Parameters:
scheme - The scheme that the permissions belong to
permissionId - The Id of the permission
parameter - The permission parameter (group name etc)
Returns:
List of (GenericValue) permissions
Throws:
GenericEntityException

getEntities

public java.util.List getEntities(GenericValue scheme,
                                  java.lang.Long permissionId,
                                  java.lang.String type,
                                  java.lang.String parameter)
                           throws GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

Parameters:
scheme - The scheme that the permissions belong to
permissionId - The Id of the permission
parameter - The permission parameter (group name etc)
type - The type of the permission(Group, Current Reporter etc)
Returns:
List of (GenericValue) permissions
Throws:
GenericEntityException

getEntities

public java.util.List getEntities(GenericValue scheme,
                                  java.lang.String type,
                                  java.lang.Long permissionId)
                           throws GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

Parameters:
scheme - The scheme that the permissions belong to
type - The type of the permission(Group, Current Reporter etc)
permissionId - The Id of the permission
Returns:
List of (GenericValue) permissions
Throws:
GenericEntityException

getEntities

public java.util.List getEntities(GenericValue scheme,
                                  java.lang.String entityTypeId)
                           throws GenericEntityException
Throws:
GenericEntityException

createSchemeEntity

public GenericValue createSchemeEntity(GenericValue scheme,
                                       SchemeEntity schemeEntity)
                                throws GenericEntityException
Create a new permission record in the database

Parameters:
scheme - The scheme that the permission record is associated with
schemeEntity - The scheme entity object that is to be added to the scheme
Returns:
The permission object
Throws:
GenericEntityException

deleteEntity

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

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

copySchemeEntity

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

getEntities

public java.util.List getEntities(GenericValue scheme)
                           throws GenericEntityException
Specified by:
getEntities in interface SchemeManager
Overrides:
getEntities in class AbstractSchemeManager
Parameters:
scheme - The parameter in the entity
Returns:
List of (GenericValue) entities
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
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
parameter - must NOT be null
Returns:
Throws:
RemoveException

removeEntities

public boolean removeEntities(GenericValue scheme,
                              java.lang.Long permissionId)
                       throws RemoveException
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
permissionId - to remove must NOT be a global permission
Returns:
True is all the entities are removed
Throws:
RemoveException

hasSchemeAuthority

public boolean hasSchemeAuthority(java.lang.Long permissionId,
                                  GenericValue project)
Checks to see if there is an anyone permission for that permission type. Specific permissions can things such as Current Reporter, Project Lead, Single User etc.

Parameters:
permissionId - The permission to check against, must not be global permission
project - The entity to check for the permission. This entity must be a project
Returns:
true if the user has the permission otherwise false

hasSchemeAuthority

public boolean hasSchemeAuthority(java.lang.Long permissionId,
                                  GenericValue project,
                                  User user)
Checks to see if the user has any specific permissions for that permission type. Specific permissions can things such as Current Reporter, Project Lead, Single User etc.

Parameters:
permissionId - The permission to check against, must not be global permission
project - The entity to check for the permission. This entity must be a project
user - The user to check for the permission. The user must NOT be null
Returns:
true if the user has the permission otherwise false

getGroups

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

getUsers

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

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