@Override public String apply(Length op, Map<String, Object> variables) { return EsIndexColumn.LENGTH_PREFIX + op.getPropertyValue().getPropertyName(); } };
protected Length length( PropertyValue propertyValue ) { return new Length(propertyValue); }
@Override public void visit( Length length ) { symbols.add(length.selectorName()); }
PropertyValue wrapped = operation.getPropertyValue(); SelectorName replacement = rewrittenSelectors.get(wrapped.selectorName()); if (replacement == null) return operand; return new Length(new PropertyValue(replacement, wrapped.getPropertyName()));
@Test public void shouldParseDynamicOperandFromStringContainingLengthOfPropertyValue() { DynamicOperand operand = parser.parseDynamicOperand(tokens("LENGTH(tableA.property)"), typeSystem, mock(Source.class)); assertThat(operand, is(instanceOf(Length.class))); Length length = (Length)operand; assertThat(length.getPropertyValue().getPropertyName(), is("property")); assertThat(length.getPropertyValue().selectorName(), is(selectorName("tableA"))); assertThat(length.selectorName(), is(selectorName("tableA"))); Source source = new NamedSelector(selectorName("tableA")); operand = parser.parseDynamicOperand(tokens("LENGTH(property)"), typeSystem, source); assertThat(operand, is(instanceOf(Length.class))); length = (Length)operand; assertThat(length.getPropertyValue().getPropertyName(), is("property")); assertThat(length.getPropertyValue().selectorName(), is(selectorName("tableA"))); assertThat(length.selectorName(), is(selectorName("tableA"))); }
/** * Get the selector symbol upon which this operand applies. * * @return the one selector names used by this operand; never null */ public SelectorName selectorName() { return selectorNames().iterator().next(); }
PropertyValue wrapped = operation.getPropertyValue(); SelectorName replacement = rewrittenSelectors.get(wrapped.selectorName()); if (replacement == null) return operand; return new Length(new PropertyValue(replacement, wrapped.getPropertyName()));
/** * Get the selector symbol upon which this operand applies. * * @return the one selector names used by this operand; never null */ public SelectorName selectorName() { return selectorNames().iterator().next(); }
PropertyValue value = operation.getPropertyValue(); PropertyValue newValue = replaceAliasesWithProperties(context, value, propertyByAlias); if (newValue == value) return operation; return new Length(newValue);
@Override public int hashCode() { return getPropertyValue().hashCode(); }
protected Length length( PropertyValue propertyValue ) { return new Length(propertyValue); }
@Override public void visit( Length length ) { symbols.add(length.selectorName()); }
PropertyValue value = operation.getPropertyValue(); PropertyValue newValue = replaceAliasesWithProperties(context, value, propertyByAlias); if (newValue == value) return operation; return new Length(newValue);
@Override public int hashCode() { return getPropertyValue().hashCode(); }
@Override public Length length( javax.jcr.query.qom.PropertyValue propertyValue ) { PropertyValue jcrPropValue = CheckArg.getInstanceOf(propertyValue, PropertyValue.class, "propertyValue"); return new Length(jcrPropValue); }
@Override public void visit( Length obj ) { verify(obj.selectorName()); }
return new Length((PropertyValue)replaceViewReferences(context, operation.getPropertyValue(), mapping, node));
protected boolean applies( Length operand ) { return applies(operand.getPropertyValue()); }
@Override public Length length( javax.jcr.query.qom.PropertyValue propertyValue ) { PropertyValue jcrPropValue = CheckArg.getInstanceOf(propertyValue, PropertyValue.class, "propertyValue"); return new Length(jcrPropValue); }
@Override public void visit( Length obj ) { verify(obj.selectorName()); }