public class RelationResource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected OrchestrateClient |
client
The Orchestrate client to make requests with.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper
The object mapper used to deserialize JSON responses.
|
| Modifier and Type | Method and Description |
|---|---|
<T> OrchestrateRequest<RelationList<T>> |
get(java.lang.Class<T> clazz,
java.lang.String... kinds)
Fetch objects related to a key in the Orchestrate service.
|
RelationResource |
invert()
Swap the "source" and "destination" in the request, equivalent to:
|
RelationResource |
invert(boolean invert)
If
invert is true the "source" and "destination" objects
will be swapped in the request. |
OrchestrateRequest<java.lang.Boolean> |
purge(java.lang.String kind)
Remove a relationship between two objects in the Orchestrate service.
|
OrchestrateRequest<java.lang.Boolean> |
put(java.lang.String kind)
Store a relationship between two objects in the Orchestrate service.
|
RelationResource |
to(java.lang.String collection,
java.lang.String key)
The "destination" object to point the relationship to.
|
protected <T> T |
toDomainObject(java.lang.String rawValue,
java.lang.Class<T> clazz) |
protected byte[] |
toJsonBytes(java.lang.Object value) |
protected com.fasterxml.jackson.databind.JsonNode |
toJsonNode(org.glassfish.grizzly.http.HttpContent response) |
protected <T> KvObject<T> |
toKvObject(org.glassfish.grizzly.http.HttpContent response,
java.lang.String collection,
java.lang.String key,
java.lang.Class<T> clazz) |
protected <T> KvObject<T> |
toKvObject(com.fasterxml.jackson.databind.JsonNode result,
java.lang.Class<T> clazz) |
protected final OrchestrateClient client
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
public <T> OrchestrateRequest<RelationList<T>> get(java.lang.Class<T> clazz, java.lang.String... kinds)
Usage:
RelationList<String> relatedObjects =
client.relation("someCollection", "someKey")
.get(String.class, "someKind")
.get();
T - The type to deserialize the response from the request to.clazz - Type information for deserializing to type T at
runtime.kinds - The name of the relationships to traverse to the related
objects.public OrchestrateRequest<java.lang.Boolean> put(java.lang.String kind)
Usage:
boolean result =
client.relation("someCollection", "someKey")
.to("anotherCollection", "anotherKey")
.put(kind)
.get();
kind - The name of the relationship to create.public OrchestrateRequest<java.lang.Boolean> purge(java.lang.String kind)
boolean result =
client.relation("someCollection", "someKey")
.to("anotherCollection", "anotherKey")
.purge(kind)
.get();
kind - The name of the relationship to delete.public RelationResource to(java.lang.String collection, java.lang.String key)
collection - The collection containing the destination key.key - The destination key to add the relation to.public RelationResource invert()
this.invert(Boolean.TRUE);
invert(boolean)public RelationResource invert(boolean invert)
invert is true the "source" and "destination" objects
will be swapped in the request. This is useful for designing a
bi-directional relationship.invert - Whether to invert the request.protected byte[] toJsonBytes(java.lang.Object value)
protected com.fasterxml.jackson.databind.JsonNode toJsonNode(org.glassfish.grizzly.http.HttpContent response)
throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(com.fasterxml.jackson.databind.JsonNode result, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected <T> KvObject<T> toKvObject(org.glassfish.grizzly.http.HttpContent response, java.lang.String collection, java.lang.String key, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected <T> T toDomainObject(java.lang.String rawValue,
java.lang.Class<T> clazz)
throws java.io.IOException
java.io.IOException