public class

MockTaskDescriptor

extends Object
implements TaskDescriptor<V extends Serializable>
java.lang.Object
   ↳ com.atlassian.jira.task.MockTaskDescriptor<V extends java.io.Serializable>

Summary

Public Constructors
MockTaskDescriptor()
Public Methods
void clear()
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.
Date getFinishedTimestamp()
Return the date when the task was finished.
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.
Long getTaskId()
Reuturn the identifier for this task.
TaskProgressIndicator getTaskProgressIndicator()
Return the TaskProgressIndicator associated with the task.
String getUserName()
Return the user that started to task.
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.
void setCancelled(boolean cancelled)
Set flag to indicate this task has been cancelled;
void setDescription(String description)
void setElapsedRunTime(long elapsedRunTime)
void setFinishedTime(Date finishedTime)
void setResult(V result)
Store the result in the descriptor.
void setStartedTime(Date startedTime)
void setSubmittedTime(Date submittedTime)
void setTaskContext(TaskContext taskContext)
void setTaskId(Long taskId)
void setTaskProgressIndicator(TaskProgressIndicator taskProgressIndicator)
void setUserName(String userName)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.task.TaskDescriptor

Public Constructors

public MockTaskDescriptor ()

Public Methods

public void clear ()

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 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 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. Returns null if the task is not finished.

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 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 ()

Return the TaskProgressIndicator associated with the task. A task will only have an indictator if its callable implements the ProvidesTaskProgress interface.

Returns

public String getUserName ()

Return the user that started to task.

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

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 void setCancelled (boolean cancelled)

Set flag to indicate this task has been cancelled;

Parameters
cancelled Cancelled flag

public void setDescription (String description)

public void setElapsedRunTime (long elapsedRunTime)

public void setFinishedTime (Date finishedTime)

public void setResult (V result)

Store the result in the descriptor.

Parameters
result The Result

public void setStartedTime (Date startedTime)

public void setSubmittedTime (Date submittedTime)

public void setTaskContext (TaskContext taskContext)

public void setTaskId (Long taskId)

public void setTaskProgressIndicator (TaskProgressIndicator taskProgressIndicator)

public void setUserName (String userName)