Search in sources :

Example 1 with ProcessRecord

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

the class ProcessGenerator method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    Set<TableRecord<?>> records = new HashSet<>();
    for (long g = 1; g < 5; g++) {
        ProcessRecord record = new ProcessRecord();
        record.setDescription("Process Group: " + g);
        record.setName("Process Group " + g);
        record.setId(g);
        record.setLevel(1);
        record.setLevel_1(g);
        records.add(record);
        for (long p = 0; p < 10; p++) {
            long id = (g * 100) + p;
            ProcessRecord record2 = new ProcessRecord();
            String name = randomPick(p1) + " " + randomPick(p2);
            record2.setDescription("Process: " + name);
            record2.setName(name);
            record2.setId(id);
            record2.setParentId(g);
            record2.setLevel(2);
            record2.setLevel_1(g);
            record2.setLevel_2(id);
            records.add(record2);
        }
    }
    System.out.println("-- deleting");
    dsl.deleteFrom(PROCESS).execute();
    System.out.println("-- inserting");
    dsl.batchInsert(records).execute();
    System.out.println(" -- done");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DSLContext(org.jooq.DSLContext) ProcessRecord(com.khartec.waltz.schema.tables.records.ProcessRecord) TableRecord(org.jooq.TableRecord) HashSet(java.util.HashSet)

Aggregations

ProcessRecord (com.khartec.waltz.schema.tables.records.ProcessRecord)1 HashSet (java.util.HashSet)1 DSLContext (org.jooq.DSLContext)1 TableRecord (org.jooq.TableRecord)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1