com.atlassian.jira.notification.type
Class ProjectRoleSecurityAndNotificationType

java.lang.Object
  extended by com.atlassian.jira.security.type.AbstractSecurityType
      extended by com.atlassian.jira.security.type.AbstractProjectsSecurityType
          extended by com.atlassian.jira.notification.type.ProjectRoleSecurityAndNotificationType
All Implemented Interfaces:
NotificationType, SchemeType, SecurityType

public class ProjectRoleSecurityAndNotificationType
extends AbstractProjectsSecurityType
implements NotificationType, SecurityType


Field Summary
static String PROJECT_ROLE
           
 
Constructor Summary
ProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory)
           
 
Method Summary
 boolean doValidation(String key, Map parameters)
          Validate the configuration (the argument in NotificationType.getRecipients(com.atlassian.jira.event.issue.IssueEvent, java.lang.String)) when it is entered in the "Add Notification" page.
 String getArgumentDisplay(String roleTypeId)
          Displays the type's configuration in the notification scheme.
 String getDisplayName()
          Text to display for this type, on the "Add Notification" page.
 Collection getProjectRoles()
           
 List getRecipients(IssueEvent event, String roleId)
          Who is to be notified of an event.
 String getType()
          Type identifier (currently unused).
 Set getUsers(PermissionContext permissionContext, String roleId)
          Returns a list of Users represented by a security type instance.
protected  Set getUsersFromRole(Project project, String roleId)
          Get all the users that satisfy this particular role.
 boolean hasPermission(org.ofbiz.core.entity.GenericValue entity, String argument)
          Interface for determining if a permission type has the permission.
 boolean hasPermission(org.ofbiz.core.entity.GenericValue entity, String argument, User user, boolean issueCreation)
          Interface for determining if a permission type has the permission
 
Methods inherited from class com.atlassian.jira.security.type.AbstractProjectsSecurityType
getQuery
 
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.security.type.SecurityType
getQuery
 

Field Detail

PROJECT_ROLE

public static final String PROJECT_ROLE
See Also:
Constant Field Values
Constructor Detail

ProjectRoleSecurityAndNotificationType

public ProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext,
                                              ProjectRoleManager projectRoleManager,
                                              ProjectFactory projectFactory)
Method Detail

getProjectRoles

public Collection getProjectRoles()

getDisplayName

public String getDisplayName()
Description copied from interface: NotificationType
Text to display for this type, on the "Add Notification" page.

Specified by:
getDisplayName in interface NotificationType
Specified by:
getDisplayName in interface SchemeType
Returns:
(Internationalized) text to display, eg. "Group".

getType

public String getType()
Description copied from interface: NotificationType
Type identifier (currently unused).

Specified by:
getType in interface NotificationType
Specified by:
getType in interface SchemeType
Returns:
Eg. "group"

doValidation

public boolean doValidation(String key,
                            Map parameters)
Description copied from interface: NotificationType
Validate the configuration (the argument in NotificationType.getRecipients(com.atlassian.jira.event.issue.IssueEvent, java.lang.String)) when it is entered in the "Add Notification" page. For instance, a group notification type might check if the entered group exists.

Specified by:
doValidation in interface NotificationType
Specified by:
doValidation in interface SchemeType
Parameters:
key - Key of relevant value in parameters
parameters - HTML form parameters (only the keyed entry is relevant).
Returns:
Whether the entered value is valid for this type.

getArgumentDisplay

public String getArgumentDisplay(String roleTypeId)
Description copied from interface: NotificationType
Displays the type's configuration in the notification scheme. Eg. shows the group name, or custom field name.

Specified by:
getArgumentDisplay in interface NotificationType
Specified by:
getArgumentDisplay in interface SecurityType
Overrides:
getArgumentDisplay in class AbstractSecurityType
Parameters:
roleTypeId - Raw configuration value
Returns:
Formatted configuration value.

getUsers

public Set getUsers(PermissionContext permissionContext,
                    String roleId)
Description copied from interface: SecurityType
Returns a list of Users represented by a security type instance. The collection must not contain any nulls.

Specified by:
getUsers in interface SecurityType
Parameters:
permissionContext - The current issue and project
roleId - Instance value, eg. a group name, user name, custom field id
Returns:
A set of Users.

hasPermission

public boolean hasPermission(org.ofbiz.core.entity.GenericValue entity,
                             String argument)
Description copied from interface: SchemeType
Interface for determining if a permission type has the permission.

This method is called if there is no Remote User (ie anonymous)

Specified by:
hasPermission in interface SchemeType
Parameters:
entity - This is the issue or the project that the security is being checked for
argument - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)

hasPermission

public boolean hasPermission(org.ofbiz.core.entity.GenericValue entity,
                             String argument,
                             User user,
                             boolean issueCreation)
Description copied from interface: SchemeType
Interface for determining if a permission type has the permission

Specified by:
hasPermission in interface SchemeType
Parameters:
entity - This is the issue or the project that the security is being checked for
argument - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
user - The user for whom the permission is being checked
issueCreation - Whether this permission is being checked during issue creation

getRecipients

public List getRecipients(IssueEvent event,
                          String roleId)
Description copied from interface: NotificationType
Who is to be notified of an event.

Specified by:
getRecipients in interface NotificationType
Parameters:
event - The event, eg. issue created
roleId - Configuration from notification scheme, eg. group name, custom field id.
Returns:
A list of NotificationRecipients.

getUsersFromRole

protected Set getUsersFromRole(Project project,
                               String roleId)
Get all the users that satisfy this particular role.

Protected access so it can be directly called from unittests

Parameters:
project - the project you to find want users for
roleId - the specific role you want to find users for
Returns:
A collection of User objects


Copyright © 2002-2007 Atlassian. All Rights Reserved.