use of org.finos.waltz.schema.Tables.APPLICATION_GROUP_ENTRY in project waltz by khartec.
the class AppGroupEntryGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
DSLContext dsl = getDsl(ctx);
List<Long> appIds = getAppIds(dsl);
List<Long> groupIds = dsl.select(APPLICATION_GROUP.ID).from(APPLICATION_GROUP).fetch(APPLICATION_GROUP.ID);
List<ApplicationGroupEntryRecord> records = groupIds.stream().flatMap(id -> randomlySizedIntStream(0, 25).mapToLong(idx -> randomPick(appIds)).distinct().mapToObj(appId -> {
ApplicationGroupEntryRecord record = dsl.newRecord(APPLICATION_GROUP_ENTRY);
record.setGroupId(id);
record.setApplicationId(appId);
return record;
})).collect(Collectors.toList());
dsl.batchStore(records).execute();
return null;
}
Aggregations