use of org.finos.waltz.schema.tables.records.EndUserApplicationRecord in project waltz by khartec.
the class EndUserAppGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
Set<Long> ids = IdUtilities.toIds(organisationalUnitDao.findAll());
String[] subjects = { "Trade", "Risk", "Balance", "PnL", "Rate", "Fines", "Party", "Confirmations", "Settlement", "Instruction", "Person", "Profit", "Margin", "Finance", "Account" };
String[] types = { "Report", "Summary", "Draft", "Calculations", "Breaks", "Record", "Statement", "Information", "Pivot" };
String[] tech = { "MS ACCESS", "MS EXCEL", "VBA" };
final Long[] idCounter = { 1L };
ids.forEach(ouId -> {
for (int i = 0; i < getRandom().nextInt(3); i++) {
EndUserApplicationRecord record = dsl.newRecord(END_USER_APPLICATION);
String name = String.format("%s %s %s %s", randomPick(subjects), randomPick(subjects), randomPick(types), randomPick(types));
record.setName(name);
record.setDescription("About the " + name + " End user app");
record.setKind(randomPick(tech));
record.setRiskRating(randomPick(Criticality.values()).name());
record.setLifecyclePhase(randomPick(LifecyclePhase.values()).name());
record.setOrganisationalUnitId(ouId);
record.setId(idCounter[0]++);
record.insert();
}
});
return null;
}
Aggregations