private boolean isPrimaryTypeConstraint( DynamicOperand operand ) { if (operand instanceof PropertyValue) { PropertyValue propValue = (PropertyValue)operand; if (propValue.getSelectorName().equals(selectorName.getString())) { // The property value matches our selector name, so this might be a constraint on the // primary type or mixin types. If so, then the selector name is an alias ... String propName = propValue.getPropertyName(); return "jcr:primaryType".equals(propName) || "jcr:mixinTypes".equals(propName); } } return false; }
private boolean isPrimaryTypeConstraint( DynamicOperand operand ) { if (operand instanceof PropertyValue) { PropertyValue propValue = (PropertyValue)operand; if (propValue.getSelectorName().equals(selectorName.getString())) { // The property value matches our selector name, so this might be a constraint on the // primary type or mixin types. If so, then the selector name is an alias ... String propName = propValue.getPropertyName(); return "jcr:primaryType".equals(propName) || "jcr:mixinTypes".equals(propName); } } return false; }
private PropertyExistence getPropertyExistence(PropertyValue p) throws InvalidQueryException, RepositoryException { return factory.propertyExistence(p.getSelectorName(), p.getPropertyName()); }
private PropertyExistence getPropertyExistence(PropertyValue p) throws InvalidQueryException, RepositoryException { return factory.propertyExistence(p.getSelectorName(), p.getPropertyName()); }
/** * Returns the identified property from the given row. This method * is used by both the {@link #getValue(Length, Row)} and the * {@link #getValue(PropertyValue, Row)} methods to access properties. * * @param operand property value operand * @param row row * @return the identified property, * or <code>null</code> if the property does not exist * @throws RepositoryException if the property can't be accessed */ private Property getProperty(PropertyValue operand, Row row) throws RepositoryException { return getProperty(operand, row.getNode(operand.getSelectorName())); }
public EquiJoinMerger( Join join, Map<String, PropertyValue> columns, OperandEvaluator evaluator, QueryObjectModelFactory factory, EquiJoinCondition condition) throws RepositoryException { super(join, columns, evaluator, factory); PropertyValue property1 = factory.propertyValue( condition.getSelector1Name(), condition.getProperty1Name()); PropertyValue property2 = factory.propertyValue( condition.getSelector2Name(), condition.getProperty2Name()); if (leftSelectors.contains(property1.getSelectorName()) && rightSelectors.contains(property2.getSelectorName())) { leftProperty = property1; rightProperty = property2; } else if (leftSelectors.contains(property2.getSelectorName()) && rightSelectors.contains(property1.getSelectorName())) { leftProperty = property2; rightProperty = property1; } else { throw new RepositoryException("Invalid equi-join"); } }
private PropertyExistence getPropertyExistence(PropertyValue p) throws InvalidQueryException, RepositoryException { return factory.propertyExistence(p.getSelectorName(), p.getPropertyName()); }
/** * Returns the identified property from the given row. This method * is used by both the {@link #getValue(Length, Row)} and the * {@link #getValue(PropertyValue, Row)} methods to access properties. * * @param operand property value operand * @param row row * @return the identified property, * or <code>null</code> if the property does not exist * @throws RepositoryException if the property can't be accessed */ private Property getProperty(PropertyValue operand, Row row) throws RepositoryException { return getProperty(operand, row.getNode(operand.getSelectorName())); }
public EquiJoinMerger( Join join, Map<String, PropertyValue> columns, OperandEvaluator evaluator, QueryObjectModelFactory factory, EquiJoinCondition condition) throws RepositoryException { super(join, columns, evaluator, factory); PropertyValue property1 = factory.propertyValue( condition.getSelector1Name(), condition.getProperty1Name()); PropertyValue property2 = factory.propertyValue( condition.getSelector2Name(), condition.getProperty2Name()); if (leftSelectors.contains(property1.getSelectorName()) && rightSelectors.contains(property2.getSelectorName())) { leftProperty = property1; rightProperty = property2; } else if (leftSelectors.contains(property2.getSelectorName()) && rightSelectors.contains(property1.getSelectorName())) { leftProperty = property2; rightProperty = property1; } else { throw new RepositoryException("Invalid equi-join"); } }
/** * Returns the identified property from the given row. This method * is used by both the {@link #getValue(Length, Row)} and the * {@link #getValue(PropertyValue, Row)} methods to access properties. * * @param operand property value operand * @param row row * @return the identified property, * or <code>null</code> if the property does not exist * @throws RepositoryException if the property can't be accessed */ private Property getProperty(PropertyValue operand, Row row) throws RepositoryException { return getProperty(operand, row.getNode(operand.getSelectorName())); }
private void append(PropertyValue operand) { appendName(operand.getSelectorName()); append("."); appendName(operand.getPropertyName()); }
/** * Test case for {@link QueryObjectModelFactory#propertyValue(String, String)} */ public void testPropertyValue() throws RepositoryException { PropertyValue propVal = qf.propertyValue(SELECTOR_NAME1, propertyName1); assertEquals("Wrong selector name", SELECTOR_NAME1, propVal.getSelectorName()); assertEquals("Wrong property name", propertyName1, propVal.getPropertyName()); }
private void append(PropertyValue operand) { appendName(operand.getSelectorName()); append("."); appendName(operand.getPropertyName()); }
private void append(PropertyValue operand) { appendName(operand.getSelectorName()); append("."); appendName(operand.getPropertyName()); }
/** * Test case for {@link QueryObjectModelFactory#propertyValue(String, String)} */ public void testPropertyValueWithSelector() throws RepositoryException { PropertyValue propVal = qf.propertyValue(SELECTOR_NAME1, propertyName1); assertEquals("Wrong selector name", SELECTOR_NAME1, propVal.getSelectorName()); assertEquals("Wrong property name", propertyName1, propVal.getPropertyName()); }
protected Query getComparisonQuery( DynamicOperand left, int transform, String operator, StaticOperand rigth, Map<String, NodeType> selectorMap) throws RepositoryException { if (left instanceof PropertyValue) { PropertyValue pv = (PropertyValue) left; String field = npResolver.getJCRName(session.getQName( pv.getPropertyName())); int type = PropertyType.UNDEFINED; NodeType nt = selectorMap.get(pv.getSelectorName()); if (nt != null) { for (PropertyDefinition pd : nt.getPropertyDefinitions()) { if (pd.getName().equals(pv.getPropertyName())) { type = pd.getRequiredType(); break; } } } return getPropertyValueQuery( field, operator, evaluator.getValue(rigth), type, transform); } else if (left instanceof NodeName) { return getNodeNameQuery(transform, operator, rigth); } else if (left instanceof NodeLocalName) { return getNodeLocalNameQuery(transform, operator, rigth); } else { throw new UnsupportedRepositoryOperationException( "Unknown operand type: " + left); // FIXME } }
@Test public void propertyValue() throws RepositoryException { PropertyValue pv = f.propertyValue("selectorName", "propertyName"); assertEquals("selectorName", pv.getSelectorName()); assertEquals("propertyName", pv.getPropertyName()); assertEquals("[selectorName].[propertyName]", pv.toString()); assertEquals("*", f.propertyValue(null, null).toString()); assertEquals("[s].*", f.propertyValue("s", null).toString()); assertEquals("[p]", f.propertyValue(null, "p").toString()); assertEquals("[s].[p]", f.propertyValue("s", "p").toString()); }
protected Query getComparisonQuery( DynamicOperand left, int transform, String operator, StaticOperand rigth, Map<String, NodeType> selectorMap) throws RepositoryException { if (left instanceof PropertyValue) { PropertyValue pv = (PropertyValue) left; String field = npResolver.getJCRName(session.getQName( pv.getPropertyName())); int type = PropertyType.UNDEFINED; NodeType nt = selectorMap.get(pv.getSelectorName()); if (nt != null) { for (PropertyDefinition pd : nt.getPropertyDefinitions()) { if (pd.getName().equals(pv.getPropertyName())) { type = pd.getRequiredType(); break; } } } return getPropertyValueQuery( field, operator, evaluator.getValue(rigth), type, transform); } else if (left instanceof NodeName) { return getNodeNameQuery(transform, operator, rigth); } else if (left instanceof NodeLocalName) { return getNodeLocalNameQuery(transform, operator, rigth); } else { throw new UnsupportedRepositoryOperationException( "Unknown operand type: " + left); // FIXME } }
} else if (operand instanceof PropertyValue) { PropertyValue value = (PropertyValue) operand; return value.getSelectorName(); } else if (operand instanceof UpperCase) { UpperCase upper = (UpperCase) operand;
} else if (operand instanceof PropertyValue) { PropertyValue value = (PropertyValue) operand; return value.getSelectorName(); } else if (operand instanceof UpperCase) { UpperCase upper = (UpperCase) operand;