Search in sources :

Example 31 with QueryObjectModel

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

the class NodeLocalNameTest method testDateLiteral.

public void testDateLiteral() throws RepositoryException {
    Value literal = superuser.getValueFactory().createValue(Calendar.getInstance());
    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 32 with QueryObjectModel

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

the class NodeLocalNameTest method testBooleanLiteral.

public void testBooleanLiteral() throws RepositoryException {
    Value literal = superuser.getValueFactory().createValue(true);
    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 33 with QueryObjectModel

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

the class NodeLocalNameTest method testReferenceLiteral.

public void testReferenceLiteral() throws RepositoryException, NotExecutableException {
    ensureMixinType(node1, mixReferenceable);
    superuser.save();
    Value literal = superuser.getValueFactory().createValue(node1);
    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 34 with QueryObjectModel

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

the class NodeLocalNameTest method checkOperatorSingleLiteral.

private void checkOperatorSingleLiteral(String literal, String operator, boolean matches) throws RepositoryException {
    Value value = superuser.getValueFactory().createValue(literal);
    QueryObjectModel qom = createQuery(operator, value);
    checkQOM(qom, matches ? new Node[] { node1 } : new Node[0]);
}
Also used : Node(javax.jcr.Node) Value(javax.jcr.Value) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel)

Example 35 with QueryObjectModel

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

the class SQL2PathEscapingTest method testGetChildrenApiDirect.

/**
     * will build a query directly via the api using a spaced path
     * 
     * @throws Exception
     */
public void testGetChildrenApiDirect() throws Exception {
    QueryObjectModelFactory qomf = qm.getQOMFactory();
    Source source1 = qomf.selector(NodeType.NT_BASE, "selector");
    Column[] columns = new Column[] { qomf.column("selector", null, null) };
    Constraint constraint2 = qomf.childNode("selector", n1.getPath());
    QueryObjectModel qom = qomf.createQuery(source1, constraint2, null, columns);
    checkResult(qom.execute(), 2);
}
Also used : Column(javax.jcr.query.qom.Column) Constraint(javax.jcr.query.qom.Constraint) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) QueryObjectModelFactory(javax.jcr.query.qom.QueryObjectModelFactory) Source(javax.jcr.query.qom.Source)

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