/** * 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)); }
/** * 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)); }
/** * 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 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); }
/** * 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); }
@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); }
@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); }