com.atlassian.jira.web.bean
Class TaskDescriptorBean<V>

java.lang.Object
  extended by com.atlassian.jira.web.bean.TaskDescriptorBean<V>
All Implemented Interfaces:
TaskDescriptor<V>

public class TaskDescriptorBean<V>
extends Object
implements TaskDescriptor<V>

A UI styler bean to help format up a TaskDescriptor.

Since:
v3.13

Constructor Summary
TaskDescriptorBean(TaskDescriptor<V> taskDescriptor, I18nHelper i18nHelper, OutlookDateManager outlookDateManager, com.atlassian.crowd.embedded.api.User currentUser)
           
 
Method Summary
 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.
 com.atlassian.crowd.embedded.api.User getUser()
          Return the user that started to task.
 String getUserURL()
           
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskDescriptorBean

public TaskDescriptorBean(TaskDescriptor<V> taskDescriptor,
                          I18nHelper i18nHelper,
                          OutlookDateManager outlookDateManager,
                          com.atlassian.crowd.embedded.api.User currentUser)
Method Detail

getTaskDescriptor

public TaskDescriptor getTaskDescriptor()

getFormattedElapsedRunTime

public String getFormattedElapsedRunTime()

getResult

public V getResult()
            throws ExecutionException,
                   InterruptedException
Description copied from interface: TaskDescriptor
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.

Specified by:
getResult in interface TaskDescriptor<V>
Returns:
the result of the long running task or null if it has not return value.
Throws:
ExecutionException - if an uncaught exception is thrown from the task's callable.
InterruptedException - if the calling thread is interrupted while waiting for the result.

isStarted

public boolean isStarted()
Description copied from interface: TaskDescriptor
True if the task has been started.

Specified by:
isStarted in interface TaskDescriptor<V>
Returns:
true if the task has been started.

isFinished

public boolean isFinished()
Description copied from interface: TaskDescriptor
Tells if caller if the task has finished running or not.

Specified by:
isFinished in interface TaskDescriptor<V>
Returns:
true if the task has finished running.

getTaskId

public Long getTaskId()
Description copied from interface: TaskDescriptor
Reuturn the identifier for this task. This is only unique in the current execution of the JVM.

Specified by:
getTaskId in interface TaskDescriptor<V>
Returns:
The unique id of the task

getStartedTimestamp

public Date getStartedTimestamp()
Description copied from interface: TaskDescriptor
Return the date when the task was started.

Specified by:
getStartedTimestamp in interface TaskDescriptor<V>
Returns:
the time that task was started. null will be returned if the task has not started executing.

getFormattedStartedTimestamp

public String getFormattedStartedTimestamp()

getFinishedTimestamp

public Date getFinishedTimestamp()
Description copied from interface: TaskDescriptor
Return the date when the task was finished.

Specified by:
getFinishedTimestamp in interface TaskDescriptor<V>
Returns:
the time that task finished executing. null will be returned if the task has not finished executing.

getFormattedFinishedTimestamp

public String getFormattedFinishedTimestamp()

getSubmittedTimestamp

public Date getSubmittedTimestamp()
Description copied from interface: TaskDescriptor
Return the date when the task was submitted.

Specified by:
getSubmittedTimestamp in interface TaskDescriptor<V>
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.

getFormattedSubmittedTimestamp

public String getFormattedSubmittedTimestamp()

getElapsedRunTime

public long getElapsedRunTime()
Description copied from interface: TaskDescriptor
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).

Specified by:
getElapsedRunTime in interface TaskDescriptor<V>
Returns:
the elapsed run time in milliseconds.

getUser

public com.atlassian.crowd.embedded.api.User getUser()
Description copied from interface: TaskDescriptor
Return the user that started to task.

Specified by:
getUser in interface TaskDescriptor<V>
Returns:
the user that caused the task to be submitted. This may be null.

getDescription

public String getDescription()
Description copied from interface: TaskDescriptor
Return the description of the task passed when it was created.

Specified by:
getDescription in interface TaskDescriptor<V>
Returns:
a meaningful description of the task

getTaskContext

public TaskContext getTaskContext()
Description copied from interface: TaskDescriptor
Return he context of task. Code that starts long running tasks can implement their own variants of this.

Specified by:
getTaskContext in interface TaskDescriptor<V>
Returns:
the context of the task. This method will never return null as a task must always have a context.

getTaskProgressIndicator

public TaskProgressIndicator getTaskProgressIndicator()
We dont re-expose this. Use getLastProgressEvent().

Specified by:
getTaskProgressIndicator in interface TaskDescriptor<V>
Returns:
always null

getFormattedProgress

public String getFormattedProgress()

getProgressNumber

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.

getInverseProgressNumber

public long getInverseProgressNumber()

setExceptionCause

public void setExceptionCause(Throwable cause)

getExceptionCause

public Throwable getExceptionCause()

getFormattedExceptionCause

public String getFormattedExceptionCause()

isUserWhoStartedTask

public boolean isUserWhoStartedTask()

getProgressURL

public String getProgressURL()
Description copied from interface: TaskDescriptor
Returns the URL that displays progress on this task. It is built using the TaskContext.

Specified by:
getProgressURL in interface TaskDescriptor<V>
Returns:
the URL that displays progress for this task. null cannot be returned.

getUserURL

public String getUserURL()

getLastProgressEvent

public TaskProgressEvent getLastProgressEvent()


Copyright © 2002-2012 Atlassian. All Rights Reserved.