Class TaskProgress

java.lang.Object
org.dlese.dpc.schemedit.threadedservices.TaskProgress

public class TaskProgress extends Object
Class to report progress of a MonitoredTask via a json object.

The monitoredTask updates the TaskProgress object as it runs, and the TaskProgress can also query the Task for other properties, such as whether the task is actually running.

Author:
ostwald
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the TaskProgress object
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the done attribute of the TaskProgress object
    boolean
    Gets the error attribute of the TaskProgress object
    Gets the msg attribute of the TaskProgress object
    float
    Percentage of task completed
    Reports the current progress as a JSON string
    int
    Gets the total attribute of the TaskProgress object
    void
    init(int total)
    Initialize with total items to be processed
    void
    init(int total, String msg)
    Initialize with total items to be processed and a message that is part of progress reports
    boolean
    Reports whether this TaskProgress' task is processing.
    void
    NOT YET DOCUMENTED
    void
    setDone(int done)
    Sets the done attribute of the TaskProgress object
    void
    setError(boolean error)
    Sets the error attribute of the TaskProgress object
    void
    Sets the msg attribute of the TaskProgress object
    void
    setTotal(int total)
    Sets the total attribute of the TaskProgress object

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • debug

      protected static boolean debug
  • Constructor Details

    • TaskProgress

      public TaskProgress(MonitoredTask task)
      Constructor for the TaskProgress object
      Parameters:
      task - the task for which we report progress
  • Method Details

    • init

      public void init(int total)
      Initialize with total items to be processed
      Parameters:
      total - number of items to be processed
    • init

      public void init(int total, String msg)
      Initialize with total items to be processed and a message that is part of progress reports
      Parameters:
      total - number of items to be processed
      msg - message used in reporting
    • isActive

      public boolean isActive()
      Reports whether this TaskProgress' task is processing.
      Returns:
      The active value
    • getMsg

      public String getMsg()
      Gets the msg attribute of the TaskProgress object
      Returns:
      The msg value
    • setMsg

      public void setMsg(String msg)
      Sets the msg attribute of the TaskProgress object
      Parameters:
      msg - The new msg value
    • getDone

      public int getDone()
      Gets the done attribute of the TaskProgress object
      Returns:
      The done value
    • setDone

      public void setDone(int done)
      Sets the done attribute of the TaskProgress object
      Parameters:
      done - The new done value
    • getTotal

      public int getTotal()
      Gets the total attribute of the TaskProgress object
      Returns:
      The total value
    • setTotal

      public void setTotal(int total)
      Sets the total attribute of the TaskProgress object
      Parameters:
      total - The new total value
    • getError

      public boolean getError()
      Gets the error attribute of the TaskProgress object
      Returns:
      The error value
    • setError

      public void setError(boolean error)
      Sets the error attribute of the TaskProgress object
      Parameters:
      error - The new error value
    • getPercentComplete

      public float getPercentComplete()
      Percentage of task completed

      Can be calculated by client!?

      Returns:
      NOT YET DOCUMENTED
    • getProgressReport

      public String getProgressReport()
      Reports the current progress as a JSON string
      Returns:
      The progressReport value
    • reset

      public void reset()
      NOT YET DOCUMENTED