java.lang.Object
com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery
All Implemented Interfaces:
ConstraintContainer<WebQuery>

public class WebQuery extends Object implements ConstraintContainer<WebQuery>
Describes a database query to be executed
  • Field Details

    • LIMIT_RETURN_ZERO

      public static final int LIMIT_RETURN_ZERO
      Special limit value used to request the returning of 0 data rows (will still return count if requested)
      See Also:
    • name

      public String name
      An optional name for the query, to allow server-side optimisation/hinting
    • fetch

      public String fetch
      What to fetch: should be "entity" or "id".
    • dbfetch

      public String dbfetch
      Comma-separated list of relations to fetch from the database as part of the query
    • expand

      public String expand
      What relationships to expand (by default, all relationships are expanded)
    • logSQL

      public boolean logSQL
    • logPerformance

      public Boolean logPerformance
    • constraints

      public WQConstraints constraints
    • orderings

      public List<WQOrder> orderings
  • Constructor Details

    • WebQuery

      public WebQuery()
  • Method Details

    • expand

      public WebQuery expand(String... relationships)
    • getOffset

      public int getOffset()
    • getLimit

      public int getLimit()
    • getFetch

      public String getFetch()
    • getDBFetch

      public Set<String> getDBFetch()
    • getExpand

      public Set<String> getExpand()
    • isComputeSize

      public boolean isComputeSize()
    • isLogSQL

      public boolean isLogSQL()
    • isLogPerformance

      public boolean isLogPerformance()
    • subclass

      public WebQuery subclass(String... subclasses)
    • fetch

      public WebQuery fetch(String expression)
    • offset

      public WebQuery offset(int offset)
    • limit

      public WebQuery limit(int limit)
    • computeSize

      public WebQuery computeSize(boolean computeSize)
    • order

      public WebQuery order(WQOrder order)
    • orderAsc

      public WebQuery orderAsc(String field)
    • orderDesc

      public WebQuery orderDesc(String field)
    • logSQL

      public WebQuery logSQL(boolean enabled)
    • logPerformance

      public WebQuery logPerformance(boolean enabled)
    • dbfetch

      public WebQuery dbfetch(String... relations)
    • name

      public WebQuery name(String name)
    • add

      public WebQuery add(WQConstraintLine line)
      Specified by:
      add in interface ConstraintContainer<WebQuery>
    • decode

      public WebQuery decode(javax.ws.rs.core.UriInfo qs)
      Overwrite any fields in this WebQuery using the query defined in the Query String of the provided UriInfo
      Parameters:
      qs - the UriInfo to extract the QueryParameters from
      Returns:
      this WebQuery for chaining
    • decode

      public WebQuery decode(javax.ws.rs.core.UriInfo qs, WebQueryDecodePlugin parserPlugin)
    • decode

      public WebQuery decode(Map<String,List<String>> map)
    • decode

      public WebQuery decode(Map<String,List<String>> map, WebQueryDecodePlugin parserPlugin)
      Overwrite any fields in this WebQuery using the query defined in the provided map
      Parameters:
      map - a map of fields (or control fields) to encoded constraints
      Returns:
      this WebQuery for chaining
    • decode

      public WebQuery decode(String textQuery)
      Parameters:
      textQuery -
    • encode

      public Map<String,List<String>> encode()
      Encode this query to the equivalent (where possible) URI web query
      Returns:
    • toString

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

      public String toQueryFragment()
    • toQueryFragment

      public String toQueryFragment(boolean includeSelectAndExpand)
    • parse

      public static WebQuery parse(String str)