public class

TaskDescriptorBean

extends Object
implements TaskDescriptor<V>
java.lang.Object
   ↳ com.atlassian.jira.web.bean.TaskDescriptorBean<V>

Class Overview

A UI styler bean to help format up a TaskDescriptor.

Summary

Nested Classes
class TaskDescriptorBean.Factory  
Public Methods
void cancel()
Requests that this task be cancelled.
String getDescription()
Return the description of the task passed when it was created.
long getElapsedRunTime()
This returns number of milliseconds the task has been running for.
Throwable getExceptionCause()
Date getFinishedTimestamp()
Return the date when the task was finished.
String getFormattedElapsedRunTime()
String getFormattedExceptionCause()
String getFormattedFinishedTimestamp()
String getFormattedProgress()
String getFormattedStartedTimestamp()
String getFormattedSubmittedTimestamp()
long getInverseProgressNumber()
TaskProgressEvent getLastProgressEvent()
long getProgressNumber()
Returns a number between 0 and 100 and caters for lack of progress and finished tasks.
String getProgressURL()
Returns the URL that displays progress on this task.
V getResult()
This returns the result of the long running task.
Date getStartedTimestamp()
Return the date when the task was started.
Date getSubmittedTimestamp()
Return the date when the task was submitted.
TaskContext getTaskContext()
Return he context of task.
TaskDescriptor getTaskDescriptor()
Long getTaskId()
Reuturn the identifier for this task.
TaskProgressIndicator getTaskProgressIndicator()
We dont re-expose this.
User getUser()
Return the user that started to task.
String getUserURL()
boolean isCancellable()
Returns whether this supports requests to cancel it.
boolean isCancelled()
Returns whether cancellation of task has been requested.
boolean isFinished()
Tells if caller if the task has finished running or not.
boolean isStarted()
True if the task has been started.
boolean isUserWhoStartedTask()
void setExceptionCause(Throwable cause)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.task.TaskDescriptor

Public Methods

public void cancel ()

Requests that this task be cancelled.

public String getDescription ()

Return the description of the task passed when it was created.

Returns
  • a meaningful description of the task

public long getElapsedRunTime ()

This returns number of milliseconds the task has been running for. Will return zero if the task has not started. When the task has started but not finished, it will return the the difference between the current time and the time was started (i.e. it will change). When the task has finished, it will return the difference between the start time and the end time (i.e. it will not change).

Returns
  • the elapsed run time in milliseconds.

public Throwable getExceptionCause ()

public Date getFinishedTimestamp ()

Return the date when the task was finished.

Returns
  • the time that task finished executing. null will be returned if the task has not finished executing.

public String getFormattedElapsedRunTime ()

public String getFormattedExceptionCause ()

public String getFormattedFinishedTimestamp ()

public String getFormattedProgress ()

public String getFormattedStartedTimestamp ()

public String getFormattedSubmittedTimestamp ()

public long getInverseProgressNumber ()

public TaskProgressEvent getLastProgressEvent ()

public long getProgressNumber ()

Returns a number between 0 and 100 and caters for lack of progress and finished tasks.

Returns
  • a number between 0 and 100 and caters for lack of progress and finished tasks.

public String getProgressURL ()

Returns the URL that displays progress on this task. It is built using the TaskContext.

Returns
  • the URL that displays progress for this task. null cannot be returned.

public V getResult ()

This returns the result of the long running task. WARNING: This will BLOCK if the task has not finished and will not return until it has finished executing.

Returns
  • the result of the long running task or null if it has not return value.

public Date getStartedTimestamp ()

Return the date when the task was started.

Returns
  • the time that task was started. null will be returned if the task has not started executing.

public Date getSubmittedTimestamp ()

Return the date when the task was submitted.

Returns
  • the time that task was submited to the TaskManager. A null value will never be returned as the task will always have a submission time.

public TaskContext getTaskContext ()

Return he context of task. Code that starts long running tasks can implement their own variants of this.

Returns
  • the context of the task. This method will never return null as a task must always have a context.

public TaskDescriptor getTaskDescriptor ()

public Long getTaskId ()

Reuturn the identifier for this task. This is only unique in the current execution of the JVM.

Returns
  • The unique id of the task

public TaskProgressIndicator getTaskProgressIndicator ()

We dont re-expose this. Use getLastProgressEvent().

Returns
  • always null

public User getUser ()

Return the user that started to task.

Returns
  • the user that caused the task to be submitted. This may be null.

public String getUserURL ()

public boolean isCancellable ()

Returns whether this supports requests to cancel it.

Returns
  • true if cancellation is supported, and false otherwise

public boolean isCancelled ()

Returns whether cancellation of task has been requested. Long-running operations should poll to see if task has been requested.

Returns
  • true if cancellation has been requested, and false otherwise

public boolean isFinished ()

Tells if caller if the task has finished running or not.

Returns
  • true if the task has finished running.

public boolean isStarted ()

True if the task has been started.

Returns
  • true if the task has been started.

public boolean isUserWhoStartedTask ()

public void setExceptionCause (Throwable cause)