public class EventResource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected OrchestrateClient |
client
The Orchestrate client to make requests with.
|
protected JacksonMapper |
jacksonMapper |
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper
The object mapper used to deserialize JSON responses.
|
| Modifier and Type | Method and Description |
|---|---|
OrchestrateRequest<EventMetadata> |
create(java.lang.Object value)
Add an event to a key in the Orchestrate service.
|
EventResource |
end(long end)
The exclusive end of a time range to query.
|
<T> OrchestrateRequest<EventList<T>> |
get(java.lang.Class<T> clazz)
Fetch events for a key in the Orchestrate service.
|
SingleEventResource |
ordinal(java.lang.String ordinal)
Called to make operations for an individual event instance.
|
protected <T> OrchestrateRequest<T> |
parseLink(java.lang.String name,
com.fasterxml.jackson.databind.JsonNode jsonNode,
io.orchestrate.client.ResponseConverter<T> clazz) |
OrchestrateRequest<java.lang.Boolean> |
put(java.lang.Object value)
Deprecated.
Use
create(Object) for adding new events, and SingleEventResource's 'update'
(via ordinal(String)) for updating existing event instances. |
OrchestrateRequest<java.lang.Boolean> |
put(java.lang.Object value,
java.lang.Long timestamp)
Deprecated.
Use
create(Object) for adding new events, and SingleEventResource's 'update'
(via ordinal(String)) for updating existing event instances. |
EventResource |
start(long start)
The inclusive start of a time range to query.
|
EventResource |
timestamp(java.lang.Long timestamp)
The timestamp for an event.
|
protected byte[] |
toJsonBytes(java.lang.Object value) |
protected com.fasterxml.jackson.databind.JsonNode |
toJsonNode(org.glassfish.grizzly.http.HttpContent response) |
protected com.fasterxml.jackson.databind.JsonNode |
toJsonNodeOrNull(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) |
EventResource |
type(java.lang.String type)
The type for an event, e.g.
|
protected final OrchestrateClient client
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
protected final JacksonMapper jacksonMapper
public <T> OrchestrateRequest<EventList<T>> get(java.lang.Class<T> clazz)
Usage:
EventList<DomainObject> events =
client.event("someCollection", "someKey")
.type("eventType")
.get(DomainObject.class)
.get();
T - The type to deserialize the result of the request to.clazz - Type information for marshalling objects at runtime.public OrchestrateRequest<java.lang.Boolean> put(@NonNull java.lang.Object value)
create(Object) for adding new events, and SingleEventResource's 'update'
(via ordinal(String)) for updating existing event instances.value - The value for the event.public OrchestrateRequest<java.lang.Boolean> put(@NonNull java.lang.Object value, @Nullable java.lang.Long timestamp)
create(Object) for adding new events, and SingleEventResource's 'update'
(via ordinal(String)) for updating existing event instances.Usage:
DomainObject obj = new DomainObject(); // a POJO
boolean result =
client.event("someCollection", "someKey")
.type("someType")
.put(obj)
.get();
value - The object to store as the event.timestamp - The timestamp to store the event at.public OrchestrateRequest<EventMetadata> create(@NonNull java.lang.Object value)
Usage:
DomainObject obj = new DomainObject(); // a POJO
EventMetadata eventMeta =
client.event("someCollection", "someKey")
.type("someType")
.create(obj)
.get();
To add an event to a specific timestamp:
DomainObject obj = new DomainObject(); // a POJO
EventMetadata eventMeta =
client.event("someCollection", "someKey")
.type("someType")
.timestamp(someTimestamp)
.create(obj)
.get();
value - The object to store as the event.public EventResource type(java.lang.String type)
type - The type of the event.public EventResource timestamp(java.lang.Long timestamp)
timestamp - The timestamp of the event.public SingleEventResource ordinal(java.lang.String ordinal)
type
and timestamp must be called prior to calling this method.
Usage:
// fetches a single event instance
Event<String> event =
client.event("someCollection", "someKey")
.type("someType")
.timestamp(someTimestamp)
.ordinal(someOrdinal)
.get(String.class)
.get();
ordinal - The event instance's ordinal value.public EventResource start(long start)
start - The timestamp to get events from.public EventResource end(long end)
end - The timestamp to get events up to.protected byte[] toJsonBytes(java.lang.Object value)
protected com.fasterxml.jackson.databind.JsonNode toJsonNodeOrNull(org.glassfish.grizzly.http.HttpContent response)
throws java.io.IOException
java.io.IOExceptionprotected 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> OrchestrateRequest<T> parseLink(java.lang.String name, com.fasterxml.jackson.databind.JsonNode jsonNode, io.orchestrate.client.ResponseConverter<T> clazz)