use of org.finos.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP in project waltz by khartec.
the class BookmarkGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
DSLContext dsl = getDsl(ctx);
List<EntityReference> appRefs = dsl.select(APPLICATION.NAME, APPLICATION.ID).from(APPLICATION).fetch(r -> EntityReference.mkRef(EntityKind.APPLICATION, r.value2(), r.value1()));
List<EntityReference> measurableRefs = dsl.select(MEASURABLE.NAME, MEASURABLE.ID).from(MEASURABLE).fetch(r -> EntityReference.mkRef(EntityKind.MEASURABLE, r.value2(), r.value1()));
List<EntityReference> ouRefs = dsl.select(ORGANISATIONAL_UNIT.NAME, ORGANISATIONAL_UNIT.ID).from(ORGANISATIONAL_UNIT).fetch(r -> EntityReference.mkRef(EntityKind.ORG_UNIT, r.value2(), r.value1()));
List<EntityReference> appGroupRefs = dsl.select(APPLICATION_GROUP.NAME, APPLICATION_GROUP.ID).from(APPLICATION_GROUP).fetch(r -> EntityReference.mkRef(EntityKind.APP_GROUP, r.value2(), r.value1()));
List<EntityReference> refs = ListUtilities.concat(appRefs, measurableRefs, ouRefs, appGroupRefs);
List<BookmarkRecord> bookmarks = refs.stream().flatMap(r -> RandomUtilities.randomlySizedIntStream(2, 15).mapToObj(idx -> {
BookmarkRecord record = dsl.newRecord(BOOKMARK);
record.setParentKind(r.kind().name());
record.setParentId(r.id());
record.setTitle(mkText(r.name().get()));
record.setDescription(mkText(r.name().get()));
record.setKind(randomPick(bookmarkKinds));
record.setUrl(mkUrl(r.name().get()));
record.setProvenance(SAMPLE_DATA_PROVENANCE);
record.setLastUpdatedBy("admin");
record.setUpdatedAt(DateTimeUtilities.nowUtcTimestamp());
record.setCreatedAt(DateTimeUtilities.nowUtcTimestamp());
return record;
})).collect(Collectors.toList());
dsl.batchStore(bookmarks).execute();
return null;
}
use of org.finos.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP 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;
}
use of org.finos.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP in project waltz by khartec.
the class AppGroupGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
DSLContext dsl = getDsl(ctx);
List<ApplicationGroupRecord> groupRecords = Arrays.stream(names).map(n -> {
ApplicationGroupRecord record = dsl.newRecord(APPLICATION_GROUP);
record.setName(n);
record.setKind(AppGroupKind.PUBLIC.name());
record.setDescription(format("%s : Description of %s", SAMPLE_DATA_PROVENANCE, n));
return record;
}).collect(Collectors.toList());
dsl.batchStore(groupRecords).execute();
return null;
}
Aggregations