com.atlassian.jira.permission
Class DefaultPermissionSchemeManager

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by com.atlassian.jira.permission.DefaultPermissionSchemeManager
All Implemented Interfaces:
PermissionSchemeManager, SchemeManager
Direct Known Subclasses:
WorkflowBasedPermissionSchemeManager

public class DefaultPermissionSchemeManager
extends AbstractSchemeManager
implements PermissionSchemeManager

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
projectManager
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
DefaultPermissionSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme, org.ofbiz.core.entity.GenericValue entity)
           
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
          Create a new permission record in the database
 void deleteEntity(Long id)
          Deletes a permission from the database
 void flushSchemeEntities()
           
 String getAssociationType()
           
 List getEntities(org.ofbiz.core.entity.GenericValue scheme)
          Get all Scheme entity records for a particular scheme
 List getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 List getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId, String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 List getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId, String type, String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 List getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId)
           
 List getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 String getEntityName()
           
 Collection getGroups(Long entityTypeId, org.ofbiz.core.entity.GenericValue project)
           
 String getSchemeDesc()
           
 String getSchemeEntityName()
           
 Collection getSchemesContainingEntity(String type, String parameter)
          This is a method that is meant to quickly get you all the schemes that contain an entity of the specified type and parameter.
 Collection getUsers(Long permissionId, org.ofbiz.core.entity.GenericValue projectOrIssue)
           
 boolean hasSchemeAuthority(Long permissionId, org.ofbiz.core.entity.GenericValue project)
          Checks to see if there is an anyone permission for that permission type.
 boolean hasSchemeAuthority(Long permissionId, org.ofbiz.core.entity.GenericValue project, User user, boolean issueCreation)
          Checks to see if the user has any specific permissions for that permission type.
 boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId)
          Retrieves all the entites for this permission and then removes them.
 boolean removeEntities(String type, String parameter)
          Removes all scheme entities with this parameter
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, deleteScheme, flushProjectSchemes, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getProjectAndValidate, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, 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, createScheme, createSchemeAndEntities, deleteScheme, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
 

Constructor Detail

DefaultPermissionSchemeManager

public DefaultPermissionSchemeManager(ProjectManager projectManager,
                                      PermissionTypeManager permissionTypeManager,
                                      PermissionContextFactory permissionContextFactory,
                                      OfBizDelegator delegator,
                                      SchemeFactory schemeFactory)
Method Detail

getSchemeEntityName

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

getEntityName

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

getAssociationType

public String getAssociationType()
Specified by:
getAssociationType in interface PermissionSchemeManager
Specified by:
getAssociationType in class AbstractSchemeManager

getSchemeDesc

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

getEntities

public List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                        Long permissionId)
                 throws org.ofbiz.core.entity.GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

Specified by:
getEntities in interface SchemeManager
Parameters:
scheme - The scheme that the permissions belong to
permissionId - The Id of the permission
Returns:
List of (GenericValue) permissions
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                        Long permissionId,
                        String parameter)
                 throws org.ofbiz.core.entity.GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

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

getEntities

public List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                        Long permissionId,
                        String type,
                        String parameter)
                 throws org.ofbiz.core.entity.GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

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

getEntities

public List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                        String type,
                        Long permissionId)
                 throws org.ofbiz.core.entity.GenericEntityException
Get all Generic Value permission records for a particular scheme and permission Id

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

getEntities

public List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                        String entityTypeId)
                 throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
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
Create a new permission record in the database

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

deleteEntity

public void deleteEntity(Long id)
                  throws org.ofbiz.core.entity.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:
org.ofbiz.core.entity.GenericEntityException

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 getEntities(org.ofbiz.core.entity.GenericValue scheme)
                 throws org.ofbiz.core.entity.GenericEntityException
Description copied from class: AbstractSchemeManager
Get all Scheme entity records for a particular scheme

Specified by:
getEntities in interface SchemeManager
Overrides:
getEntities in class AbstractSchemeManager
Parameters:
scheme - The scheme that the entities belong to
Returns:
List of (GenericValue) entities
Throws:
org.ofbiz.core.entity.GenericEntityException

removeEntities

public boolean removeEntities(String type,
                              String parameter)
                       throws RemoveException
Removes all scheme entities with this parameter

Specified by:
removeEntities in interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
type - the type of scheme entity you wish to remove 'user', 'group', 'projectrole'
parameter - must NOT be null
Throws:
RemoveException

removeEntities

public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme,
                              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(Long permissionId,
                                  org.ofbiz.core.entity.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.

Specified by:
hasSchemeAuthority in interface SchemeManager
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(Long permissionId,
                                  org.ofbiz.core.entity.GenericValue project,
                                  User user,
                                  boolean issueCreation)
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.

Specified by:
hasSchemeAuthority in interface SchemeManager
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
issueCreation - true if this call is for a "Create Issue" permission.
Returns:
true if the user has the permission otherwise false

getGroups

public Collection getGroups(Long entityTypeId,
                            org.ofbiz.core.entity.GenericValue project)
Specified by:
getGroups in interface SchemeManager
Overrides:
getGroups in class AbstractSchemeManager

getUsers

public Collection getUsers(Long permissionId,
                           org.ofbiz.core.entity.GenericValue projectOrIssue)
Specified by:
getUsers in interface SchemeManager
Overrides:
getUsers in class AbstractSchemeManager

flushSchemeEntities

public void flushSchemeEntities()
Specified by:
flushSchemeEntities in interface PermissionSchemeManager

getSchemesContainingEntity

public Collection getSchemesContainingEntity(String type,
                                             String parameter)
Description copied from interface: PermissionSchemeManager
This is a method that is meant to quickly get you all the schemes that contain an entity of the specified type and parameter.

Specified by:
getSchemesContainingEntity in interface PermissionSchemeManager
Parameters:
type - is the entity type
parameter - is the scheme entries parameter value
Returns:
Collection of GenericValues that represents a scheme


Copyright © 2002-2008 Atlassian. All Rights Reserved.