Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.model
Class SetQuery

    java.lang.Object
      org.modeshape.jcr.query.model.SetQuery

All Implemented Interfaces:
  Serializable, QueryCommand, SetQuery, Command, LanguageObject, Visitable

    @Immutable
    public class SetQuery

extends Object
implements QueryCommand, SetQuery

This object acts as a Set operator on multiple `queries`, such as performing UNION, INTERSECT, and EXCEPT operations.

The two `queries` are expected to have the same number and order of columns, and the corresponding columns types must be compatible.

See Also:
  Serialized Form

Nested Class Summary
`static class` | `SetQuery.Operation`

Constructor Summary
`SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all)` Create a set query involving the supplied left- and right-hand-side queries.
`SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all, List<? extends Ordering> orderings, Limit limit)` Create a set query involving the supplied left- and right-hand-side queries.

Method Summary
`void` | `accept(Visitor visitor)` Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
`SetQuery` | `adding(Ordering... orderings)`
`List<? extends Column>` | `columns()` Return the columns defining the query results.
`boolean` | `equals(Object obj)`
`Column[]` | `getColumns()` Gets the columns for this query.
`QueryCommand` | `getLeft()` Get the left-hand query.
`Limit` | `getLimits()` Get the limits associated with this query.
`String` | `getOperation()` Get the set operation for this query.
`Ordering[]` | `getOrderings()` Gets the orderings for this query.
`QueryCommand` | `getRight()` Get the right-hand query.
`int` | `hashCode()`
`boolean` | `isAll()` Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.
`SetQuery.Operation` | `operation()` Get the set operation for this query.
`List<? extends Ordering>` | `orderings()` Return the orderings for this query.
`String` | `toString()`
`protected static boolean` | `unionableColumns(List<? extends Column> left, List<? extends Column> right)`
`SetQuery` | `withLimit(int rowLimit)` Create a copy of this query, but one that uses the supplied limit on the number of result rows.
`SetQuery` | `withOffset(int offset)` Create a copy of this query, but one that uses the supplied offset.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SetQuery

    public SetQuery(QueryCommand left,
                    SetQuery.Operation operation,
                    QueryCommand right,
                    boolean all)

  Create a set query involving the supplied left- and right-hand-side queries.

  Parameters:
    `left` - the left-hand-side query being combined
    `operation` - the set operation
    `right` - the right-hand-side query being combined
    `all` - true if all of the results should be included
  Throws:
    `IllegalArgumentException` - if the left-hand-side query, right-hand-side query, or operation are null

### SetQuery

    public SetQuery(QueryCommand left,
                    SetQuery.Operation operation,
                    QueryCommand right,
                    boolean all,
                    List<? extends Ordering> orderings,
                    Limit limit)

  Create a set query involving the supplied left- and right-hand-side queries.

  Parameters:
    `left` - the left-hand-side query being combined
    `operation` - the set operation
    `right` - the right-hand-side query being combined
    `all` - true if all of the results should be included
    `orderings` - the specification of the order of the result rows, or null if the results need not be ordered
    `limit` - the limit for the result rows, or null if there are no limits
  Throws:
    `IllegalArgumentException` - if the left-hand-side query, right-hand-side query, or operation are null

Method Detail

### unionableColumns

    protected static boolean unionableColumns(List<? extends Column> left,
                                              List<? extends Column> right)

### columns

    public List<? extends Column> columns()

  Description copied from interface: `QueryCommand`
  Return the columns defining the query results. If there are no columns, then the columns are implementation determined.

  Returns:
    the list of columns; never null

### getLimits

    public Limit getLimits()

  Description copied from interface: `QueryCommand`
  Get the limits associated with this query.

  Specified by:
    `getLimits` in interface `QueryCommand`
  Returns:
    the limits; never null but possibly `unlimited`

### orderings

    public List<? extends Ordering> orderings()

  Description copied from interface: `QueryCommand`
  Return the orderings for this query.

  Returns:
    the list of orderings; never null

### getLeft

    public QueryCommand getLeft()

  Description copied from interface: `SetQuery`
  Get the left-hand query.

  Specified by:
    `getLeft` in interface `SetQuery`
  Returns:
    the left-hand query; never null

### getRight

    public QueryCommand getRight()

  Description copied from interface: `SetQuery`
  Get the right-hand query.

  Specified by:
    `getRight` in interface `SetQuery`
  Returns:
    the right-hand query; never null

### operation

    public final SetQuery.Operation operation()

  Get the set operation for this query.

  Returns:
    the operation; never null

### getOperation

    public String getOperation()

  Description copied from interface: `SetQuery`
  Get the set operation for this query.

  Specified by:
    `getOperation` in interface `SetQuery`
  Returns:
    the operation; never null

### isAll

    public final boolean isAll()

  Description copied from interface: `SetQuery`
  Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.

  Specified by:
    `isAll` in interface `SetQuery`
  Returns:
    true if this is an 'ALL' query, or false otherwise

### getOrderings

    public Ordering[] getOrderings()

  Description copied from interface: `QueryCommand`
  Gets the orderings for this query.

  Specified by:
    `getOrderings` in interface `QueryCommand`
  Returns:
    an array of zero or more orderings; non-null

### getColumns

    public Column[] getColumns()

  Description copied from interface: `QueryCommand`
  Gets the columns for this query.

  Specified by:
    `getColumns` in interface `QueryCommand`
  Returns:
    an array of zero or more columns; non-null

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### accept

    public void accept(Visitor visitor)

  Description copied from interface: `Visitable`
  Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.

  Specified by:
    `accept` in interface `Visitable`
  Parameters:
    `visitor` - the visitor; never null

### withLimit

    public SetQuery withLimit(int rowLimit)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied limit on the number of result rows.

  Parameters:
    `rowLimit` - the limit that should be used; must be a positive number
  Returns:
    the copy of the query that uses the supplied limit; never null

### withOffset

    public SetQuery withOffset(int offset)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied offset.

  Parameters:
    `offset` - the limit that should be used; may not be negative
  Returns:
    the copy of the query that uses the supplied offset; never null

### adding

    public SetQuery adding(Ordering... orderings)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.