com.atlassian.jira.issue.security
Class IssueSecuritySchemeManagerImpl

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by com.atlassian.jira.issue.security.IssueSecuritySchemeManagerImpl
All Implemented Interfaces:
Startable, IssueSecuritySchemeManager, SchemeManager

public class IssueSecuritySchemeManagerImpl
extends AbstractSchemeManager
implements IssueSecuritySchemeManager, 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
IssueSecuritySchemeManagerImpl(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue copyScheme(org.ofbiz.core.entity.GenericValue scheme)
          This method overrides the AbstractSchemeManager because within Issue Security schemes there is an extra level, which is the table that holds the Security Levels for that Scheme.
 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
 void deleteScheme(java.lang.Long id)
          Deletes a scheme from the database
protected  void flushProjectSchemes()
           
 java.lang.String getAssociationType()
           
 java.lang.String getDefaultDescriptionKey()
           
 java.lang.String getDefaultNameKey()
           
 java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme)
          Get all Scheme entity records for a particular scheme
 java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long entityTypeId)
           
 java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long schemeTypeId, java.lang.String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String entityTypeId)
           
 java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String type, java.lang.Long schemeTypeId)
          Get all Generic Value issue security records for a particular scheme, type and Id
 java.util.List getEntitiesBySecurityLevel(java.lang.Long securityLevelId)
           
 java.lang.String getEntityName()
           
 java.lang.String getSchemeDesc()
           
 java.lang.String getSchemeEntityName()
           
 java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(java.lang.String type, java.lang.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.
 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 issue, com.opensymphony.user.User user, boolean issueCreation)
          Checks to see if the user has access to issues of this security level.
 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.
 boolean removeEntities(java.lang.String type, java.lang.String parameter)
          This method overrides the super implemntation in order to clear cache.
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getGroups, getProjectAndValidate, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, 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, createDefaultScheme, createSchemeAndEntities, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
 

Constructor Detail

IssueSecuritySchemeManagerImpl

public IssueSecuritySchemeManagerImpl(ProjectManager projectManager,
                                      PermissionTypeManager permissionTypeManager,
                                      PermissionContextFactory permissionContextFactory,
                                      SchemeFactory schemeFactory,
                                      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 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

getDefaultNameKey

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

getDefaultDescriptionKey

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

getEntities

public java.util.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

getEntities

public java.util.List 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

getEntitiesBySecurityLevel

public java.util.List getEntitiesBySecurityLevel(java.lang.Long securityLevelId)
                                          throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntitiesBySecurityLevel in interface IssueSecuritySchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getSchemesContainingEntity

public java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(java.lang.String type,
                                                                                           java.lang.String parameter)
Description copied from interface: IssueSecuritySchemeManager
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 IssueSecuritySchemeManager
Parameters:
type - is the entity type
parameter - is the scheme entries parameter value
Returns:
Collection of GenericValues that represents a scheme

getEntities

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

getEntities

public java.util.List getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                  java.lang.String type,
                                  java.lang.Long schemeTypeId)
                           throws org.ofbiz.core.entity.GenericEntityException
Get all Generic Value issue security records for a particular scheme, type and 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)
schemeTypeId - The Id of the permission
Returns:
List of (GenericValue) permissions
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

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

copyScheme

public org.ofbiz.core.entity.GenericValue copyScheme(org.ofbiz.core.entity.GenericValue scheme)
                                              throws org.ofbiz.core.entity.GenericEntityException
This method overrides the AbstractSchemeManager because within Issue Security schemes there is an extra level, which is the table that holds the Security Levels for that Scheme. This is because with Issue Security schemes you can add and delete the different levels of security. With other schemes this is not possible

Specified by:
copyScheme in interface SchemeManager
Overrides:
copyScheme in class AbstractSchemeManager
Parameters:
scheme - The permission scheme to be copied
Returns:
The new permission scheme
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 issue,
                                  com.opensymphony.user.User user,
                                  boolean issueCreation)
Checks to see if the user has access to issues of this security level. If the user is not passed in then the check is made on the current user

Specified by:
hasSchemeAuthority in interface SchemeManager
Parameters:
entityType - The security level to check against
issue - The issue
user - The user to check for the permission. User must NOT be null
issueCreation -
Returns:
true if the user is a member of the security level otherwise false

deleteScheme

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

Specified by:
deleteScheme in interface SchemeManager
Overrides:
deleteScheme in class AbstractSchemeManager
Parameters:
id - Id of the scheme to be deleted
Throws:
org.ofbiz.core.entity.GenericEntityException

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

removeEntities

public boolean removeEntities(java.lang.String type,
                              java.lang.String parameter)
                       throws RemoveException
This method overrides the super implemntation in order to clear cache.

Specified by:
removeEntities in interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
type - type
parameter - parameter
Returns:
the original result of the call to super method
Throws:
RemoveException - if super method throws it


Copyright © 2002-2010 Atlassian. All Rights Reserved.