Class WrappingLookupCommand
java.lang.Object
org.apache.struts.chain.commands.generic.WrappingLookupCommand
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Invoke the Command for a Context, returning TRUE if processing should halt.Return CatalogName property.getCommand
(Context context) Return the Command to process for this Context.protected Context
getContext
(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.getName()
Retrieve Name property.Return NameKey property.Return the WrapperClass property.boolean
Test Optional property.boolean
postprocess
(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.
-
Constructor Details
-
WrappingLookupCommand
public WrappingLookupCommand()Zero-argument constructor.
-
-
Method Details
-
getCatalogName
Return CatalogName property.- Returns:
- Value of CatalogName property.
-
setCatalogName
Set CatalogName property.- Parameters:
catalogName
- New value for CatalogName
-
getName
Retrieve Name property.- Returns:
- Value of Name property
-
setName
Set Name property.- Parameters:
name
- New value for Name
-
getNameKey
Return NameKey property.- Returns:
- Value of NameKey property.
-
setNameKey
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
Return the WrapperClass property.- Returns:
- The WrapperClass property
-
setWrapperClassName
Set WrappClassName property.- Parameters:
wrapperClassName
- The name of a WrapperClass
-
execute
Invoke the Command for a Context, returning TRUE if processing should halt. -
postprocess
Process the Exception for any Command that is a filter.- Specified by:
postprocess
in interfaceFilter<Context>
- Parameters:
context
- Our ActionContextexception
- The Exception thrown by another Command in a Chain- Returns:
- TRUE if there is a Filter to process
-
getCommand
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 Context getContext(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 instantiationInstantiationException
- On failed instantiationInvocationTargetException
- On failed instantiationIllegalAccessException
- On failed instantiationNoSuchMethodException
- On failed instantiation
-