Class AbstractSaveListActionSupport<M extends Serializable,K extends Serializable,T extends Serializable,F extends AbstractForm>
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.AbstractSaveListActionSupport<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 AbstractSaveListActionSupport<M extends Serializable,K extends Serializable,T extends Serializable,F extends AbstractForm>
extends AbstractFormDrivenActionSupport<F>
Template class for changing business data related to the currently, selected item.
Concrete subclasses must implement getSaveListConfig()
, which defines the the
AbstractCompositeCache
being used. Subclasses must override doSave(M, T)
.
The URL parameters, whose names can be changed by config, that can be used are:-
- select
- Index of item in list cache to update (which starts at 0).
- M
- Record type of master list cache if loading a slave list or Object otherwise.
- K
- Primary key type of list cache.
- T
- Record type of list cache.
- F
- Type of Struts action form used by this action or NullForm if Struts forms aren't used.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Configures list that is updated by save action.static class
Forwarding and cache updating response set by concrete subclass.Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.ValidationAware
com.opensymphony.xwork2.interceptor.ValidationAware.LegacyAdapter
-
Field Summary
FieldsFields 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 TypeMethodDescriptionprotected abstract AbstractSaveListActionSupport.SaveResponse
<T> Written by subclasses to try to save form data to business model.execute()
protected Integer
getAlternateIndex
(ListCache<M, K, T> listCache) Optionally written by subclasses to return index of record to select, typically by a request parameter, or null for no change of selection.Written by subclasses to return list cache that is being updated.Written by subclasses to return master list cache or null if the list cache is the master list.protected abstract AbstractSaveListActionSupport.SaveListConfig
Written by subclasses to configure behaviour of view action.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
-
Field Details
-
PARAMETER_NAME_INDEXSELECT
- See Also:
-
-
Constructor Details
-
AbstractSaveListActionSupport
public AbstractSaveListActionSupport()
-
-
Method Details
-
execute
- Specified by:
execute
in interfaceorg.apache.struts2.action.Action
- Overrides:
execute
in classorg.apache.struts2.ActionSupport
- Throws:
Exception
-
doSave
protected abstract AbstractSaveListActionSupport.SaveResponse<T> doSave(M selectedMaster, T selectedItem) throws Exception Written by subclasses to try to save form data to business model. The form data applies to the currently selected item displayed on the viewer page. Returns response configuration, which includes whether the save succeeded and, if available, the updated item.- Parameters:
selectedItem
- Currently selected item in cache that will be changed, or null if none, generally for adding.- Returns:
- Response Configuration including success flag and any updated item.
- Throws:
Exception
-
getAlternateIndex
Optionally written by subclasses to return index of record to select, typically by a request parameter, or null for no change of selection. If any action or field errors are written, the action ends and the input result is used. -
getListCache
Written by subclasses to return list cache that is being updated. -
getMasterListCache
Written by subclasses to return master list cache or null if the list cache is the master list. -
getSaveListConfig
Written by subclasses to configure behaviour of view action.
-