Class WrappingLookupCommand

java.lang.Object
org.apache.struts.chain.commands.generic.WrappingLookupCommand
All Implemented Interfaces:
org.apache.commons.chain.Command<org.apache.commons.chain.Context>, org.apache.commons.chain.Filter<org.apache.commons.chain.Context>

public class WrappingLookupCommand extends Object implements org.apache.commons.chain.Filter<org.apache.commons.chain.Context>
Variant on chain LookupCommand which can optionally wrap the context it passes to the looked up command in an alternative class.
  • Field Summary

    Fields inherited from interface org.apache.commons.chain.Command

    CONTINUE_PROCESSING, PROCESSING_COMPLETE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Zero-argument constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    execute(org.apache.commons.chain.Context context)
    Invoke the Command for a Context, returning TRUE if processing should halt.
    Return CatalogName property.
    protected org.apache.commons.chain.Command<org.apache.commons.chain.Context>
    getCommand(org.apache.commons.chain.Context context)
    Return the Command to process for this Context.
    protected org.apache.commons.chain.Context
    getContext(org.apache.commons.chain.Context context)
    If the wrapperClassName property is not null, return a Context of the type specified by wrapperClassName, instantiated using a single-arg constructor which takes the context passed as an argument to this method.
    Retrieve Name property.
    Return NameKey property.
    Return the WrapperClass property.
    boolean
    Test Optional property.
    boolean
    postprocess(org.apache.commons.chain.Context context, Exception exception)
    Process the Exception for any Command that is a filter.
    void
    setCatalogName(String catalogName)
    Set CatalogName property.
    void
    Set Name property.
    void
    setNameKey(String nameKey)
    Set NameKey property.
    void
    setOptional(boolean optional)
    Set Optional property.
    void
    setWrapperClassName(String wrapperClassName)
    Set WrappClassName property.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WrappingLookupCommand

      public WrappingLookupCommand()
      Zero-argument constructor.
  • Method Details

    • getCatalogName

      public String getCatalogName()
      Return CatalogName property.
      Returns:
      Value of CatalogName property.
    • setCatalogName

      public void setCatalogName(String catalogName)
      Set CatalogName property.
      Parameters:
      catalogName - New value for CatalogName
    • getName

      public String getName()
      Retrieve Name property.
      Returns:
      Value of Name property
    • setName

      public void setName(String name)
      Set Name property.
      Parameters:
      name - New value for Name
    • getNameKey

      public String getNameKey()
      Return NameKey property.
      Returns:
      Value of NameKey property.
    • setNameKey

      public void setNameKey(String nameKey)
      Set NameKey property.
      Parameters:
      nameKey - New value for NameKey
    • isOptional

      public boolean isOptional()
      Test Optional property.
      Returns:
      TRUE if Optional is TRUE.
    • setOptional

      public void setOptional(boolean optional)
      Set Optional property.
      Parameters:
      optional - New value for Optional
    • getWrapperClassName

      public String getWrapperClassName()
      Return the WrapperClass property.
      Returns:
      The WrapperClass property
    • setWrapperClassName

      public void setWrapperClassName(String wrapperClassName)
      Set WrappClassName property.
      Parameters:
      wrapperClassName - The name of a WrapperClass
    • execute

      public boolean execute(org.apache.commons.chain.Context context) throws Exception
      Invoke the Command for a Context, returning TRUE if processing should halt.
      Specified by:
      execute in interface org.apache.commons.chain.Command<org.apache.commons.chain.Context>
      Parameters:
      context - Our ActionContext
      Returns:
      TRUE if processing should halt
      Throws:
      Exception - On any error
    • postprocess

      public boolean postprocess(org.apache.commons.chain.Context context, Exception exception)
      Process the Exception for any Command that is a filter.
      Specified by:
      postprocess in interface org.apache.commons.chain.Filter<org.apache.commons.chain.Context>
      Parameters:
      context - Our ActionContext
      exception - The Exception thrown by another Command in a Chain
      Returns:
      TRUE if there is a Filter to process
    • getCommand

      protected org.apache.commons.chain.Command<org.apache.commons.chain.Context> getCommand(org.apache.commons.chain.Context context)
      Return the Command to process for this Context.
      Parameters:
      context - The Context we are processing
      Returns:
      The Command to process for this Context
    • getContext

      protected org.apache.commons.chain.Context getContext(org.apache.commons.chain.Context context) throws ClassNotFoundException, InstantiationException, InvocationTargetException, IllegalAccessException, NoSuchMethodException
      If the wrapperClassName property is not null, return a Context of the type specified by wrapperClassName, instantiated using a single-arg constructor which takes the context passed as an argument to this method.

      This method throws an exception if the wrapperClass cannot be found, or if there are any errors instantiating the wrapping context.

      Parameters:
      context - Context we are processing
      Returns:
      Context wrapper
      Throws:
      ClassNotFoundException - On failed instantiation
      InstantiationException - On failed instantiation
      InvocationTargetException - On failed instantiation
      IllegalAccessException - On failed instantiation
      NoSuchMethodException - On failed instantiation