Interface FilterSubscriptionService

All Known Implementing Classes:
DefaultFilterSubscriptionService

@PublicApi public interface FilterSubscriptionService
Provides high level access to CRUD and query FilterSubscriptions.
  • Method Details

    • validateCronExpression

      void validateCronExpression(JiraServiceContext context, String expr)
      Validates a given cron expression

      Errors are passed back in the ErrorCollection of the JiraServiceContext

      Parameters:
      context - Jira service context
      expr - 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 context
      filterId - id of the filter subscribing to
      groupName - sent to group (may be null if sent to self)
      expr - cron expression to store
      emailOnEmpty - 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 context
      subscriptionId - id of the subscription being updated
      groupName - sent to group (may be null if sent to self)
      expr - cron expression to store
      emailOnEmpty - 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 context
      owner - new owner for the subscription
      subscriptionId - id of the subscription being updated
      groupName - sent to group (may be null if sent to self)
      expr - cron expression to store
      emailOnEmpty - send email if filter returns no results
      Since:
      v8.11
    • getPrettySchedule

      String getPrettySchedule(JiraServiceContext context, String cronExpression)
      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 context
      cronExpression - 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 subscriptions
      filter - the filter with the associated subscriptions
      Returns:
      a collection of subscriptions
    • getCronExpression

      String getCronExpression(JiraServiceContext context, FilterSubscription subscription)
      Retrieve the cron expression associated with this subscription
      Parameters:
      subscription -
      Returns:
      the cron expression associated with this subscription
    • getNextSendTime

      @Nullable Date getNextSendTime(@Nonnull FilterSubscription subscription)
      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