Search in sources :

Example 1 with LogicalFlowDecoratorRecord

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

the class FlowDecorationGenerator method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    List<Long> flowIds = dsl.select(LOGICAL_FLOW.ID).from(LOGICAL_FLOW).fetch(LOGICAL_FLOW.ID);
    List<Long> typeIds = dsl.select(DATA_TYPE.ID).from(DATA_TYPE).fetch(DATA_TYPE.ID);
    List<LogicalFlowDecoratorRecord> records = map(flowIds, id -> {
        LogicalFlowDecoratorRecord record = dsl.newRecord(LOGICAL_FLOW_DECORATOR);
        record.setLogicalFlowId(id);
        record.setDecoratorEntityId(randomPick(typeIds));
        record.setDecoratorEntityKind(EntityKind.DATA_TYPE.name());
        record.setProvenance("sample");
        return record;
    });
    dsl.deleteFrom(LOGICAL_FLOW_DECORATOR).where(LOGICAL_FLOW_DECORATOR.PROVENANCE.eq("sample")).execute();
    System.out.println("--- saving: " + records.size());
    dsl.batchStore(records).execute();
    System.out.println("--- done");
}
Also used : LogicalFlowDecoratorRecord(com.khartec.waltz.schema.tables.records.LogicalFlowDecoratorRecord) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DSLContext(org.jooq.DSLContext)

Aggregations

LogicalFlowDecoratorRecord (com.khartec.waltz.schema.tables.records.LogicalFlowDecoratorRecord)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1