Search in sources :

Example 1 with DfClassificationAllInOneSqlExecutor

use of org.dbflute.properties.assistant.classification.allinone.DfClassificationAllInOneSqlExecutor in project dbflute-core by dbflute.

the class DfClsTableAllInOneArranger method arrangeAllInOneTableClassification.

public void arrangeAllInOneTableClassification(Map<String, DfClassificationTop> classificationTopMap, Connection conn, String sql) {
    final DfClassificationAllInOneSqlExecutor executor = new DfClassificationAllInOneSqlExecutor();
    final List<Map<String, String>> resultList = executor.executeAllInOneSql(conn, sql);
    for (Map<String, String> map : resultList) {
        final String classificationName = map.get("classificationName");
        final DfClassificationTop classificationTop;
        {
            DfClassificationTop tmpTop = classificationTopMap.get(classificationName);
            if (tmpTop == null) {
                tmpTop = createAllInOneTableClassificationTop(classificationName);
                classificationTopMap.put(classificationName, tmpTop);
            }
            classificationTop = tmpTop;
        }
        // }
        if (!classificationTop.hasTopComment()) {
            final String topComment = map.get(DfClassificationTop.KEY_TOP_COMMENT);
            classificationTop.setTopComment(topComment);
        }
        if (!classificationTop.hasCodeType()) {
            final String codeType;
            {
                String tmpType = map.get(DfClassificationTop.KEY_CODE_TYPE);
                if (Srl.is_Null_or_TrimmedEmpty(tmpType)) {
                    // for compatibility
                    tmpType = map.get(DfClassificationTop.KEY_DATA_TYPE);
                }
                codeType = tmpType;
            }
            classificationTop.setCodeType(codeType);
        }
        final DfClassificationElement element = new DfClassificationElement();
        element.setClassificationName(classificationName);
        element.acceptBasicItemMap(map);
        classificationTop.addClassificationElement(element);
    }
}
Also used : DfClassificationElement(org.dbflute.properties.assistant.classification.DfClassificationElement) DfClassificationAllInOneSqlExecutor(org.dbflute.properties.assistant.classification.allinone.DfClassificationAllInOneSqlExecutor) DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 DfClassificationElement (org.dbflute.properties.assistant.classification.DfClassificationElement)1 DfClassificationTop (org.dbflute.properties.assistant.classification.DfClassificationTop)1 DfClassificationAllInOneSqlExecutor (org.dbflute.properties.assistant.classification.allinone.DfClassificationAllInOneSqlExecutor)1