protected DynamicOperand createOrderingOperand() throws RepositoryException { return qf.length(qf.propertyValue("s", propertyName1)); }
public void testLength() throws RepositoryException { String lenStr = String.valueOf(node.getProperty(propertyName1).getLength()); // upper case checkQueries(qf.length(qf.propertyValue("s", propertyName1)), true, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, new String[]{lenStr.toUpperCase()}, PropertyType.STRING, new boolean[]{true}); // lower case checkQueries(qf.length(qf.propertyValue("s", propertyName1)), false, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, new String[]{lenStr.toLowerCase()}, PropertyType.STRING, new boolean[]{true}); }
/** * Test case for {@link QueryObjectModelFactory#length(PropertyValue)} */ public void testLength() throws RepositoryException { PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1); Length len = qf.length(propValue); assertNotNull("Property value must not be null", len.getPropertyValue()); }
@Test public void length() throws RepositoryException { PropertyValue p = f.propertyValue("selectorName", "propertyName"); Length l = f.length(p); assertEquals(p, l.getPropertyValue()); assertEquals("LENGTH([selectorName].[propertyName])", l.toString()); }
@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()); }
@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()); }
private DynamicOperand parseExpressionFunction(String functionName) throws RepositoryException { DynamicOperand op; if ("LENGTH".equalsIgnoreCase(functionName)) { op = factory.length(parsePropertyValue(readName())); } else if ("NAME".equalsIgnoreCase(functionName)) { if (isToken(")")) {
private DynamicOperand parseExpressionFunction(String functionName) throws RepositoryException { DynamicOperand op; if ("LENGTH".equalsIgnoreCase(functionName)) { op = factory.length(parsePropertyValue(readName())); } else if ("NAME".equalsIgnoreCase(functionName)) { if (isToken(")")) {
private DynamicOperand parseExpressionFunction(String functionName) throws RepositoryException { DynamicOperand op; if ("LENGTH".equalsIgnoreCase(functionName)) { op = factory.length(parsePropertyValue(readName())); } else if ("NAME".equalsIgnoreCase(functionName)) { if (isToken(")")) {
private QueryResult[] executeQueries(String propertyName, String operator, Value length) throws RepositoryException { QueryObjectModel qom = qf.createQuery( qf.selector(testNodeType, "s"), qf.and( qf.childNode("s", testRoot), qf.comparison( qf.length( qf.propertyValue( "s", propertyName)), operator, qf.literal(length)) ), null, null); QueryResult[] results = new QueryResult[2]; results[0] = qom.execute(); results[1] = qm.createQuery(qom.getStatement(), Query.JCR_SQL2).execute(); return results; } }