edu.wpi.prc.task
Class Task

java.lang.Object
  extended by edu.wpi.prc.task.Task
All Implemented Interfaces:
Prioritizable
Direct Known Subclasses:
NonPersistentResult, NonPersistentWorkUnit, Result, WorkUnit

public abstract class Task
extends java.lang.Object
implements Prioritizable

The Task class stores information about each task (WorkUnit or Result), including the task's ID, the users who are responsible for this task, and the data the task contains. Note: this class has a natural ordering that is inconsistent with equals.

Author:
James Baldassari

Field Summary
private  java.util.Date creationDate
           
private  java.util.List<byte[]> dataPartitions
           
private  long id
           
static int MIN_PRIORITY
           
private static int PARTITION_LENGTH
           
private  int priority
           
private  java.lang.String stateStr
           
private  java.lang.String taskID
           
 
Constructor Summary
Task()
           
 
Method Summary
abstract  void delete()
          Deletes this Task from the database.
 java.util.Date getCreationDate()
           
 byte[] getData()
           
protected  java.util.List<byte[]> getDataPartitions()
           
protected  long getId()
           
 int getPriority()
           
 TaskState getState()
           
protected  java.lang.String getStateStr()
           
 java.lang.String getTaskID()
           
 boolean isEqual(java.lang.Object o)
          Tests whether this Task is equal to another.
abstract  void save()
          Inserts this Task into the database as a new record.
protected  void setCreationDate(java.util.Date creationDate)
           
 void setData(byte[] data)
           
protected  void setDataPartitions(java.util.List<byte[]> dataPartitions)
          Sets the list of data partitions (required for Hibernate to work).
protected  void setId(long id)
           
 void setPriority(int priority)
           
 void setState(TaskState state)
          Sets the current state of this Task.
protected  void setStateStr(java.lang.String taskStateStr)
           
 void setTaskID(java.lang.String taskID)
           
abstract  void update()
          Updates this Task in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_PRIORITY

public static final int MIN_PRIORITY
See Also:
Constant Field Values

PARTITION_LENGTH

private static final int PARTITION_LENGTH
See Also:
Constant Field Values

id

private long id

taskID

private java.lang.String taskID

dataPartitions

private java.util.List<byte[]> dataPartitions

stateStr

private java.lang.String stateStr

creationDate

private java.util.Date creationDate

priority

private int priority
Constructor Detail

Task

public Task()
Method Detail

getId

protected long getId()
Returns:
Returns the id.

setId

protected void setId(long id)
Parameters:
id - The id to set.

getDataPartitions

protected java.util.List<byte[]> getDataPartitions()
Returns:
Returns the list of data partitions (required for Hibernate to work).

setDataPartitions

protected void setDataPartitions(java.util.List<byte[]> dataPartitions)
Sets the list of data partitions (required for Hibernate to work).


getData

public byte[] getData()
Returns:
Returns the data.

setData

public void setData(byte[] data)
Parameters:
data - The data to set.

getTaskID

public java.lang.String getTaskID()
Returns:
Returns the taskID.

setTaskID

public void setTaskID(java.lang.String taskID)
Parameters:
taskID - The taskID to set.

getStateStr

protected java.lang.String getStateStr()
Returns:
Returns the stateStr.

setStateStr

protected void setStateStr(java.lang.String taskStateStr)
Parameters:
taskStateStr - The stateStr to set.

getState

public TaskState getState()
Returns:
Returns the current state of this Task.

setState

public void setState(TaskState state)
Sets the current state of this Task.

Parameters:
state - The state to set.

getCreationDate

public java.util.Date getCreationDate()
Returns:
Returns the creationDate.

setCreationDate

protected void setCreationDate(java.util.Date creationDate)
Parameters:
creationDate - The creationDate to set.

getPriority

public int getPriority()
Specified by:
getPriority in interface Prioritizable
Returns:
Returns the priority.

setPriority

public void setPriority(int priority)
Parameters:
priority - The priority to set.

save

public abstract void save()
Inserts this Task into the database as a new record.


update

public abstract void update()
Updates this Task in the database.


delete

public abstract void delete()
Deletes this Task from the database.


isEqual

public boolean isEqual(java.lang.Object o)
Tests whether this Task is equal to another.

Parameters:
o - The object to compare this Task to.