Class AbstractFindListMultiModeActionSupport<M extends Serializable,K extends Serializable,T extends Serializable,F extends Form>
java.lang.Object
org.apache.struts2.ActionSupport
com.opensymphony.xwork2.ActionSupport
name.matthewgreet.strutscommons.action.AbstractActionSupport
name.matthewgreet.strutscommons.action.AbstractFormDrivenActionSupport<F>
name.matthewgreet.strutscommons.action.AbstractFindListMultiModeActionSupport<M,K,T,F>
- All Implemented Interfaces:
com.opensymphony.xwork2.Action
,com.opensymphony.xwork2.interceptor.ValidationAware
,com.opensymphony.xwork2.LocaleProvider
,com.opensymphony.xwork2.ModelDriven<F>
,com.opensymphony.xwork2.TextProvider
,com.opensymphony.xwork2.Validateable
,Serializable
,BrowserTabAware
,BrowserTabAware2
,FormDriven<F>
,org.apache.struts2.action.Action
,org.apache.struts2.action.ServletRequestAware
,org.apache.struts2.interceptor.ValidationAware
,org.apache.struts2.ModelDriven<F>
,org.apache.struts2.Validateable
public abstract class AbstractFindListMultiModeActionSupport<M extends Serializable,K extends Serializable,T extends Serializable,F extends Form>
extends AbstractFormDrivenActionSupport<F>
Template class for creating Command objects that load a list cache in the AbstractCompositeCache
by
various pagination modes, whether full list, page by id, or page by index.
Concrete subclasses must implement various template functions:-
getFindCommand(M)
- Returns a Command object used to load list cache, which can be initialized with an input form received by this Struts action.
getFindListMultiModeConfig()
- Returns miscellaneous config, such as whether no records found means an input form rejection.
getListCache()
- Returns list cache that stores the retrieved Value Objects.
getMasterListCache()
- If the list cache is a slave list, returns master list cache that controls it, otherwise returns null.
- M
- Record type of master list cache if loading a slave list or Object otherwise.
- K
- Id type of list cache.
- T
- Record type of list cache.
- F
- Struts ActionForm that provides any search form fields or ActionForm if no form is used.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Configures list to be loaded by Struts, finder action and whether empty lists means search parameters must be rejected.static class
AbstractFindListMultiModeActionSupport.FindListMultiModeResponse<M extends Serializable,
K extends Serializable, T extends Serializable> Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.ValidationAware
com.opensymphony.xwork2.interceptor.ValidationAware.LegacyAdapter
-
Field Summary
Fields inherited from class org.apache.struts2.ActionSupport
container
Fields inherited from interface org.apache.struts2.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()
protected abstract AbstractFindListMultiModeActionSupport.FindListMultiModeResponse
<M, K, T> getFindCommand
(M selectedMaster) Overridden by subclasses to return Command object for retrieving list (configured with any search parameters) and forwarding in the case of success.protected abstract AbstractFindListMultiModeActionSupport.FindListMultiModeConfig
Written by subclasses to configure behaviour of find action.protected ListCacheRecordComparator
<T> Written by subclasses to return item comparator for sorting list after finding it, or null for no post-find sorting.Written by subclasses to return list cache that is being populated.Written by subclasses to return master list cache or null if the list cache is the master list.protected String
translateFinderException
(ListFinder<M, T> listFinderCommand, IdListFinder<M, K> idListFinderCommand, ListSizeFinder<M> listSizeFinderCommand, Exception e) May be overridden by subclasses to translate an exception thrown by a list finder Command, id list finder Command or list size finder Command into message.Methods inherited from class name.matthewgreet.strutscommons.action.AbstractFormDrivenActionSupport
formValidationFailed, getForm, getModel, makeForm, setForm, validate
Methods inherited from class name.matthewgreet.strutscommons.action.AbstractActionSupport
getBrowserTabSession, getLogger, getServletRequest, getTabId, setBrowserTabSession, setTabId, withServletRequest
Methods inherited from class org.apache.struts2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocale, getLocaleProvider, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, toLocale
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface name.matthewgreet.strutscommons.action.BrowserTabAware2
copyAttributesFromOldTabToNewTab, handleAttributeFailures
Methods inherited from interface org.apache.struts2.interceptor.ValidationAware
addActionError, addActionMessage, addFieldError, getActionErrors, getActionMessages, getFieldErrors, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, setActionErrors, setActionMessages, setFieldErrors
-
Constructor Details
-
AbstractFindListMultiModeActionSupport
public AbstractFindListMultiModeActionSupport()
-
-
Method Details
-
getFindCommand
protected abstract AbstractFindListMultiModeActionSupport.FindListMultiModeResponse<M,K, getFindCommandT> (M selectedMaster) throws Exception Overridden by subclasses to return Command object for retrieving list (configured with any search parameters) and forwarding in the case of success.- Parameters:
selectedMaster
- Selected record of master list or null if loading master list.- Throws:
Exception
-
getFindListMultiModeConfig
protected abstract AbstractFindListMultiModeActionSupport.FindListMultiModeConfig getFindListMultiModeConfig()Written by subclasses to configure behaviour of find action. -
getItemSorter
Written by subclasses to return item comparator for sorting list after finding it, or null for no post-find sorting. -
getListCache
Written by subclasses to return list cache that is being populated. -
getMasterListCache
Written by subclasses to return master list cache or null if the list cache is the master list. -
translateFinderException
protected String translateFinderException(ListFinder<M, T> listFinderCommand, IdListFinder<M, K> idListFinderCommand, ListSizeFinder<M> listSizeFinderCommand, Exception e) May be overridden by subclasses to translate an exception thrown by a list finder Command, id list finder Command or list size finder Command into message. May return null to default to a generic error message. -
execute
- Specified by:
execute
in interfaceorg.apache.struts2.action.Action
- Overrides:
execute
in classorg.apache.struts2.ActionSupport
- Throws:
Exception
-