net.sf.borg.model
Class TaskTypes

java.lang.Object
  extended by net.sf.borg.model.TaskTypes

public class TaskTypes
extends Object

The Class TaskTypes manages the Task type and state information, including the state transitions allowed for each task type.


Constructor Summary
TaskTypes()
          constructor.
 
Method Summary
 void addNextState(String type, String state, String nextstate)
          add a next state transition to a state for a type.
 void addState(String type, String state)
          Adds a state to a type.
 void addSubtask(String type, String value)
          add a subtask to a type
 void addType(String type)
          Adds a new type to the state model with default OPEN and CLOSE states.
 void changeState(String type, String state, String newstate)
          change a state name for a type.
 void changeType(String type, String newtype)
          Change a type name.
 TaskTypes copy()
          Deep Copy this object.
 void deleteNextState(String type, String state, String nextstate)
          Delete a next state transition from a state for a type.
 void deleteState(String type, String state)
          Delete a state from a type.
 void deleteSubtask(String type, String value)
          delete a subtask from a type
 void deleteType(String type)
          Delete a type.
 void fillFromLegacyXml(String xml)
          This method will read a string containin the pre-1.7.2 XML that describes a task state model and convert it to the 1.7.2 format.
 void fromString(String xmlString)
          load this TaskTypes object from an XML string.
 void fromXml(InputStream is)
          load this TaskTypes object from an XML input stream.
 String getFinalState(String type)
          Gets the final state for a type.
 String getInitialState(String type)
          Gets the initial state for a type.
 Collection<String> getStates(String type)
          Gets the states for a given task type.
 String[] getSubTasks(String type)
          get the built-in subtasks for a type.
 Vector<String> getTaskTypes()
          Gets all task types.
 void loadDefault()
          Load the default state model XML from the borg JAR file.
 Collection<String> nextStates(String type, String state)
          get a list of possible Next states for a given state and type.
 void setInitialState(String type, String state)
          Sets the initial state for a type.
 String toXml()
          return the task state model as XML
 void validate()
          validate the state model (somewhat).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskTypes

public TaskTypes()
constructor.

Method Detail

addNextState

public void addNextState(String type,
                         String state,
                         String nextstate)
add a next state transition to a state for a type.

Parameters:
type - the type
state - the state
nextstate - the nextstate

addState

public void addState(String type,
                     String state)
Adds a state to a type.

Parameters:
type - the type
state - the state

addSubtask

public void addSubtask(String type,
                       String value)
add a subtask to a type

Parameters:
type - the type
value - the subtask text

addType

public void addType(String type)
Adds a new type to the state model with default OPEN and CLOSE states.

Parameters:
type - the type

changeState

public void changeState(String type,
                        String state,
                        String newstate)
change a state name for a type.

Parameters:
type - the type
state - the state
newstate - the newstate

changeType

public void changeType(String type,
                       String newtype)
Change a type name.

Parameters:
type - the type name
newtype - the new type name

copy

public TaskTypes copy()
               throws Exception
Deep Copy this object.

Returns:
the copy
Throws:
Exception - the exception

deleteNextState

public void deleteNextState(String type,
                            String state,
                            String nextstate)
Delete a next state transition from a state for a type.

Parameters:
type - the type
state - the state
nextstate - the nextstate

deleteState

public void deleteState(String type,
                        String state)
Delete a state from a type.

Parameters:
type - the type
state - the state

deleteSubtask

public void deleteSubtask(String type,
                          String value)
delete a subtask from a type

Parameters:
type - the type
value - the subtask text

deleteType

public void deleteType(String type)
Delete a type.

Parameters:
type - the type

fillFromLegacyXml

public void fillFromLegacyXml(String xml)
                       throws Exception
This method will read a string containin the pre-1.7.2 XML that describes a task state model and convert it to the 1.7.2 format. As of 1.7.2, this old format would be only found in the SMODEL rows of the options table. This method will never be called for a database created by version 1.7.2 or later.

Parameters:
xml - the pre-1.7.2 format XML for task types
Throws:
Exception

fromString

public void fromString(String xmlString)
                throws Exception
load this TaskTypes object from an XML string. Discard any data that was already present

Parameters:
xmlString - the XML string
Throws:
Exception

fromXml

public void fromXml(InputStream is)
             throws Exception
load this TaskTypes object from an XML input stream. Discard any data that was already present

Parameters:
is - the InputStream
Throws:
Exception

getFinalState

public String getFinalState(String type)
Gets the final state for a type.

Parameters:
type - the type
Returns:
the final state

getInitialState

public String getInitialState(String type)
Gets the initial state for a type.

Parameters:
type - the type
Returns:
the initial state

getStates

public Collection<String> getStates(String type)
Gets the states for a given task type.

Parameters:
type - the task type
Returns:
the states

getSubTasks

public String[] getSubTasks(String type)
get the built-in subtasks for a type.

Parameters:
type - the type
Returns:
the subtasks

getTaskTypes

public Vector<String> getTaskTypes()
Gets all task types.

Returns:
the task types

loadDefault

public void loadDefault()
                 throws Exception
Load the default state model XML from the borg JAR file.

Throws:
Exception - the exception

nextStates

public Collection<String> nextStates(String type,
                                     String state)
get a list of possible Next states for a given state and type.

Parameters:
type - the type
state - the state
Returns:
the vector< string>

setInitialState

public void setInitialState(String type,
                            String state)
Sets the initial state for a type.

Parameters:
type - the type
state - the state

toXml

public String toXml()
             throws Exception
return the task state model as XML

Returns:
the XML string
Throws:
Exception - the exception

validate

public void validate()
              throws Exception
validate the state model (somewhat).

Throws:
Exception - the exception


Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic