com.arsdigita.acs.workflow
Class WizardTasks

java.lang.Object
  |
  +--com.arsdigita.acs.workflow.WizardTasks

public class WizardTasks
extends java.lang.Object

This class helps us maintain the tasks created in the Simple Process Creation wizard. While using the wizard, these tasks are stored as a client property.

Since:
ACS4.0

Field Summary
static java.lang.String cvsId
           
 
Constructor Summary
WizardTasks()
           
 
Method Summary
 boolean addTask(java.lang.String task_name, java.math.BigDecimal task_time)
          Create a new task with the given name and duration.
 void createPlaces()
          Creates input_place_key, output_place_key, and loop_attribute_name for each of the tasks.
 void delete(java.lang.String transition_key)
          Deletes the task with the given key.
 java.lang.String getKey(int i)
           
 java.lang.String getName(int i)
           
 java.lang.String getName(java.lang.String transition_key)
           
 com.arsdigita.db.ListResultSet getPriorTasks(java.lang.String from_transition_key)
          returns a ListResultSet containing the transition_key and task_name for all tasks preceding the given task, and including the given task.
 WizardTask getTaskObject(int i)
           
 com.arsdigita.db.ListResultSet getTasksForDisplay()
          Returns a ListResultSet suitable for passing to a template.
 com.arsdigita.db.ListResultSet getTasksWithOptions()
          returns the list of tasks in an outer-join style ListResultSet, the outer join being the list of all prior tasks, so we can present an html select box for each task.
static java.lang.String makeUnique(int maxlen, java.util.Vector taken_names, java.lang.String name_part_one, java.lang.String name_part_two)
          Takes a name (split in two parts) and makes it unique with respect to the list passed in taken_names, by putting an integer number between name_part_one and name_part_two, chopping name_part_one as required to stay within maxlen.
 void move(java.lang.String transition_key)
          Swaps the given task with the one above it.
static java.lang.String nameToKey(java.lang.String name)
          Generates a key from a name by making it all lowercase, removing non-letters and putting in underscores instead of spaces.
 void setAssigningTask(java.lang.String assigned_index, java.lang.String assigning_index)
          Sets the task that provides assignments for the given task.
 void setLoopInfo(java.lang.String from_transition_key, java.lang.String to_transition_key, java.lang.String question, java.lang.String answer)
          Sets the given task's loop destination.
 int size()
           
 boolean validKey(java.lang.String transition_key)
          Returns true if the given key has been defined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvsId

public static final java.lang.String cvsId
Constructor Detail

WizardTasks

public WizardTasks()
Method Detail

addTask

public boolean addTask(java.lang.String task_name,
                       java.math.BigDecimal task_time)
Create a new task with the given name and duration.
Returns:
true if successful; false if the given name could not be used to generate a unique key.

nameToKey

public static java.lang.String nameToKey(java.lang.String name)
Generates a key from a name by making it all lowercase, removing non-letters and putting in underscores instead of spaces.

getTasksForDisplay

public com.arsdigita.db.ListResultSet getTasksForDisplay()
Returns a ListResultSet suitable for passing to a template. The fields it contains are task_name, transition_key, task_time, loop_to_transition_key, and assigning_transition_key.

getTasksWithOptions

public com.arsdigita.db.ListResultSet getTasksWithOptions()
returns the list of tasks in an outer-join style ListResultSet, the outer join being the list of all prior tasks, so we can present an html select box for each task.

getPriorTasks

public com.arsdigita.db.ListResultSet getPriorTasks(java.lang.String from_transition_key)
returns a ListResultSet containing the transition_key and task_name for all tasks preceding the given task, and including the given task. This can be passed to a template to display the tasks that can be the destination of a loop.

validKey

public boolean validKey(java.lang.String transition_key)
Returns true if the given key has been defined.

delete

public void delete(java.lang.String transition_key)
Deletes the task with the given key. Also removes loops and assignments that refer to this task.

move

public void move(java.lang.String transition_key)
Swaps the given task with the one above it.

size

public int size()
Returns:
the number of tasks that have been added

getKey

public java.lang.String getKey(int i)
Returns:
the key at the given index, or null if the index is invalid

getName

public java.lang.String getName(java.lang.String transition_key)
Returns:
the name of the given task, or null if the index is invalid

getName

public java.lang.String getName(int i)
Returns:
the name of the task at the given index, or null if the index is invalid

setLoopInfo

public void setLoopInfo(java.lang.String from_transition_key,
                        java.lang.String to_transition_key,
                        java.lang.String question,
                        java.lang.String answer)
Sets the given task's loop destination. Ensures that the destination of the loop is to a prior step in the process.

setAssigningTask

public void setAssigningTask(java.lang.String assigned_index,
                             java.lang.String assigning_index)
Sets the task that provides assignments for the given task. Ensures that the assigning task is a prior step in the process. It's okay to pass null for assigning_index to make the task be statically assigned.

createPlaces

public void createPlaces()
Creates input_place_key, output_place_key, and loop_attribute_name for each of the tasks.

makeUnique

public static java.lang.String makeUnique(int maxlen,
                                          java.util.Vector taken_names,
                                          java.lang.String name_part_one,
                                          java.lang.String name_part_two)
Takes a name (split in two parts) and makes it unique with respect to the list passed in taken_names, by putting an integer number between name_part_one and name_part_two, chopping name_part_one as required to stay within maxlen.

getTaskObject

public WizardTask getTaskObject(int i)
Returns:
the task object at the given index, or null if the index is invalid