protected static String toString( StaticOperand operand ) throws RepositoryException { if (operand instanceof javax.jcr.query.qom.Literal) { return ((javax.jcr.query.qom.Literal)operand).getLiteralValue().getString(); } return operand.toString(); }
protected static String toString( StaticOperand operand ) throws RepositoryException { if (operand instanceof javax.jcr.query.qom.Literal) { return ((javax.jcr.query.qom.Literal)operand).getLiteralValue().getString(); } return operand.toString(); }
/** * Test case for {@link QueryObjectModelFactory#literal(Value)} */ public void testLiteral() throws RepositoryException { Value v = superuser.getValueFactory().createValue("test"); Literal literal = qf.literal(v); assertEquals("Wrong literal value", v.getString(), literal.getLiteralValue().getString()); }
/** * Returns the value of the given static operand * ({@link Literal literal} or {@link BindVariableValue bind variable}). * * @param operand static operand to be evaluated * @return evaluated value * @throws RepositoryException if a named bind variable is not found, * or if the operand type is unknown */ public Value getValue(StaticOperand operand) throws RepositoryException { if (operand instanceof Literal) { Literal literal = (Literal) operand; return literal.getLiteralValue(); } else if (operand instanceof BindVariableValue) { BindVariableValue bvv = (BindVariableValue) operand; Value value = variables.get(bvv.getBindVariableName()); if (value != null) { return value; } else { throw new RepositoryException( "Unknown bind variable: " + bvv.getBindVariableName()); } } else { throw new UnsupportedRepositoryOperationException( "Unknown static operand type: " + operand); } }
/** * Returns the value of the given static operand * ({@link Literal literal} or {@link BindVariableValue bind variable}). * * @param operand static operand to be evaluated * @return evaluated value * @throws RepositoryException if a named bind variable is not found, * or if the operand type is unknown */ public Value getValue(StaticOperand operand) throws RepositoryException { if (operand instanceof Literal) { Literal literal = (Literal) operand; return literal.getLiteralValue(); } else if (operand instanceof BindVariableValue) { BindVariableValue bvv = (BindVariableValue) operand; Value value = variables.get(bvv.getBindVariableName()); if (value != null) { return value; } else { throw new RepositoryException( "Unknown bind variable: " + bvv.getBindVariableName()); } } else { throw new UnsupportedRepositoryOperationException( "Unknown static operand type: " + operand); } }
/** * Returns the value of the given static operand * ({@link Literal literal} or {@link BindVariableValue bind variable}). * * @param operand static operand to be evaluated * @return evaluated value * @throws RepositoryException if a named bind variable is not found, * or if the operand type is unknown */ public Value getValue(StaticOperand operand) throws RepositoryException { if (operand instanceof Literal) { Literal literal = (Literal) operand; return literal.getLiteralValue(); } else if (operand instanceof BindVariableValue) { BindVariableValue bvv = (BindVariableValue) operand; Value value = variables.get(bvv.getBindVariableName()); if (value != null) { return value; } else { throw new RepositoryException( "Unknown bind variable: " + bvv.getBindVariableName()); } } else { throw new UnsupportedRepositoryOperationException( "Unknown static operand type: " + operand); } }
private void append(Literal value) throws RepositoryException { Value v = value.getLiteralValue(); switch (v.getType()) { case PropertyType.BINARY:
private void append(Literal value) throws RepositoryException { Value v = value.getLiteralValue(); switch (v.getType()) { case PropertyType.BINARY:
private void append(Literal value) throws RepositoryException { Value v = value.getLiteralValue(); switch (v.getType()) { case PropertyType.BINARY:
/** * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)} */ public void testFullTextSearch() throws RepositoryException { FullTextSearch ftSearch = qf.fullTextSearch( SELECTOR_NAME1, propertyName1, qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR))); assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName()); assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName()); StaticOperand op = ftSearch.getFullTextSearchExpression(); assertNotNull(op); assertTrue("not a Literal", op instanceof Literal); Literal literal = (Literal) op; assertEquals(FULLTEXT_SEARCH_EXPR, literal.getLiteralValue().getString()); }
dynamicOperandValues[0] = ((Literal) operand1).getLiteralValue(); } else if (operand1 instanceof BindVariableValue) { dynamicOperandValues[0] = valueFactory.createValue(((BindVariableValue) operand1).getBindVariableName()); scalarOperandValue = ((Literal) operand2).getLiteralValue(); } else if (operand2 instanceof BindVariableValue) { scalarOperandValue = valueFactory.createValue(((BindVariableValue) operand2).getBindVariableName());
@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()); }
Value value = literal.getLiteralValue(); try { String str = value.getString(); ((Literal)rhs).getLiteralValue().getLong(); } catch (javax.jcr.RepositoryException e) {
Value value = literal.getLiteralValue(); try { String str = value.getString(); ((Literal)rhs).getLiteralValue().getLong(); } catch (javax.jcr.RepositoryException e) {
Value value = literal.getLiteralValue(); read("AS"); value = parseCastAs(value);
Value value = literal.getLiteralValue(); read("AS"); value = parseCastAs(value);
Value value = literal.getLiteralValue(); read("AS"); value = parseCastAs(value);