com.atlassian.jira.issue.subscription
Class DefaultSubscriptionManager

java.lang.Object
  extended by com.atlassian.jira.mail.MailingListCompiler
      extended by com.atlassian.jira.issue.subscription.DefaultSubscriptionManager
All Implemented Interfaces:
SubscriptionManager

public class DefaultSubscriptionManager
extends MailingListCompiler
implements SubscriptionManager


Field Summary
static String JOB_RUNNER_KEY
           
static String SUBSCRIPTION_PREFIX
           
 
Fields inherited from interface com.atlassian.jira.issue.subscription.SubscriptionManager
SUBSCRIPTION_IDENTIFIER
 
Constructor Summary
DefaultSubscriptionManager(OfBizDelegator delegator, com.atlassian.mail.queue.MailQueue mailQueue, TemplateManager templateManager, SubscriptionMailQueueItemFactory subscriptionMailQueueItemFactory, ProjectRoleManager projectRoleManager, GroupManager groupManager, com.atlassian.scheduler.SchedulerService schedulerService)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue createSubscription(ApplicationUser user, Long filterId, String groupName, Long period, Boolean emailOnEmpty)
           
 FilterSubscription createSubscription(ApplicationUser user, Long filterId, String groupName, String cronExpression, Boolean emailOnEmpty)
          Creates a new subscription based on the passed in filter id and fired in accordance with the passed in trigger
 org.ofbiz.core.entity.GenericValue createSubscription(ApplicationUser user, Long filterId, String groupName, org.quartz.Trigger trigger, Boolean emailOnEmpty)
          Creates a new subscription based on the passed in filter id and fired in accordance with the passed in trigger
 org.ofbiz.core.entity.GenericValue createSubscription(com.atlassian.crowd.embedded.api.User user, Long filterId, String groupName, Long period, Boolean emailOnEmpty)
           
 org.ofbiz.core.entity.GenericValue createSubscription(com.atlassian.crowd.embedded.api.User user, Long filterId, String groupName, org.quartz.Trigger trigger, Boolean emailOnEmpty)
           
 void deleteSubscription(Long subId)
           
 void deleteSubscriptionsForGroup(com.atlassian.crowd.embedded.api.Group group)
           
 void deleteSubscriptionsForUser(ApplicationUser user)
           
 void deleteSubscriptionsForUser(com.atlassian.crowd.embedded.api.User user)
           
 List<FilterSubscription> getAllFilterSubscriptions()
           
 List<FilterSubscription> getAllFilterSubscriptions(Long filterId)
           
 List<org.ofbiz.core.entity.GenericValue> getAllSubscriptions()
           
 List<org.ofbiz.core.entity.GenericValue> getAllSubscriptions(Long filterId)
           
 String getCronExpressionForSubscription(FilterSubscription subscription)
          Retrieve the cron expression associated with this subscription
 FilterSubscription getFilterSubscription(ApplicationUser user, Long subId)
           
 FilterSubscription getFilterSubscription(Long subId)
          Get a subscription by Id
 List<FilterSubscription> getFilterSubscriptions(ApplicationUser user, Long filterId)
           
 Date getNextSendTime(FilterSubscription sub)
          Returns the next send time for this subscription.
 org.ofbiz.core.entity.GenericValue getSubscription(ApplicationUser user, Long subId)
           
 org.ofbiz.core.entity.GenericValue getSubscription(com.atlassian.crowd.embedded.api.User user, Long subId)
           
 org.ofbiz.core.entity.GenericValue getSubscriptionFromTriggerName(String triggerName)
           
 List<org.ofbiz.core.entity.GenericValue> getSubscriptions(ApplicationUser user, Long filterId)
           
 List<org.ofbiz.core.entity.GenericValue> getSubscriptions(com.atlassian.crowd.embedded.api.User user, Long filterId)
           
 org.quartz.Trigger getTriggerFromSubscription(org.ofbiz.core.entity.GenericValue subscription)
           
 boolean hasSubscription(ApplicationUser user, Long filterId)
           
 boolean hasSubscription(com.atlassian.crowd.embedded.api.User user, Long filterId)
           
 void runSubscription(ApplicationUser user, Long subId)
           
 void runSubscription(org.ofbiz.core.entity.GenericValue sub)
           
 void runSubscription(Long subId)
           
 void runSubscription(com.atlassian.crowd.embedded.api.User user, Long subId)
           
 void updateSubscription(ApplicationUser user, Long subId, String groupName, String cronExpression, Boolean emailOnEmpty)
           
 void updateSubscription(ApplicationUser user, Long subId, String groupName, org.quartz.Trigger trigger, Boolean emailOnEmpty)
           
 void updateSubscription(com.atlassian.crowd.embedded.api.User user, Long subscriptionId, String groupName, org.quartz.Trigger trigger, Boolean emailOnEmpty)
           
 
Methods inherited from class com.atlassian.jira.mail.MailingListCompiler
getEmailAddresses, sendLists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBSCRIPTION_PREFIX

public static final String SUBSCRIPTION_PREFIX

JOB_RUNNER_KEY

public static final String JOB_RUNNER_KEY
Constructor Detail

DefaultSubscriptionManager

public DefaultSubscriptionManager(OfBizDelegator delegator,
                                  com.atlassian.mail.queue.MailQueue mailQueue,
                                  TemplateManager templateManager,
                                  SubscriptionMailQueueItemFactory subscriptionMailQueueItemFactory,
                                  ProjectRoleManager projectRoleManager,
                                  GroupManager groupManager,
                                  com.atlassian.scheduler.SchedulerService schedulerService)
Method Detail

hasSubscription

public boolean hasSubscription(ApplicationUser user,
                               Long filterId)
                        throws org.ofbiz.core.entity.GenericEntityException
Specified by:
hasSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

hasSubscription

public boolean hasSubscription(com.atlassian.crowd.embedded.api.User user,
                               Long filterId)
                        throws org.ofbiz.core.entity.GenericEntityException
Specified by:
hasSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getFilterSubscription

public FilterSubscription getFilterSubscription(Long subId)
                                         throws org.ofbiz.core.entity.GenericEntityException
Description copied from interface: SubscriptionManager
Get a subscription by Id

Specified by:
getFilterSubscription in interface SubscriptionManager
Parameters:
subId - Subscription Id
Returns:
Subscription
Throws:
org.ofbiz.core.entity.GenericEntityException

getSubscription

public org.ofbiz.core.entity.GenericValue getSubscription(ApplicationUser user,
                                                          Long subId)
                                                   throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getFilterSubscription

public FilterSubscription getFilterSubscription(ApplicationUser user,
                                                Long subId)
                                         throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getFilterSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getSubscription

public org.ofbiz.core.entity.GenericValue getSubscription(com.atlassian.crowd.embedded.api.User user,
                                                          Long subId)
                                                   throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getSubscriptionFromTriggerName

@Nullable
public org.ofbiz.core.entity.GenericValue getSubscriptionFromTriggerName(String triggerName)
                                                                  throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getSubscriptionFromTriggerName in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getSubscriptions

public List<org.ofbiz.core.entity.GenericValue> getSubscriptions(ApplicationUser user,
                                                                 Long filterId)
                                                          throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getSubscriptions in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getFilterSubscriptions

public List<FilterSubscription> getFilterSubscriptions(ApplicationUser user,
                                                       Long filterId)
                                                throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getFilterSubscriptions in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getSubscriptions

public List<org.ofbiz.core.entity.GenericValue> getSubscriptions(com.atlassian.crowd.embedded.api.User user,
                                                                 Long filterId)
                                                          throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getSubscriptions in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getTriggerFromSubscription

public org.quartz.Trigger getTriggerFromSubscription(org.ofbiz.core.entity.GenericValue subscription)
Specified by:
getTriggerFromSubscription in interface SubscriptionManager

getCronExpressionForSubscription

@Nullable
public String getCronExpressionForSubscription(FilterSubscription subscription)
Description copied from interface: SubscriptionManager
Retrieve the cron expression associated with this subscription

Specified by:
getCronExpressionForSubscription in interface SubscriptionManager
Returns:
the cron expression associated with this subscription

updateSubscription

public void updateSubscription(ApplicationUser user,
                               Long subId,
                               String groupName,
                               org.quartz.Trigger trigger,
                               Boolean emailOnEmpty)
                        throws DataAccessException
Specified by:
updateSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
subId - identifies the subscription to update
groupName - (optional) the name of the group to receive the email
trigger - The trigger to update the subscription with
Throws:
DataAccessException - if there is a problem persisting the data.

updateSubscription

public void updateSubscription(ApplicationUser user,
                               Long subId,
                               String groupName,
                               String cronExpression,
                               Boolean emailOnEmpty)
                        throws DataAccessException
Specified by:
updateSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
subId - identifies the subscription to update
groupName - (optional) the name of the group to receive the email
cronExpression - The Cron expression to update the subscription with
Throws:
DataAccessException - if there is a problem persisting the data.

updateSubscription

public void updateSubscription(com.atlassian.crowd.embedded.api.User user,
                               Long subscriptionId,
                               String groupName,
                               org.quartz.Trigger trigger,
                               Boolean emailOnEmpty)
                        throws DataAccessException
Specified by:
updateSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
subscriptionId - identifies the subscription to update
groupName - (optional) the name of the group to receive the email
trigger - The trigger to update the subscription with
Throws:
DataAccessException - if there is a problem persisting the data.

getAllFilterSubscriptions

public List<FilterSubscription> getAllFilterSubscriptions(Long filterId)
Specified by:
getAllFilterSubscriptions in interface SubscriptionManager

getAllFilterSubscriptions

public List<FilterSubscription> getAllFilterSubscriptions()
Specified by:
getAllFilterSubscriptions in interface SubscriptionManager

getAllSubscriptions

public List<org.ofbiz.core.entity.GenericValue> getAllSubscriptions(Long filterId)
Specified by:
getAllSubscriptions in interface SubscriptionManager

getAllSubscriptions

public List<org.ofbiz.core.entity.GenericValue> getAllSubscriptions()
Specified by:
getAllSubscriptions in interface SubscriptionManager

createSubscription

public org.ofbiz.core.entity.GenericValue createSubscription(ApplicationUser user,
                                                             Long filterId,
                                                             String groupName,
                                                             Long period,
                                                             Boolean emailOnEmpty)
Specified by:
createSubscription in interface SubscriptionManager

createSubscription

public org.ofbiz.core.entity.GenericValue createSubscription(com.atlassian.crowd.embedded.api.User user,
                                                             Long filterId,
                                                             String groupName,
                                                             Long period,
                                                             Boolean emailOnEmpty)
Specified by:
createSubscription in interface SubscriptionManager

createSubscription

public org.ofbiz.core.entity.GenericValue createSubscription(ApplicationUser user,
                                                             Long filterId,
                                                             String groupName,
                                                             org.quartz.Trigger trigger,
                                                             Boolean emailOnEmpty)
Description copied from interface: SubscriptionManager
Creates a new subscription based on the passed in filter id and fired in accordance with the passed in trigger

Specified by:
createSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
filterId - Id of the filter subscribing to
groupName - Sent ot group
trigger - The trigger to store
emailOnEmpty - send email if filter returns no results
Returns:
GenericValue representing new subscription

createSubscription

public FilterSubscription createSubscription(ApplicationUser user,
                                             Long filterId,
                                             String groupName,
                                             String cronExpression,
                                             Boolean emailOnEmpty)
Description copied from interface: SubscriptionManager
Creates a new subscription based on the passed in filter id and fired in accordance with the passed in trigger

Specified by:
createSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
filterId - Id of the filter subscribing to
groupName - Sent ot group
cronExpression - The Cron expression for the subscription
emailOnEmpty - send email if filter returns no results
Returns:
GenericValue representing new subscription

getNextSendTime

@Nullable
public Date getNextSendTime(@Nonnull
                                     FilterSubscription sub)
Description copied from interface: SubscriptionManager
Returns the next send time for this subscription. This may return null if the scheduler does not support the reporting of next send times.

Specified by:
getNextSendTime in interface SubscriptionManager
Parameters:
sub - The subscription
Returns:
Next send time

createSubscription

public org.ofbiz.core.entity.GenericValue createSubscription(com.atlassian.crowd.embedded.api.User user,
                                                             Long filterId,
                                                             String groupName,
                                                             org.quartz.Trigger trigger,
                                                             Boolean emailOnEmpty)
Specified by:
createSubscription in interface SubscriptionManager
Parameters:
user - the current user performing this operation
filterId - Id of the filter subscribing to
groupName - Sent ot group
trigger - The trigger to store
emailOnEmpty - send email if filter returns no results
Returns:
GenericValue representing new subscription

deleteSubscription

public void deleteSubscription(Long subId)
                        throws org.ofbiz.core.entity.GenericEntityException
Specified by:
deleteSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteSubscriptionsForUser

public void deleteSubscriptionsForUser(@Nonnull
                                       ApplicationUser user)
                                throws org.ofbiz.core.entity.GenericEntityException
Specified by:
deleteSubscriptionsForUser in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteSubscriptionsForUser

public void deleteSubscriptionsForUser(com.atlassian.crowd.embedded.api.User user)
                                throws org.ofbiz.core.entity.GenericEntityException
Specified by:
deleteSubscriptionsForUser in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

runSubscription

public void runSubscription(org.ofbiz.core.entity.GenericValue sub)
                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
runSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

runSubscription

public void runSubscription(Long subId)
                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
runSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

runSubscription

public void runSubscription(ApplicationUser user,
                            Long subId)
                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
runSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

runSubscription

public void runSubscription(com.atlassian.crowd.embedded.api.User user,
                            Long subId)
                     throws org.ofbiz.core.entity.GenericEntityException
Specified by:
runSubscription in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteSubscriptionsForGroup

public void deleteSubscriptionsForGroup(com.atlassian.crowd.embedded.api.Group group)
                                 throws org.ofbiz.core.entity.GenericEntityException
Specified by:
deleteSubscriptionsForGroup in interface SubscriptionManager
Throws:
org.ofbiz.core.entity.GenericEntityException


Copyright © 2002-2014 Atlassian. All Rights Reserved.