Search in sources :

Example 1 with EndUserApplicationRecord

use of com.khartec.waltz.schema.tables.records.EndUserApplicationRecord in project waltz by khartec.

the class EndUserAppMaker method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    List<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" };
    dsl.delete(END_USER_APPLICATION).execute();
    final Long[] idCounter = { 1L };
    ids.forEach(ouId -> {
        for (int i = 0; i < new Random().nextInt(100) + 40; i++) {
            EndUserApplicationRecord record = dsl.newRecord(END_USER_APPLICATION);
            String name = new StringBuilder().append(randomPick(subjects)).append(" ").append(randomPick(subjects)).append(" ").append(randomPick(types)).append(" ").append(randomPick(types)).toString();
            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();
        }
    });
}
Also used : OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Random(java.util.Random) DSLContext(org.jooq.DSLContext) EndUserApplicationRecord(com.khartec.waltz.schema.tables.records.EndUserApplicationRecord)

Aggregations

OrganisationalUnitDao (com.khartec.waltz.data.orgunit.OrganisationalUnitDao)1 EndUserApplicationRecord (com.khartec.waltz.schema.tables.records.EndUserApplicationRecord)1 Random (java.util.Random)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1