Interface QueryFilterAction

All Superinterfaces:

public interface QueryFilterAction
extends Action
Actions for creating restrictions on queries. The actions are used by the ItemContext.configureQuery(DbControl, EntityQuery, ClientContext, boolean) method to let extensions handle some filtering in table lists and synchronization filters.

The ActionFactory is asked to create a QueryFilterAction once for every call to the configureQuery() method. The ClientContext.getCurrentItem() returns the ItemContext instance and the ItemContext.getQuery() returns the query that was passed to the configureQuery() method. Action factories should check if there is a filter on a column they want to handle, for example by calling ItemContext.hasPropertyFilter(String) or ItemContext.hasExtensionFilter(String).

All created actions are called multiple times:

  • getColumnRestriction(PropertyFilter) is called once for every column with a filter, including filters that normally are handled by the default implementation. Extensions should return null if they want BASE to use normal handling of the filter. Columns restrictions are combined row-wise with AND.
  • getRowRestriction(int) is called once for every filter row after all column restrictions have been handled. If the extension returns a restriction, it is combined with AND with the other column restrictions. Restrictions for different rows are combined with OR.
  • getQueryRestriction() is called once after all row and columns restrictions have been handled. The query restrictions is combined with AND.
  • Method Details

    • getColumnRestriction

      Restriction getColumnRestriction​(PropertyFilter filter)
      Generate a restriction for the given filter. This method is called for all columns with a filter. The extension should check PropertyFilter.getProperty() or PropertyFilter.isExtensionFilter(String) if the filter should be handled or not. If a restriction is returned it is used in the query instead of the default implementation.
    • getRowRestriction

      Restriction getRowRestriction​(int rowNo)
      Generate a restriction for the given filter row. This method is mainly intended for multi-column filtering that can be combined into a single restriction that is more efficient than multiple per-column restrictions. For example, two column restrictions that return a list of ID:s can be combined into a single row-restriction with only the overlapping ID:s from the two lists.
    • getQueryRestriction

      Restriction getQueryRestriction()
      Generate a restriction for the entire query after all column and row filters has been processed.