Class AbstractSaveListActionSupport.SaveResponse<T>

java.lang.Object
name.matthewgreet.strutscommons.action.AbstractSaveListActionSupport.SaveResponse<T>
Enclosing class:
AbstractSaveListActionSupport<M extends Serializable,K extends Serializable,T extends Serializable,F extends AbstractForm>

public static class AbstractSaveListActionSupport.SaveResponse<T> extends Object
Forwarding and cache updating response set by concrete subclass.

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.

  • 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

      public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeDeselectResponse()
      Returns response for changing the list selection to no item.
    • makeFailureResponse

      public static <T> AbstractSaveListActionSupport.SaveResponse<T> makeFailureResponse(String message)
      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 by getSuccessResultName(), otherwise uses action result named by getFailureResultName(). Defaults to false.
    • setSucceeded

      public void setSucceeded(boolean value)
    • getFailureResultName

      public String getFailureResultName()
      Action result name to use if response reports failure. Defaults to "input".
    • setFailureResultName

      public void setFailureResultName(String value)
    • getSuccessResultName

      public String getSuccessResultName()
      Action result name to use if response reports success. Defaults to "success".
    • setSuccessResultName

      public void setSuccessResultName(String value)
    • 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

      public T 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

      public void setUpdatedItem(T value)
    • getListAction

      Cache list reload mode.

      See RELOAD_ constants.

    • setListAction

      public void setListAction(AbstractSaveListActionSupport.SaveResponse.ListAction value)
    • getErrors

      public Collection<String> getErrors()
      Struts errors messages to be used, usually for update failure. An error message does not indicate an error (use setSucceeded(boolean)) and is displayed even for success (though that's unusual).
    • getMessages

      public Collection<String> getMessages()
      Struts information messages to be used, usually for update success. An info message does not indicate a success (use setSucceeded(boolean)) and is displayed even for failure (though that's unusual).
    • addErrorMessage

      public void addErrorMessage(String text)
      Convenience function to add error message.
    • addInfoMessage

      public void addInfoMessage(String text)
      Convenience function to add info message.