Search in sources :

Example 36 with DfIllegalPropertySettingException

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

the class DfSplittingDfpropHandler method throwDfPropDefinitionDuplicateDefinitionException.

protected void throwDfPropDefinitionDuplicateDefinitionException(String mapName, String elementName, String keyword) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Found the duplicate definition.");
    br.addItem("Advice");
    br.addElement("The element names should be unique.");
    br.addElement("(in all split files if split)");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    Sea = map:{");
    br.addElement("        ; ...");
    br.addElement("    }");
    br.addElement("    Sea = map:{");
    br.addElement("        ; ...");
    br.addElement("    }");
    br.addElement("  (o):");
    br.addElement("    Land = map:{");
    br.addElement("        ; ...");
    br.addElement("    }");
    br.addElement("    Sea = map:{");
    br.addElement("        ; ...");
    br.addElement("    }");
    br.addItem("DBFlute Property");
    br.addElement(mapName);
    if (keyword != null) {
        br.addItem("Duplicate Found Location");
        br.addElement(keyword);
    }
    br.addItem("Duplicate Name");
    br.addElement(elementName);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 37 with DfIllegalPropertySettingException

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

the class DfRefClsRefTypeVerifier method doVerifyRefExists.

// -----------------------------------------------------
// Exists
// ------
protected void doVerifyRefExists(DfClassificationTop classificationTop) {
    final List<DfClassificationElement> appElementList = classificationTop.getClassificationElementList();
    final List<DfClassificationElement> referredElementList = _referredElementList;
    final List<DfClassificationElement> nonExistingList = appElementList.stream().filter(appElement -> {
        return notMatchesReferredElement(referredElementList, appElement);
    }).collect(Collectors.toList());
    if (!nonExistingList.isEmpty()) {
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Not found the app classification code in the referred classification");
        br.addItem("Advice");
        br.addElement("The codes of the app classification should be included");
        br.addElement("in the referred classification because of refType='exists'.");
        br.addElement("For example:");
        br.addElement("  (x): app(A), referred(B, C)");
        br.addElement("  (x): app(A, B), referred(A, C)");
        br.addElement("  (x): app(A, B, C), referred(A, B)");
        br.addElement("  (o): app(A), referred(A, B)");
        br.addElement("  (o): app(A, B), referred(A, B, C)");
        br.addElement("  (o): app(A, B, C), referred(A, B, C)");
        br.addItem("dfprop File");
        br.addElement(_resourceFile);
        br.addItem("AppCls");
        br.addElement(classificationTop.getClassificationName() + ": " + buildClsCodesExp(appElementList));
        br.addItem("ReferredCls");
        br.addElement(buildReferredExp() + ": " + buildClsCodesExp(referredElementList));
        br.addItem("Ref Type");
        br.addElement(_refType);
        br.addItem("Non-Existing Code");
        br.addElement(nonExistingList.stream().map(element -> {
            return element.getCode();
        }).collect(Collectors.joining(", ")));
        final String msg = br.buildExceptionMessage();
        throw new DfIllegalPropertySettingException(msg);
    }
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException) List(java.util.List) DfClassificationElement(org.dbflute.properties.assistant.classification.DfClassificationElement) DfClassificationTop(org.dbflute.properties.assistant.classification.DfClassificationTop) Collectors(java.util.stream.Collectors) Srl(org.dbflute.util.Srl) DfClassificationGroup(org.dbflute.properties.assistant.classification.DfClassificationGroup) DfClassificationElement(org.dbflute.properties.assistant.classification.DfClassificationElement) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 38 with DfIllegalPropertySettingException

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

the class DfAbstractHelperProperties method throwClassificationSplitDefinitionNotFoundException.

protected void throwClassificationSplitDefinitionNotFoundException(String mapName, String keyword) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the split definition of DBFlute property.");
    br.addItem("Advice");
    br.addElement("Make sure the file name of your split dfprop");
    br.addElement("or define at least one definition in the split file.");
    br.addElement("");
    br.addElement("For example:");
    br.addElement("    $$split$$ = map:{");
    br.addElement("        ; land = dummy");
    br.addElement("        ; sea  = dummy");
    br.addElement("    }");
    br.addElement("");
    br.addElement("The following files should exist:");
    br.addElement("    dfprop/" + mapName + "_land.dfprop");
    br.addElement("    dfprop/" + mapName + "_sea.dfprop");
    br.addItem("DBFlute Property");
    br.addElement(mapName);
    br.addItem("Split Keyword");
    br.addElement(keyword);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 39 with DfIllegalPropertySettingException

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

the class DfClassificationProperties method throwClassificationAlreadyExistsInDfPropException.

protected void throwClassificationAlreadyExistsInDfPropException(String classificationName, String settingName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The classification already exists in dfprop settings.");
    br.addItem("Advice");
    br.addElement("Check the classification names in '" + settingName + "' settings.");
    br.addElement("The settings may contain classifications existing in dfprop.");
    br.addItem("Classification");
    br.addElement(classificationName);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 40 with DfIllegalPropertySettingException

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

the class DfAppClsTableLoader 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 app classification.");
        br.addItem("Advice");
        br.addElement("Make sure your DB classification name.");
        br.addItem("AppCls");
        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)

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