edu.wpi.prc.task
Class Result

java.lang.Object
  extended by edu.wpi.prc.task.Task
      extended by edu.wpi.prc.task.Result
All Implemented Interfaces:
Prioritizable

public class Result
extends Task

A Result is a type of Task that contains data that was analyzed by the science application and returned by a client. Results are unique, and can only have one associated volunteer. However, WorkUnits can be sent to more than one client, so there can be several Results for the same WorkUnit. In that case, the data contained in all of the Results should be the same.

Author:
James Baldassari

Field Summary
private  Volunteer volunteer
           
private  WorkUnit workUnit
           
 
Fields inherited from class edu.wpi.prc.task.Task
MIN_PRIORITY
 
Constructor Summary
protected Result()
          Default constructor is protected so that the Result will either be created by the TaskFactory or the public constructor that takes a task ID will be called.
protected Result(java.lang.String taskID)
          Constructor that takes a task ID.
 
Method Summary
 void delete()
          Deletes a Result from the database.
 boolean equals(java.lang.Object o)
          Tests whether this Result is equal to another.
 Result[] find()
          Finds all Results in the database that match the attributes set in this Result.
static Result[] findAll()
          Finds all Results in the database.
static Result[] findAllEgress()
           
static Result[] findAllIngress()
           
static Result[] findAllPending()
           
static Result[] findAllSpotCheck()
           
 Volunteer getVolunteer()
           
 WorkUnit getWorkUnit()
           
 void removeUser()
          Removes the associated volunteer from this result.
 void save()
          Inserts this Result into the database as a new record.
 void setVolunteer(Volunteer user)
           
 void setWorkUnit(WorkUnit wu)
           
 void update()
          Updates this Result in the database.
 
Methods inherited from class edu.wpi.prc.task.Task
getCreationDate, getData, getDataPartitions, getId, getPriority, getState, getStateStr, getTaskID, isEqual, setCreationDate, setData, setDataPartitions, setId, setPriority, setState, setStateStr, setTaskID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workUnit

private WorkUnit workUnit

volunteer

private Volunteer volunteer
Constructor Detail

Result

protected Result()
Default constructor is protected so that the Result will either be created by the TaskFactory or the public constructor that takes a task ID will be called. This restriction ensures that the Result will always have a valid task ID.


Result

protected Result(java.lang.String taskID)
Constructor that takes a task ID. The task ID CANNOT be null.

Parameters:
taskID - The task ID to set.
Method Detail

getWorkUnit

public WorkUnit getWorkUnit()
Returns:
Returns the workUnit.

setWorkUnit

public void setWorkUnit(WorkUnit wu)
Parameters:
wu - The workUnit to set.

getVolunteer

public Volunteer getVolunteer()
Returns:
Returns the volunteer.

setVolunteer

public void setVolunteer(Volunteer user)
Parameters:
user - The volunteer to set.

removeUser

public void removeUser()
Removes the associated volunteer from this result.


save

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

Specified by:
save in class Task

update

public void update()
Updates this Result in the database.

Specified by:
update in class Task

find

public Result[] find()
Finds all Results in the database that match the attributes set in this Result.

Returns:
An array of all matching Results.

findAll

public static Result[] findAll()
Finds all Results in the database.

Returns:
An array of all Results in the database.

findAllIngress

public static Result[] findAllIngress()
Returns:
Returns an array of all Results in the Ingress state.

findAllPending

public static Result[] findAllPending()
Returns:
Returns an array of all Results in the Pending state.

findAllEgress

public static Result[] findAllEgress()
Returns:
Returns an array of all Results in the Egress state.

findAllSpotCheck

public static Result[] findAllSpotCheck()
Returns:
Returns an array of all Results in the SpotCheck state.

delete

public void delete()
Deletes a Result from the database.

Specified by:
delete in class Task

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare Result to.