Search in sources :

Example 21 with DfIllegalPropertySettingException

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

the class DfClsTopDeprecatedExistenceVerifier 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(_classificationTop.getClassificationName());
    br.addItem("Existing Element");
    final StringBuilder sb = new StringBuilder();
    for (DfClassificationElement element : _classificationTop.getClassificationElementList()) {
        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 : DfClassificationElement(org.dbflute.properties.assistant.classification.DfClassificationElement) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 22 with DfIllegalPropertySettingException

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

the class DfLastaFluteFreeGenReflector method reflectFrom.

// ===================================================================================
// Prepare FreeGen
// ===============
public void reflectFrom(Map<String, Object> lastafluteMap, String lastaDocOutputDirectory) {
    _log.info("Before LastaFlute refecting, existing freeGen settigs: " + _freeGenMap.keySet());
    boolean hasCommonEnv = false;
    boolean hasCommonConfig = false;
    boolean hasCommonLabel = false;
    boolean hasCommonMessage = false;
    @SuppressWarnings("unchecked") final Map<String, Object> commonMap = (Map<String, Object>) lastafluteMap.get("commonMap");
    if (commonMap != null) {
        final String path = (String) commonMap.get("path");
        final List<String> freeGenList = extractCommonFreeGenList(lastafluteMap, commonMap);
        for (String freeGen : freeGenList) {
            _log.info("...Reflecting common freeGen settigs: " + freeGen + ", " + path);
            if ("env".equals(freeGen)) {
                setupEnvGen(_uncapServiceName, path, false, false);
                hasCommonEnv = true;
            } else if ("config".equals(freeGen)) {
                final String pluginInterface = (String) commonMap.get("configPluginInterface");
                setupConfigGen(_uncapServiceName, path, hasCommonEnv, false, false, pluginInterface);
                hasCommonConfig = true;
            } else if ("label".equals(freeGen)) {
                setupLabelGen(_uncapServiceName, path, false, false, lastafluteMap);
                hasCommonLabel = true;
            } else if ("message".equals(freeGen)) {
                setupMessageGen(_uncapServiceName, path, hasCommonLabel, false, false, lastafluteMap);
                hasCommonMessage = true;
            } else if ("mail".equals(freeGen)) {
                final String pluginInterface = (String) commonMap.get("mailPluginInterface");
                setupMailFluteGen(_uncapServiceName, path, lastafluteMap, pluginInterface);
            } else if ("template".equals(freeGen)) {
                setupPmTemplateGen(_uncapServiceName, path, lastafluteMap);
            } else if ("doc".equals(freeGen)) {
                final String mailPluginInterface = (String) commonMap.get("mailPluginInterface");
                setupDocGen(_uncapServiceName, path, lastafluteMap, lastaDocOutputDirectory, freeGenList, mailPluginInterface);
            } else if ("namedcls".equals(freeGen)) {
                setupNamedClsGen(_uncapServiceName, path, lastafluteMap);
            } else {
                String msg = "Unkonwn type for commonMap's freeGen: " + freeGen;
                throw new DfIllegalPropertySettingException(msg);
            }
        }
    }
    boolean hasAppEnv = false;
    boolean hasAppLabel = false;
    @SuppressWarnings("unchecked") final Map<String, Map<String, Object>> appMap = (Map<String, Map<String, Object>>) lastafluteMap.get("appMap");
    if (appMap != null) {
        for (Entry<String, Map<String, Object>> entry : appMap.entrySet()) {
            final String appName = entry.getKey();
            final Map<String, Object> defMap = entry.getValue();
            final String path = (String) defMap.get("path");
            final List<String> freeGenList = extractAppFreeGenList(lastafluteMap, defMap);
            for (String freeGen : freeGenList) {
                _log.info("...Reflecting application freeGen settigs: " + appName + "." + freeGen);
                if ("env".equals(freeGen)) {
                    // should be before config, related each other
                    setupEnvGen(appName, path, hasCommonEnv, hasCommonConfig);
                    hasAppEnv = true;
                } else if ("config".equals(freeGen)) {
                    final String pluginInterface = (String) defMap.get("configPluginInterface");
                    setupConfigGen(appName, path, hasCommonEnv, hasCommonConfig, hasAppEnv, pluginInterface);
                } else if ("label".equals(freeGen)) {
                    setupLabelGen(appName, path, hasCommonLabel, hasCommonMessage, lastafluteMap);
                    hasAppLabel = true;
                } else if ("message".equals(freeGen)) {
                    setupMessageGen(appName, path, hasCommonLabel, hasCommonMessage, hasAppLabel, lastafluteMap);
                } else if ("mail".equals(freeGen)) {
                    final String pluginInterface = (String) defMap.get("mailPluginInterface");
                    setupMailFluteGen(appName, path, lastafluteMap, pluginInterface);
                } else if ("template".equals(freeGen)) {
                    setupPmTemplateGen(appName, path, lastafluteMap);
                } else if ("jsp".equals(freeGen)) {
                    setupJspPathGen(appName, path, lastafluteMap);
                } else if ("html".equals(freeGen)) {
                    setupHtmlPathGen(appName, path, lastafluteMap);
                } else if ("doc".equals(freeGen)) {
                    final String mailPluginInterface = (String) defMap.get("mailPluginInterface");
                    setupDocGen(appName, path, lastafluteMap, lastaDocOutputDirectory, freeGenList, mailPluginInterface);
                } else if ("appcls".equals(freeGen)) {
                    setupAppClsGen(appName, path, lastafluteMap);
                } else if ("webcls".equals(freeGen)) {
                    setupWebClsGen(appName, path, lastafluteMap);
                } else if ("namedcls".equals(freeGen)) {
                    setupNamedClsGen(appName, path, lastafluteMap);
                } else if ("clientcls".equals(freeGen)) {
                    setupClientClsGen(appName, path, lastafluteMap);
                } else {
                    String msg = "Unkonwn type for appMap's freeGen: " + freeGen;
                    throw new DfIllegalPropertySettingException(msg);
                }
            }
        }
    }
    showFreeGenSettings();
}
Also used : LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 23 with DfIllegalPropertySettingException

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

the class DfClsTopGroupInheritanceArranger method throwClassificationReferredGroupingMapConflictException.

protected void throwClassificationReferredGroupingMapConflictException(DfClassificationGroup referredGroup) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The group name is conflicted with grouping map of the referred classification.");
    br.addItem("Advice");
    br.addElement("You cannot define same-name group as one of referred classification.");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    refCls has serviceAvailable");
    br.addElement("    myCls has serviceAvailable // *Bad");
    br.addElement("  (o):");
    br.addElement("    refCls has serviceAvailable");
    br.addElement("    myCls has otherNameAvailable // Good");
    br.addItem("Classification Name");
    br.addElement(_classificationTop.getClassificationName());
    br.addItem("refCls Name");
    br.addElement(_referredClsTop.getClassificationName());
    br.addItem("Conflicted Group");
    br.addElement(referredGroup.getGroupName());
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 24 with DfIllegalPropertySettingException

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

the class DfClsTopLiteralArranger method throwUnknownClassificationUndefinedCodeHandlingTypeException.

protected void throwUnknownClassificationUndefinedCodeHandlingTypeException(String code) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Unknown handling type of classification undefined code.");
    br.addItem("Advice");
    br.addElement("You can specify following types:");
    for (ClassificationUndefinedHandlingType handlingType : ClassificationUndefinedHandlingType.values()) {
        br.addElement(" " + handlingType.code());
    }
    final String exampleCode = ClassificationUndefinedHandlingType.EXCEPTION.code();
    br.addElement("");
    br.addElement("For example: (classificationDefinitionMap.dfprop)");
    br.addElement("; [classification-name] = list:{");
    br.addElement("    ; map:{");
    br.addElement("        ; topComment=...");
    br.addElement("        ; codeType=String");
    br.addElement("        ; classificationUndefinedCodeHandlingType = " + exampleCode);
    br.addElement("        ...");
    br.addElement("    }");
    br.addElement("}");
    br.addItem("Specified Unknown Type");
    br.addElement(code);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ClassificationUndefinedHandlingType(org.dbflute.jdbc.ClassificationUndefinedHandlingType) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 25 with DfIllegalPropertySettingException

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

the class DfRefClsLoadingHandler method throwAppClsReferredClsThemeNotFoundException.

protected void throwAppClsReferredClsThemeNotFoundException(String classificationName, String refAttr, String refClsTheme, String refClsName, DfFreeGenResource resource) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the referred cls-theme from the app classification.");
    br.addItem("Advice");
    br.addElement("Make sure your cls-theme value of refCls attribute.");
    br.addElement("And refCls attribute depends on loading order.");
    br.addElement("For example, appcls can refers namedcls, but reverse cannot.");
    br.addElement("  (o):");
    br.addElement("    appcls to namedcls");
    br.addElement("    appcls to DB cls");
    br.addElement("    namedcls to DB cls");
    br.addElement("  (?):");
    br.addElement("    appcls to appcls (depending on FreeGen definition order)");
    br.addElement("");
    br.addElement("In case of reference to DB, if dbflute_maihamadb:");
    br.addElement("  refType=maihamadb@MemberStatus");
    br.addElement("");
    br.addElement("In case of reference to namedcls, if hangar_leonardo_cls.dfprop:");
    br.addElement("  refType=leonardo_cls@MemberStatus");
    br.addItem("AppCls");
    br.addElement(classificationName);
    br.addItem("RefCls Attribute");
    br.addElement(refAttr);
    br.addItem("NotFound Theme");
    br.addElement(refClsTheme);
    br.addItem("Existing Theme");
    br.addElement(DfRefClsReferenceRegistry.getInstance().getThemeClsTopMap().keySet());
    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)

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