com.ingenta.clownbike
Class SimpleTask

java.lang.Object
  extended byTaskDataImpl
      extended bycom.ingenta.clownbike.SimpleTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
EditTask, NewTask

public class SimpleTask
extends TaskDataImpl
implements Task

See Also:
Serialized Form

Constructor Summary
SimpleTask()
           
 
Method Summary
 void canceled(DatabaseTransaction transaction)
          Cancel the task.
 void completed(DatabaseTransaction transaction)
          Finish the task.
 void doGet(DatabaseTransaction transaction, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void doPost(DatabaseTransaction transaction, MultipartHttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 Attribute findAttribute(java.lang.String name)
          Return the attribute with the given name or null.
 java.util.List findAttributes(java.lang.String name)
          Return the attributes with the given name or an empty list.
 TaskStep findStep(java.lang.Integer stepId)
          Returns the step with the given step id or null if step not found.
 TaskStep findStepAfter(TaskStep step)
          Returns the step after the given step or null if the given step is the last step.
 TaskStep findStepBefore(TaskStep step)
          Returns the step before the given step or null if the given step is the first step.
 int findStepIndex(TaskStep step)
           
 Attribute getAttribute(java.lang.String name)
          Return the attribute with the given name or throws TaskException exception.
 TaskStep getCurrentStep()
          Returns the current step active step.
 TaskStep getStep(java.lang.Integer stepId)
          Returns the step with the given step id or throws TaskException if step not found.
protected  boolean isActive()
           
 void setCurrentStep(TaskStep step)
          Sets the given step as the current step.
 void started(DatabaseTransaction transaction)
          Start the task.
protected static java.util.Date toDate(java.lang.String value)
          Return an date from the string value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ingenta.clownbike.Task
getSteps
 

Constructor Detail

SimpleTask

public SimpleTask()
Method Detail

getCurrentStep

public TaskStep getCurrentStep()
Description copied from interface: Task
Returns the current step active step. Throws an IllegalStateException if the task is not active.

Specified by:
getCurrentStep in interface Task

setCurrentStep

public void setCurrentStep(TaskStep step)
Description copied from interface: Task
Sets the given step as the current step. Throws IllegalArgumentException if the given step is null or not in the task's list of steps.

Specified by:
setCurrentStep in interface Task

getStep

public TaskStep getStep(java.lang.Integer stepId)
                 throws TaskException
Description copied from interface: Task
Returns the step with the given step id or throws TaskException if step not found.

Specified by:
getStep in interface Task
Throws:
TaskException

findStep

public TaskStep findStep(java.lang.Integer stepId)
Description copied from interface: Task
Returns the step with the given step id or null if step not found.

Specified by:
findStep in interface Task

findStepBefore

public TaskStep findStepBefore(TaskStep step)
Description copied from interface: Task
Returns the step before the given step or null if the given step is the first step. Throws IllegalArgumentException if the given step is null or not in the task's list of steps.

Specified by:
findStepBefore in interface Task

findStepAfter

public TaskStep findStepAfter(TaskStep step)
Description copied from interface: Task
Returns the step after the given step or null if the given step is the last step. Throws IllegalArgumentException if the given step is null or not in the task's list of steps.

Specified by:
findStepAfter in interface Task

findStepIndex

public int findStepIndex(TaskStep step)

getAttribute

public Attribute getAttribute(java.lang.String name)
                       throws TaskException
Return the attribute with the given name or throws TaskException exception.

Specified by:
getAttribute in interface Task
Throws:
TaskException

findAttribute

public Attribute findAttribute(java.lang.String name)
Return the attribute with the given name or null.

Specified by:
findAttribute in interface Task

findAttributes

public java.util.List findAttributes(java.lang.String name)
Return the attributes with the given name or an empty list.

Specified by:
findAttributes in interface Task

started

public void started(DatabaseTransaction transaction)
             throws DatabaseException,
                    TaskException
Description copied from interface: Task
Start the task. Throws an TaskException if the task is already active.

Specified by:
started in interface Task
Throws:
DatabaseException
TaskException

canceled

public void canceled(DatabaseTransaction transaction)
              throws DatabaseException,
                     TaskException
Description copied from interface: Task
Cancel the task. Throws an TaskException if the task is not active.

Specified by:
canceled in interface Task
Throws:
DatabaseException
TaskException

completed

public void completed(DatabaseTransaction transaction)
               throws DatabaseException,
                      TaskException
Description copied from interface: Task
Finish the task. Throws an TaskException if the task is not active.

Specified by:
completed in interface Task
Throws:
DatabaseException
TaskException

doPost

public void doPost(DatabaseTransaction transaction,
                   MultipartHttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws TaskException
Specified by:
doPost in interface Task
Throws:
TaskException

doGet

public void doGet(DatabaseTransaction transaction,
                  javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws TaskException
Specified by:
doGet in interface Task
Throws:
TaskException

isActive

protected boolean isActive()

toDate

protected static java.util.Date toDate(java.lang.String value)
Return an date from the string value. Valid date forms are "yyyy-M-d" and "d MMM yyyy". Return a null if the string is not a date.