use of com.khartec.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP in project waltz by khartec.
the class ChangeInitiativeGenerator method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
List<Long> groupIds = dsl.select(APPLICATION_GROUP.ID).from(APPLICATION_GROUP).fetch(APPLICATION_GROUP.ID);
List<String> employeeIds = dsl.select(PERSON.EMPLOYEE_ID).from(PERSON).fetch(PERSON.EMPLOYEE_ID);
List<Long> orgUnitIds = dsl.select(ORGANISATIONAL_UNIT.ID).from(ORGANISATIONAL_UNIT).fetch(ORGANISATIONAL_UNIT.ID);
List<TableRecord<?>> records = LongStream.range(0, 400).mapToObj(i -> {
String name = randomPick(p1) + " " + randomPick(p2) + " " + randomPick(p3);
Long ouId = randomPick(orgUnitIds.toArray(new Long[0]));
return Tuple.tuple(i, name, ouId);
}).map(t -> buildChangeInitiativeRecord(t)).flatMap(r -> Stream.concat(Stream.of(r), buildLinks(r, groupIds, employeeIds))).collect(toList());
System.out.println("-- deleting");
dsl.deleteFrom(CHANGE_INITIATIVE).execute();
System.out.println("-- inserting");
dsl.batchInsert(records).execute();
System.out.println(" -- done");
}
Aggregations