public static class

Context.Builder

extends Object
java.lang.Object
   ↳ com.atlassian.jira.task.context.Context.Builder

Class Overview

A builder for constructing a background task Context.

Summary

Public Constructors
Builder()
Public Methods
Context build()
Returns the completed Context.
Context.Builder event(Event event)
A global atlassian-johnson event that will be used to block access to the application.
Context.Builder log(Logger log, String format, Level level)
Provides a logger to which progress will be logged at the specified level.
Context.Builder log(Logger log, String format)
A convenience method that calls assumes DEBUG logging.
Context.Builder progress(TaskProgressSink progressSink, I18nHelper i18n, String uiMessageKeyPercentage, String uiMessageKeyCurrent)
Uses the specified TaskProgressSink, using the provided I18nHelper to supply translated messages about the task.
Context.Builder sized(Sized sized)
Something that can provide an estimate of the amount of work that the background task will perform.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Builder ()

Public Methods

public Context build ()

Returns the completed Context.

Returns
  • the completed Context.

public Context.Builder 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

public Context.Builder log (Logger log, String format, 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

public Context.Builder log (Logger log, String format)

A convenience method that calls assumes DEBUG logging. It is exactly equivalent to log(log, format, Level.DEBUG).

Returns
  • this

public Context.Builder progress (TaskProgressSink progressSink, I18nHelper i18n, String uiMessageKeyPercentage, 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

public Context.Builder sized (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