Search in sources :

Example 16 with DfIllegalPropertySettingException

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

the class DfPropHtmlManager method assertPropHtmlRootFileExists.

protected void assertPropHtmlRootFileExists(Map<String, DfPropHtmlFileAttribute> defaultEnvMap, String requestName, String rootFile) {
    if (!defaultEnvMap.isEmpty()) {
        return;
    }
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the root file for PropertiesHtml.");
    br.addItem("Request Name");
    br.addElement(requestName);
    br.addItem("Root File");
    br.addElement(rootFile);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 17 with DfIllegalPropertySettingException

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

the class DfPropHtmlRequest method checkEnvOnlyNoLang.

protected void checkEnvOnlyNoLang(String propertyKey, DfPropHtmlProperty property) {
    if (_envOnlyFloatLeft && property.getLangTypeSet().size() >= 2) {
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Env only mode but two lang types exist.");
        br.addItem("Advice");
        br.addElement("You cannot use isEnvOnlyFloatLeft if lang type is plural");
        br.addElement("in request of PropertiesHtml.");
        br.addItem("Request");
        br.addElement(_requestName);
        br.addItem("Property");
        br.addElement(propertyKey);
        br.addItem("Lang Types");
        br.addElement(property.getLangTypeSet());
        final String msg = br.buildExceptionMessage();
        throw new DfIllegalPropertySettingException(msg);
    }
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 18 with DfIllegalPropertySettingException

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

the class DfAdditionalForeignKeyInitializer method getForeignColumnNameList.

protected List<String> getForeignColumnNameList(String foreignKeyName, final String foreignTableName) {
    List<String> foreignColumnNameList = getForeignColumnNameList(foreignKeyName);
    if (foreignColumnNameList != null && !foreignColumnNameList.isEmpty()) {
        return foreignColumnNameList;
    }
    foreignColumnNameList = DfCollectionUtil.newArrayList();
    final List<Column> foreignPrimaryKeyList = getTable(foreignTableName).getPrimaryKey();
    if (foreignPrimaryKeyList.isEmpty()) {
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Not found primary key on the foreign table of additionalForeignKey.");
        br.addItem("Advice");
        br.addElement("Foreign table should have primary keys.");
        br.addItem("Additional FK");
        br.addElement(foreignKeyName);
        br.addItem("Foreign Table");
        br.addElement(foreignTableName);
        final String msg = br.buildExceptionMessage();
        throw new DfIllegalPropertySettingException(msg);
    }
    for (Column column : foreignPrimaryKeyList) {
        foreignColumnNameList.add(column.getName());
    }
    return foreignColumnNameList;
}
Also used : Column(org.apache.torque.engine.database.model.Column) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 19 with DfIllegalPropertySettingException

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

the class DfClsTopGroupListArranger 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 : DfClassificationGroup(org.dbflute.properties.assistant.classification.DfClassificationGroup) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 20 with DfIllegalPropertySettingException

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

the class DfLastaFlutePropertiesHtmlReflector method reflectFrom.

// ===================================================================================
// Prepare FreeGen
// ===============
public void reflectFrom(Map<String, Object> lastafluteMap) {
    logger.info("Before LastaFlute refecting, existing propertiesHtml settigs: " + _propHtmlMap.keySet());
    final boolean lastaEnv = isUseLastaEnv(lastafluteMap);
    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");
        @SuppressWarnings("unchecked") final List<String> propertiesHtmlList = (List<String>) commonMap.getOrDefault(PROPERTIES_HTML_KEY, Collections.emptyList());
        for (String propertiesHtml : propertiesHtmlList) {
            logger.info("...Reflecting common propertiesHtml settigs: " + propertiesHtml + ", " + path);
            if ("env".equals(propertiesHtml)) {
                setupEnv(_uncapServiceName, path, false, false, lastaEnv);
                hasCommonEnv = true;
            } else if ("config".equals(propertiesHtml)) {
                setupConfig(_uncapServiceName, path, hasCommonEnv, false, false);
                hasCommonConfig = true;
            } else if ("label".equals(propertiesHtml)) {
                setupLabel(_uncapServiceName, path, false, false);
                hasCommonLabel = true;
            } else if ("message".equals(propertiesHtml)) {
                setupMessage(_uncapServiceName, path, hasCommonLabel, false, false);
                hasCommonMessage = true;
            } else {
                String msg = "Unkonwn type for commonMap's propertiesHtml: " + propertiesHtml;
                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");
            @SuppressWarnings("unchecked") final List<String> propertiesHtmlList = (List<String>) defMap.getOrDefault(PROPERTIES_HTML_KEY, Collections.emptyList());
            for (String propertiesHtml : propertiesHtmlList) {
                logger.info("...Reflecting application propertiesHtml settigs: " + appName + "." + propertiesHtml);
                if ("env".equals(propertiesHtml)) {
                    setupEnv(appName, path, hasCommonEnv, hasCommonConfig, lastaEnv);
                    hasAppEnv = true;
                } else if ("config".equals(propertiesHtml)) {
                    setupConfig(appName, path, hasCommonEnv, hasCommonConfig, hasAppEnv);
                } else if ("label".equals(propertiesHtml)) {
                    setupLabel(appName, path, hasCommonLabel, hasCommonMessage);
                    hasAppLabel = true;
                } else if ("message".equals(propertiesHtml)) {
                    setupMessage(appName, path, hasCommonLabel, hasCommonMessage, hasAppLabel);
                } else {
                    String msg = "Unkonwn type for appMap's propertiesHtml: " + propertiesHtml;
                    throw new DfIllegalPropertySettingException(msg);
                }
            }
        }
    }
    showPropertiesHtmlSettings();
}
Also used : List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) 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