Class DefaultSubscriptionManager
java.lang.Object
com.atlassian.jira.mail.MailingListCompiler
com.atlassian.jira.issue.subscription.DefaultSubscriptionManager
- All Implemented Interfaces:
GroupConfigurable
,SubscriptionManager
public class DefaultSubscriptionManager
extends MailingListCompiler
implements SubscriptionManager, GroupConfigurable
-
Field Summary
FieldsFields inherited from interface com.atlassian.jira.issue.subscription.SubscriptionManager
SUBSCRIPTION_IDENTIFIER
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSubscriptionManager
(com.atlassian.mail.queue.MailQueue mailQueue, TemplateManager templateManager, SubscriptionMailQueueItemFactory subscriptionMailQueueItemFactory, ProjectRoleManager projectRoleManager, GroupManager groupManager, com.atlassian.scheduler.SchedulerService schedulerService, EntityEngine entityEngine, DateTimeFormatterFactory dateTimeFormatterFactory, UserManager userManager, FeatureManager featureManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateSubscription
(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 triggervoid
deleteSubscription
(Long subId) void
deleteSubscriptionsForGroup
(com.atlassian.crowd.embedded.api.Group group) void
Delete all subscriptions owned by a user.getAllFilterSubscriptions
(Long filterId) getCronExpressionForSubscription
(FilterSubscription subscription) Retrieve the cron expression associated with this subscriptiongetFilterSubscription
(ApplicationUser user, Long subId) getFilterSubscription
(Long subId) Get a subscription by IdgetFilterSubscriptions
(ApplicationUser user, Long filterId) Returns the next send time for this subscription.Get all subscriptions owned by the given userboolean
hasSubscription
(ApplicationUser user, Long filterId) boolean
isGroupUsed
(com.atlassian.crowd.embedded.api.Group group) Determine whether configuration exists for the specifiedGroup
.void
runSubscription
(ApplicationUser user, Long subId) Run this subscription now.void
runSubscription
(Long subId) void
updateSubscription
(ApplicationUser user, Long subId, String groupName, String cronExpression, Boolean emailOnEmpty) Methods inherited from class com.atlassian.jira.mail.MailingListCompiler
getEmailAddresses, prepareEmail, sendLists
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.config.group.GroupConfigurable
isGroupUsed
-
Field Details
-
SUBSCRIPTION_PREFIX
-
JOB_RUNNER_KEY
-
-
Constructor Details
-
DefaultSubscriptionManager
public DefaultSubscriptionManager(com.atlassian.mail.queue.MailQueue mailQueue, TemplateManager templateManager, SubscriptionMailQueueItemFactory subscriptionMailQueueItemFactory, ProjectRoleManager projectRoleManager, GroupManager groupManager, com.atlassian.scheduler.SchedulerService schedulerService, EntityEngine entityEngine, DateTimeFormatterFactory dateTimeFormatterFactory, UserManager userManager, FeatureManager featureManager)
-
-
Method Details
-
hasSubscription
public boolean hasSubscription(ApplicationUser user, Long filterId) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
hasSubscription
in interfaceSubscriptionManager
- 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 interfaceSubscriptionManager
- Parameters:
subId
- Subscription Id- Returns:
- Subscription
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getFilterSubscription
public FilterSubscription getFilterSubscription(ApplicationUser user, Long subId) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
getFilterSubscription
in interfaceSubscriptionManager
- 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 interfaceSubscriptionManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getCronExpressionForSubscription
Description copied from interface:SubscriptionManager
Retrieve the cron expression associated with this subscription- Specified by:
getCronExpressionForSubscription
in interfaceSubscriptionManager
- Returns:
- the cron expression associated with this subscription
-
updateSubscription
public void updateSubscription(ApplicationUser user, Long subId, String groupName, String cronExpression, Boolean emailOnEmpty) throws DataAccessException - Specified by:
updateSubscription
in interfaceSubscriptionManager
- Parameters:
user
- new owner for the subscriptionsubId
- identifies the subscription to updategroupName
- (optional) the name of the group to receive the emailcronExpression
- The Cron expression to update the subscription with- Throws:
DataAccessException
- if there is a problem persisting the data.
-
getAllFilterSubscriptions
- Specified by:
getAllFilterSubscriptions
in interfaceSubscriptionManager
-
getAllFilterSubscriptions
- Specified by:
getAllFilterSubscriptions
in interfaceSubscriptionManager
-
getSubscriptionsForUser
Description copied from interface:SubscriptionManager
Get all subscriptions owned by the given user- Specified by:
getSubscriptionsForUser
in interfaceSubscriptionManager
- Parameters:
user
- subscription owner or null for an anonymous user- Returns:
- list of subscriptions. Can be empty.
-
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 interfaceSubscriptionManager
- Parameters:
user
- the owner of the subscriptionfilterId
- Id of the filter subscribing togroupName
- Sent ot groupcronExpression
- The Cron expression for the subscriptionemailOnEmpty
- send email if filter returns no results- Returns:
- FilterSubscription representing new subscription
-
getNextSendTime
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 interfaceSubscriptionManager
- Parameters:
sub
- The subscription- Returns:
- Next send time
-
deleteSubscription
- Specified by:
deleteSubscription
in interfaceSubscriptionManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
deleteSubscriptionsForUser
public void deleteSubscriptionsForUser(@Nonnull ApplicationUser user) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:SubscriptionManager
Delete all subscriptions owned by a user.- Specified by:
deleteSubscriptionsForUser
in interfaceSubscriptionManager
- Parameters:
user
- the current user performing this operation- Throws:
org.ofbiz.core.entity.GenericEntityException
-
runSubscription
- Specified by:
runSubscription
in interfaceSubscriptionManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
runSubscription
public void runSubscription(ApplicationUser user, Long subId) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:SubscriptionManager
Run this subscription now.- Specified by:
runSubscription
in interfaceSubscriptionManager
- Parameters:
user
- the current user performing this operationsubId
- identifies the subscription to update- 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 interfaceSubscriptionManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
isGroupUsed
public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupConfigurable
Determine whether configuration exists for the specifiedGroup
.- Specified by:
isGroupUsed
in interfaceGroupConfigurable
- Parameters:
group
- that may or may not exist.- Returns:
- true if the group is used in the components configuration.
-