protected ExpandItemImpl buildExpandItem(final EdmNavigationProperty edmNavigationProperty) { return new ExpandItemImpl() .setResourcePath(new UriInfoImpl() .addResourcePart(new UriResourceNavigationPropertyImpl(edmNavigationProperty))); } }
protected ExpandItemImpl buildExpandItem(final EdmNavigationProperty edmNavigationProperty) { return new ExpandItemImpl() .setResourcePath(new UriInfoImpl() .addResourcePart(new UriResourceNavigationPropertyImpl(edmNavigationProperty))); } }
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; }
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; }
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; }
List<EdmKeyPropertyRef> keyFieldList = targetEtySet.getEntityType().getKeyPropertyRefs() ; final UriResourceEntitySetImpl uriResourceEntitySet = new UriResourceEntitySetImpl(targetEtySet); final UriInfo uriInfoForCollection = new UriInfoImpl().addResourcePart(uriResourceEntitySet);
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; }
private static UriInfoDraftHelperV4 transFormerForCreate(Entity ent,EdmEntityContainer entityContainer,DraftFlow flow) { 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 .... UriResourceEntitySet entitySetForCreate = new UriResourceEntitySetImpl(entSet); UriInfo uriInfoForCreate = new UriInfoImpl().addResourcePart(entitySetForCreate); //Create the Deserializer //Remove any links and navigation links . We only want to create payload for a single level //ent.getNavigationLinks().clear(); if(flow.equals(DraftFlow.DRAFT_ACTIVATE_FROMNEW)||flow.equals(DraftFlow.DRAFT_ACTIVATE_FROMEXISTING)) { washDraftEntity(ent); } DeserializerResult deserializerResult=DeserializerResultImpl.with().entity(ent).build(); _uriT.setUriInfo(uriInfoForCreate); _uriT.setDeserializerResult(deserializerResult); _uriT.setUriFunction(UriFunction.CREATE); return _uriT; }
private static ExpandOptionImpl constructDraftTreeExpand(EdmEntityType rootEntityType,ExpandOptionImpl eO,Map<String,List<String>> draftTree) { if(eO==null) { eO=new ExpandOptionImpl(); } if(rootEntityType.getNavigationPropertyNames()!=null && !rootEntityType.getNavigationPropertyNames().isEmpty()) { for(String navName:rootEntityType.getNavigationPropertyNames()) { EdmNavigationProperty expandNp=rootEntityType.getNavigationProperty(navName); if(draftTree.get(rootEntityType.getName()).contains(expandNp.getType().getName())) { UriResourceNavigationPropertyImpl adminNaVPropImpl=new UriResourceNavigationPropertyImpl(expandNp); UriInfoImpl uriInfoForExpand = new UriInfoImpl().addResourcePart(adminNaVPropImpl); //Recursively set compositions ExpandOption innerExpandoption=constructDraftTreeExpand(expandNp.getType(),(ExpandOptionImpl) uriInfoForExpand.getExpandOption(),draftTree); if(innerExpandoption!=null) { uriInfoForExpand.setSystemQueryOption(innerExpandoption); ExpandItem eI = new ExpandItemImpl().setResourcePath(uriInfoForExpand).setSystemQueryOption(innerExpandoption); eO.addExpandItem(eI); } } } return eO; } return eO; }
private static UriInfoDraftHelperV4 transFormerForUpdate(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 entitySetForUpdate = new UriResourceEntitySetImpl(entSet); entitySetForUpdate.setKeyPredicates(DraftUtilsV4.extractKeyPredicateRefsEntity(ent, entSet.getEntityType())); //Extract Keys from Entity UriInfo uriInfoForUpdate = new UriInfoImpl().addResourcePart(entitySetForUpdate); //Create the Deserializer //Remove any links and navigation links . We only want to create payload for a single level //ent.getNavigationLinks().clear(); if(flow.equals(DraftFlow.DRAFT_ACTIVATE_FROMEXISTING)) { washDraftEntity(ent); } DeserializerResult deserializerResult=DeserializerResultImpl.with().entity(ent).build(); _uriT.setUriInfo(uriInfoForUpdate); _uriT.setDeserializerResult(deserializerResult); _uriT.setUriFunction(UriFunction.UPDATE); return _uriT; }
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 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; }
public static UriInfoDraftHelperV4 getCreateUriInfoForDraftsOneToOneUsingParent(EdmNavigationProperty navPropParent,Entity parentDraftsEntry,EdmEntityContainer entityContainer) throws ODataApplicationException { Entity childPayload=new Entity(); List<EdmReferentialConstraint> refConstraints = null ; refConstraints = navPropParent.getReferentialConstraints(); if( refConstraints == null || refConstraints.isEmpty() ){ throw new ODataApplicationException ("Unable to create with navigation because the corresponding referential constraint is missing.", HttpStatusCode.INTERNAL_SERVER_ERROR .getStatusCode(),Locale.ENGLISH,"Unable to create with navigation because the corresponding referential constraint is missing"); } refConstraints.forEach(refConstraint->{ // Map of <ChildKey , ParentKey> childPayload.addProperty(new Property(null, refConstraint.getReferencedPropertyName(), ValueType.PRIMITIVE, parentDraftsEntry.getProperty(refConstraint.getPropertyName()).getValue())); }); DeserializerResult deserializerResult=DeserializerResultImpl.with().entity(childPayload).build(); EdmEntitySet entSet=entityContainer.getEntitySet(navPropParent.getType().getName()); UriResourceEntitySet entitySetForCreate = new UriResourceEntitySetImpl(entSet); UriInfo uriInfoForCreate = new UriInfoImpl().addResourcePart(entitySetForCreate); UriInfoDraftHelperV4 _uriT=new UriInfoDraftHelperV4(); _uriT.setUriInfo(uriInfoForCreate); _uriT.setDeserializerResult(deserializerResult); _uriT.setUriFunction(UriFunction.CREATE); return _uriT; }
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);
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 Expression parseFirstMemberExpr(final TokenKind lastTokenKind) throws UriParserException, UriValidationException { final UriInfoImpl uriInfo = new UriInfoImpl(); EdmType startTypeFilter = null;
private Expression parseFirstMemberExpr(final TokenKind lastTokenKind) throws UriParserException, UriValidationException { final UriInfoImpl uriInfo = new UriInfoImpl(); EdmType startTypeFilter = null;
protected static UriInfoImpl parseExpandPath(UriTokenizer tokenizer, final Edm edm, final EdmStructuredType referencedType, ExpandItemImpl item) throws UriParserException { UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
protected static UriInfoImpl parseExpandPath(UriTokenizer tokenizer, final Edm edm, final EdmStructuredType referencedType, ExpandItemImpl item) throws UriParserException { UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
UriInfoImpl uriInfo = new UriInfoImpl(); final String identifierLeft = parsePathPrefix(uriInfo, referencedType); if (identifierLeft != null) {