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 classConfigures list that is updated by save action.static classForwarding 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
containerFields 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 IntegergetAlternateIndex(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.SaveListConfigWritten by subclasses to configure behaviour of view action.Methods inherited from class name.matthewgreet.strutscommons.action.AbstractFormDrivenActionSupport
formValidationFailed, getForm, getModel, makeForm, setForm, validateMethods inherited from class name.matthewgreet.strutscommons.action.AbstractActionSupport
getBrowserTabSession, getLogger, getServletRequest, getTabId, setBrowserTabSession, setTabId, withServletRequestMethods 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, toLocaleMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface name.matthewgreet.strutscommons.action.BrowserTabAware2
copyAttributesFromOldTabToNewTab, handleAttributeFailuresMethods 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:
executein interfaceorg.apache.struts2.action.Action- Overrides:
executein 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.
-