public ConsumerQueryLinksRequest(ODataClient client, String serviceRootUri, EdmDataServices metadata, OEntityId sourceEntity, String targetNavProp) { super(client, serviceRootUri, metadata, OEntityIds.toKeyString(sourceEntity)); this.targetNavProp = targetNavProp; }
/** * Creates an entity-id. * * @param entitySetName the entity-set * @param entityKeyValues the entity-key as one or more values * @return the entity-id */ public static OEntityId create(String entitySetName, Object... entityKeyValues) { return create(entitySetName, OEntityKey.create(entityKeyValues)); }
/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
/** * Creates an entity-id. * * @param entitySetName the entity-set * @param entityKeyValues the entity-key as one or more values * @return the entity-id */ public static OEntityId create(String entitySetName, Object... entityKeyValues) { return create(entitySetName, OEntityKey.create(entityKeyValues)); }
/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
public ConsumerQueryLinksRequest(ODataClient client, String serviceRootUri, EdmDataServices metadata, OEntityId sourceEntity, String targetNavProp) { super(client, serviceRootUri, metadata, OEntityIds.toKeyString(sourceEntity)); this.targetNavProp = targetNavProp; }
/** * Creates an entity-id. * * @param entitySetName the entity-set * @param entityKeyValues the entity-key as one or more values * @return the entity-id */ public static OEntityId create(String entitySetName, Object... entityKeyValues) { return create(entitySetName, OEntityKey.create(entityKeyValues)); }
/** * Parses an entity-id of an entity at an OData uri given its service root uri. * @param serviceRootUri the service root uri * @param uri the entity uri * @return the parsed entity-id */ public static OEntityId parse(String serviceRootUri, String uri) { if (serviceRootUri == null) throw new NullPointerException("Must provide service-root-uri"); if (uri == null) throw new NullPointerException("Must provide uri"); String entityId = uri; if (entityId.toLowerCase().startsWith(serviceRootUri.toLowerCase())) entityId = entityId.substring(serviceRootUri.length()); if (entityId.startsWith("/")) entityId = entityId.substring(1); return parse(entityId); }
/** * Determines equality of two entity ids. Ids are equal if their key strings are equal. * * @param lhs the first entity id * @param rhs the second entity id * @return whether or not the ids are equal */ public static boolean equals(OEntityId lhs, OEntityId rhs) { if (lhs == null) return rhs == null; return toKeyString(lhs).equals(toKeyString(rhs)); }
/** * 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); }
@Override public OEntityId apply(SingleLink link) { return OEntityIds.parse(getServiceRootUri(), link.getUri()); } });
/** * Determines equality of two entity ids. Ids are equal if their key strings are equal. * * @param lhs the first entity id * @param rhs the second entity id * @return whether or not the ids are equal */ public static boolean equals(OEntityId lhs, OEntityId rhs) { if (lhs == null) return rhs == null; return toKeyString(lhs).equals(toKeyString(rhs)); }
/** * 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); }
@Override public OEntityId apply(SingleLink link) { return OEntityIds.parse(getServiceRootUri(), link.getUri()); } });
/** * Determines equality of two entity ids. Ids are equal if their key strings are equal. * * @param lhs the first entity id * @param rhs the second entity id * @return whether or not the ids are equal */ public static boolean equals(OEntityId lhs, OEntityId rhs) { if (lhs == null) return rhs == null; return toKeyString(lhs).equals(toKeyString(rhs)); }
/** * 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); }
private OEntityId parseRequestUri(HttpHeaders httpHeaders, UriInfo uriInfo, String payload) { FormatParser<SingleLink> parser = FormatParserFactory.getParser(SingleLink.class, httpHeaders.getMediaType(), null); SingleLink link = parser.parse(new StringReader(payload)); return OEntityIds.parse(uriInfo.getBaseUri().toString(), link.getUri()); }
public static SingleLink create(String serviceRootUri, OEntityId entity) { String uri = serviceRootUri; if (!uri.endsWith("/")) uri += "/"; uri += OEntityIds.toKeyString(entity); return create(uri); }
@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); }
private OEntityId parseRequestUri(HttpHeaders httpHeaders, UriInfo uriInfo, String payload) { FormatParser<SingleLink> parser = FormatParserFactory.getParser(SingleLink.class, httpHeaders.getMediaType(), null); SingleLink link = parser.parse(new StringReader(payload)); return OEntityIds.parse(uriInfo.getBaseUri().toString(), link.getUri()); }