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; }
final UriResourceEntitySetImpl uriResourceEntitySet = new UriResourceEntitySetImpl(targetEtySet); final UriInfo uriInfoForCollection = new UriInfoImpl().addResourcePart(uriResourceEntitySet);
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 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; }
if (crossjoinEntitySetNames.contains(name)) { final UriResourceEntitySetImpl resource = new UriResourceEntitySetImpl(edm.getEntityContainer().getEntitySet(name)); uriInfo.addResourcePart(resource); if (tokenizer.next(TokenKind.SLASH)) {
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; }
if (crossjoinEntitySetNames.contains(name)) { final UriResourceEntitySetImpl resource = new UriResourceEntitySetImpl(edm.getEntityContainer().getEntitySet(name)); uriInfo.addResourcePart(resource); if (tokenizer.next(TokenKind.SLASH)) {
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; }
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 UriResourceEntitySetImpl entitySetResource = new UriResourceEntitySetImpl(edmEntitySet);
final UriResourceEntitySetImpl entitySetResource = new UriResourceEntitySetImpl(edmEntitySet);