private EventEntry(DBObject dbObject) { this.serializedPayload = dbObject.get(SERIALIZED_PAYLOAD_PROPERTY); this.payloadType = (String) dbObject.get(PAYLOAD_TYPE_PROPERTY); this.payloadRevision = (String) dbObject.get(PAYLOAD_REVISION_PROPERTY); this.serializedMetaData = dbObject.get(META_DATA_PROPERTY); this.eventIdentifier = (String) dbObject.get(EVENT_IDENTIFIER_PROPERTY); this.sequenceNumber = (Long) dbObject.get(EVENT_SEQUENCE_NUMBER_PROPERTY); this.timestamp = (long) dbObject.get(EVENT_TIMESTAMP_PROPERTY); }
/** * Creates a new CommitEntry based onm data provided by Mongo. * * @param dbObject Mongo object that contains data to represent an CommitEntry */ @SuppressWarnings("unchecked") private CommitEntry(DBObject dbObject) { this.aggregateIdentifier = (String) dbObject.get(AGGREGATE_IDENTIFIER_PROPERTY); this.firstSequenceNumber = ((Number) dbObject.get(FIRST_SEQUENCE_NUMBER_PROPERTY)).longValue(); this.lastSequenceNumber = ((Number) dbObject.get(LAST_SEQUENCE_NUMBER_PROPERTY)).longValue(); this.firstTimestamp = (long) dbObject.get(FIRST_TIME_STAMP_PROPERTY); this.lastTimestamp = (long) dbObject.get(LAST_TIME_STAMP_PROPERTY); List<DBObject> entries = (List<DBObject>) dbObject.get(EVENTS_PROPERTY); eventEntries = new EventEntry[entries.size()]; for (int i = 0, entriesSize = entries.size(); i < entriesSize; i++) { eventEntries[i] = new EventEntry(entries.get(i)); } }