info.joseluismartin.cmd
Class DefaultTask

java.lang.Object
  extended by info.joseluismartin.cmd.DefaultTask
All Implemented Interfaces:
Command, Task

public class DefaultTask
extends Object
implements Task

Composite of commands that delegate operations to collections. A command may be added as preprocessor, command or postprocessor

Author:
Jose Luis Martin - (chelu.es@gmail.com)

Constructor Summary
DefaultTask()
          Default Ctor.
 
Method Summary
 void addComand(List<Command> cmdList)
          Add a list of commands
 void addCommand(Command c)
          Add a Command to the command list of task
 void addPostProcessor(Command c)
          Add a Command to postprocessor command list
 void addPreprocesor(Command c)
          Add a Command to prepocesor command list
 boolean execute(Object data)
          Execute prepocesors, commands and postprocessors in order throw a CommandException if some command fails an stopOnfault is true.
 List<Command> getCommands()
           
 String getName()
           
 List<Command> getPostProcessors()
           
 List<Command> getPreProcessors()
           
 List<Command> newCommandList()
          Creates a new command list
 void onFault(Object data)
          Composite onFault to Commands
 void removeComannd(Command c)
          Remove a Command from command list of task
 void removePostProcessor(Command c)
          Remove a Command to postprocesor list of task
 void removePreprocesor(Command c)
          Remove a Command from preprocesor command list
 void setCommands(List<Command> commands)
           
 void setName(String name)
           
 void setPostProcessors(List<Command> postProcessors)
           
 void setPreProcessors(List<Command> preProcessors)
           
 void undo()
          Undo command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTask

public DefaultTask()
Default Ctor.

Method Detail

addCommand

public void addCommand(Command c)
Add a Command to the command list of task

Specified by:
addCommand in interface Task
Parameters:
c - Command to add.

addComand

public void addComand(List<Command> cmdList)
Add a list of commands

Parameters:
cmdList - the command list to add

removeComannd

public void removeComannd(Command c)
Remove a Command from command list of task

Specified by:
removeComannd in interface Task
Parameters:
c - Commmand to remove

addPreprocesor

public void addPreprocesor(Command c)
Add a Command to prepocesor command list

Specified by:
addPreprocesor in interface Task
Parameters:
c - Command to add.

removePreprocesor

public void removePreprocesor(Command c)
Remove a Command from preprocesor command list

Specified by:
removePreprocesor in interface Task
Parameters:
c - Command to remove.

addPostProcessor

public void addPostProcessor(Command c)
Add a Command to postprocessor command list

Specified by:
addPostProcessor in interface Task
Parameters:
c - Command to add.

removePostProcessor

public void removePostProcessor(Command c)
Remove a Command to postprocesor list of task

Specified by:
removePostProcessor in interface Task
Parameters:
c - Command to removce.

execute

public boolean execute(Object data)
Execute prepocesors, commands and postprocessors in order throw a CommandException if some command fails an stopOnfault is true.

Specified by:
execute in interface Command
Parameters:
data - with command data
Returns:
true if command ok.

onFault

public void onFault(Object data)
Composite onFault to Commands

Specified by:
onFault in interface Command
Parameters:
data - generic command data

newCommandList

public List<Command> newCommandList()
Creates a new command list

Returns:
list a new Command List with all commands from pre, commmand, post lists.

getCommands

public List<Command> getCommands()
Returns:
list of commands

setCommands

public void setCommands(List<Command> commands)
Parameters:
commands - list of commands to set

getPostProcessors

public List<Command> getPostProcessors()
Returns:
postprocesor command list

setPostProcessors

public void setPostProcessors(List<Command> postProcessors)
Parameters:
postProcessors - command list to set

getPreProcessors

public List<Command> getPreProcessors()
Returns:
preprocesor command list

setPreProcessors

public void setPreProcessors(List<Command> preProcessors)
Parameters:
preProcessors - command list to sets

getName

public String getName()
Specified by:
getName in interface Command
Returns:
the name

setName

public void setName(String name)
Parameters:
name - the name to set

undo

public void undo()
Undo command

Specified by:
undo in interface Command


Copyright © 2012 JDAL. All Rights Reserved.