/** * Creates a single unvalidated filter item based on a expression. * Expression based filters are typically NOT datastore-neutral but are * available for special "hacking" needs. * * Expression based filters can only be used for JDBC based datastores since * they are translated directly into SQL. * * @param expression * An expression to use for the filter, for example * "YEAR(my_date) = 2008". */ public FilterItem(String expression) { this(null, null, null, null, expression, null); require("Expression cannot be null", _expression != null); }
/** * Creates a single unvalidated filter item based on a expression. * Expression based filters are typically NOT datastore-neutral but are * available for special "hacking" needs. * * Expression based filters can only be used for JDBC based datastores since * they are translated directly into SQL. * * @param expression * An expression to use for the filter, for example * "YEAR(my_date) = 2008". */ public FilterItem(String expression) { this(null, null, null, null, expression, null); require("Expression cannot be null", _expression != null); }
/** * Creates a compound filter item based on other filter items. Each provided * filter item will be combined according to the {@link LogicalOperator}. * * @param logicalOperator * the logical operator to apply * @param items * a list of items to include in the composite */ public FilterItem(LogicalOperator logicalOperator, List<FilterItem> items) { this(null, null, null, items, null, logicalOperator); require("Child items cannot be null", _childItems != null); require("Child items cannot be empty", !_childItems.isEmpty()); }
/** * Creates a compound filter item based on other filter items. Each provided * filter item will be combined according to the {@link LogicalOperator}. * * @param logicalOperator * the logical operator to apply * @param items * a list of items to include in the composite */ public FilterItem(LogicalOperator logicalOperator, List<FilterItem> items) { this(null, null, null, items, null, logicalOperator); require("Child items cannot be null", _childItems != null); require("Child items cannot be empty", !_childItems.isEmpty()); }
this(selectItem, operator, operand, null, null, null); if (_operand == null) { require("Can only use EQUALS or DIFFERENT_FROM operator with null-operand", _operator == OperatorType.DIFFERENT_FROM || _operator == OperatorType.EQUALS_TO); ColumnType type = _selectItem.getColumn().getType(); if (type != null) { require("Can only use LIKE operator with strings", type.isLiteral() && (_operand instanceof String || _operand instanceof SelectItem)); require("SelectItem cannot be null", _selectItem != null);
this(selectItem, operator, operand, null, null, null); if (_operand == null) { require("Can only use EQUALS or DIFFERENT_FROM operator with null-operand", _operator == OperatorType.DIFFERENT_FROM || _operator == OperatorType.EQUALS_TO); ColumnType type = _selectItem.getColumn().getType(); if (type != null) { require("Can only use LIKE operator with strings", type.isLiteral() && (_operand instanceof String || _operand instanceof SelectItem)); require("SelectItem cannot be null", _selectItem != null);
require("Expression-based filters cannot be manually evaluated", _expression == null);
require("Expression-based filters cannot be manually evaluated", _expression == null);