private void parseSingleNavigationExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.SLASH)) { final TokenKind tokenKind = ParserHelper.next(tokenizer, TokenKind.QualifiedName, TokenKind.ODataIdentifier); parseMemberExpression(tokenKind, uriInfo, lastResource, true); } }
protected static void requireNext(UriTokenizer tokenizer, final TokenKind required) throws UriParserException { if (!tokenizer.next(required)) { throw new UriParserSyntaxException("Expected token '" + required.toString() + "' not found.", UriParserSyntaxException.MessageKeys.SYNTAX); } }
private void checkOptionEOF(UriTokenizer tokenizer, final String optionName, final String optionValue) throws UriParserException { if (!tokenizer.next(TokenKind.EOF)) { throw new UriParserSyntaxException("Illegal value of '" + optionName + "' option!", UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION, optionName, optionValue); } } }
private void parseComplexPathRestExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.QualifiedName)) { final FullQualifiedName fullQualifiedName = new FullQualifiedName(tokenizer.getText()); // Must be a bound function. parseBoundFunction(fullQualifiedName, uriInfo, lastResource); } else if (tokenizer.next(TokenKind.ODataIdentifier)) { parsePropertyPathExpr(uriInfo, lastResource); } else { throw new UriParserSyntaxException("Unexpected token.", UriParserSyntaxException.MessageKeys.SYNTAX); } }
private void parseSinglePathExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.SLASH)) { ParserHelper.requireNext(tokenizer, TokenKind.QualifiedName); parseBoundFunction(new FullQualifiedName(tokenizer.getText()), uriInfo, lastResource); } }
private GroupBy parseGroupByTrafo(final EdmStructuredType referencedType) throws UriParserException, UriValidationException { GroupByImpl groupBy = new GroupByImpl(); parseGroupByList(groupBy, referencedType); if (tokenizer.next(TokenKind.COMMA)) { groupBy.setApplyOption(parseApply(referencedType)); } ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); return groupBy; }
private boolean nextGeoPolygon(final boolean isGeography) { return nextGeoPrefix(isGeography) && nextCharacter('\'') && nextSrid() && nextCharacter(';') && nextPolygon() && nextCharacter('\''); }
private void parseGroupByList(GroupByImpl groupBy, final EdmStructuredType referencedType) throws UriParserException { ParserHelper.requireNext(tokenizer, TokenKind.OPEN); do { groupBy.addGroupByItem(parseGroupByElement(referencedType)); } while (tokenizer.next(TokenKind.COMMA)); ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); }
private Aggregate parseAggregateTrafo(EdmStructuredType referencedType) throws UriParserException, UriValidationException { AggregateImpl aggregate = new AggregateImpl(); do { aggregate.addExpression(parseAggregateExpr(referencedType)); } while (tokenizer.next(TokenKind.COMMA)); ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); return aggregate; }
private void ensureReferencedTypeNotNull(final EdmStructuredType referencedType) throws UriParserException { if (referencedType == null) { throw new UriParserSemanticException("The referenced part is not typed.", UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "select"); } }
protected void checkNumericType(final Expression expression) throws UriParserException { checkNoCollection(expression); checkType(expression, EdmPrimitiveTypeKind.Int64, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte, EdmPrimitiveTypeKind.Decimal, EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double); }
@Override public String getKey() { return name(); } }
private void parseComplexPathRestExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.QualifiedName)) { final FullQualifiedName fullQualifiedName = new FullQualifiedName(tokenizer.getText()); // Must be a bound function. parseBoundFunction(fullQualifiedName, uriInfo, lastResource); } else if (tokenizer.next(TokenKind.ODataIdentifier)) { parsePropertyPathExpr(uriInfo, lastResource); } else { throw new UriParserSyntaxException("Unexpected token.", UriParserSyntaxException.MessageKeys.SYNTAX); } }
private void parseSinglePathExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.SLASH)) { ParserHelper.requireNext(tokenizer, TokenKind.QualifiedName); parseBoundFunction(new FullQualifiedName(tokenizer.getText()), uriInfo, lastResource); } }
private GroupBy parseGroupByTrafo(final EdmStructuredType referencedType) throws UriParserException, UriValidationException { GroupByImpl groupBy = new GroupByImpl(); parseGroupByList(groupBy, referencedType); if (tokenizer.next(TokenKind.COMMA)) { groupBy.setApplyOption(parseApply(referencedType)); } ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); return groupBy; }
private void parseSingleNavigationExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { if (tokenizer.next(TokenKind.SLASH)) { final TokenKind tokenKind = ParserHelper.next(tokenizer, TokenKind.QualifiedName, TokenKind.ODataIdentifier); parseMemberExpression(tokenKind, uriInfo, lastResource, true); } }
protected static void requireNext(UriTokenizer tokenizer, final TokenKind required) throws UriParserException { if (!tokenizer.next(required)) { throw new UriParserSyntaxException("Expected token '" + required.toString() + "' not found.", UriParserSyntaxException.MessageKeys.SYNTAX); } }
private void parseGroupByList(GroupByImpl groupBy, final EdmStructuredType referencedType) throws UriParserException { ParserHelper.requireNext(tokenizer, TokenKind.OPEN); do { groupBy.addGroupByItem(parseGroupByElement(referencedType)); } while (tokenizer.next(TokenKind.COMMA)); ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); }
private Aggregate parseAggregateTrafo(EdmStructuredType referencedType) throws UriParserException, UriValidationException { AggregateImpl aggregate = new AggregateImpl(); do { aggregate.addExpression(parseAggregateExpr(referencedType)); } while (tokenizer.next(TokenKind.COMMA)); ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); return aggregate; }
private void checkOptionEOF(UriTokenizer tokenizer, final String optionName, final String optionValue) throws UriParserException { if (!tokenizer.next(TokenKind.EOF)) { throw new UriParserSyntaxException("Illegal value of '" + optionName + "' option!", UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION, optionName, optionValue); } } }