Search in sources :

Example 31 with DfIllegalPropertySettingException

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

the class DfJsonFreeAgent method throwKeyPathExpectedMapButNotMapException.

protected void throwKeyPathExpectedMapButNotMapException(String requestName, DfFreeGenResource resource, String keyPath, String targetPath, Object current) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The key path expects map type but not 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("Target Path Element");
    br.addElement(targetPath);
    br.addItem("Actual Object");
    br.addElement(current != null ? current.getClass().getName() : null);
    br.addElement(current);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 32 with DfIllegalPropertySettingException

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

the class DfPropTableLoader method throwFreeGenPropReadFailureException.

protected void throwFreeGenPropReadFailureException(String requestName, DfFreeGenResource resource, Map<String, Object> tableMap, Map<String, Map<String, String>> mappingMap, RuntimeException cause) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Failed to read the property for free-gen.");
    br.addItem("Current Request");
    br.addElement(requestName);
    br.addItem("Resource");
    br.addElement(resource);
    br.addItem("tableMap");
    if (!tableMap.isEmpty()) {
        for (Entry<String, Object> entry : tableMap.entrySet()) {
            br.addElement(entry.getKey() + " = " + entry.getValue());
        }
    } else {
        br.addElement("*empty");
    }
    br.addItem("mappingMap");
    if (!mappingMap.isEmpty()) {
        for (Entry<String, Map<String, String>> entry : mappingMap.entrySet()) {
            br.addElement(entry.getKey() + " = " + entry.getValue());
        }
    } else {
        br.addElement("*empty");
    }
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg, cause);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) Map(java.util.Map) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 33 with DfIllegalPropertySettingException

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

the class DfElasticsearchLoadingAgent method throwJsonTablePathPropertyNotFoundException.

protected void throwJsonTablePathPropertyNotFoundException() {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the table path in the tableMap property. (FreeGen)");
    br.addItem("Request Name");
    br.addElement(_requestName);
    br.addItem("JSON File");
    br.addElement(_resource.getResourceFile());
    br.addItem("tableMap");
    br.addElement(_mapProp.getOptionMap());
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 34 with DfIllegalPropertySettingException

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

the class DfBasicProperties method throwBasicInfoSubTypeOnDatabaseUnknownException.

protected void throwBasicInfoSubTypeOnDatabaseUnknownException(String subType) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Unknown value of the property 'subTypeOnDatabase' in basicInfoMap.dfprop.");
    br.addItem("Advice");
    br.addElement("Only supported types can be set.");
    br.addElement("For example, if database is 'sqlserver', databaseSubType can be 'localdb'.");
    br.addItem("Target Database");
    br.addElement(getTargetDatabase());
    br.addItem("SubType on Database");
    br.addElement(subType);
    final String msg = br.buildExceptionMessage();
    throw new DfIllegalPropertySettingException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 35 with DfIllegalPropertySettingException

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

the class DfDocumentProperties method getLoadDataReverseXlsLimit.

// -----------------------------------------------------
// XLS Limit
// ---------
public Integer getLoadDataReverseXlsLimit() {
    final Map<String, Object> loadDataReverseMap = getLoadDataReverseMap();
    String limitExp = null;
    if (!loadDataReverseMap.isEmpty()) {
        limitExp = (String) loadDataReverseMap.get("xlsLimit");
    }
    if (limitExp == null) {
        // if null, default limit
        return null;
    }
    final Integer limit;
    try {
        limit = Integer.valueOf(limitExp);
    } catch (NumberFormatException e) {
        String msg = "The property 'xlsLimit' of loadDataReverse in " + KEY_oldDocumentMap;
        msg = msg + " should be number but: value=" + limitExp;
        throw new DfIllegalPropertyTypeException(msg, e);
    }
    if (limit < 0) {
        String msg = "The property 'xlsLimit' of loadDataReverse in " + KEY_oldDocumentMap;
        msg = msg + " should be zero or plus number but minus: value=" + limit;
        throw new DfIllegalPropertySettingException(msg);
    }
    return limit;
}
Also used : DfIllegalPropertyTypeException(org.dbflute.exception.DfIllegalPropertyTypeException) 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