public static OEntityKey parseEntityKey(String atomEntryId) { Matcher m = ENTITY_SET_NAME.matcher(atomEntryId); if (!m.find()) throw new RuntimeException("Unable to parse the entity-key from atom entry id: " + atomEntryId); return OEntityKey.parse(atomEntryId.substring(m.end() - 1)); }
public static OEntityKey parseEntityKey(String atomEntryId) { Matcher m = ENTITY_SET_NAME.matcher(atomEntryId); if (!m.find()) throw new RuntimeException("Unable to parse the entity-key from atom entry id: " + atomEntryId); return OEntityKey.parse(atomEntryId.substring(m.end() - 1)); }
@Path("{first: \\$}links/{targetNavProp:.+?}{targetId: (\\(.+?\\))?}") public LinksRequestResource getLinks( @PathParam("entitySetName") String entitySetName, @PathParam("id") String id, @PathParam("targetNavProp") String targetNavProp, @PathParam("targetId") String targetId) { OEntityKey targetEntityKey = targetId == null || targetId.isEmpty() ? null : OEntityKey.parse(targetId); return new LinksRequestResource(OEntityIds.create(entitySetName, OEntityKey.parse(id)), targetNavProp, targetEntityKey); }
public OEntityKey getEntityKey() { String uri = getUri(); if (uri == null) return null; return OEntityKey.parse(uri.substring(uri.lastIndexOf('('))); }
public OEntityKey getEntityKey() { String uri = getUri(); if (uri == null) return null; return OEntityKey.parse(uri.substring(uri.lastIndexOf('('))); }
@Path("{first: \\$}links/{targetNavProp:.+?}{targetId: (\\(.+?\\))?}") public LinksRequestResource getLinks( @PathParam("entitySetName") String entitySetName, @PathParam("id") String id, @PathParam("targetNavProp") String targetNavProp, @PathParam("targetId") String targetId) { OEntityKey targetEntityKey = targetId == null || targetId.isEmpty() ? null : OEntityKey.parse(targetId); return new LinksRequestResource(OEntityIds.create(entitySetName, OEntityKey.parse(id)), targetNavProp, targetEntityKey); }
public static ParsedHref parse(String href) { // href: entityset(keyvalue[,keyvalue])/navprop[/navprop] // keyvalue: <literal> for one key value -or- <name=literal> for multiple key values int slashIndex = href.indexOf('/'); String head = href.substring(0, slashIndex); String navProperty = href.substring(slashIndex + 1); int pIndex = head.indexOf('('); String entitySetName = head.substring(0, pIndex); String keyString = head.substring(pIndex + 1, head.length() - 1); // keyvalue[,keyvalue] ParsedHref rt = new ParsedHref(); rt.entitySetName = entitySetName; rt.entityKey = OEntityKey.parse(keyString); rt.navProperty = navProperty; return rt; } }
/** * Parses an entity-id from a "key string" representation. * <p>e.g. {@code Customers(15)} * @param entityId the entity-id as a string representation * @return the parsed entity-id */ public static OEntityId parse(String entityId) { if (entityId == null) throw new NullPointerException("Must provide entity-id"); int indexOfParen = entityId.indexOf('('); if (indexOfParen == -1) throw new IllegalArgumentException("Invalid entity-id: " + entityId); String entitySetName = entityId.substring(0, indexOfParen); OEntityKey entityKey = OEntityKey.parse(entityId.substring(indexOfParen)); return create(entitySetName, entityKey); }
public static ParsedHref parse(String href) { // href: entityset(keyvalue[,keyvalue])/navprop[/navprop] // keyvalue: <literal> for one key value -or- <name=literal> for multiple key values int slashIndex = href.indexOf('/'); String head = href.substring(0, slashIndex); String navProperty = href.substring(slashIndex + 1); int pIndex = head.indexOf('('); String entitySetName = head.substring(0, pIndex); String keyString = head.substring(pIndex + 1, head.length() - 1); // keyvalue[,keyvalue] ParsedHref rt = new ParsedHref(); rt.entitySetName = entitySetName; rt.entityKey = OEntityKey.parse(keyString); rt.navProperty = navProperty; return rt; } }
/** * Parses an entity-id from a "key string" representation. * <p>e.g. {@code Customers(15)} * @param entityId the entity-id as a string representation * @return the parsed entity-id */ public static OEntityId parse(String entityId) { if (entityId == null) throw new NullPointerException("Must provide entity-id"); int indexOfParen = entityId.indexOf('('); if (indexOfParen == -1) throw new IllegalArgumentException("Invalid entity-id: " + entityId); String entitySetName = entityId.substring(0, indexOfParen); OEntityKey entityKey = OEntityKey.parse(entityId.substring(indexOfParen)); return create(entitySetName, entityKey); }
/** * Parses an entity-id from a "key string" representation. * <p>e.g. {@code Customers(15)} * @param entityId the entity-id as a string representation * @return the parsed entity-id */ public static OEntityId parse(String entityId) { if (entityId == null) throw new NullPointerException("Must provide entity-id"); int indexOfParen = entityId.indexOf('('); if (indexOfParen == -1) throw new IllegalArgumentException("Invalid entity-id: " + entityId); String entitySetName = entityId.substring(0, indexOfParen); OEntityKey entityKey = OEntityKey.parse(entityId.substring(indexOfParen)); return create(entitySetName, entityKey); }
OEntityKey entityKey = OEntityKey.parse(id); ODataContext context = ODataContextImpl.builder().aspect(httpHeaders).aspect(securityContext).aspect(producer).build(); OEntity entity = this.getRequestEntity(httpHeaders, uriInfo, payload, producer.getMetadata(), entitySetName, OEntityKey.parse(id)); producer.updateEntity(context, entitySetName, entity); return Response.noContent().header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataConstants.DATA_SERVICE_VERSION_HEADER).build();
OEntityKey entityKey = OEntityKey.parse(id); return updateMediaLinkEntry(httpHeaders, uriInfo, producer, entitySet, inStream, OEntityKey.parse(id), odataContext); } finally { inStream.close(); OEntity entity = this.getRequestEntity(httpHeaders, uriInfo, payload, producer.getMetadata(), entitySetName, OEntityKey.parse(id)); producer.updateEntity(odataContext, entitySetName, entity); return Response.noContent().header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataConstants.DATA_SERVICE_VERSION_HEADER).build();
OEntityKey entityKey = OEntityKey.parse(id); ODataContext context = ODataContextImpl.builder().aspect(httpHeaders).aspect(securityContext).aspect(producer).build(); OEntity entity = this.getRequestEntity(httpHeaders, uriInfo, payload, producer.getMetadata(), entitySetName, OEntityKey.parse(id)); producer.updateEntity(context, entitySetName, entity);
OEntityKey entityKey = OEntityKey.parse(id); return updateMediaLinkEntry(httpHeaders, uriInfo, producer, entitySet, payload, OEntityKey.parse(id), odataContext); OEntity entity = this.getRequestEntity(httpHeaders, uriInfo, payload, producer.getMetadata(), entitySetName, OEntityKey.parse(id)); producer.updateEntity(odataContext, entitySetName, entity); return Response.noContent().header(ODataConstants.Headers.DATA_SERVICE_VERSION, ODataConstants.DATA_SERVICE_VERSION_HEADER).build();
OEntityKey entityKey = OEntityKey.parse(id); return updateMediaLinkEntry(httpHeaders, uriInfo, producer, entitySet, payload, OEntityKey.parse(id), odataContext); OEntity entity = this.getRequestEntity(httpHeaders, uriInfo, payload, producer.getMetadata(), entitySetName, OEntityKey.parse(id)); producer.updateEntity(odataContext, entitySetName, entity);
protected Response getStreamResponse(HttpHeaders httpHeaders, UriInfo uriInfo, ODataProducer producer, EdmEntitySet entitySet, String entityId, EntityQueryInfo queryInfo, SecurityContext securityContext, ODataContext odataContext) { OMediaLinkExtension mediaLinkExtension = this.getMediaLinkExtension(httpHeaders, uriInfo, entitySet, producer, odataContext); if (mediaLinkExtension == null) throw new NotImplementedException(); EntityResponse entityResponse = producer.getEntity(odataContext, entitySet.getName(), OEntityKey.parse(entityId), queryInfo); InputStream entityStream = mediaLinkExtension.getInputStreamForMediaLinkEntry(odataContext, entityResponse.getEntity(), null, queryInfo); String contentType = mediaLinkExtension.getMediaLinkContentType(odataContext, entityResponse.getEntity()); String contentDisposition = mediaLinkExtension.getMediaLinkContentDisposition(odataContext, entityResponse.getEntity()); return Response.ok(entityStream, contentType).header("Content-Disposition", contentDisposition).build(); }
protected Response getStreamResponse(HttpHeaders httpHeaders, UriInfo uriInfo, ODataProducer producer, EdmEntitySet entitySet, String entityId, EntityQueryInfo queryInfo, SecurityContext securityContext, ODataContext odataContext) { OMediaLinkExtension mediaLinkExtension = this.getMediaLinkExtension(httpHeaders, uriInfo, entitySet, producer, odataContext); if (mediaLinkExtension == null) throw new NotImplementedException(); EntityResponse entityResponse = producer.getEntity(odataContext, entitySet.getName(), OEntityKey.parse(entityId), queryInfo); InputStream entityStream = mediaLinkExtension.getInputStreamForMediaLinkEntry(odataContext, entityResponse.getEntity(), null, queryInfo); String contentType = mediaLinkExtension.getMediaLinkContentType(odataContext, entityResponse.getEntity()); String contentDisposition = mediaLinkExtension.getMediaLinkContentDisposition(odataContext, entityResponse.getEntity()); return Response.ok(entityStream, contentType).header("Content-Disposition", contentDisposition).build(); }
try { response = producer.getEntity(ODataContextImpl.builder().aspect(httpHeaders).aspect(securityContext).aspect(producer).build(), entitySetName, OEntityKey.parse(id), query); } catch (IllegalArgumentException e) { throw new BadRequestException("Illegal key " + id, e);
try { response = producer.getEntity(ODataContextImpl.builder().aspect(httpHeaders).aspect(securityContext).aspect(producer).build(), entitySetName, OEntityKey.parse(id), query); } catch (IllegalArgumentException e) { throw new BadRequestException("Illegal key " + id, e);