com.atlassian.jira.notification
Class DefaultNotificationSchemeManager

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by com.atlassian.jira.notification.DefaultNotificationSchemeManager
All Implemented Interfaces:
Startable, NotificationSchemeManager, SchemeManager

public class DefaultNotificationSchemeManager
extends AbstractSchemeManager
implements NotificationSchemeManager, Startable


Field Summary
 
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
projectManager, schemeFactory
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
DefaultNotificationSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory, com.atlassian.event.api.EventPublisher eventPublisher, NotificationTypeManager notificationTypeManager, AssociationManager associationManager, GroupManager groupManager)
           
 
Method Summary
 Scheme copyScheme(Scheme scheme)
          Copys a scheme, giving the new scheme the same entities as the original one
 org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme, org.ofbiz.core.entity.GenericValue entity)
           
 org.ofbiz.core.entity.GenericValue createDefaultScheme()
          Creates a default scheme, with an id of 0
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
 Scheme createSchemeObject(String name, String description)
          Creates a new scheme
 void deleteEntity(Long id)
          Deletes an entity with the given id from the database.
 void deleteScheme(Long id)
          Deletes a scheme from the database
 String getDefaultDescriptionKey()
           
 String getDefaultNameKey()
           
 org.ofbiz.core.entity.GenericValue getDefaultScheme()
          Gets the default scheme.
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long eventTypeId)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long eventTypeId, String parameter)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId)
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId)
           
 String getEntityName()
           
 List<SchemeEntity> getNotificationSchemeEntities(Project project, long entityTypeId)
          Get the notification scheme entities for this project and entity type.
 org.ofbiz.core.entity.GenericValue getNotificationSchemeForProject(org.ofbiz.core.entity.GenericValue projectGV)
          Get the notification scheme for this project.
 Set<NotificationRecipient> getRecipients(IssueEvent event)
          Given an issue event this method returns a set of NotificationRecipients who will receive an e-mail notification
 Set<NotificationRecipient> getRecipients(IssueEvent event, SchemeEntity notification)
          Retrieve the set of recipients for the event using the specified notification entity.
 String getSchemeDesc()
           
 String getSchemeEntityName()
           
 Collection<org.ofbiz.core.entity.GenericValue> 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.
 Map<Long,String> getSchemesMapByConditions(Map<String,?> conditions)
          Retrieve a map of scheme ids to scheme names that match the specified conditions.
 boolean hasEntities(org.ofbiz.core.entity.GenericValue scheme, Long eventTypeId, String type, String parameter, Long templateId)
           
 boolean hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue entity)
          Checks anonymous permission of the given permission type for the given entity.
 boolean hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue entity, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Checks the given user's permission of the given permission type for the given entity.
 boolean isHasMailServer()
           
 void onClearCache(ClearCacheEvent event)
           
 void removeSchemeEntitiesForField(String customFieldId)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 void updateScheme(Scheme scheme)
          Updates any changes to the scheme object.
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createScheme, createSchemeAndEntities, createSchemeGenericValue, flushProjectSchemes, getAssociatedSchemes, getAssociationType, getDefaultSchemeObject, getEntities, getEntities, getEntity, getGroups, getGroups, getNameForCopy, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, 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, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createScheme, createSchemeAndEntities, getAssociatedSchemes, getDefaultSchemeObject, getEntities, getEntities, getEntity, getGroups, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeEntities, removeEntities, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme
 

Constructor Detail

DefaultNotificationSchemeManager

public DefaultNotificationSchemeManager(ProjectManager projectManager,
                                        PermissionTypeManager permissionTypeManager,
                                        PermissionContextFactory permissionContextFactory,
                                        OfBizDelegator delegator,
                                        SchemeFactory schemeFactory,
                                        com.atlassian.event.api.EventPublisher eventPublisher,
                                        NotificationTypeManager notificationTypeManager,
                                        AssociationManager associationManager,
                                        GroupManager groupManager)
Method Detail

start

public void start()
           throws 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:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)
Overrides:
onClearCache in class AbstractSchemeManager

getSchemeEntityName

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

getEntityName

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

getSchemeDesc

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

getDefaultNameKey

public String getDefaultNameKey()
Specified by:
getDefaultNameKey in class AbstractSchemeManager

getDefaultDescriptionKey

public String getDefaultDescriptionKey()
Specified by:
getDefaultDescriptionKey in class AbstractSchemeManager

createSchemeObject

public Scheme createSchemeObject(String name,
                                 String description)
Description copied from interface: SchemeManager
Creates a new scheme

Specified by:
createSchemeObject in interface SchemeManager
Overrides:
createSchemeObject in class AbstractSchemeManager
Parameters:
name - The name of the new scheme
description - The description of the new scheme
Returns:
The new scheme object

copyScheme

public Scheme copyScheme(Scheme scheme)
Description copied from interface: SchemeManager
Copys a scheme, giving the new scheme the same entities as the original one

Specified by:
copyScheme in interface SchemeManager
Overrides:
copyScheme in class AbstractSchemeManager
Parameters:
scheme - The permission scheme to be copied
Returns:
The new permission scheme

updateScheme

public void updateScheme(Scheme scheme)
                  throws DataAccessException
Description copied from interface: SchemeManager
Updates any changes to the scheme object. This does not include changes to the scheme entities.

Specified by:
updateScheme in interface SchemeManager
Overrides:
updateScheme in class AbstractSchemeManager
Parameters:
scheme - The modified scheme object
Throws:
DataAccessException

deleteScheme

public void deleteScheme(Long id)
                  throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: SchemeManager
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 - If a DB error occurs

getDefaultScheme

public org.ofbiz.core.entity.GenericValue getDefaultScheme()
                                                    throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: SchemeManager
Gets the default scheme. This should have an id of 0 This does not work for the Default Notification scheme as it does not have an id of 0.

Specified by:
getDefaultScheme in interface SchemeManager
Overrides:
getDefaultScheme in class AbstractSchemeManager
Returns:
The default scheme
Throws:
org.ofbiz.core.entity.GenericEntityException - If a DB error occurs

createDefaultScheme

public org.ofbiz.core.entity.GenericValue createDefaultScheme()
                                                       throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: SchemeManager
Creates a default scheme, with an id of 0

Specified by:
createDefaultScheme in interface SchemeManager
Overrides:
createDefaultScheme in class AbstractSchemeManager
Returns:
The new permission scheme object
Throws:
org.ofbiz.core.entity.GenericEntityException - If a DB error occurs

removeSchemeEntitiesForField

public void removeSchemeEntitiesForField(String customFieldId)
                                  throws RemoveException
Specified by:
removeSchemeEntitiesForField in interface NotificationSchemeManager
Throws:
RemoveException

getNotificationSchemeEntities

public List<SchemeEntity> getNotificationSchemeEntities(Project project,
                                                        long entityTypeId)
                                                 throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: NotificationSchemeManager
Get the notification scheme entities for this project and entity type.

Returns an empty List if there problems (e.g. more than one scheme association for the Project) encountered.

Specified by:
getNotificationSchemeEntities in interface NotificationSchemeManager
Parameters:
project - the project
entityTypeId - the type of entity
Returns:
notificationSchemeEntities scheme entities representing the notifications for the project
Throws:
org.ofbiz.core.entity.GenericEntityException

getNotificationSchemeForProject

public org.ofbiz.core.entity.GenericValue getNotificationSchemeForProject(org.ofbiz.core.entity.GenericValue projectGV)
Description copied from interface: NotificationSchemeManager
Get the notification scheme for this project. There should be only one.

Returns null if there problems (e.g. more than one scheme association) encountered.

Specified by:
getNotificationSchemeForProject in interface NotificationSchemeManager
Parameters:
projectGV - the project
Returns:
notificationScheme the GenericValue object representing a notification scheme

getSchemesMapByConditions

public Map<Long,String> getSchemesMapByConditions(Map<String,?> conditions)
Description copied from interface: NotificationSchemeManager
Retrieve a map of scheme ids to scheme names that match the specified conditions.

Specified by:
getSchemesMapByConditions in interface NotificationSchemeManager
Parameters:
conditions - Map of conditions on which to limit the search
Returns:
Map scheme ids -> scheme names

getSchemesContainingEntity

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

isHasMailServer

public boolean isHasMailServer()
                        throws com.atlassian.mail.MailException
Specified by:
isHasMailServer in interface NotificationSchemeManager
Throws:
com.atlassian.mail.MailException

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

deleteEntity

public void deleteEntity(Long id)
                  throws DataAccessException
Description copied from interface: SchemeManager
Deletes an entity with the given id 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:
DataAccessException

getRecipients

public Set<NotificationRecipient> getRecipients(IssueEvent event,
                                                SchemeEntity notification)
                                         throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: NotificationSchemeManager
Retrieve the set of recipients for the event using the specified notification entity.

Specified by:
getRecipients in interface NotificationSchemeManager
Parameters:
event - issue event
notification - scheme entity
Returns:
a Set of notification recipients
Throws:
org.ofbiz.core.entity.GenericEntityException

getRecipients

public Set<NotificationRecipient> getRecipients(IssueEvent event)
Description copied from interface: NotificationSchemeManager
Given an issue event this method returns a set of NotificationRecipients who will receive an e-mail notification

Specified by:
getRecipients in interface NotificationSchemeManager
Parameters:
event - The issue event that triggered the notification
Returns:
A Set of recipients that will receive e-mails for this event.

hasEntities

public boolean hasEntities(org.ofbiz.core.entity.GenericValue scheme,
                           Long eventTypeId,
                           String type,
                           String parameter,
                           Long templateId)
                    throws org.ofbiz.core.entity.GenericEntityException
Specified by:
hasEntities in interface NotificationSchemeManager
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<org.ofbiz.core.entity.GenericValue> 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

getEntities

public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                            Long eventTypeId)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                            Long eventTypeId,
                                                            String parameter)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                            String type,
                                                            Long entityTypeId)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

hasSchemeAuthority

public boolean hasSchemeAuthority(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(Long entityType,
                                  org.ofbiz.core.entity.GenericValue entity,
                                  com.atlassian.crowd.embedded.api.User user,
                                  boolean issueCreation)
Description copied from interface: SchemeManager
Checks the given user's 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.
user - the user.
issueCreation - whether the permission is for creating an issue.
Returns:
true only if the user is permitted.


Copyright © 2002-2013 Atlassian. All Rights Reserved.