Package com.atlassian.jira.bc.filter
Class DefaultFilterSubscriptionService
java.lang.Object
com.atlassian.jira.bc.filter.DefaultFilterSubscriptionService
- All Implemented Interfaces:
FilterSubscriptionService
Uses Atlassian Scheduler
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultFilterSubscriptionService(JiraAuthenticationContext jiraAuthenticationContext, SubscriptionManager subscriptionManager, com.atlassian.scheduler.SchedulerService schedulerService, FeatureManager featureManager, GlobalPermissionManager globalPermissionManager) -
Method Summary
Modifier and TypeMethodDescriptiongetCronExpression(JiraServiceContext context, FilterSubscription subscription) Retrieve the cron expression associated with this subscriptiongetNextSendTime(FilterSubscription subscription) Returns the next send time for this subscription.getPrettySchedule(JiraServiceContext context, String cronExpression) Renders a human readable description of the given cron expression.getVisibleFilterSubscriptions(ApplicationUser user, SearchRequest filter) Retrieves subscriptions that a user can see for a filter.voidstoreSubscription(JiraServiceContext context, Long filterId, String groupName, String expr, boolean emailOnEmpty) Create and store a subscription that uses the given cron expressionvoidupdateSubscription(JiraServiceContext context, ApplicationUser owner, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates the subscription to the new given values and persists.voidupdateSubscription(JiraServiceContext context, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates the subscription to the new given values and persists.voidvalidateCronExpression(JiraServiceContext context, String expr) Validates a given cron expression
-
Constructor Details
-
DefaultFilterSubscriptionService
public DefaultFilterSubscriptionService(JiraAuthenticationContext jiraAuthenticationContext, SubscriptionManager subscriptionManager, com.atlassian.scheduler.SchedulerService schedulerService, FeatureManager featureManager, GlobalPermissionManager globalPermissionManager)
-
-
Method Details
-
validateCronExpression
Description copied from interface:FilterSubscriptionServiceValidates a given cron expressionErrors are passed back in the
ErrorCollectionof theJiraServiceContext- Specified by:
validateCronExpressionin interfaceFilterSubscriptionService- Parameters:
context- Jira service contextexpr- expression to evaluate
-
storeSubscription
public void storeSubscription(JiraServiceContext context, Long filterId, String groupName, String expr, boolean emailOnEmpty) Description copied from interface:FilterSubscriptionServiceCreate and store a subscription that uses the given cron expression- Specified by:
storeSubscriptionin interfaceFilterSubscriptionService- Parameters:
context- Jira service contextfilterId- id of the filter subscribing togroupName- sent to group (may be null if sent to self)expr- cron expression to storeemailOnEmpty- send email if filter returns no results
-
updateSubscription
public void updateSubscription(JiraServiceContext context, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Description copied from interface:FilterSubscriptionServiceUpdates the subscription to the new given values and persists.Note: This method will always change the owner of the subscription to the logged in user. If you don't want this behavior, use
FilterSubscriptionService.updateSubscription(JiraServiceContext, ApplicationUser, Long, String, String, boolean).- Specified by:
updateSubscriptionin interfaceFilterSubscriptionService- Parameters:
context- Jira service contextsubscriptionId- id of the subscription being updatedgroupName- sent to group (may be null if sent to self)expr- cron expression to storeemailOnEmpty- send email if filter returns no results
-
updateSubscription
public void updateSubscription(JiraServiceContext context, ApplicationUser owner, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Description copied from interface:FilterSubscriptionServiceUpdates the subscription to the new given values and persists.- Specified by:
updateSubscriptionin interfaceFilterSubscriptionService- Parameters:
context- Jira service contextowner- new owner for the subscriptionsubscriptionId- id of the subscription being updatedgroupName- sent to group (may be null if sent to self)expr- cron expression to storeemailOnEmpty- send email if filter returns no results
-
getPrettySchedule
Description copied from interface:FilterSubscriptionServiceRenders a human readable description of the given cron expression.Returns the cron expression if it can't be parsed by the
CronExpressionParser.- Specified by:
getPrettySchedulein interfaceFilterSubscriptionService- Parameters:
context- Jira service contextcronExpression- a cron expression.- Returns:
- a locale-specific sentence describing the cron string (or on failure, the cron string).
-
getCronExpression
Description copied from interface:FilterSubscriptionServiceRetrieve the cron expression associated with this subscription- Specified by:
getCronExpressionin interfaceFilterSubscriptionService- Parameters:
subscription-- Returns:
- the cron expression associated with this subscription
-
getVisibleFilterSubscriptions
public Collection<FilterSubscription> getVisibleFilterSubscriptions(ApplicationUser user, SearchRequest filter) Description copied from interface:FilterSubscriptionServiceRetrieves subscriptions that a user can see for a filter.An admin can see all subscriptions, the filter owner can see all subscriptions for their filter, otherwise a user can only see their own subscriptions.
- Specified by:
getVisibleFilterSubscriptionsin interfaceFilterSubscriptionService- Parameters:
user- the user that can see the subscriptionsfilter- the filter with the associated subscriptions- Returns:
- a collection of subscriptions
-
getNextSendTime
Description copied from interface:FilterSubscriptionServiceReturns 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:
getNextSendTimein interfaceFilterSubscriptionService- Parameters:
subscription- the subscription- Returns:
- next send time
-