Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.Literal


        } else if (operand instanceof NodeName) {
            // Verify that the rhs is convertable to a name ...
            if (rhs instanceof Literal) {
                boolean fail = false;
                // The literal value must be a NAME or URI ...
                Literal literal = (Literal)rhs;
                Value value = literal.getLiteralValue();
                try {
                    String str = value.getString();
                    switch (value.getType()) {
                        case PropertyType.PATH:
                            Path path = context.getExecutionContext().getValueFactories().getPathFactory().create(str);
View Full Code Here


    }

    @Test
    public void comparison() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Literal l = f.literal(vf.createValue(1));
        Comparison c = f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, l);
        assertEquals(p, c.getOperand1());
        assertEquals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, c.getOperator());
        assertEquals(l, c.getOperand2());
        assertEquals("[selectorName].[propertyName] = 1", c.toString());
View Full Code Here

    }

    @Test
    public void literal() throws RepositoryException {
        Value v = vf.createValue(1);
        Literal l = f.literal(v);
        assertEquals(v, l.getLiteralValue());
        assertEquals("1", l.toString());
        assertEquals("'Joe''s'", f.literal(vf.createValue("Joe's")).toString());
        assertEquals("' - \" - '", f.literal(vf.createValue(" - \" - ")).toString());
    }
View Full Code Here

    }

    @Test
    public void comparison() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Literal l = f.literal(vf.createValue(1));
        Comparison c = f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, l);
        assertEquals(p, c.getOperand1());
        assertEquals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, c.getOperator());
        assertEquals(l, c.getOperand2());
        assertEquals("[selectorName].[propertyName] = 1", c.toString());
View Full Code Here

                e.toString());
    }

    @Test
    public void fullTextSearch() throws RepositoryException {
        Literal l = f.literal(vf.createValue(1));
        FullTextSearch x = f.fullTextSearch("selectorName", "propertyName", l);
        assertEquals("selectorName", x.getSelectorName());
        assertEquals("propertyName", x.getPropertyName());
        assertEquals(l, x.getFullTextSearchExpression());
        assertEquals("CONTAINS([selectorName].[propertyName], 1)", x.toString());
View Full Code Here

    }

    @Test
    public void literal() throws RepositoryException {
        Value v = vf.createValue(1);
        Literal l = f.literal(v);
        assertEquals(v, l.getLiteralValue());
        assertEquals("1", l.toString());
        assertEquals("'Joe''s'", f.literal(vf.createValue("Joe's")).toString());
        assertEquals("' - \" - '", f.literal(vf.createValue(" - \" - ")).toString());
    }
View Full Code Here

    }

    @Test
    public void comparison() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Literal l = f.literal(vf.createValue(1));
        Comparison c = f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, l);
        assertEquals(p, c.getOperand1());
        assertEquals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, c.getOperator());
        assertEquals(l, c.getOperand2());
    }
View Full Code Here

        assertEquals("property2Name", e.getProperty2Name());
    }

    @Test
    public void fullTextSearch() throws RepositoryException {
        Literal l = f.literal(vf.createValue(1));
        FullTextSearch x = f.fullTextSearch("selectorName", "propertyName", l);
        assertEquals("selectorName", x.getSelectorName());
        assertEquals("propertyName", x.getPropertyName());
        assertEquals(l, x.getFullTextSearchExpression());
    }
View Full Code Here

    }

    @Test
    public void literal() throws RepositoryException {
        Value v = vf.createValue(1);
        Literal l = f.literal(v);
        assertEquals(v, l.getLiteralValue());
    }
View Full Code Here

TOP

Related Classes of javax.jcr.query.qom.Literal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.