Package com.atlassian.jira.task.context
Class Context.Builder
java.lang.Object
com.atlassian.jira.task.context.Context.Builder
- Enclosing interface:
- Context
A builder for constructing a background task
Context.- Since:
- v6.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns the completedContext.event(com.atlassian.johnson.event.Event event) A globalatlassian-johnsonevent that will be used to block access to the application.A convenience method that calls assumesDEBUGlogging.Provides a logger to which progress will be logged at the specified level.progress(TaskProgressSink progressSink, I18nHelper i18n, String uiMessageKeyPercentage, String uiMessageKeyCurrent) Uses the specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.progressPercentage(TaskProgressSink progressSink, I18nHelper i18n, String uiMessageKeyPercentage) Uses the specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.progressSubTask(TaskProgressSink progressSink, I18nHelper i18n, String uiMessageKeyCurrent) Uses the specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.Something that can provide an estimate of the amount of work that the background task will perform.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
A globalatlassian-johnsonevent 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 globalatlassian-johnsonevent- Returns:
this
-
log
A convenience method that calls assumesDEBUGlogging. It is exactly equivalent tolog(log, format, Level.DEBUG).- Parameters:
log- as forlog(org.apache.log4j.Logger, String, org.apache.log4j.Level)format- as forlog(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 loggedformat- a message format string, such as forString.format(String, Object...). It will be called with a single argument that represents the progress percentage; a number between0and100, 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 specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.- Parameters:
progressSink- the delegateTaskProgressSinkto which translated messages are relayedi18n- the I18N helper for formatting the progress messagesuiMessageKeyPercentage- the message key for messages about the progressuiMessageKeyCurrent- 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 specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.- Parameters:
progressSink- the delegateTaskProgressSinkto which translated messages are relayedi18n- the I18N helper for formatting the progress messagesuiMessageKeyPercentage- 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 specifiedTaskProgressSink, using the providedI18nHelperto supply translated messages about the task.- Parameters:
progressSink- the delegateTaskProgressSinkto which translated messages are relayedi18n- the I18N helper for formatting the progress messagesuiMessageKeyCurrent- the message key for messages about the current subtask- Returns:
this
-
build
Returns the completedContext.- Returns:
- the completed
Context.
-