Package com.atlassian.jira.bc.filter
Interface FilterSubscriptionService
- All Known Implementing Classes:
DefaultFilterSubscriptionService
@PublicApi
public interface FilterSubscriptionService
Provides high level access to CRUD and query FilterSubscriptions.
-
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.void
storeSubscription
(JiraServiceContext context, Long filterId, String groupName, String expr, boolean emailOnEmpty) Create and store a subscription that uses the given cron expressionvoid
updateSubscription
(JiraServiceContext context, ApplicationUser owner, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates the subscription to the new given values and persists.void
updateSubscription
(JiraServiceContext context, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates the subscription to the new given values and persists.void
validateCronExpression
(JiraServiceContext context, String expr) Validates a given cron expression
-
Method Details
-
validateCronExpression
Validates a given cron expressionErrors are passed back in the
ErrorCollection
of theJiraServiceContext
- Parameters:
context
- Jira service contextexpr
- expression to evaluate
-
storeSubscription
void storeSubscription(JiraServiceContext context, Long filterId, String groupName, String expr, boolean emailOnEmpty) Create and store a subscription that uses the given cron expression- 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
void updateSubscription(JiraServiceContext context, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates 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
updateSubscription(JiraServiceContext, ApplicationUser, Long, String, String, boolean)
.- 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
void updateSubscription(JiraServiceContext context, ApplicationUser owner, Long subscriptionId, String groupName, String expr, boolean emailOnEmpty) Updates the subscription to the new given values and persists.- 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- Since:
- v8.11
-
getPrettySchedule
Renders a human readable description of the given cron expression.Returns the cron expression if it can't be parsed by the
CronExpressionParser
.- Parameters:
context
- Jira service contextcronExpression
- a cron expression.- Returns:
- a locale-specific sentence describing the cron string (or on failure, the cron string).
-
getVisibleFilterSubscriptions
Collection<FilterSubscription> getVisibleFilterSubscriptions(ApplicationUser user, SearchRequest filter) Retrieves 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.
- Parameters:
user
- the user that can see the subscriptionsfilter
- the filter with the associated subscriptions- Returns:
- a collection of subscriptions
-
getCronExpression
Retrieve the cron expression associated with this subscription- Parameters:
subscription
-- Returns:
- the cron expression associated with this subscription
-
getNextSendTime
Returns the next send time for this subscription.This may return null if the scheduler does not support the reporting of next send times.
- Parameters:
subscription
- the subscription- Returns:
- next send time
-