/** * Convenience constructor that assumes no payload. */ public static NessEvent createEvent(@Nullable final UUID user, @Nonnull final NessEventType type) { return new NessEvent(user, new DateTime(DateTimeZone.UTC), type, Collections.<String, Object>emptyMap(), UUID.randomUUID()); }
/** * Convenience constructor that assigns the current time in UTC and a random UUID. */ public static NessEvent createEvent(@Nullable final UUID user, @Nonnull final NessEventType type, @Nullable final Map<String, ? extends Object> payload) { return new NessEvent(user, new DateTime(DateTimeZone.UTC), type, payload, UUID.randomUUID()); }
/** * Create a new event. * * @param user User that the event happened for. Can be null for a system level event. * @param timestamp The time when this event entered the system * @param type The Event type. * @param payload Arbitrary data describing the event. */ public static NessEvent createEvent(@Nullable final UUID user, @Nullable final DateTime timestamp, @Nonnull final NessEventType type, @Nullable final Map<String, ? extends Object> payload) { return new NessEvent(user, timestamp, type, payload, UUID.randomUUID()); }
/** * Create a new event from over-the-wire json. * * @param user User that the event happened for. Can be null for a system level event. * @param timestamp The time when this event entered the system * @param type The Event type. * @param payload Arbitrary data describing the event. * @param id UUID as event id. */ @JsonCreator static NessEvent createEvent(@Nullable @JsonProperty("user") final UUID user, @Nullable @JsonProperty("timestamp") final DateTime timestamp, @Nonnull @JsonProperty("id") final UUID id, @Nonnull @JsonProperty("type") final NessEventType type, @Nullable @JsonProperty("payload") final Map<String, ? extends Object> payload) { return new NessEvent(user, timestamp, type, payload, id); }