org.jooq.Record6 Java Examples

The following examples show how to use org.jooq.Record6. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrgUnitExtractor.java    From waltz with Apache License 2.0 5 votes vote down vote up
private SelectJoinStep<Record6<Long, Long, String, String, String, String>> prepareExtract() {
    return dsl
            .select(
                ORGANISATIONAL_UNIT.ID.as("id"),
                ORGANISATIONAL_UNIT.PARENT_ID.as("parentId"),
                ORGANISATIONAL_UNIT.NAME.as("name"),
                ORGANISATIONAL_UNIT.DESCRIPTION.as("description"),
                ORGANISATIONAL_UNIT.EXTERNAL_ID.as("externalId"),
                ORGANISATIONAL_UNIT.PROVENANCE.as("provenance"))
            .from(ORGANISATIONAL_UNIT);
}
 
Example #2
Source File: ScenarioExtractor.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Object extract(Request request, Response response) throws Exception {

        long scenarioId = getId(request);

        Measurable rowMeasurable = MEASURABLE.as("rowMeasurable");
        Measurable colMeasurable = MEASURABLE.as("colMeasurable");
        ScenarioAxisItem rowAxisItem = SCENARIO_AXIS_ITEM.as("rowAxisItem");
        ScenarioAxisItem colAxisItem = SCENARIO_AXIS_ITEM.as("colAxisItem");

        Condition rowMeasurableJoin = rowMeasurable.ID.eq(SCENARIO_RATING_ITEM.ROW_ID)
                .and(SCENARIO_RATING_ITEM.ROW_KIND.eq(EntityKind.MEASURABLE.name()));

        Condition colMeasurableJoin = colMeasurable.ID.eq(SCENARIO_RATING_ITEM.COLUMN_ID)
                .and(SCENARIO_RATING_ITEM.COLUMN_KIND.eq(EntityKind.MEASURABLE.name()));

        Condition appJoin = APPLICATION.ID.eq(SCENARIO_RATING_ITEM.DOMAIN_ITEM_ID)
                .and(SCENARIO_RATING_ITEM.DOMAIN_ITEM_KIND.eq(EntityKind.APPLICATION.name()));

        Condition rowAxisItemJoin = rowAxisItem.DOMAIN_ITEM_ID.eq(SCENARIO_RATING_ITEM.ROW_ID)
                .and(rowAxisItem.ORIENTATION.eq(AxisOrientation.ROW.name()))
                .and(rowAxisItem.SCENARIO_ID.eq(SCENARIO_RATING_ITEM.SCENARIO_ID));

        Condition colAxisItemJoin = colAxisItem.DOMAIN_ITEM_ID.eq(SCENARIO_RATING_ITEM.COLUMN_ID)
                .and(colAxisItem.ORIENTATION.eq(AxisOrientation.COLUMN.name()))
                .and(colAxisItem.SCENARIO_ID.eq(SCENARIO_RATING_ITEM.SCENARIO_ID));

        SelectConditionStep<Record6<String, String, String, String, String, String>> qry = dsl
                .select(
                    APPLICATION.NAME.as("Application"),
                    APPLICATION.ASSET_CODE.as("App Asset Code"),
                    colMeasurable.NAME.as("Column"),
                    rowMeasurable.NAME.as("Row"),
                    RATING_SCHEME_ITEM.NAME.as("Rating"),
                    SCENARIO_RATING_ITEM.DESCRIPTION.as("Description"))
                .from(SCENARIO_RATING_ITEM)
                .innerJoin(APPLICATION)
                .on(appJoin)
                .innerJoin(rowMeasurable)
                .on(rowMeasurableJoin)
                .innerJoin(colMeasurable)
                .on(colMeasurableJoin)
                .innerJoin(rowAxisItem)
                .on(rowAxisItemJoin)
                .innerJoin(colAxisItem)
                .on(colAxisItemJoin)
                .innerJoin(SCENARIO)
                .on(SCENARIO.ID.eq(scenarioId))
                .innerJoin(ROADMAP)
                .on(ROADMAP.ID.eq(SCENARIO.ROADMAP_ID))
                .innerJoin(RATING_SCHEME_ITEM)
                .on(RATING_SCHEME_ITEM.SCHEME_ID.eq(ROADMAP.RATING_SCHEME_ID).and(RATING_SCHEME_ITEM.CODE.eq(SCENARIO_RATING_ITEM.RATING)))
                .where(SCENARIO_RATING_ITEM.SCENARIO_ID.eq(scenarioId));


        String scenarioName = dsl
                .select(SCENARIO.NAME)
                .from(SCENARIO)
                .where(SCENARIO.ID.eq(scenarioId))
                .fetchOne(SCENARIO.NAME);

        String suggestedFilename = "scenario-" + scenarioName;

        return writeExtract(suggestedFilename, qry, request, response);
    }