Package org.silverpeas.components.mydb.web

# Class TableRowsFilter

java.lang.Object
org.silverpeas.components.mydb.web.TableRowsFilter

public class TableRowsFilter extends Object
Filter of table rows by applying a `ColumnValuePredicate` predicate on them.

Author:
  mmoquillon

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `FIELD_NONE`
  Default value when no comparator or no field name are set.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TableRowsFilter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Clears all the filtering parameters used by this filter.
  `static Set<String>`
  `getAllComparators()`
  Gets the symbol of all the comparators supported by this filter.
  `Optional<DbColumn>`
  `getColumn()`
  Ges the column on which the filtering will be applied.
  `String`
  `getColumnValue()`
  Gets the reference field value, that is the value with which the field of all table rows in the result will be filtered.
  `String`
  `getComparator()`
  Gets the symbol of the comparator used in the filtering of the SQL query result.
  `ColumnValuePredicate`
  `getFilteringPredicate()`
  Gets the predicate corresponding to this filtering rule.
  `boolean`
  `isDefined()`
  Is this filter defined?
  `void`
  `setColumn(DbColumn column)`
  Sets the column of the table on which the filtering will be applied.
  `void`
  `setColumnValue(String value)`
  Sets the value on which the whole column will be filtered.
  `void`
  `setComparator(String comparatorSymbol)`
  Sets the current comparator to use in the filtering of the SQL query result.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FIELD_NONE

    public static final String FIELD_NONE
    Default value when no comparator or no field name are set.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### TableRowsFilter

    public TableRowsFilter()

- ## Method Details

  - ### getAllComparators

    public static Set<String> getAllComparators()
    Gets the symbol of all the comparators supported by this filter.
    Returns:
      a set of comparator symbols.

  - ### setComparator

    public void setComparator(String comparatorSymbol)
    Sets the current comparator to use in the filtering of the SQL query result.
    Parameters:
      `comparatorSymbol` - the symbol of a supported comparator.

  - ### setColumn

    public void setColumn(DbColumn column)
    Sets the column of the table on which the filtering will be applied.
    Parameters:
      `column` - a `DbColumn` instance.

  - ### setColumnValue

    public void setColumnValue(String value)
    Sets the value on which the whole column will be filtered.
    Parameters:
      `value` - the value on which the filtering will be applied.

  - ### getComparator

    public String getComparator()
    Gets the symbol of the comparator used in the filtering of the SQL query result.
    Returns:
      the symbol of a supported comparator.

  - ### getColumn

    public Optional<DbColumn> getColumn()
    Ges the column on which the filtering will be applied.
    Returns:
      optionally a `DbColumn` instance. If no filter was set, then returns nothing.

  - ### getColumnValue

    public String getColumnValue()
    Gets the reference field value, that is the value with which the field of all table rows in the result will be filtered.
    Returns:
      the value used in the filtering as a `String` instance.

  - ### clear

    public void clear()
    Clears all the filtering parameters used by this filter.

  - ### isDefined

    public boolean isDefined()
    Is this filter defined?
    Returns:
      true if the filtering parameters are set, false otherwise.

  - ### getFilteringPredicate

    public ColumnValuePredicate getFilteringPredicate()
    Gets the predicate corresponding to this filtering rule.
    Returns:
      a `ColumnValuePredicate` object. If no filtering rule is defined, returns an `Identity` predicate.