Search in sources :

Example 1 with DfClassificationAllInOneSqlExecutor

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

the class DfClassificationProperties method processAllInOneTableClassification.

// -----------------------------------------------------
// All-in-One Table Classification
// -------------------------------
protected void processAllInOneTableClassification(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.DfClassificationAllInOneSqlExecutor) DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1 DfClassificationAllInOneSqlExecutor (org.dbflute.properties.assistant.classification.DfClassificationAllInOneSqlExecutor)1 DfClassificationElement (org.dbflute.properties.assistant.classification.DfClassificationElement)1 DfClassificationTop (org.dbflute.properties.assistant.classification.DfClassificationTop)1