UriInfoImpl contextUriInfo = new UriInfoImpl(); contextUriInfo.setQueryOption(parsedOption == null ? option : parsedOption); } catch (final ODataRuntimeException e) { throw new UriParserSyntaxException( contextUriInfo.setKind(UriInfoKind.service); contextUriInfo.setKind(UriInfoKind.batch); contextUriInfo.setKind(UriInfoKind.metadata); contextUriInfo.setFragment(fragment); contextUriInfo.setKind(UriInfoKind.all); contextIsCollection = true; if (null != contextUriInfo.getIdOption()) { String idOptionText = contextUriInfo.getIdOption().getText(); if (idOptionText.startsWith(HTTP)) { baseUri = UriDecoder.decode(baseUri); (edm, contextUriInfo.getAliasMap()); String typeCastSegment = pathSegmentsDecoded.get(1); ensureLastSegment(typeCastSegment, 2, numberOfSegments); contextUriInfo = (UriInfoImpl) new Parser(edm, odata). parseUri("/" + idOptionText, query, fragment, baseUri); contextUriInfo.setEntityTypeCast((EdmEntityType) contextType); } else if (numberOfSegments == 1) {
public static UriInfoImpl constructDeepReadForDraftRoot(EdmEntitySet entitySet,Map<String,List<String>> draftTree,UriInfo requestUriInfo) throws ODataApplicationException { UriInfoImpl uriInfoForRead=null; if(requestUriInfo!=null) { uriInfoForRead=(UriInfoImpl)requestUriInfo; }else { UriResourceEntitySet entitySetForRead = new UriResourceEntitySetImpl(entitySet); uriInfoForRead = new UriInfoImpl().addResourcePart(entitySetForRead); } ExpandOptionImpl eo=constructDraftTreeExpand(EdmHelper.getEdmEntitySet(uriInfoForRead, null).getEntityType(),(ExpandOptionImpl) uriInfoForRead.getExpandOption(),draftTree); if(eo!=null && eo.getExpandItems()!=null&&!eo.getExpandItems().isEmpty()) { uriInfoForRead.setSystemQueryOption(eo); } return uriInfoForRead; }
public UriInfoImpl setQueryOption(final QueryOption option) { if (option instanceof SystemQueryOption) { setSystemQueryOption((SystemQueryOption) option); } else if (option instanceof AliasQueryOption) { addAlias((AliasQueryOption) option); } else if (option instanceof CustomQueryOption) { addCustomQueryOption((CustomQueryOption) option); } return this; }
private UriInfo parseGroupingProperty(final EdmStructuredType referencedType) throws UriParserException { UriInfoImpl uriInfo = new UriInfoImpl(); final String identifierLeft = parsePathPrefix(uriInfo, referencedType); if (identifierLeft != null) { throw new UriParserSemanticException("Unknown identifier in grouping property path.", UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE, identifierLeft, uriInfo.getLastResourcePart() != null && uriInfo.getLastResourcePart() instanceof UriResourcePartTyped ? ((UriResourcePartTyped) uriInfo.getLastResourcePart()) .getType().getFullQualifiedName().getFullQualifiedNameAsString() : ""); } return uriInfo; }
protected ExpandItemImpl buildExpandItem(final EdmNavigationProperty edmNavigationProperty) { return new ExpandItemImpl() .setResourcePath(new UriInfoImpl() .addResourcePart(new UriResourceNavigationPropertyImpl(edmNavigationProperty))); } }
private ExpandItem parseCrossJoinItem(UriTokenizer tokenizer) throws UriParserSemanticException { ExpandItemImpl item = new ExpandItemImpl(); if (tokenizer.next(TokenKind.STAR)) { item.setIsStar(true); } else if (tokenizer.next(TokenKind.ODataIdentifier)) { String entitySetName = tokenizer.getText(); if (crossjoinEntitySetNames.contains(entitySetName)) { UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource); final UriResourceEntitySetImpl entitySetResourceSegment = new UriResourceEntitySetImpl(edm.getEntityContainer().getEntitySet(entitySetName)); resource.addResourcePart(entitySetResourceSegment); item.setResourcePath(resource); } else { throw new UriParserSemanticException("Unknown crossjoin entity set.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, entitySetName); } } else { throw new UriParserSemanticException("If the target resource is a crossjoin an entity set is " + "needed as the starting point.", UriParserSemanticException.MessageKeys.UNKNOWN_PART); } return item; }
private void parseCollectionPathExpr(UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { // The initial slash (see grammar) must have been checked and consumed by the caller. if (tokenizer.next(TokenKind.COUNT)) { uriInfo.addResourcePart(new UriResourceCountImpl()); } else if (tokenizer.next(TokenKind.ANY)) { uriInfo.addResourcePart(parseLambdaRest(TokenKind.ANY, lastResource)); } else if (tokenizer.next(TokenKind.ALL)) { uriInfo.addResourcePart(parseLambdaRest(TokenKind.ALL, lastResource)); } else if (tokenizer.next(TokenKind.QualifiedName)) { parseBoundFunction(new FullQualifiedName(tokenizer.getText()), uriInfo, lastResource); } else { throw new UriParserSyntaxException("Unexpected token.", UriParserSyntaxException.MessageKeys.SYNTAX); } }
UriInfoImpl uriInfo = new UriInfoImpl(); final String identifierLeft = parsePathPrefix(uriInfo, referencedType); if (identifierLeft != null) { uriInfo.addResourcePart(new UriResourcePrimitivePropertyImpl(createDynamicProperty(customAggregate, null))); aggregateExpression.setPath(uriInfo); final String alias = parseAsAlias(referencedType, false); final UriResource lastResourcePart = uriInfo.getLastResourcePart(); if (lastResourcePart == null) { throw new UriParserSyntaxException("Invalid 'aggregateExpr' syntax.", ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); } else if (tokenizer.next(TokenKind.COUNT)) { uriInfo.addResourcePart(new UriResourceCountImpl()); aggregateExpression.setPath(uriInfo); final String alias = parseAsAlias(referencedType, true);
UriResourcePartTyped lastPart = (UriResourcePartTyped) resource.getLastResourcePart(); if (hasSlash || tokenizer.next(TokenKind.SLASH)) { if (tokenizer.next(TokenKind.REF)) { resource.addResourcePart(new UriResourceRefImpl()); item.setIsRef(true); parseOptions(tokenizer, newReferencedType, newReferencedIsCollection, item, true, false); } else { ParserHelper.requireNext(tokenizer, TokenKind.COUNT); resource.addResourcePart(new UriResourceCountImpl()); item.setCountPath(true); parseOptions(tokenizer, newReferencedType, newReferencedIsCollection, item, false, true);
private Expression parseFirstMemberExpr(final TokenKind lastTokenKind) throws UriParserException, UriValidationException { final UriInfoImpl uriInfo = new UriInfoImpl(); EdmType startTypeFilter = null;
private ExpandItem parseCrossJoinItem(UriTokenizer tokenizer) throws UriParserSemanticException { ExpandItemImpl item = new ExpandItemImpl(); if (tokenizer.next(TokenKind.STAR)) { item.setIsStar(true); } else if (tokenizer.next(TokenKind.ODataIdentifier)) { String entitySetName = tokenizer.getText(); if (crossjoinEntitySetNames.contains(entitySetName)) { UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource); final UriResourceEntitySetImpl entitySetResourceSegment = new UriResourceEntitySetImpl(edm.getEntityContainer().getEntitySet(entitySetName)); resource.addResourcePart(entitySetResourceSegment); item.setResourcePath(resource); } else { throw new UriParserSemanticException("Unknown crossjoin entity set.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, entitySetName); } } else { throw new UriParserSemanticException("If the target resource is a crossjoin an entity set is " + "needed as the starting point.", UriParserSemanticException.MessageKeys.UNKNOWN_PART); } return item; }
protected ExpandItemImpl buildExpandItem(final EdmNavigationProperty edmNavigationProperty) { return new ExpandItemImpl() .setResourcePath(new UriInfoImpl() .addResourcePart(new UriResourceNavigationPropertyImpl(edmNavigationProperty))); } }
private void parseDollarIt(UriInfoImpl uriInfo, final EdmType referringType) throws UriParserException, UriValidationException { UriResourceItImpl itResource = new UriResourceItImpl(referringType, false); uriInfo.addResourcePart(itResource); if (tokenizer.next(TokenKind.SLASH)) { final TokenKind tokenKind = ParserHelper.next(tokenizer, TokenKind.QualifiedName, TokenKind.ODataIdentifier); parseMemberExpression(tokenKind, uriInfo, itResource, true); } }
UriInfoImpl uriInfo = new UriInfoImpl(); final String identifierLeft = parsePathPrefix(uriInfo, referencedType); if (identifierLeft != null) { uriInfo.addResourcePart(new UriResourcePrimitivePropertyImpl(createDynamicProperty(customAggregate, null))); aggregateExpression.setPath(uriInfo); final String alias = parseAsAlias(referencedType, false); final UriResource lastResourcePart = uriInfo.getLastResourcePart(); if (lastResourcePart == null) { throw new UriParserSyntaxException("Invalid 'aggregateExpr' syntax.", ParserHelper.requireNext(tokenizer, TokenKind.CLOSE); } else if (tokenizer.next(TokenKind.COUNT)) { uriInfo.addResourcePart(new UriResourceCountImpl()); aggregateExpression.setPath(uriInfo); final String alias = parseAsAlias(referencedType, true);
private UriInfo parseGroupingProperty(final EdmStructuredType referencedType) throws UriParserException { UriInfoImpl uriInfo = new UriInfoImpl(); final String identifierLeft = parsePathPrefix(uriInfo, referencedType); if (identifierLeft != null) { throw new UriParserSemanticException("Unknown identifier in grouping property path.", UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE, identifierLeft, uriInfo.getLastResourcePart() != null && uriInfo.getLastResourcePart() instanceof UriResourcePartTyped ? ((UriResourcePartTyped) uriInfo.getLastResourcePart()) .getType().getFullQualifiedName().getFullQualifiedNameAsString() : ""); } return uriInfo; }
UriResourcePartTyped lastPart = (UriResourcePartTyped) resource.getLastResourcePart(); if (hasSlash || tokenizer.next(TokenKind.SLASH)) { if (tokenizer.next(TokenKind.REF)) { resource.addResourcePart(new UriResourceRefImpl()); item.setIsRef(true); parseOptions(tokenizer, newReferencedType, newReferencedIsCollection, item, true, false); } else { ParserHelper.requireNext(tokenizer, TokenKind.COUNT); resource.addResourcePart(new UriResourceCountImpl()); item.setCountPath(true); parseOptions(tokenizer, newReferencedType, newReferencedIsCollection, item, false, true);
private Expression parseFirstMemberExpr(final TokenKind lastTokenKind) throws UriParserException, UriValidationException { final UriInfoImpl uriInfo = new UriInfoImpl(); EdmType startTypeFilter = null;
UriInfoImpl contextUriInfo = new UriInfoImpl(); contextUriInfo.setQueryOption(parsedOption == null ? option : parsedOption); } catch (final ODataRuntimeException e) { throw new UriParserSyntaxException( contextUriInfo.setKind(UriInfoKind.service); contextUriInfo.setKind(UriInfoKind.batch); contextUriInfo.setKind(UriInfoKind.metadata); contextUriInfo.setFragment(fragment); contextUriInfo.setKind(UriInfoKind.all); contextIsCollection = true; if (null != contextUriInfo.getIdOption()) { String idOptionText = contextUriInfo.getIdOption().getText(); if (idOptionText.startsWith(HTTP)) { baseUri = UriDecoder.decode(baseUri); (edm, contextUriInfo.getAliasMap()); String typeCastSegment = pathSegmentsDecoded.get(1); ensureLastSegment(typeCastSegment, 2, numberOfSegments); contextUriInfo = (UriInfoImpl) new Parser(edm, odata). parseUri("/" + idOptionText, query, fragment, baseUri); contextUriInfo.setEntityTypeCast((EdmEntityType) contextType); } else if (numberOfSegments == 1) {
item.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( parseBoundOperation(tokenizer, qualifiedName, referencedType, referencedIsCollection))); if (tokenizer.next(TokenKind.SLASH)) { ParserHelper.requireNext(tokenizer, TokenKind.ODataIdentifier); UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource); addSelectPath(tokenizer, type, resource); item.setResourcePath(resource); UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource); addSelectPath(tokenizer, referencedType, resource); item.setResourcePath(resource);
private static UriInfoDraftHelperV4 transFormerForDelete(Entity ent,EdmEntityContainer entityContainer,DraftFlow flow) throws ODataApplicationException { String serviceName=entityContainer.getNamespace(); UriInfoDraftHelperV4 _uriT=new UriInfoDraftHelperV4(); //Create the UriInfoForCreate EdmEntitySet entSet=entityContainer.getEntitySet(ent.getType().substring(serviceName.length()+1)); //Recheck what value is being stored here .... UriResourceEntitySetImpl entitySetForDelete = new UriResourceEntitySetImpl(entSet); entitySetForDelete.setKeyPredicates(DraftUtilsV4.extractKeyPredicateRefsEntity(ent, entSet.getEntityType())); //Extract Keys from Entity UriInfo uriInfoForDelete = new UriInfoImpl().addResourcePart(entitySetForDelete); _uriT.setUriInfo(uriInfoForDelete); _uriT.setUriFunction(UriFunction.DELETE); return _uriT; }