Class WrappingLookupCommand

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

public class WrappingLookupCommand extends Object implements Filter<Context>
Variant on chain LookupCommand which can optionally wrap the context it passes to the looked up command in an alternative class.
  • 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(Context context) throws Exception
      Invoke the Command for a Context, returning TRUE if processing should halt.
      Specified by:
      execute in interface Command<Context>
      Parameters:
      context - Our ActionContext
      Returns:
      TRUE if processing should halt
      Throws:
      Exception - On any error
    • postprocess

      public boolean postprocess(Context context, Exception exception)
      Process the Exception for any Command that is a filter.
      Specified by:
      postprocess in interface Filter<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 Command<Context> getCommand(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

      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