Search in sources :

Example 6 with DfIllegalPropertySettingException

use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.

the class DfWebClsTableLoader method handleRefCls.

protected void handleRefCls(DfClassificationTop classificationTop, DfRefClsElement refClsElement) {
    refClsElement.checkFormalRefType(classificationTop);
    classificationTop.addRefClsElement(refClsElement);
    if (refClsElement.isRefTypeIncluded()) {
        final DfClassificationTop dbClsTop = refClsElement.getDBClsTop();
        final String groupName = refClsElement.getGroupName();
        if (groupName != null) {
            final DfClassificationGroup group = dbClsTop.getGroupList().stream().filter(gr -> {
                return gr.getGroupName().equals(groupName);
            }).findFirst().orElseThrow(() -> {
                String msg = "Not found the group name: " + refClsElement.getClassificationName() + "." + groupName;
                return new DfIllegalPropertySettingException(msg);
            });
            classificationTop.addClassificationElementAll(group.getElementList());
        } else {
            final List<DfClassificationElement> dbElementList = dbClsTop.getClassificationElementList();
            classificationTop.addClassificationElementAll(dbElementList);
            classificationTop.acceptGroupList(dbClsTop.getGroupList());
        }
    }
}
Also used : DfClassificationGroup(org.dbflute.properties.assistant.classification.DfClassificationGroup) DfClassificationElement(org.dbflute.properties.assistant.classification.DfClassificationElement) DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 7 with DfIllegalPropertySettingException

use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.

the class DfWebClsTableLoader method findDBCls.

protected DfClassificationTop findDBCls(String classificationName, String refClsName, Map<String, DfClassificationTop> dbClsMap, DfFreeGenResource resource) {
    final DfClassificationTop refTop = dbClsMap.get(refClsName);
    if (refTop == null) {
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Not found the DB classification for web classification.");
        br.addItem("Advice");
        br.addElement("Make sure your DB classification name.");
        br.addItem("WebCls");
        br.addElement(classificationName);
        br.addItem("NotFound DBCls");
        br.addElement(refClsName);
        br.addItem("Existing DBCls");
        br.addElement(dbClsMap.keySet());
        br.addItem("dfprop File");
        br.addElement(resource.getResourceFile());
        final String msg = br.buildExceptionMessage();
        throw new DfIllegalPropertySettingException(msg);
    }
    return refTop;
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 8 with DfIllegalPropertySettingException

use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.

the class DfClassificationGroup method throwClassificationGroupingMapElementNotFoundException.

protected void throwClassificationGroupingMapElementNotFoundException(String elementName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the classification element in the grouping map.");
    br.addItem("Classification Name");
    br.addElement(_classificationTop.getClassificationName());
    br.addItem("Group Name");
    br.addElement(_groupName);
    br.addItem("NotFound Name");
    br.addElement(elementName);
    br.addItem("Defined Element");
    final List<DfClassificationElement> elementList = _classificationTop.getClassificationElementList();
    for (DfClassificationElement element : elementList) {
        br.addElement(element);
    }
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 9 with DfIllegalPropertySettingException

use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.

the class DfClassificationTop method throwDeprecatedClassificationElementNotFoundException.

protected void throwDeprecatedClassificationElementNotFoundException(String deprecated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the specified element in deprecated list.");
    br.addItem("Classification");
    br.addElement(_classificationName);
    br.addItem("Existing Element");
    final StringBuilder sb = new StringBuilder();
    for (DfClassificationElement element : _elementList) {
        if (sb.length() > 0) {
            sb.append(", ");
        }
        sb.append(element.getName());
    }
    br.addElement(sb.toString());
    br.addItem("NotFound Element");
    br.addElement(deprecated);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 10 with DfIllegalPropertySettingException

use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.

the class DfClassificationTop method throwClassificationGroupingMapReferenceNotFoundException.

protected void throwClassificationGroupingMapReferenceNotFoundException(List<DfClassificationGroup> groupList, DfClassificationGroup group, String refName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the refenrece in the grouping map.");
    br.addItem("Classification Name");
    br.addElement(group.getClassificationName());
    br.addItem("Group Name");
    br.addElement(group.getGroupName());
    br.addItem("NotFound Name");
    br.addElement(refName);
    br.addItem("Defined Group");
    for (DfClassificationGroup defined : groupList) {
        br.addElement(defined);
    }
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Aggregations

DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)76 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)58 Map (java.util.Map)9 DfClassificationTop (org.dbflute.properties.assistant.classification.DfClassificationTop)9 List (java.util.List)8 DfClassificationElement (org.dbflute.properties.assistant.classification.DfClassificationElement)8 LinkedHashMap (java.util.LinkedHashMap)6 ArrayList (java.util.ArrayList)5 StringKeyMap (org.dbflute.helper.StringKeyMap)4 DfClassificationGroup (org.dbflute.properties.assistant.classification.DfClassificationGroup)4 Collectors (java.util.stream.Collectors)3 ClassificationUndefinedHandlingType (org.dbflute.jdbc.ClassificationUndefinedHandlingType)3 DfRefClsElement (org.dbflute.properties.assistant.classification.DfRefClsElement)3 RichTextString (org.apache.poi.ss.usermodel.RichTextString)2 DfIllegalPropertyTypeException (org.dbflute.exception.DfIllegalPropertyTypeException)2 ScopeInfo (org.dbflute.util.Srl.ScopeInfo)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1