/** * Returns the current CommitEntry as a mongo DBObject. * * @return DBObject representing the CommitEntry */ public DBObject asDBObject() { final BasicDBList events = new BasicDBList(); BasicDBObjectBuilder commitBuilder = BasicDBObjectBuilder.start() .add(AGGREGATE_IDENTIFIER_PROPERTY, aggregateIdentifier) .add(SEQUENCE_NUMBER_PROPERTY, firstSequenceNumber) .add(LAST_SEQUENCE_NUMBER_PROPERTY, lastSequenceNumber) .add(FIRST_SEQUENCE_NUMBER_PROPERTY, firstSequenceNumber) .add(TIME_STAMP_PROPERTY, firstTimestamp) .add(FIRST_TIME_STAMP_PROPERTY, firstTimestamp) .add(LAST_TIME_STAMP_PROPERTY, lastTimestamp) .add(EVENTS_PROPERTY, events); for (EventEntry eventEntry : eventEntries) { events.add(eventEntry.asDBObject()); } return commitBuilder.get(); }
@Override public SerializedObject getPayload() { return eventEntry.getPayload(); }
@Override public SerializedObject getMetaData() { return eventEntry.getMetaData(); }
@Override public Instant getTimestamp() { return Instant.ofEpochMilli(eventEntry.getTimestamp()); }
@Override public long getSequenceNumber() { return eventEntry.getSequenceNumber(); }
@Override public String getEventIdentifier() { return eventEntry.getEventIdentifier(); }