@Override
 @TransactionalReadOnly
 public EventSummary findByUuid(String uuid) throws ZepException {
   final Map<String, Object> fields =
       Collections.singletonMap(COLUMN_UUID, uuidConverter.toDatabaseType(uuid));
   List<EventSummary> summaries =
       this.template.query(
           "SELECT * FROM event_archive WHERE uuid=:uuid",
           new EventSummaryRowMapper(this.eventDaoHelper, databaseCompatibility),
           fields);
   return (summaries.size() > 0) ? summaries.get(0) : null;
 }
  @Override
  @TransactionalRollbackAllExceptions
  public String create(Event event, EventPreCreateContext context) throws ZepException {
    if (!ZepConstants.CLOSED_STATUSES.contains(event.getStatus())) {
      throw new ZepException("Invalid status for event in event archive: " + event.getStatus());
    }

    TypeConverter<Long> timestampConverter = databaseCompatibility.getTimestampConverter();
    Map<String, Object> occurrenceFields = eventDaoHelper.createOccurrenceFields(event);
    Map<String, Object> fields = new HashMap<String, Object>(occurrenceFields);
    final long created = event.getCreatedTime();
    final long firstSeen = (event.hasFirstSeenTime()) ? event.getFirstSeenTime() : created;
    long updateTime = System.currentTimeMillis();
    final String uuid = this.uuidGenerator.generate().toString();
    fields.put(COLUMN_UUID, uuidConverter.toDatabaseType(uuid));
    fields.put(COLUMN_STATUS_ID, event.getStatus().getNumber());
    fields.put(COLUMN_FIRST_SEEN, timestampConverter.toDatabaseType(firstSeen));
    fields.put(COLUMN_STATUS_CHANGE, timestampConverter.toDatabaseType(created));
    fields.put(COLUMN_LAST_SEEN, timestampConverter.toDatabaseType(created));
    fields.put(COLUMN_EVENT_COUNT, event.getCount());
    fields.put(COLUMN_UPDATE_TIME, timestampConverter.toDatabaseType(updateTime));

    this.template.update(DaoUtils.createNamedInsert(TABLE_EVENT_ARCHIVE, fields.keySet()), fields);
    return uuid;
  }