public List<EventLogEntry> list(QueryRunner queryRunner, EventLogFilters filters) { SelectQuery select = QueryFactory.selectAll().from(config.entityName()); if (filters.parameterKey() != null) { select .where("parameter_key = :parameterKey") .withArgument("parameterKey", filters.parameterKey().value()); } if (filters.entryKey() != null) { select .where("parameter_entry_key = :parameterEntryKey") .withArgument("parameterEntryKey", filters.entryKey().value()); } return queryRunner.queryList(select, new EventLogEntryMapper()); }
public void save(QueryRunner queryRunner, EventLogEntry logEntry) { InsertQuery insert = QueryFactory.insert() .into(config.entityName()) .sequence("id", config.sequenceName()) .value("timestamp", Timestamp.from(logEntry.timestamp())) .value("entry_type", logEntry.type().typeCode()) .value("event_type", logEntry.action().name()) .value("responsible", logEntry.responsibleLogin()) .value("repository", logEntry.repository().name()) .value("parameter_key", logEntry.parameterKey().value()) .value("event_details", logEntry.serializedEventDetails()); if (logEntry.type() == EventLogEntryType.ENTRY) { insert.value("parameter_entry_key", logEntry.entryKey().value()); } queryRunner.insert(insert); }