use of javax.jcr.query.qom.LowerCase in project jackrabbit-oak by apache.
the class QomTest method lowerCase.
@Test
public void lowerCase() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Length length = f.length(p);
LowerCase l = f.lowerCase(length);
assertEquals(length, l.getOperand());
assertEquals("LOWER(LENGTH([selectorName].[propertyName]))", l.toString());
}
use of javax.jcr.query.qom.LowerCase in project jackrabbit by apache.
the class OperandEvaluator method getValues.
/**
* Evaluates the given operand in the context of the given row.
*
* @param operand operand to be evaluated
* @param row query result row
* @return values of the operand at the given row
* @throws RepositoryException if the operand can't be evaluated
*/
public Value[] getValues(Operand operand, Row row) throws RepositoryException {
if (operand instanceof StaticOperand) {
StaticOperand so = (StaticOperand) operand;
return new Value[] { getValue(so) };
} else if (operand instanceof FullTextSearchScore) {
FullTextSearchScore ftss = (FullTextSearchScore) operand;
double score = row.getScore(ftss.getSelectorName());
return new Value[] { factory.createValue(score) };
} else if (operand instanceof NodeName) {
NodeName nn = (NodeName) operand;
String name = row.getNode(nn.getSelectorName()).getName();
// root node
if ("".equals(name)) {
return new Value[] { factory.createValue(name, PropertyType.STRING) };
}
return new Value[] { factory.createValue(name, PropertyType.NAME) };
} else if (operand instanceof Length) {
return getLengthValues((Length) operand, row);
} else if (operand instanceof LowerCase) {
return getLowerCaseValues((LowerCase) operand, row);
} else if (operand instanceof UpperCase) {
return getUpperCaseValues((UpperCase) operand, row);
} else if (operand instanceof NodeLocalName) {
return getNodeLocalNameValues((NodeLocalName) operand, row);
} else if (operand instanceof PropertyValue) {
return getPropertyValues((PropertyValue) operand, row);
} else {
throw new UnsupportedRepositoryOperationException("Unknown operand type: " + operand);
}
}
use of javax.jcr.query.qom.LowerCase in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testLowerCase.
/**
* Test case for {@link QueryObjectModelFactory#lowerCase(DynamicOperand)}
*/
public void testLowerCase() throws RepositoryException {
PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
LowerCase lower = qf.lowerCase(propValue);
assertTrue("Not a property value operand", lower.getOperand() instanceof PropertyValue);
}
Aggregations