Class IdListRestriction

java.lang.Object
net.sf.basedb.core.query.IdListRestriction
All Implemented Interfaces:
QueryElement, Restriction

public class IdListRestriction
extends Object
implements Restriction
Restriction that filters on a list of ID values: id IN (a, b, c, ....) id NOT IN (a, b, c, ....)
Since:
3.16
Author:
nicklas
  • Field Details

    • notIn

      private boolean notIn
    • idList

      private Set<Integer> idList
    • idExpression

      private final Expression idExpression
    • tmpTable

      private String tmpTable
  • Constructor Details

    • IdListRestriction

      public IdListRestriction()
    • IdListRestriction

      public IdListRestriction​(boolean notIn)
      Since:
      3.18
    • IdListRestriction

      public IdListRestriction​(Set<Integer> idList)
    • IdListRestriction

      public IdListRestriction​(String idProperty, Collection<Integer> idList)
      Since:
      3.19.8
    • IdListRestriction

      public IdListRestriction​(boolean notIn, Set<Integer> idList)
      Since:
      3.18
    • IdListRestriction

      public IdListRestriction​(String idProperty, boolean notIn, Collection<Integer> idList)
      Since:
      3.19.8
  • Method Details

    • toQl

      public String toQl​(Query query, DbControl dc)
      Description copied from interface: QueryElement
      Create a query language string of the query element. Use the Query.getQueryType() method to find out which query language is wanted in case the element requires different syntax for different languages.
      Specified by:
      toQl in interface QueryElement
      Parameters:
      query - The query that is about to be executed
      dc - The DbControl object used to execute the query
    • getChildren

      public Collection<? extends QueryElement> getChildren()
      Description copied from interface: QueryElement
      Get the children of this query element or null if it has no children. For example the AddExpression has two children, the expression beeing added.
      Specified by:
      getChildren in interface QueryElement
      Returns:
      A collection or null
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • union

      public void union​(IdListRestriction other)
      Merge this id list with another list. This list will now contain the combined set of ids from both lists. NOTE! This method ignore the 'notIn' setting for both lists.
    • intersect

      public void intersect​(IdListRestriction other)
      Merge this id list with another list. This list will now contain only the ids that are found in both lists. NOTE! This method ignore the 'notIn' setting for both lists.
    • remove

      public void remove​(IdListRestriction other)
      Merge this id list with another list by removing ids that are found in the other list. NOTE! This method ignore the 'notIn' setting for both lists.
    • mergeAnd

      public void mergeAnd​(IdListRestriction other)
      Merge this list with another list with AND logic respecting the notIn setting. This may cause the list of ids and notIn setting of this list to change.
      Since:
      3.18