Class AbstractSaveListActionSupport.SaveResponse<T>
- Enclosing class:
AbstractSaveListActionSupport<M extends Serializable,
K extends Serializable, T extends Serializable, F extends AbstractForm>
If succeeded is set, action will forward or redirect to the success page, otherwise forwards to input page (as defined in Struts action mapping). If succeeded is set, the selected item of the cache is replaced from the updatedItem property unless it is null, which will mark the list for reload. The success page is derived from the action mapping using the successForwardName property, which defaults to 'success', unless the successForwardURL is set. Error messages should included if failed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
ADD_AND_RELOAD_ITEMAdds item to list and reloads item for all required data. ADD_ITEMAdds item to list, which must have all expected data. DESELECTSets the list selection to no item. NONEDoes not affect list. RELOAD_ENTIREReloads master list, which means all slave lists are cleared for reload. RELOAD_ITEMReloads selected item of list only. RELOAD_LISTReloads list using current list finder. RELOAD_MASTERReloads selected item of master list, which means all slave lists are cleared for reload. REMOVE_ITEMRemoves selected item of list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorMessage
(String text) Convenience function to add error message.void
addInfoMessage
(String text) Convenience function to add info message.Struts errors messages to be used, usually for update failure.Action result name to use if response reports failure.Cache list reload mode.Struts information messages to be used, usually for update success.boolean
Indicates the save succeeded.Action result name to use if response reports success.Updated version of selected item in current cache list or item to add.boolean
Whether selected item should be updated or new item added.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeCreatedAndReloadItemSuccessResponse
(T createdItem, String message) Returns response for when an item is successfully created, complete with other list data.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeCreatedItemSuccessResponse
(T createdItem, String message) Returns response for when an item is successfully created, complete with other list data.static <T> AbstractSaveListActionSupport.SaveResponse
<T> Returns response for changing the list selection to no item.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeFailureAndReloadItemResponse
(String message) Returns response for when an action fails and user needs to see a reloaded item to see why.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeFailureAndReloadListResponse
(String message) Returns response for when an action fails and user needs to see a reloaded list to see why.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeFailureAndReloadMasterResponse
(String message) Returns response for when an action fails and user needs to see a reloaded master record and child list to see why.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeFailureResponse
(String message) Returns response for when an action fails.static <T> AbstractSaveListActionSupport.SaveResponse
<T> Returns response for when an action fails but uses any existing error messages.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeInvisibleSuccessResponse
(String message) Returns response for when an action is successful but does not change the selected item.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeRemovedItemSuccessResponse
(String message) Returns response for when the selected item is successfully removed.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeSuccessAndReloadItemResponse
(String message) static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeSuccessAndReloadListResponse
(String message) static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeSuccessAndReloadMasterResponse
(String message) static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeUpdatedItemSuccessResponse
(T updatedItem, String message) Returns response for when the selected item is successfully updated.static <T> AbstractSaveListActionSupport.SaveResponse
<T> makeUpdatedItemSuccessSilentResponse
(T updatedItem) Returns response for when the selected item is successfully updated.void
setFailureResultName
(String value) void
void
setSucceeded
(boolean value) void
setSuccessResultName
(String value) void
setUpdatedItem
(T value) void
setUpdateItem
(boolean value)
-
Constructor Details
-
SaveResponse
public SaveResponse()Default constructor.
-
-
Method Details
-
makeCreatedItemSuccessResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeCreatedItemSuccessResponse(T createdItem, String message) Returns response for when an item is successfully created, complete with other list data. -
makeCreatedAndReloadItemSuccessResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeCreatedAndReloadItemSuccessResponse(T createdItem, String message) Returns response for when an item is successfully created, complete with other list data. -
makeDeselectResponse
Returns response for changing the list selection to no item. -
makeFailureResponse
Returns response for when an action fails. -
makeFailureResponseExistingMessages
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeFailureResponseExistingMessages()Returns response for when an action fails but uses any existing error messages. -
makeFailureAndReloadItemResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeFailureAndReloadItemResponse(String message) Returns response for when an action fails and user needs to see a reloaded item to see why. -
makeFailureAndReloadListResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeFailureAndReloadListResponse(String message) Returns response for when an action fails and user needs to see a reloaded list to see why. -
makeFailureAndReloadMasterResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeFailureAndReloadMasterResponse(String message) Returns response for when an action fails and user needs to see a reloaded master record and child list to see why. -
makeInvisibleSuccessResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeInvisibleSuccessResponse(String message) Returns response for when an action is successful but does not change the selected item. -
makeRemovedItemSuccessResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeRemovedItemSuccessResponse(String message) Returns response for when the selected item is successfully removed. -
makeSuccessAndReloadItemResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeSuccessAndReloadItemResponse(String message) -
makeSuccessAndReloadListResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeSuccessAndReloadListResponse(String message) -
makeSuccessAndReloadMasterResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeSuccessAndReloadMasterResponse(String message) -
makeUpdatedItemSuccessResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeUpdatedItemSuccessResponse(T updatedItem, String message) Returns response for when the selected item is successfully updated. -
makeUpdatedItemSuccessSilentResponse
public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeUpdatedItemSuccessSilentResponse(T updatedItem) Returns response for when the selected item is successfully updated. -
getSucceeded
public boolean getSucceeded()Indicates the save succeeded. If set, template base class uses action result named bygetSuccessResultName()
, otherwise uses action result named bygetFailureResultName()
. Defaults to false. -
setSucceeded
public void setSucceeded(boolean value) -
getFailureResultName
Action result name to use if response reports failure. Defaults to "input". -
setFailureResultName
-
getSuccessResultName
Action result name to use if response reports success. Defaults to "success". -
setSuccessResultName
-
getUpdateItem
public boolean getUpdateItem()Whether selected item should be updated or new item added. Only used if update succeeded and cache reload mode is NONE. Defaults to false. -
setUpdateItem
public void setUpdateItem(boolean value) -
getUpdatedItem
Updated version of selected item in current cache list or item to add.This is typically returned by set business methods that update a record and returns the updated version. Only used if update succeeded and cache reload mode is RELOAD_NONE or RELOAD_ADD. Defaults to null.
-
setUpdatedItem
-
getListAction
Cache list reload mode.See RELOAD_ constants.
-
setListAction
-
getErrors
Struts errors messages to be used, usually for update failure. An error message does not indicate an error (usesetSucceeded(boolean)
) and is displayed even for success (though that's unusual). -
getMessages
Struts information messages to be used, usually for update success. An info message does not indicate a success (usesetSucceeded(boolean)
) and is displayed even for failure (though that's unusual). -
addErrorMessage
Convenience function to add error message. -
addInfoMessage
Convenience function to add info message.
-