@Test public void shouldParseSelectStarFromEquijoinAndAdditionalCriteria() { query = parse("SELECT * FROM [modetest:queryable] JOIN [mix:referenceable] ON ISSAMENODE([modetest:queryable],[mix:referenceable]) WHERE PATH([modetest:queryable]) LIKE '/testroot/someQueryableNodeD/%'"); assertThat(query.columns().isEmpty(), is(true)); Join join = isJoin(query.source()); assertThat(join.getLeft(), is((Source)namedSelector(selectorName("modetest:queryable")))); assertThat(join.getRight(), is((Source)namedSelector(selectorName("mix:referenceable")))); assertThat(join.type(), is(JoinType.INNER)); SameNodeJoinCondition joinCondition = isSameNodeJoinCondition(join.getJoinCondition()); assertThat(joinCondition.selector1Name(), is(selectorName("modetest:queryable"))); assertThat(joinCondition.selector2Name(), is(selectorName("mix:referenceable"))); assertThat(joinCondition.getSelector2Path(), is(nullValue())); Comparison comparison = isComparison(query.constraint()); assertThat(comparison.getOperand1(), is((DynamicOperand)nodePath(selectorName("modetest:queryable")))); assertThat(comparison.getOperand2(), is((StaticOperand)literal("/testroot/someQueryableNodeD/%"))); }
@Override protected LiteralValue literal( TypeSystem typeSystem, Object value ) throws ValueFormatException { JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory(); Value jcrValue = null; if (value instanceof String) { jcrValue = factory.createValue((String)value); } else if (value instanceof Boolean) { jcrValue = factory.createValue(((Boolean)value).booleanValue()); } else if (value instanceof Binary) { jcrValue = factory.createValue((Binary)value); } else if (value instanceof DateTime) { jcrValue = factory.createValue(((DateTime)value).toCalendar()); } else if (value instanceof Calendar) { jcrValue = factory.createValue((Calendar)value); } else if (value instanceof BigDecimal) { jcrValue = factory.createValue((BigDecimal)value); } else if (value instanceof Double) { jcrValue = factory.createValue((Double)value); } else if (value instanceof Long) { jcrValue = factory.createValue((Long)value); } else if (value instanceof Reference) { jcrValue = factory.createValue((Reference)value); } else if (value instanceof URI) { jcrValue = factory.createValue((URI)value); } else if (value instanceof InputStream) { Binary binary = factory.createBinary((InputStream)value); jcrValue = factory.createValue(binary); } else if (value instanceof Name || value instanceof Path) { String strValue = typeSystem.getStringFactory().create(value); jcrValue = factory.createValue(strValue); } else if (value instanceof Node) { try { jcrValue = factory.createValue((Node)value); } catch (RepositoryException e) { throw new ValueFormatException(value, PropertyType.REFERENCE, GraphI18n.errorConvertingType.text(Node.class.getSimpleName(), Reference.class.getSimpleName(), value), e); } } else { jcrValue = factory.createValue(value.toString()); } return new LiteralValue(jcrValue, value); }
JcrSql2QueryParser extends BasicSqlQueryParser { @Override protected LiteralValue literal( TypeSystem typeSystem, Object value ) throws ValueFormatException { JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory(); Value jcrValue = null; if (value instanceof String) { jcrValue = factory.createValue((String)value); } else if (value instanceof Boolean) { jcrValue = factory.createValue(((Boolean)value).booleanValue()); } else if (value instanceof Binary) { jcrValue = factory.createValue((Binary)value); } else if (value instanceof DateTime) { jcrValue = factory.createValue(((DateTime)value).toCalendar()); } else if (value instanceof Calendar) { jcrValue = factory.createValue((Calendar)value); } else if (value instanceof BigDecimal) { jcrValue = factory.createValue((BigDecimal)value); } else if (value instanceof Double) { jcrValue = factory.createValue((Double)value); } else if (value instanceof Long) { jcrValue = factory.createValue((Long)value); } else if (value instanceof Reference) { jcrValue = factory.createValue((Reference)value); } else if (value instanceof URI) { jcrValue = factory.createValue((URI)value); } else if (value instanceof InputStream) { Binary binary = factory.createBinary((InputStream)value); jcrValue = factory.createValue(binary); } else if (value instanceof Name || value instanceof Path) { String strValue = typeSystem.getStringFactory().create(value); jcrValue = factory.createValue(strValue); } else if (value instanceof Node) { try { jcrValue = factory.createValue((Node)value); } catch (RepositoryException e) { throw new ValueFormatException(value, PropertyType.REFERENCE, GraphI18n.errorConvertingType.text(Node.class.getSimpleName(), Reference.class.getSimpleName(), value), e); } } else { jcrValue = factory.createValue(value.toString()); } return new LiteralValue(jcrValue, value); } }
JcrSql2QueryParser extends BasicSqlQueryParser { @Override protected LiteralValue literal( TypeSystem typeSystem, Object value ) throws ValueFormatException { JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory(); Value jcrValue = null; if (value instanceof String) { jcrValue = factory.createValue((String)value); } else if (value instanceof Boolean) { jcrValue = factory.createValue(((Boolean)value).booleanValue()); } else if (value instanceof Binary) { jcrValue = factory.createValue((Binary)value); } else if (value instanceof DateTime) { jcrValue = factory.createValue(((DateTime)value).toCalendar()); } else if (value instanceof Calendar) { jcrValue = factory.createValue((Calendar)value); } else if (value instanceof BigDecimal) { jcrValue = factory.createValue((BigDecimal)value); } else if (value instanceof Double) { jcrValue = factory.createValue((Double)value); } else if (value instanceof Long) { jcrValue = factory.createValue((Long)value); } else if (value instanceof Reference) { jcrValue = factory.createValue((Reference)value); } else if (value instanceof URI) { jcrValue = factory.createValue((URI)value); } else if (value instanceof InputStream) { Binary binary = factory.createBinary((InputStream)value); jcrValue = factory.createValue(binary); } else if (value instanceof Name || value instanceof Path) { String strValue = typeSystem.getStringFactory().create(value); jcrValue = factory.createValue(strValue); } else if (value instanceof Node) { try { jcrValue = factory.createValue((Node)value); } catch (RepositoryException e) { throw new ValueFormatException(value, PropertyType.REFERENCE, GraphI18n.errorConvertingType.text(Node.class.getSimpleName(), Reference.class.getSimpleName(), value), e); } } else { jcrValue = factory.createValue(value.toString()); } return new LiteralValue(jcrValue, value); }  }
JcrSql2QueryParser extends BasicSqlQueryParser { @Override protected LiteralValue literal( TypeSystem typeSystem, Object value ) throws ValueFormatException { JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory(); Value jcrValue = null; if (value instanceof String) { jcrValue = factory.createValue((String)value); } else if (value instanceof Boolean) { jcrValue = factory.createValue(((Boolean)value).booleanValue()); } else if (value instanceof Binary) { jcrValue = factory.createValue((Binary)value); } else if (value instanceof DateTime) { jcrValue = factory.createValue(((DateTime)value).toCalendar()); } else if (value instanceof Calendar) { jcrValue = factory.createValue((Calendar)value); } else if (value instanceof BigDecimal) { jcrValue = factory.createValue((BigDecimal)value); } else if (value instanceof Double) { jcrValue = factory.createValue((Double)value); } else if (value instanceof Long) { jcrValue = factory.createValue((Long)value); } else if (value instanceof Reference) { jcrValue = factory.createValue((Reference)value); } else if (value instanceof URI) { jcrValue = factory.createValue((URI)value); } else if (value instanceof InputStream) { Binary binary = factory.createBinary((InputStream)value); jcrValue = factory.createValue(binary); } else if (value instanceof Name || value instanceof Path) { String strValue = typeSystem.getStringFactory().create(value); jcrValue = factory.createValue(strValue); } else if (value instanceof Node) { try { jcrValue = factory.createValue((Node)value); } catch (RepositoryException e) { throw new ValueFormatException(value, PropertyType.REFERENCE, GraphI18n.errorConvertingType.text(Node.class.getSimpleName(), Reference.class.getSimpleName(), value), e); } } else { jcrValue = factory.createValue(value.toString()); } return new LiteralValue(jcrValue, value); }  @Override String getLanguage(); }
JcrSql2QueryParser extends BasicSqlQueryParser { @Override protected LiteralValue literal( TypeSystem typeSystem, Object value ) throws ValueFormatException { JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory(); Value jcrValue = null; if (value instanceof String) { jcrValue = factory.createValue((String)value); } else if (value instanceof Boolean) { jcrValue = factory.createValue(((Boolean)value).booleanValue()); } else if (value instanceof Binary) { jcrValue = factory.createValue((Binary)value); } else if (value instanceof DateTime) { jcrValue = factory.createValue(((DateTime)value).toCalendar()); } else if (value instanceof Calendar) { jcrValue = factory.createValue((Calendar)value); } else if (value instanceof BigDecimal) { jcrValue = factory.createValue((BigDecimal)value); } else if (value instanceof Double) { jcrValue = factory.createValue((Double)value); } else if (value instanceof Long) { jcrValue = factory.createValue((Long)value); } else if (value instanceof Reference) { jcrValue = factory.createValue((Reference)value); } else if (value instanceof URI) { jcrValue = factory.createValue((URI)value); } else if (value instanceof InputStream) { Binary binary = factory.createBinary((InputStream)value); jcrValue = factory.createValue(binary); } else if (value instanceof Name || value instanceof Path) { String strValue = typeSystem.getStringFactory().create(value); jcrValue = factory.createValue(strValue); } else if (value instanceof Node) { try { jcrValue = factory.createValue((Node)value); } catch (RepositoryException e) { throw new ValueFormatException(value, PropertyType.REFERENCE, GraphI18n.errorConvertingType.text(Node.class.getSimpleName(), Reference.class.getSimpleName(), value), e); } } else { jcrValue = factory.createValue(value.toString()); } return new LiteralValue(jcrValue, value); }  @Override String getLanguage(); static final String LANGUAGE; }