Search in sources :

Example 36 with DfClassificationTop

use of org.dbflute.properties.assistant.classification.DfClassificationTop 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)

Example 37 with DfClassificationTop

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

the class DfClassificationResourceDefinitionReflector method reflectClassificationResourceToDefinition.

// ===================================================================================
// Reflect to Definition
// =====================
public void reflectClassificationResourceToDefinition(Map<String, DfClassificationTop> classificationTopMap) {
    final Set<String> alreadySet = new HashSet<String>(classificationTopMap.keySet());
    for (DfClassificationTop resourcePresentsTop : _resourcePresentsTopList) {
        final String classificationName = resourcePresentsTop.getClassificationName();
        if (alreadySet.contains(classificationName)) {
            throwClassificationAlreadyExistsInDfPropException(classificationName, "ClassificationResource");
        }
        // reflect to classification top definition
        classificationTopMap.put(classificationName, resourcePresentsTop);
    }
}
Also used : DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) HashSet(java.util.HashSet)

Example 38 with DfClassificationTop

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

the class DfClassificationResourceDeploymentReflector method reflectClassificationResourceToDeployment.

// ===================================================================================
// Reflect to Deployment
// =====================
public void reflectClassificationResourceToDeployment(Supplier<Map<String, String>> allColumnClassificationMapProvider) {
    final List<DfClassificationTop> classificationTopList = _resourcePresentsTopList;
    for (DfClassificationTop classificationTop : classificationTopList) {
        final String classificationName = classificationTop.getClassificationName();
        final String relatedColumnName = classificationTop.getRelatedColumnName();
        if (relatedColumnName == null) {
            continue;
        }
        // both callback to keep process order
        _allColumnClsSetupper.process();
        final Map<String, String> allColumnClassificationMap = allColumnClassificationMapProvider.get();
        if (allColumnClassificationMap.containsKey(relatedColumnName)) {
            continue;
        }
        allColumnClassificationMap.put(relatedColumnName, classificationName);
    }
}
Also used : DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop)

Aggregations

DfClassificationTop (org.dbflute.properties.assistant.classification.DfClassificationTop)38 DfClassificationElement (org.dbflute.properties.assistant.classification.DfClassificationElement)11 ArrayList (java.util.ArrayList)10 DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)10 List (java.util.List)6 Map (java.util.Map)6 DfClassificationProperties (org.dbflute.properties.DfClassificationProperties)5 DfClassificationGroup (org.dbflute.properties.assistant.classification.DfClassificationGroup)5 LinkedHashMap (java.util.LinkedHashMap)4 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)4 DfRefClsElement (org.dbflute.properties.assistant.classification.refcls.DfRefClsElement)4 DfRefClsElement (org.dbflute.properties.assistant.classification.DfRefClsElement)3 DfRefClsReferredCDef (org.dbflute.properties.assistant.classification.refcls.DfRefClsReferredCDef)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 Collectors (java.util.stream.Collectors)2 DfFixedConditionInvalidClassificationEmbeddedCommentException (org.dbflute.exception.DfFixedConditionInvalidClassificationEmbeddedCommentException)2 StringKeyMap (org.dbflute.helper.StringKeyMap)2 ClassificationUndefinedHandlingType (org.dbflute.jdbc.ClassificationUndefinedHandlingType)2 DfClsElementLiteralArranger (org.dbflute.properties.assistant.classification.element.proploading.DfClsElementLiteralArranger)2