com.atlassian.jira.bc.projectroles
Interface ProjectRoleService

All Known Implementing Classes:
DefaultProjectRoleService

@PublicApi
public interface ProjectRoleService

This is the business layer component that must be used to access all ProjectRole functionality. This will perform validation before it hands off to the project role manager. Operations will not be performed if validation fails.


Field Summary
static String PROJECTROLE_ISSUE_SECURITY_TYPE
           
static String PROJECTROLE_NOTIFICATION_TYPE
           
static String PROJECTROLE_PERMISSION_TYPE
           
 
Method Summary
 void addActorsToProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Collection<String> actors, ProjectRole projectRole, Project project, String actorType, ErrorCollection errorCollection)
          Will add project role actor associations for the given actors and checking the currentUser has the correct permissions to perform the update operation.
 void addDefaultActorsToProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Collection<String> actors, ProjectRole projectRole, String type, ErrorCollection errorCollection)
          Will add default role actor associations based off the passed in actors and checking the currentUser has the correct permissions to perform the update operation.
 ProjectRole createProjectRole(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will create the project role with the given projectRole.getName(), projectRole.getDescription() and checking the currentUser has the correct permissions to perform the create operation.
 void deleteProjectRole(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will delete the given projectRole and checks the currentUser has the correct permissions to perform the delete operation.
 Collection getAssociatedIssueSecuritySchemes(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will get all issue security scheme's that the specified projectRole is currently used in.
 Collection getAssociatedNotificationSchemes(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will get all notification scheme's that the specified projectRole is currently used in.
 Collection getAssociatedPermissionSchemes(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will get all permission scheme's that the specified projectRole is currently used in.
 org.apache.commons.collections.MultiMap getAssociatedWorkflows(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Returns workflows and their actions that are associated with the given ProjectRole.
 DefaultRoleActors getDefaultRoleActors(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection collection)
          Will return a DefaultRoleActors for the given projectRole checking the currentUser has the correct permissions to perform the get operation.
 Map<Long,List<String>> getProjectIdsForUserInGroupsBecauseOfRole(com.atlassian.crowd.embedded.api.User currentUser, List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String userName, ErrorCollection errorCollection)
          Returns a Map of Lists.
 ProjectRole getProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Long id, ErrorCollection errorCollection)
          Will return the project role with the given id, and checking the currentUser has the correct permissions to perform the operation.
 ProjectRoleActors getProjectRoleActors(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, Project project, ErrorCollection errorCollection)
          Will return a {@link ProjectRoleActors) for the given projectRole and project checking the currentUser has the correct permissions to perform the get operation.
 ProjectRole getProjectRoleByName(com.atlassian.crowd.embedded.api.User currentUser, String name, ErrorCollection errorCollection)
          Will return the project role with the given name, and checking the currentUser has the correct permissions to perform the operation.
 Collection<ProjectRole> getProjectRoles(com.atlassian.crowd.embedded.api.User currentUser, ErrorCollection errorCollection)
          Get all the ProjectRoles available in JIRA.
 Collection<Project> getProjectsContainingRoleActorByNameAndType(com.atlassian.crowd.embedded.api.User currentUser, String name, String type, ErrorCollection errorCollection)
          Returns the Project's which contain a role actor of the specified name and type within any role.
 boolean hasProjectRolePermission(com.atlassian.crowd.embedded.api.User currentUser, Project project)
          Will have permission to modify roles if they are a JIRA admin or, if in enterprise, the user is a project administrator.
 boolean isProjectRoleNameUnique(com.atlassian.crowd.embedded.api.User currentUser, String name, ErrorCollection errorCollection)
          Will tell you if a role name exists or not.
 void removeActorsFromProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Collection<String> actors, ProjectRole projectRole, Project project, String actorType, ErrorCollection errorCollection)
          Will remove project role actor associations for the given actors and checking the currentUser has the correct permissions to perform the update operation.
 void removeAllRoleActorsByNameAndType(String name, String type)
          Will remove all role actors with the specified name and the specified type.
 void removeAllRoleActorsByNameAndType(com.atlassian.crowd.embedded.api.User currentUser, String name, String type, ErrorCollection errorCollection)
          Will remove all role actors with the specified name and the specified type.
 void removeAllRoleActorsByProject(com.atlassian.crowd.embedded.api.User currentUser, Project project, ErrorCollection errorCollection)
          Will remove all role actors associated with the specified project.
 void removeDefaultActorsFromProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Collection<String> actors, ProjectRole projectRole, String actorType, ErrorCollection errorCollection)
          Will remove default actor associations based off the passed in actors, projectRole and actorType and checking the currentUser has the correct permissions to perform the update operation.
 List<Long> roleActorOfTypeExistsForProjects(com.atlassian.crowd.embedded.api.User currentUser, List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String projectRoleParameter, ErrorCollection errorCollection)
          Returns a list of projectId's for which the role actor of the specified type exists in the project for the provided projectRole.
 void setActorsForProjectRole(com.atlassian.crowd.embedded.api.User currentUser, Map<String,Set<String>> newRoleActors, ProjectRole projectRole, Project project, ErrorCollection errorCollection)
          Will set the project role actor associations for the given newRoleActors and checking the currentUser has the correct permissions to perform the update operation.
 void updateProjectRole(com.atlassian.crowd.embedded.api.User currentUser, ProjectRole projectRole, ErrorCollection errorCollection)
          Will update projectRole, checking the currentUser has the correct permissions to perform the update operation.
 ErrorCollection validateRemoveAllRoleActorsByNameAndType(com.atlassian.crowd.embedded.api.User currentUser, String name, String type)
          Will validate removing all role actors with the specified name and the specified type.
 

Field Detail

PROJECTROLE_ISSUE_SECURITY_TYPE

static final String PROJECTROLE_ISSUE_SECURITY_TYPE
See Also:
Constant Field Values

PROJECTROLE_PERMISSION_TYPE

static final String PROJECTROLE_PERMISSION_TYPE
See Also:
Constant Field Values

PROJECTROLE_NOTIFICATION_TYPE

static final String PROJECTROLE_NOTIFICATION_TYPE
See Also:
Constant Field Values
Method Detail

getProjectRoles

Collection<ProjectRole> getProjectRoles(com.atlassian.crowd.embedded.api.User currentUser,
                                        ErrorCollection errorCollection)
Get all the ProjectRoles available in JIRA. Currently this list is global.

Returns:
The global list of project roles in JIRA

getProjectRole

ProjectRole getProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                           Long id,
                           ErrorCollection errorCollection)
Will return the project role with the given id, and checking the currentUser has the correct permissions to perform the operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
id - the id of the ProjectRole
errorCollection - will contain any errors in calling the method
Returns:
the ProjectRole for the given id, will return null if no role found

getProjectRoleByName

ProjectRole getProjectRoleByName(com.atlassian.crowd.embedded.api.User currentUser,
                                 String name,
                                 ErrorCollection errorCollection)
Will return the project role with the given name, and checking the currentUser has the correct permissions to perform the operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
name - the name of the project role to return
errorCollection - will contain any errors in calling the method
Returns:
the ProjectRole for the given name, will return null if no role found

createProjectRole

ProjectRole createProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                              ProjectRole projectRole,
                              ErrorCollection errorCollection)
Will create the project role with the given projectRole.getName(), projectRole.getDescription() and checking the currentUser has the correct permissions to perform the create operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
projectRole - can not be null and will contain the name and description for the project role to create
errorCollection - will contain any errors in calling the method
Returns:
the ProjectRole object that was created

isProjectRoleNameUnique

boolean isProjectRoleNameUnique(com.atlassian.crowd.embedded.api.User currentUser,
                                String name,
                                ErrorCollection errorCollection)
Will tell you if a role name exists or not.

Parameters:
name - the name of the project role to check
Returns:
true if unique, false if one already exists with that name

deleteProjectRole

void deleteProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                       ProjectRole projectRole,
                       ErrorCollection errorCollection)
Will delete the given projectRole and checks the currentUser has the correct permissions to perform the delete operation. This will also delete all ProjectRoleActor associations that it is the parent of. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
projectRole -
errorCollection - will contain any errors in calling the method

addActorsToProjectRole

void addActorsToProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                            Collection<String> actors,
                            ProjectRole projectRole,
                            Project project,
                            String actorType,
                            ErrorCollection errorCollection)
Will add project role actor associations for the given actors and checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
actors - is a list of strings that they RoleActor impl should be able to handle
projectRole - is the project role to associate with
project - is the project to associate with
actorType - is a type that defines the type of role actor to instantiate (ex./ UserRoleActor.TYPE, GroupRoleActor.TYPE)
errorCollection - will contain any errors in calling the method

removeActorsFromProjectRole

void removeActorsFromProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                                 Collection<String> actors,
                                 ProjectRole projectRole,
                                 Project project,
                                 String actorType,
                                 ErrorCollection errorCollection)
Will remove project role actor associations for the given actors and checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
actors - is a list of strings that they RoleActor impl should be able to handle
projectRole - is the project role to associate with
project - is the project to associate with
actorType - is a type that defines the type of role actor to instantiate (ex./ UserRoleActor.TYPE, GroupRoleActor.TYPE)
errorCollection - will contain any errors in calling the method

setActorsForProjectRole

void setActorsForProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                             Map<String,Set<String>> newRoleActors,
                             ProjectRole projectRole,
                             Project project,
                             ErrorCollection errorCollection)
Will set the project role actor associations for the given newRoleActors and checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
newRoleActors - is a mapping of actor types to actor parameters that will be set for the project role
projectRole - is the project role to associate with
project - is the project to associate with
errorCollection - will contain any errors in calling the method

updateProjectRole

void updateProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                       ProjectRole projectRole,
                       ErrorCollection errorCollection)
Will update projectRole, checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
projectRole -
errorCollection - will contain any errors in calling the method

getProjectRoleActors

ProjectRoleActors getProjectRoleActors(com.atlassian.crowd.embedded.api.User currentUser,
                                       ProjectRole projectRole,
                                       Project project,
                                       ErrorCollection errorCollection)
Will return a {@link ProjectRoleActors) for the given projectRole and project checking the currentUser has the correct permissions to perform the get operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
projectRole -
project -
errorCollection - will contain any errors in calling the method
Returns:
the ProjectRoleActor representing the projectRole and project

getDefaultRoleActors

DefaultRoleActors getDefaultRoleActors(com.atlassian.crowd.embedded.api.User currentUser,
                                       ProjectRole projectRole,
                                       ErrorCollection collection)
Will return a DefaultRoleActors for the given projectRole checking the currentUser has the correct permissions to perform the get operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
projectRole -
collection -
Returns:
the default role actors

addDefaultActorsToProjectRole

void addDefaultActorsToProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                                   Collection<String> actors,
                                   ProjectRole projectRole,
                                   String type,
                                   ErrorCollection errorCollection)
Will add default role actor associations based off the passed in actors and checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
actors - is a list of strings that they RoleActor impl should be able to handle
projectRole - is the project role to associate with
type - is a type that defines the type of role actor to instantiate (ex./ UserRoleActor.TYPE, GroupRoleActor.TYPE)
errorCollection - will contain any errors in calling the method

removeDefaultActorsFromProjectRole

void removeDefaultActorsFromProjectRole(com.atlassian.crowd.embedded.api.User currentUser,
                                        Collection<String> actors,
                                        ProjectRole projectRole,
                                        String actorType,
                                        ErrorCollection errorCollection)
Will remove default actor associations based off the passed in actors, projectRole and actorType and checking the currentUser has the correct permissions to perform the update operation. The passed in errorCollection will contain any errors that are generated, such as permission violations.

Parameters:
currentUser - the user performing the call
actors - is a list of strings that they RoleActor impl should be able to handle
projectRole - is the project role to associate with
actorType - is a type that defines the type of role actor to instantiate (ex./ UserRoleActor.TYPE, GroupRoleActor.TYPE)
errorCollection - will contain any errors in calling the method

removeAllRoleActorsByNameAndType

void removeAllRoleActorsByNameAndType(com.atlassian.crowd.embedded.api.User currentUser,
                                      String name,
                                      String type,
                                      ErrorCollection errorCollection)
Will remove all role actors with the specified name and the specified type. This method should be used to clean up after the actual subject of the role actor has been deleted (ex. deleting a user from the system).

Parameters:
currentUser - the user performing the call
name - this is the name that the role actor is stored under (ex. username of 'admin', group name of 'jira-users')
type - this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)
errorCollection - will contain any errors in calling the method

validateRemoveAllRoleActorsByNameAndType

ErrorCollection validateRemoveAllRoleActorsByNameAndType(com.atlassian.crowd.embedded.api.User currentUser,
                                                         String name,
                                                         String type)
Will validate removing all role actors with the specified name and the specified type. This method should be used before clean up after the actual subject of the role actor has been deleted (ex. deleting a user from the system). Validation error wil be reported when name does not exists, type does not exists or user performing validation does not have administrative rights

Parameters:
currentUser - the user performing the call
name - this is the name that the role actor is stored under (ex. username of 'admin', group name of 'jira-users')
type - this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)
Returns:
errorCollection will contain any errors in calling the method

removeAllRoleActorsByNameAndType

void removeAllRoleActorsByNameAndType(String name,
                                      String type)
Will remove all role actors with the specified name and the specified type. This method should be used to clean up after the actual subject of the role actor has been deleted (ex. deleting a user from the system).

Parameters:
name - this is the name that the role actor is stored under (ex. username of 'admin', group name of 'jira-users')
type - this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)

removeAllRoleActorsByProject

void removeAllRoleActorsByProject(com.atlassian.crowd.embedded.api.User currentUser,
                                  Project project,
                                  ErrorCollection errorCollection)
Will remove all role actors associated with the specified project. This method should be used to clean up just before the actual project has been deleted (ex. deleting a project from the system).

Parameters:
currentUser - the user performing the call
project -
errorCollection - will contain any errors in calling the method

getAssociatedNotificationSchemes

Collection getAssociatedNotificationSchemes(com.atlassian.crowd.embedded.api.User currentUser,
                                            ProjectRole projectRole,
                                            ErrorCollection errorCollection)
Will get all notification scheme's that the specified projectRole is currently used in.

Parameters:
currentUser - the user performing the call
projectRole -
errorCollection - will contain any errors in calling the method
Returns:
a collection of schemes, if no schemes are found this will be an empty collection.

getAssociatedPermissionSchemes

Collection getAssociatedPermissionSchemes(com.atlassian.crowd.embedded.api.User currentUser,
                                          ProjectRole projectRole,
                                          ErrorCollection errorCollection)
Will get all permission scheme's that the specified projectRole is currently used in.

Parameters:
currentUser - the user performing the call
projectRole -
errorCollection - will contain any errors in calling the method
Returns:
a collection of schemes, if no schemes are found this will be an empty collection.

getAssociatedIssueSecuritySchemes

Collection getAssociatedIssueSecuritySchemes(com.atlassian.crowd.embedded.api.User currentUser,
                                             ProjectRole projectRole,
                                             ErrorCollection errorCollection)
Will get all issue security scheme's that the specified projectRole is currently used in.

Parameters:
currentUser - the user performing the call
projectRole -
errorCollection - will contain any errors in calling the method
Returns:
a collection of schemes, if no schemes are found this will be an empty collection.

getAssociatedWorkflows

org.apache.commons.collections.MultiMap getAssociatedWorkflows(com.atlassian.crowd.embedded.api.User currentUser,
                                                               ProjectRole projectRole,
                                                               ErrorCollection errorCollection)
Returns workflows and their actions that are associated with the given ProjectRole. e.g. com.atlassian.jira.workflow.condition.InProjectRoleCondition workflow elements that block workflow transition unless the acting user is in the ProjectRole.

Parameters:
currentUser - the acting user.
projectRole - the project role.
errorCollection - will contain any errors in calling the method
Returns:
a possibly empty MultiMap of Workflow objects to List of Actions.

getProjectsContainingRoleActorByNameAndType

Collection<Project> getProjectsContainingRoleActorByNameAndType(com.atlassian.crowd.embedded.api.User currentUser,
                                                                String name,
                                                                String type,
                                                                ErrorCollection errorCollection)
Returns the Project's which contain a role actor of the specified name and type within any role. This is a method that is provided so that you can efficiently tell which users or groups have been associated with any role within projects.

Parameters:
currentUser - the acting user.
name - this is the name that the role actor is stored under (ex. username of 'admin', group name of 'jira-users')
type - this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)
errorCollection - will contain any errors in calling the method
Returns:
a collection of Project's which have a role which contains the role actor with the specified name and type.

roleActorOfTypeExistsForProjects

List<Long> roleActorOfTypeExistsForProjects(com.atlassian.crowd.embedded.api.User currentUser,
                                            List<Long> projectsToLimitBy,
                                            ProjectRole projectRole,
                                            String projectRoleType,
                                            String projectRoleParameter,
                                            ErrorCollection errorCollection)
Returns a list of projectId's for which the role actor of the specified type exists in the project for the provided projectRole. This is a method that is meant to efficiently allow discovery of whether a UserRoleActor exists in a project role for a subset of projects.

Parameters:
currentUser - the acting user.
projectsToLimitBy - this will limit the range of projects the method queries. This is a list of Long, project id's. The returned list will be either the same as this list or a subset.
projectRole - the project role to find out if an actor is a member of.
projectRoleType - the type of role actor you want to query for, in most cases this will be UserRoleActor.TYPE.
projectRoleParameter - the parameter describing the role actor, in the case of a UserRoleActor this will be the username.
errorCollection - will contain any errors in calling the method
Returns:
A list of Long, project id's. If a projectId is in this list then the project contains has a role associated for the passed in actor and project role.

getProjectIdsForUserInGroupsBecauseOfRole

Map<Long,List<String>> getProjectIdsForUserInGroupsBecauseOfRole(com.atlassian.crowd.embedded.api.User currentUser,
                                                                 List<Long> projectsToLimitBy,
                                                                 ProjectRole projectRole,
                                                                 String projectRoleType,
                                                                 String userName,
                                                                 ErrorCollection errorCollection)
Returns a Map of Lists. The key of the map is a Long, project id and the value of the map is a list of group names that the user is a member of for the project. This method is meant to provide an efficient means to discover which groups that are associated with a project role implicitly include the specified user in that project role. We allow you to specify a range of projectsToLimitBy so that you can perform only one query to find this information for many projects for a single projectRole.

Parameters:
currentUser - the acting user.
projectsToLimitBy - this will limit the range of projects the method queries. This is a list of Long, project id's. The returned list will be either the same as this list or a subset.
projectRole - the project role to find out if an actor is a member of.
projectRoleType - the type of role actor you want to query for, in most cases this will be UserRoleActor.TYPE.
userName - the username to find out if the user is in the role because of a group
errorCollection - will contain any errors in calling the method
Returns:
Returns a Map of Lists. The key of the map is a Long, project id and the value of the map is a list of group names that the user is a member of for the project.

hasProjectRolePermission

boolean hasProjectRolePermission(com.atlassian.crowd.embedded.api.User currentUser,
                                 Project project)
Will have permission to modify roles if they are a JIRA admin or, if in enterprise, the user is a project administrator.

Parameters:
currentUser - the acting user.
project - is the project to check permissions against
Returns:
true if you have permission, false otherwise.


Copyright © 2002-2013 Atlassian. All Rights Reserved.