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; }
uriResourceEntitySet.setKeyPredicates(keyPredicates); else{ logger.error("Unable to fetch the key of the created entity.");
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 void parseDollarRoot(UriInfoImpl uriInfo) throws UriParserException, UriValidationException { UriResourceRootImpl rootResource = new UriResourceRootImpl(referringType, true); uriInfo.addResourcePart(rootResource); ParserHelper.requireNext(tokenizer, TokenKind.SLASH); ParserHelper.requireNext(tokenizer, TokenKind.ODataIdentifier); final String name = tokenizer.getText(); UriResourcePartTyped resource = null; final EdmEntitySet entitySet = edm.getEntityContainer().getEntitySet(name); if (entitySet == null) { final EdmSingleton singleton = edm.getEntityContainer().getSingleton(name); if (singleton == null) { throw new UriParserSemanticException("EntitySet or singleton expected.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, name); } else { resource = new UriResourceSingletonImpl(singleton); } } else { ParserHelper.requireNext(tokenizer, TokenKind.OPEN); final List<UriParameter> keyPredicates = ParserHelper.parseKeyPredicate(tokenizer, entitySet.getEntityType(), null, edm, referringType, aliases); resource = new UriResourceEntitySetImpl(entitySet).setKeyPredicates(keyPredicates); } uriInfo.addResourcePart(resource); parseSingleNavigationExpr(uriInfo, resource); }
private void parseDollarRoot(UriInfoImpl uriInfo) throws UriParserException, UriValidationException { UriResourceRootImpl rootResource = new UriResourceRootImpl(referringType, true); uriInfo.addResourcePart(rootResource); ParserHelper.requireNext(tokenizer, TokenKind.SLASH); ParserHelper.requireNext(tokenizer, TokenKind.ODataIdentifier); final String name = tokenizer.getText(); UriResourcePartTyped resource = null; final EdmEntitySet entitySet = edm.getEntityContainer().getEntitySet(name); if (entitySet == null) { final EdmSingleton singleton = edm.getEntityContainer().getSingleton(name); if (singleton == null) { throw new UriParserSemanticException("EntitySet or singleton expected.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, name); } else { resource = new UriResourceSingletonImpl(singleton); } } else { ParserHelper.requireNext(tokenizer, TokenKind.OPEN); final List<UriParameter> keyPredicates = ParserHelper.parseKeyPredicate(tokenizer, entitySet.getEntityType(), null, edm, referringType, aliases); resource = new UriResourceEntitySetImpl(entitySet).setKeyPredicates(keyPredicates); } uriInfo.addResourcePart(resource); parseSingleNavigationExpr(uriInfo, resource); }
final List<UriParameter> keyPredicates = ParserHelper.parseKeyPredicate(tokenizer, entitySetResource.getEntityType(), null, edm, null, aliases); entitySetResource.setKeyPredicates(keyPredicates);
final List<UriParameter> keyPredicates = ParserHelper.parseKeyPredicate(tokenizer, entitySetResource.getEntityType(), null, edm, null, aliases); entitySetResource.setKeyPredicates(keyPredicates);