com.atlassian.jira.issue.security
Class IssueSecurityLevelManagerImpl

java.lang.Object
  extended by com.atlassian.jira.issue.security.IssueSecurityLevelManagerImpl
All Implemented Interfaces:
IssueSecurityLevelManager

public class IssueSecurityLevelManagerImpl
extends Object
implements IssueSecurityLevelManager

This class gets a list of all the security that can be part of a issue security scheme


Field Summary
protected  org.apache.log4j.Logger log
           
 
Constructor Summary
IssueSecurityLevelManagerImpl(IssueSecuritySchemeManager issueSecuritySchemeManager, SecurityTypeManager securityTypeManager, ProjectManager projectManager, UserManager userManager, UserKeyService userKeyService, PermissionManager permissionManager, EntityEngine entityEngine, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 void clearProjectLevels(org.ofbiz.core.entity.GenericValue project)
          Clears the User security Level Map.
 void clearUsersLevels()
          Clears the User security Level Map.
 IssueSecurityLevel createIssueSecurityLevel(long schemeId, String name, String description)
          Creates an Issue Security Level with the given properties.
 void deleteSecurityLevel(Long levelId)
          Deletes the given Issue Security Level and any child permissions.
 Collection<IssueSecurityLevel> getAllIssueSecurityLevels()
          Get all the different levels of security across all schemes.
 Collection<org.ofbiz.core.entity.GenericValue> getAllSecurityLevels()
          Get all the different levels of security across all schemes.
 Collection<IssueSecurityLevel> getAllSecurityLevelsForUser(com.atlassian.crowd.embedded.api.User user)
          Get the different levels of security that the user can see across all projects.
 Collection<org.ofbiz.core.entity.GenericValue> getAllUsersSecurityLevels(com.atlassian.crowd.embedded.api.User user)
          Get the different levels of security that the user can see across all projects.
 Long getDefaultSecurityLevel(Project project)
          Returns the default Security Level as defined in the Issue Security Level scheme for the given project.
 org.ofbiz.core.entity.GenericValue getIssueSecurity(Long id)
          Returns the IssueSecurityLevel with the given ID.
 String getIssueSecurityDescription(Long id)
           
 org.ofbiz.core.entity.GenericValue getIssueSecurityLevel(Long id)
          Returns the IssueSecurityLevel with the given ID.
 List<IssueSecurityLevel> getIssueSecurityLevels(long schemeId)
          Returns the list of Security Levels for the given Issue Security Level Scheme.
 Collection<IssueSecurityLevel> getIssueSecurityLevelsByName(String securityLevelName)
          Get the different levels of security that have the specified name.
 String getIssueSecurityName(Long id)
          Get the name of the issue security
 Long getSchemeDefaultSecurityLevel(org.ofbiz.core.entity.GenericValue project)
          Returns the default Security Level as defined in the Issue Security Level scheme for the given project.
 List<org.ofbiz.core.entity.GenericValue> getSchemeIssueSecurityLevels(Long schemeId)
          Returns the list of Security Levels for the given Issue Security Level Scheme.
 IssueSecurityLevel getSecurityLevel(long id)
          Returns the IssueSecurityLevel with the given ID.
 Collection<org.ofbiz.core.entity.GenericValue> getSecurityLevelsByName(String securityLevelName)
          Get the different levels of security that have the specified name.
 Collection<IssueSecurityLevel> getSecurityLevelsForUserByName(com.atlassian.crowd.embedded.api.User user, String securityLevelName)
          Get the different levels of security that a user can see that have the specified name.
 List<org.ofbiz.core.entity.GenericValue> getUsersSecurityLevels(org.ofbiz.core.entity.GenericValue entity, com.atlassian.crowd.embedded.api.User user)
          Get the different levels of security that can be set for this issue.
 List<IssueSecurityLevel> getUsersSecurityLevels(Issue issue, com.atlassian.crowd.embedded.api.User user)
          Get the different levels of security that can be set for this issue.
 List<IssueSecurityLevel> getUsersSecurityLevels(Project project, com.atlassian.crowd.embedded.api.User user)
          Get the different levels of security that can be set for an issue created in this project.
 Collection<org.ofbiz.core.entity.GenericValue> getUsersSecurityLevelsByName(com.atlassian.crowd.embedded.api.User user, String securityLevelName)
          Get the different levels of security that a user can see that have the specified name.
 void onClearCache(ClearCacheEvent event)
           
 void onEvent(IssueSecuritySchemeDeletedEvent event)
           
 boolean schemeIssueSecurityExists(Long id)
          Checks to see if the issue security exists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.log4j.Logger log
Constructor Detail

IssueSecurityLevelManagerImpl

public IssueSecurityLevelManagerImpl(IssueSecuritySchemeManager issueSecuritySchemeManager,
                                     SecurityTypeManager securityTypeManager,
                                     ProjectManager projectManager,
                                     UserManager userManager,
                                     UserKeyService userKeyService,
                                     PermissionManager permissionManager,
                                     EntityEngine entityEngine,
                                     com.atlassian.cache.CacheManager cacheManager)
Method Detail

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

onEvent

@EventListener
public void onEvent(IssueSecuritySchemeDeletedEvent event)

getSchemeIssueSecurityLevels

public List<org.ofbiz.core.entity.GenericValue> getSchemeIssueSecurityLevels(Long schemeId)
Description copied from interface: IssueSecurityLevelManager
Returns the list of Security Levels for the given Issue Security Level Scheme.

Specified by:
getSchemeIssueSecurityLevels in interface IssueSecurityLevelManager
Parameters:
schemeId - ID of the Issue Security Level Scheme.
Returns:
the list of Security Levels for the given Issue Security Level Scheme.

getIssueSecurityLevels

public List<IssueSecurityLevel> getIssueSecurityLevels(long schemeId)
Description copied from interface: IssueSecurityLevelManager
Returns the list of Security Levels for the given Issue Security Level Scheme.

Specified by:
getIssueSecurityLevels in interface IssueSecurityLevelManager
Parameters:
schemeId - ID of the Issue Security Level Scheme.
Returns:
the list of Security Levels for the given Issue Security Level Scheme.

getIssueSecurity

public org.ofbiz.core.entity.GenericValue getIssueSecurity(Long id)
Description copied from interface: IssueSecurityLevelManager
Returns the IssueSecurityLevel with the given ID.

Specified by:
getIssueSecurity in interface IssueSecurityLevelManager
Parameters:
id - the ID
Returns:
the IssueSecurityLevel with the given ID.

getSecurityLevel

public IssueSecurityLevel getSecurityLevel(long id)
Description copied from interface: IssueSecurityLevelManager
Returns the IssueSecurityLevel with the given ID.

Specified by:
getSecurityLevel in interface IssueSecurityLevelManager
Parameters:
id - the ID
Returns:
the IssueSecurityLevel with the given ID.

createIssueSecurityLevel

public IssueSecurityLevel createIssueSecurityLevel(long schemeId,
                                                   String name,
                                                   String description)
Description copied from interface: IssueSecurityLevelManager
Creates an Issue Security Level with the given properties.

Specified by:
createIssueSecurityLevel in interface IssueSecurityLevelManager
Parameters:
schemeId - The Issue security scheme that this level belongs to.
name - The name of the new level
description - an optional description
Returns:
the newly created Issue Security Level

schemeIssueSecurityExists

public boolean schemeIssueSecurityExists(Long id)
Checks to see if the issue security exists

Specified by:
schemeIssueSecurityExists in interface IssueSecurityLevelManager
Parameters:
id - The security Id
Returns:
True / False

getIssueSecurityName

public String getIssueSecurityName(Long id)
Get the name of the issue security

Specified by:
getIssueSecurityName in interface IssueSecurityLevelManager
Parameters:
id - The security Id
Returns:
The name of the security

getIssueSecurityDescription

public String getIssueSecurityDescription(Long id)
Specified by:
getIssueSecurityDescription in interface IssueSecurityLevelManager

getUsersSecurityLevels

public List<org.ofbiz.core.entity.GenericValue> getUsersSecurityLevels(org.ofbiz.core.entity.GenericValue entity,
                                                                       com.atlassian.crowd.embedded.api.User user)
                                                                throws org.ofbiz.core.entity.GenericEntityException
Get the different levels of security that can be set for this issue. TODO: JRA-14323 This method can return incorrect results because of a bug in caching.

When editing an Issue, then you would pass in the GenericValue for the Issue. When creating an Issue, the project is passed in.

Specified by:
getUsersSecurityLevels in interface IssueSecurityLevelManager
Parameters:
entity - This is the issue or the project that the security is being checked for
user - The user used for the security check
Returns:
an unmodifiable List containing the security levels
Throws:
org.ofbiz.core.entity.GenericEntityException

getUsersSecurityLevels

public List<IssueSecurityLevel> getUsersSecurityLevels(Issue issue,
                                                       com.atlassian.crowd.embedded.api.User user)
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that can be set for this issue. If you are creating a new Issue, then use IssueSecurityLevelManager.getUsersSecurityLevels(com.atlassian.jira.project.Project, com.atlassian.crowd.embedded.api.User).

Specified by:
getUsersSecurityLevels in interface IssueSecurityLevelManager
Parameters:
issue - This is the issue that the security is being checked for
user - The user used for the security check
Returns:
list containing the security levels, can be null
See Also:
IssueSecurityLevelManager.getUsersSecurityLevels(com.atlassian.jira.project.Project, com.atlassian.crowd.embedded.api.User)

getUsersSecurityLevels

public List<IssueSecurityLevel> getUsersSecurityLevels(Project project,
                                                       com.atlassian.crowd.embedded.api.User user)
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that can be set for an issue created in this project. If you are editing an existing Issue, then use IssueSecurityLevelManager.getUsersSecurityLevels(Issue, User).

Specified by:
getUsersSecurityLevels in interface IssueSecurityLevelManager
Parameters:
project - the project that the security is being checked for
user - The user used for the security check
Returns:
list containing the security levels, can be null
See Also:
IssueSecurityLevelManager.getUsersSecurityLevels(com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User)

getAllUsersSecurityLevels

public Collection<org.ofbiz.core.entity.GenericValue> getAllUsersSecurityLevels(com.atlassian.crowd.embedded.api.User user)
                                                                         throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that the user can see across all projects.

Specified by:
getAllUsersSecurityLevels in interface IssueSecurityLevelManager
Parameters:
user - The user used for the security check
Returns:
list containing the security levels, can be null
Throws:
org.ofbiz.core.entity.GenericEntityException - Exception in the OFBiz persistence layer.

getAllSecurityLevelsForUser

@Nonnull
public Collection<IssueSecurityLevel> getAllSecurityLevelsForUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that the user can see across all projects.

Specified by:
getAllSecurityLevelsForUser in interface IssueSecurityLevelManager
Parameters:
user - The user used for the security check
Returns:
list containing the security levels

getAllSecurityLevels

public Collection<org.ofbiz.core.entity.GenericValue> getAllSecurityLevels()
                                                                    throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: IssueSecurityLevelManager
Get all the different levels of security across all schemes.

Specified by:
getAllSecurityLevels in interface IssueSecurityLevelManager
Returns:
list containing the security levels, can be null
Throws:
org.ofbiz.core.entity.GenericEntityException - Exception in the OFBiz persistence layer.

getAllIssueSecurityLevels

public Collection<IssueSecurityLevel> getAllIssueSecurityLevels()
Description copied from interface: IssueSecurityLevelManager
Get all the different levels of security across all schemes.

Specified by:
getAllIssueSecurityLevels in interface IssueSecurityLevelManager
Returns:
list containing the security levels, can be null

getUsersSecurityLevelsByName

public Collection<org.ofbiz.core.entity.GenericValue> getUsersSecurityLevelsByName(com.atlassian.crowd.embedded.api.User user,
                                                                                   String securityLevelName)
                                                                            throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that a user can see that have the specified name.

Specified by:
getUsersSecurityLevelsByName in interface IssueSecurityLevelManager
Parameters:
user - the user
securityLevelName - the name of the security level.
Returns:
a collection of the GenericValues representing each level they can see with the specified name.
Throws:
org.ofbiz.core.entity.GenericEntityException - Exception in the OFBiz persistence layer.

getSecurityLevelsForUserByName

public Collection<IssueSecurityLevel> getSecurityLevelsForUserByName(com.atlassian.crowd.embedded.api.User user,
                                                                     String securityLevelName)
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that a user can see that have the specified name.

Specified by:
getSecurityLevelsForUserByName in interface IssueSecurityLevelManager
Parameters:
user - the user
securityLevelName - the name of the security level.
Returns:
a collection of each IssueSecurityLevel they can see with the specified name.

getSecurityLevelsByName

public Collection<org.ofbiz.core.entity.GenericValue> getSecurityLevelsByName(String securityLevelName)
                                                                       throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that have the specified name.

Specified by:
getSecurityLevelsByName in interface IssueSecurityLevelManager
Parameters:
securityLevelName - the name of the security level.
Returns:
a collection of the GenericValues representing each level with the specified name.
Throws:
org.ofbiz.core.entity.GenericEntityException - Exception in the OFBiz persistence layer.

getIssueSecurityLevelsByName

public Collection<IssueSecurityLevel> getIssueSecurityLevelsByName(String securityLevelName)
Description copied from interface: IssueSecurityLevelManager
Get the different levels of security that have the specified name.

Specified by:
getIssueSecurityLevelsByName in interface IssueSecurityLevelManager
Parameters:
securityLevelName - the name of the security level.
Returns:
a collection of the IssueSecurityLevels with the specified name.

getSchemeDefaultSecurityLevel

public Long getSchemeDefaultSecurityLevel(org.ofbiz.core.entity.GenericValue project)
                                   throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: IssueSecurityLevelManager
Returns the default Security Level as defined in the Issue Security Level scheme for the given project.

Specified by:
getSchemeDefaultSecurityLevel in interface IssueSecurityLevelManager
Parameters:
project - the Project
Returns:
the default Security Level as defined in the Issue Security Level scheme for the given project. Can be null.
Throws:
org.ofbiz.core.entity.GenericEntityException - Exception in the OFBiz persistence layer.

getDefaultSecurityLevel

public Long getDefaultSecurityLevel(Project project)
Description copied from interface: IssueSecurityLevelManager
Returns the default Security Level as defined in the Issue Security Level scheme for the given project.

Specified by:
getDefaultSecurityLevel in interface IssueSecurityLevelManager
Parameters:
project - the Project
Returns:
the default Security Level as defined in the Issue Security Level scheme for the given project. Can be null.

getIssueSecurityLevel

public org.ofbiz.core.entity.GenericValue getIssueSecurityLevel(Long id)
Description copied from interface: IssueSecurityLevelManager
Returns the IssueSecurityLevel with the given ID.

Specified by:
getIssueSecurityLevel in interface IssueSecurityLevelManager
Parameters:
id - the ID
Returns:
the IssueSecurityLevel with the given ID.

deleteSecurityLevel

public void deleteSecurityLevel(Long levelId)
Description copied from interface: IssueSecurityLevelManager
Deletes the given Issue Security Level and any child permissions.

Specified by:
deleteSecurityLevel in interface IssueSecurityLevelManager
Parameters:
levelId - Issue Security Level ID

clearUsersLevels

public void clearUsersLevels()
Clears the User security Level Map. This is done when security records are added or deleted

Specified by:
clearUsersLevels in interface IssueSecurityLevelManager

clearProjectLevels

public void clearProjectLevels(org.ofbiz.core.entity.GenericValue project)
Clears the User security Level Map. This is done when security records are added or deleted

Specified by:
clearProjectLevels in interface IssueSecurityLevelManager


Copyright © 2002-2014 Atlassian. All Rights Reserved.