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
eventPublisher, groupManager, projectManager, schemeFactory, securityTypeManager
 
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, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, UserPreferencesManager userPreferencesManager, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue createDefaultScheme()
          Creates a default scheme, with an id of 0
protected  AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project)
           
protected  AbstractSchemeCopiedEvent createSchemeCopiedEvent(Scheme oldScheme, Scheme newScheme)
           
protected  AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
           
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
protected  Object createSchemeEntityDeletedEvent(org.ofbiz.core.entity.GenericValue entity)
           
protected  org.ofbiz.core.entity.GenericValue createSchemeEntityNoEvent(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
           
protected  AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project)
           
protected  AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme, Scheme originalScheme)
           
 void deleteScheme(Long id)
          Deletes a scheme from the database
protected  I18nHelper getApplicationI18n()
           
 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()
           
protected  SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue schemeEntityGV)
           
 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.
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, deleteEntity, 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, 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, copyScheme, createScheme, createSchemeAndEntities, createSchemeObject, deleteEntity, 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, updateScheme
 

Constructor Detail

DefaultNotificationSchemeManager

public DefaultNotificationSchemeManager(ProjectManager projectManager,
                                        PermissionTypeManager permissionTypeManager,
                                        PermissionContextFactory permissionContextFactory,
                                        OfBizDelegator delegator,
                                        SchemeFactory schemeFactory,
                                        com.atlassian.event.api.EventPublisher eventPublisher,
                                        NotificationTypeManager notificationTypeManager,
                                        NodeAssociationStore nodeAssociationStore,
                                        GroupManager groupManager,
                                        UserPreferencesManager userPreferencesManager,
                                        com.atlassian.cache.CacheManager cacheManager)
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

createSchemeCreatedEvent

protected AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
Specified by:
createSchemeCreatedEvent in class AbstractSchemeManager

createSchemeCopiedEvent

@Nonnull
protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull
                                                                    Scheme oldScheme,
                                                                    @Nonnull
                                                                    Scheme newScheme)
Specified by:
createSchemeCopiedEvent in class AbstractSchemeManager

createSchemeUpdatedEvent

protected AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme,
                                                              Scheme originalScheme)
Specified by:
createSchemeUpdatedEvent in class AbstractSchemeManager

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

createSchemeAddedToProjectEvent

@Nonnull
protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme,
                                                                                    Project project)
Specified by:
createSchemeAddedToProjectEvent in class AbstractSchemeManager

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

makeSchemeEntity

protected SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue schemeEntityGV)
Specified by:
makeSchemeEntity in class AbstractSchemeManager

createSchemeEntityDeletedEvent

protected Object createSchemeEntityDeletedEvent(org.ofbiz.core.entity.GenericValue entity)
Specified by:
createSchemeEntityDeletedEvent in class AbstractSchemeManager

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

@Nonnull
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

@Nonnull
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

createSchemeEntityNoEvent

protected org.ofbiz.core.entity.GenericValue createSchemeEntityNoEvent(org.ofbiz.core.entity.GenericValue scheme,
                                                                       SchemeEntity schemeEntity)
                                                                throws org.ofbiz.core.entity.GenericEntityException
Specified by:
createSchemeEntityNoEvent in class AbstractSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

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

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.

createSchemeRemovedFromProjectEvent

protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme,
                                                                                    Project project)
Specified by:
createSchemeRemovedFromProjectEvent in class AbstractSchemeManager

getApplicationI18n

protected I18nHelper getApplicationI18n()
Overrides:
getApplicationI18n in class AbstractSchemeManager


Copyright © 2002-2014 Atlassian. All Rights Reserved.