Class AbstractFindBaseRecordListActionSupport<M extends Serializable,T extends Serializable,F extends AbstractForm>

Type Parameters:
M - Record type of master list cache if loading a slave list or NA otherwise.
T - Record type of list cache.
F - Struts 2 AflForm that provides any search form fields or NullForm if no form is used.
All Implemented Interfaces:
Action, ValidationAware, LocaleProvider, ModelDriven<F>, TextProvider, Validateable, Serializable, BrowserTabAware, BrowserTabAware2, FormDriven<F>, ValidationAware2, Action, ServletRequestAware, ValidationAware, ModelDriven<F>, Validateable

public abstract class AbstractFindBaseRecordListActionSupport<M extends Serializable,T extends Serializable,F extends AbstractForm> extends AbstractFormDrivenActionSupport<F>

Template Struts 2 Action for creating Strategies that load an instance of ListCache, usually from a form.

Concrete subclasses must implement various template functions:-

Required template functions
getBaseRecordListFinder Returns a Strategy used to load list cache, which can be initialised with an input form received by this Struts action.
getFindBaseRecordListConfig Returns miscellaneous config, such as whether no records found means an input form rejection.
getListCacheReturns list cache that stores the retrieved records.
getMasterListCacheIf the list cache is a slave list, returns master list cache that controls it, otherwise returns null.
See Also:
  • Constructor Details

    • AbstractFindBaseRecordListActionSupport

      public AbstractFindBaseRecordListActionSupport()
  • Method Details

    • getBaseRecordListFinder

      protected abstract AbstractFindBaseRecordListActionSupport.FindBaseRecordListResponse<M,T> getBaseRecordListFinder(M selectedMaster) throws Exception
      Overridden by subclasses to return Strategy 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
    • getFindBaseRecordListConfig

      protected abstract AbstractFindBaseRecordListActionSupport.FindBaseRecordListConfig getFindBaseRecordListConfig()
      Written by subclasses to configure behaviour of find action.
    • getItemSorter

      protected ListCacheRecordComparator<T> getItemSorter()
      Written by subclasses to return item comparator for sorting list after finding it, or null for no post-find sorting.
    • getListCache

      protected abstract ListCache<M,?,T> getListCache()
      Written by subclasses to return list cache that is being populated.
    • getMasterListCache

      protected abstract ListCache<?,?,M> 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> finderCommand, Exception e)
      May be overridden by subclasses to translate an exception thrown by a list finder Command into a Struts message key, so a message is displayed to the user. May return null to default to a generic error message key.
      Parameters:
      finderCommand - List finder Command.
      e - Exception thrown by ListFinder.getList(M) function.
    • execute

      public String execute() throws Exception
      Specified by:
      execute in interface Action
      Overrides:
      execute in class ActionSupport
      Throws:
      Exception