Search in sources :

Example 66 with DfIllegalPropertySettingException

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

the class DfAppClsTableLoader method throwAppClsRedundantCommentException.

protected void throwAppClsRedundantCommentException(String requestName, String resourceFile, DfClassificationTop top, DfClassificationElement element, String comment) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Found the redundant comment in the app classification.");
    br.addItem("Advice");
    br.addElement("Comment should not be same as code, name, alias.");
    br.addElement("Write description for the element or remove comment definition.");
    br.addElement("(Many redundant comments are noise to watch valueable comments)");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    code=ONE ; name=OneMan ; alias=Showbase ; comment=ONE // *Bad");
    br.addElement("    code=ONE ; name=OneMan ; alias=Showbase ; comment=OneMan // *Bad");
    br.addElement("    code=ONE ; name=OneMan ; alias=Showbase ; comment=Showbase // *Bad");
    br.addElement("  (o):");
    br.addElement("    code=ONE ; ... ; comment=beautiful show at the showbase // Good");
    br.addElement("    code=ONE ; name=OneMan ; alias=ShowBase // Good");
    br.addElement("");
    br.addElement("However if you need to suppress this stop, set the property as followings.");
    br.addElement("When lastaFluteMap.dfprop:");
    br.addElement(" e.g. appName is sea, freeGen title is appcls");
    br.addElement("  ; overrideMap = map:{");
    br.addElement("      ; sea.freeGen.appcls.isSuppressRedundantCommentStop = true");
    br.addElement("  }");
    br.addElement(" e.g. appName is hangar, freeGen title is land_cls (namedcls)");
    br.addElement("  ; overrideMap = map:{");
    br.addElement("      ; hangar.freeGen.land_cls.isSuppressRedundantCommentStop = true");
    br.addElement("  }");
    br.addElement("When freeGenMap.dfprop:");
    br.addElement("  ; optionMap = map:{");
    br.addElement("      ; isSuppressRedundantCommentStop = true");
    br.addElement("  }");
    br.addItem("FreeGen Request");
    br.addElement(requestName);
    br.addItem("Resource File");
    br.addElement(resourceFile);
    br.addItem("Classification");
    br.addElement(top.toString());
    br.addItem("Element");
    br.addElement(element.toString());
    br.addItem("Redundant Comment");
    br.addElement(comment);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 67 with DfIllegalPropertySettingException

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

the class DfRefClsLoadingHandler method assertRefClsOnlyOne.

// ===================================================================================
// Prepare refCls
// ==============
public void assertRefClsOnlyOne(String classificationName, DfRefClsElement refClsElement, Map<String, Object> elementMap, DfFreeGenResource resource) {
    if (refClsElement != null) {
        // only-one refCls is supported #for_now
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Duplicate refCls in the app classification.");
        br.addItem("Advice");
        br.addElement("Only-one refCls is supported in one app classification.");
        br.addItem("AppCls");
        br.addElement(classificationName);
        br.addItem("Existing refCls");
        br.addElement(refClsElement);
        br.addItem("Duplicate refCls");
        br.addElement(elementMap);
        br.addItem("dfprop File");
        br.addElement(resource.getResourceFile());
        final String msg = br.buildExceptionMessage();
        throw new DfIllegalPropertySettingException(msg);
    }
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 68 with DfIllegalPropertySettingException

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

the class DfRefClsLoadingHandler method throwAppClsRefClsIncludedCodeConflictException.

protected void throwAppClsRefClsIncludedCodeConflictException(DfClassificationTop classificationTop, DfRefClsElement refClsElement, String conflictedCode, DfFreeGenResource resource) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The literal code is conflicted with included code by refCls.");
    br.addItem("Advice");
    br.addElement("Make sure your classification code of literal and included.");
    br.addElement("Basically you cannot define literal code same as included code.");
    br.addElement("");
    br.addElement("While, if you need to override included element by literal element,");
    br.addElement("add 'override' attribute to the literal element definition.");
    br.addElement("For example:");
    br.addElement("  (o): name attribute is overridden");
    br.addElement("    map:{ code=FML ; override=true ; name=OneMan }");
    br.addElement("");
    br.addElement("  (o): both name and alias attributes are overridden");
    br.addElement("    map:{ code=FML ; override=true ; name=OneMan ; alias=Showbase }");
    br.addItem("AppCls");
    br.addElement(classificationTop.getClassificationName());
    br.addItem("RefCls");
    br.addElement(refClsElement);
    br.addItem("Conflicted Code");
    br.addElement(conflictedCode);
    br.addItem("dfprop File");
    br.addElement(resource.getResourceFile());
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 69 with DfIllegalPropertySettingException

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

the class DfJsonFreeAgent method throwKeyPathExpectedMapListButNotMapException.

protected void throwKeyPathExpectedMapListButNotMapException(String requestName, DfFreeGenResource resource, String keyPath, String targetPath, List<Object> currentList, Object element) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The key path expects string type in list but not string. (FreeGen)");
    br.addItem("Request Name");
    br.addElement(requestName);
    br.addItem("JSON File");
    br.addElement(resource.getResourceFile());
    br.addItem("keyPath");
    br.addElement(keyPath);
    br.addItem("Target Path Element");
    br.addElement(targetPath);
    br.addItem("List Object");
    br.addElement(currentList != null ? currentList.getClass().getName() : null);
    br.addElement(currentList);
    br.addItem("Actual Element");
    br.addElement(element != null ? element.getClass().getName() : null);
    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 70 with DfIllegalPropertySettingException

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

the class DfJsonFreeAgent method throwRootMapKeyNotFoundException.

protected void throwRootMapKeyNotFoundException(String requestName, DfFreeGenResource resource, String keyPath, String rootMapKey) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the key in the root map. (FreeGen)");
    br.addItem("Request Name");
    br.addElement(requestName);
    br.addItem("JSON File");
    br.addElement(resource.getResourceFile());
    br.addItem("keyPath");
    br.addElement(keyPath);
    br.addItem("RootMap Key");
    br.addElement(rootMapKey);
    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