use of com.khartec.waltz.schema.tables.records.ChangeLogRecord in project waltz by khartec.
the class ChangeLogGenerator method mkChangeLog.
private static ChangeLogRecord mkChangeLog(long appId, String email) {
ChangeLogRecord record = new ChangeLogRecord();
record.setMessage("Dummy");
record.setParentId(appId);
record.setParentKind(EntityKind.APPLICATION.name());
record.setUserId(email);
record.setSeverity(Severity.INFORMATION.name());
return record;
}
use of com.khartec.waltz.schema.tables.records.ChangeLogRecord in project waltz by khartec.
the class ChangeLogGenerator method main.
public static void main(String[] args) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
// get applications and emails
List<Long> appIds = dsl.select(APPLICATION.ID).from(APPLICATION).fetch(APPLICATION.ID);
List<String> emails = dsl.select(PERSON.EMAIL).from(PERSON).fetch(PERSON.EMAIL);
Set<ChangeLogRecord> records = emails.stream().flatMap(email -> Stream.of(mkChangeLog(randomPick(appIds), email), mkChangeLog(randomPick(appIds), randomPick(emails)))).collect(toSet());
dsl.deleteFrom(CHANGE_LOG).execute();
dsl.batchInsert(records).execute();
System.out.println("Inserted " + records.size() + " change log entries");
}
Aggregations