info.magnolia.commands.chain
Class ChainBase

java.lang.Object
  extended by info.magnolia.commands.chain.ChainBase
All Implemented Interfaces:
Chain, Command

public class ChainBase
extends Object
implements Chain

Replacement for org.apache.commons.chain.impl.ChainBase. Base Chain implementation.


Field Summary
protected  List<Command> commands
           
protected  boolean frozen
           
 
Fields inherited from interface info.magnolia.commands.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
ChainBase()
           
ChainBase(Collection<Command> commands)
           
ChainBase(Command... commands)
           
ChainBase(Command command)
           
 
Method Summary
 void addCommand(Command command)
           
 Chain copy(Command command)
          This method allows to create new copy of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses new instance created by this method.
NOTE: If your command uses default parameters (set from a JCR property), you MUST override this method to copy the values from the master command to the actually used copy.
 boolean execute(Context context)
           
 List<Command> getCommands()
          Returns unmodifiable list of commands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commands

protected List<Command> commands

frozen

protected boolean frozen
Constructor Detail

ChainBase

public ChainBase()

ChainBase

public ChainBase(Command command)

ChainBase

public ChainBase(Command... commands)

ChainBase

public ChainBase(Collection<Command> commands)
Method Detail

addCommand

public void addCommand(Command command)
Specified by:
addCommand in interface Chain

execute

public boolean execute(Context context)
                throws Exception
Specified by:
execute in interface Command
Throws:
Exception

getCommands

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


copy

public Chain copy(Command command)
Description copied from interface: Command
This method allows to create new copy of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses new instance created by this method.
NOTE: If your command uses default parameters (set from a JCR property), you MUST override this method to copy the values from the master command to the actually used copy.

Specified by:
copy in interface Command


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.