Search in sources :

Example 41 with QueryObjectModel

use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.

the class NodeLocalNameTest method testDoubleLiteral.

public void testDoubleLiteral() throws RepositoryException {
    Value literal = superuser.getValueFactory().createValue(Math.PI);
    QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
    checkQOM(qom, new Node[] {});
}
Also used : Value(javax.jcr.Value) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel)

Example 42 with QueryObjectModel

use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.

the class NodeLocalNameTest method testBinaryLiteral.

public void testBinaryLiteral() throws RepositoryException {
    Value literal = superuser.getValueFactory().createValue(nodeLocalName, PropertyType.BINARY);
    QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
    checkQOM(qom, new Node[] { node1 });
}
Also used : Value(javax.jcr.Value) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel)

Example 43 with QueryObjectModel

use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryWithConstraintOrderingAndColumn.

public void testCreateQueryWithConstraintOrderingAndColumn() throws RepositoryException {
    Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
    PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
    PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
    Ordering ordering = qf.ascending(propValue);
    Column column = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
    QueryObjectModel qom = qf.createQuery(selector, propExist, new Ordering[] { ordering }, new Column[] { column });
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
    assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 1, qom.getColumns().length);
}
Also used : Column(javax.jcr.query.qom.Column) Ordering(javax.jcr.query.qom.Ordering) PropertyValue(javax.jcr.query.qom.PropertyValue) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) PropertyExistence(javax.jcr.query.qom.PropertyExistence) Selector(javax.jcr.query.qom.Selector)

Example 44 with QueryObjectModel

use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryFromSource.

public void testCreateQueryFromSource() throws RepositoryException {
    Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
    QueryObjectModel qom = qf.createQuery(selector, null, null, null);
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertNull("Constraint must be null", qom.getConstraint());
    assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
Also used : QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) Source(javax.jcr.query.qom.Source) Selector(javax.jcr.query.qom.Selector)

Example 45 with QueryObjectModel

use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryFromSourceWithConstraint.

public void testCreateQueryFromSourceWithConstraint() throws RepositoryException {
    Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
    PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
    QueryObjectModel qom = qf.createQuery(selector, propExist, null, null);
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
    assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
Also used : QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) PropertyExistence(javax.jcr.query.qom.PropertyExistence) Source(javax.jcr.query.qom.Source) Selector(javax.jcr.query.qom.Selector)

Aggregations

QueryObjectModel (javax.jcr.query.qom.QueryObjectModel)77 Value (javax.jcr.Value)17 Node (javax.jcr.Node)16 JoinCondition (javax.jcr.query.qom.JoinCondition)13 Selector (javax.jcr.query.qom.Selector)9 RepositoryException (javax.jcr.RepositoryException)7 Query (javax.jcr.query.Query)7 Source (javax.jcr.query.qom.Source)7 Column (javax.jcr.query.qom.Column)6 Ordering (javax.jcr.query.qom.Ordering)6 PropertyExistence (javax.jcr.query.qom.PropertyExistence)6 RowIterator (javax.jcr.query.RowIterator)5 PropertyValue (javax.jcr.query.qom.PropertyValue)5 ArrayList (java.util.ArrayList)4 NodeType (javax.jcr.nodetype.NodeType)4 NodeTypeManager (javax.jcr.nodetype.NodeTypeManager)4 InvalidQueryException (javax.jcr.query.InvalidQueryException)4 QueryResult (javax.jcr.query.QueryResult)4 Constraint (javax.jcr.query.qom.Constraint)4 NodeTypeIterator (javax.jcr.nodetype.NodeTypeIterator)3