Class Context.Builder

java.lang.Object
com.atlassian.jira.task.context.Context.Builder
Enclosing interface:
Context

public static class Context.Builder extends Object
A builder for constructing a background task Context.
Since:
v6.4
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • sized

      public Context.Builder sized(@Nonnull Sized sized)
      Something that can provide an estimate of the amount of work that the background task will perform.

      If this method is invoked multiple times, only the last value supplied will be used.

      Parameters:
      sized - whatever is providing an estimate for the amount of work
      Returns:
      this
      See Also:
    • event

      public Context.Builder event(@Nonnull com.atlassian.johnson.event.Event event)
      A global atlassian-johnson event that will be used to block access to the application.

      Some activities, like restoring from a backup file, require blocking all access to JIRA. This passes progress information on to this event when it is supplied to the builder.

      Parameters:
      event - the global atlassian-johnson event
      Returns:
      this
    • log

      public Context.Builder log(@Nonnull org.apache.log4j.Logger log, @Nonnull String format)
      A convenience method that calls assumes DEBUG logging. It is exactly equivalent to log(log, format, Level.DEBUG).
      Parameters:
      log - as for log(org.apache.log4j.Logger, String, org.apache.log4j.Level)
      format - as for log(org.apache.log4j.Logger, String, org.apache.log4j.Level)
      Returns:
      this
    • log

      public Context.Builder log(@Nonnull org.apache.log4j.Logger log, @Nonnull String format, @Nonnull org.apache.log4j.Level level)
      Provides a logger to which progress will be logged at the specified level.
      Parameters:
      log - the logger to which progress messages will be logged
      format - a message format string, such as for String.format(String, Object...). It will be called with a single argument that represents the progress percentage; a number between 0 and 100, inclusive.
      level - the logging level to use
      Returns:
      this
    • progress

      public Context.Builder progress(@Nonnull TaskProgressSink progressSink, @Nonnull I18nHelper i18n, @Nonnull String uiMessageKeyPercentage, @Nullable String uiMessageKeyCurrent)
      Uses the specified TaskProgressSink, using the provided I18nHelper to supply translated messages about the task.
      Parameters:
      progressSink - the delegate TaskProgressSink to which translated messages are relayed
      i18n - the I18N helper for formatting the progress messages
      uiMessageKeyPercentage - the message key for messages about the progress
      uiMessageKeyCurrent - the message key for messages about the current subtask
      Returns:
      this
    • progressPercentage

      public Context.Builder progressPercentage(@Nonnull TaskProgressSink progressSink, @Nonnull I18nHelper i18n, @Nullable String uiMessageKeyPercentage)
      Uses the specified TaskProgressSink, using the provided I18nHelper to supply translated messages about the task.
      Parameters:
      progressSink - the delegate TaskProgressSink to which translated messages are relayed
      i18n - the I18N helper for formatting the progress messages
      uiMessageKeyPercentage - the message key for messages about the progress
      Returns:
      this
    • progressSubTask

      public Context.Builder progressSubTask(@Nonnull TaskProgressSink progressSink, @Nonnull I18nHelper i18n, @Nullable String uiMessageKeyCurrent)
      Uses the specified TaskProgressSink, using the provided I18nHelper to supply translated messages about the task.
      Parameters:
      progressSink - the delegate TaskProgressSink to which translated messages are relayed
      i18n - the I18N helper for formatting the progress messages
      uiMessageKeyCurrent - the message key for messages about the current subtask
      Returns:
      this
    • build

      public Context build()
      Returns the completed Context.
      Returns:
      the completed Context.