use of javax.jcr.query.qom.UpperCase in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testUpperCase.
/**
* Test case for {@link QueryObjectModelFactory#upperCase(DynamicOperand)}
*/
public void testUpperCase() throws RepositoryException {
PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
UpperCase upper = qf.upperCase(propValue);
assertTrue("Not a property value operand", upper.getOperand() instanceof PropertyValue);
}
use of javax.jcr.query.qom.UpperCase in project jackrabbit-oak by apache.
the class QomTest method upperCase.
@Test
public void upperCase() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Length length = f.length(p);
UpperCase u = f.upperCase(length);
assertEquals(length, u.getOperand());
assertEquals("UPPER(LENGTH([selectorName].[propertyName]))", u.toString());
}
use of javax.jcr.query.qom.UpperCase 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);
}
}
Aggregations