Search in sources :

Example 1 with DfRequiredPropertyNotFoundException

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

the class TorqueDocumentationTask method throwSchemaSyncCheckPropertyNotFoundException.

protected void throwSchemaSyncCheckPropertyNotFoundException() {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the property for SchemaSyncCheck.");
    br.addItem("Advice");
    br.addElement("You should set the property like this:");
    br.addElement("[documentDefinitionMap.dfprop]");
    br.addElement("  ; schemaSyncCheckMap = map:{");
    br.addElement("      ; url = jdbc:...");
    br.addElement("      ; schema = EXAMPLEDB");
    br.addElement("      ; user = exampuser");
    br.addElement("      ; password = exampword");
    br.addElement("  }");
    final String msg = br.buildExceptionMessage();
    throw new DfRequiredPropertyNotFoundException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException)

Example 2 with DfRequiredPropertyNotFoundException

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

the class TorqueDocumentationTask method throwLoadDataReversePropertyNotFoundException.

protected void throwLoadDataReversePropertyNotFoundException() {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the property for LoadDataReverse.");
    br.addItem("Advice");
    br.addElement("You should set the property like this:");
    br.addElement("[documentDefinitionMap.dfprop]");
    br.addElement("  ; loadDataReverseMap = map:{");
    br.addElement("      ; recordLimit = -1");
    br.addElement("      ; isReplaceSchemaDirectUse = true");
    br.addElement("      ; isOverrideExistingDataFile = false");
    br.addElement("  }");
    final String msg = br.buildExceptionMessage();
    throw new DfRequiredPropertyNotFoundException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException)

Example 3 with DfRequiredPropertyNotFoundException

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

the class DfReplaceSchemaProperties method getAdditionalDropSchema.

public UnifiedSchema getAdditionalDropSchema(Map<String, Object> additionalDropMap) {
    final String url = getAdditionalDropUrl(additionalDropMap);
    final String catalog;
    if (Srl.is_NotNull_and_NotTrimmedEmpty(url)) {
        final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
        final DfUrlAnalyzer analyzer = factory.createAnalyzer();
        catalog = analyzer.extractCatalog();
    } else {
        catalog = getDatabaseProperties().getDatabaseCatalog();
    }
    final Object obj = additionalDropMap.get("schema");
    if (obj == null) {
        if (!isDatabaseAsSchemaSpecificationOmittable()) {
            String msg = "The schema is required:";
            msg = msg + " additionalDropMap=" + additionalDropMap;
            throw new DfRequiredPropertyNotFoundException(msg);
        }
        return null;
    }
    final String schema = castToString(obj, "additionalDropMapList.schema");
    final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalog, schema);
    return unifiedSchema;
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfUrlAnalyzerFactory(org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory)

Example 4 with DfRequiredPropertyNotFoundException

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

the class DfDatabaseProperties method getAdditionalSchemaMap.

protected Map<String, DfAdditionalSchemaInfo> getAdditionalSchemaMap() {
    if (_additionalSchemaMap != null) {
        return _additionalSchemaMap;
    }
    assertOldStyleAdditionalSchema();
    _additionalSchemaMap = StringKeyMap.createAsCaseInsensitive();
    final Map<String, Object> additionalSchemaMap = getVairousStringKeyMap("additionalSchemaMap");
    if (additionalSchemaMap.isEmpty()) {
        return _additionalSchemaMap;
    }
    final Set<Entry<String, Object>> entrySet = additionalSchemaMap.entrySet();
    for (Entry<String, Object> entry : entrySet) {
        final String identifiedSchema = entry.getKey();
        final Object obj = entry.getValue();
        if (obj == null) {
            String msg = "The value of schema in the property 'additionalSchemaMap' should be required:";
            msg = msg + " identifiedSchema=" + identifiedSchema;
            msg = msg + " additionalSchemaMap=" + additionalSchemaMap;
            throw new DfRequiredPropertyNotFoundException(msg);
        }
        if (!(obj instanceof Map<?, ?>)) {
            String msg = "The type of schema value in the property 'additionalSchemaMap' should be Map:";
            msg = msg + " type=" + DfTypeUtil.toClassTitle(obj) + " value=" + obj;
            throw new DfIllegalPropertyTypeException(msg);
        }
        @SuppressWarnings("unchecked") final Map<String, Object> elementMap = (Map<String, Object>) obj;
        final DfAdditionalSchemaInfo info = new DfAdditionalSchemaInfo();
        final String catalog;
        final boolean explicitCatalog;
        if (identifiedSchema.contains(".")) {
            catalog = Srl.substringFirstFront(identifiedSchema, ".");
            explicitCatalog = true;
        } else {
            // as main catalog
            catalog = getDatabaseCatalog();
            explicitCatalog = false;
        }
        final String schema = filterDatabaseSchema(Srl.substringFirstRear(identifiedSchema, "."));
        final UnifiedSchema unifiedSchema = createAsAdditionalSchema(catalog, schema, explicitCatalog);
        info.setUnifiedSchema(unifiedSchema);
        setupAdditionalSchemaObjectTypeTargetList(info, elementMap);
        setupAdditionalSchemaTableExceptList(info, elementMap);
        setupAdditionalSchemaTableTargetList(info, elementMap);
        setupAdditionalSchemaColumnExceptList(info, elementMap);
        info.setSuppressCommonColumn(isProperty("isSuppressCommonColumn", false, elementMap));
        info.setSuppressProcedure(isProperty("isSuppressProcedure", false, elementMap));
        _additionalSchemaMap.put(unifiedSchema.getIdentifiedSchema(), info);
    }
    return _additionalSchemaMap;
}
Also used : DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException) Entry(java.util.Map.Entry) DfIllegalPropertyTypeException(org.dbflute.exception.DfIllegalPropertyTypeException) DfAdditionalSchemaInfo(org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap)

Example 5 with DfRequiredPropertyNotFoundException

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

the class DfBasicProperties method throwBasicInfoDatabaseNotFoundException.

protected void throwBasicInfoDatabaseNotFoundException(String returnedValue) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the property 'database' in basicInfoMap.dfprop.");
    br.addItem("Returned Value");
    br.addElement(returnedValue);
    br.addItem("Map");
    final Map<String, Object> basicInfoMap = getBasicInfoMap();
    for (Entry<String, Object> entry : basicInfoMap.entrySet()) {
        br.addElement(entry.getKey() + " = " + entry.getValue());
    }
    final String msg = br.buildExceptionMessage();
    throw new DfRequiredPropertyNotFoundException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException)

Aggregations

DfRequiredPropertyNotFoundException (org.dbflute.exception.DfRequiredPropertyNotFoundException)6 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)3 Map (java.util.Map)2 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Entry (java.util.Map.Entry)1 RichTextString (org.apache.poi.ss.usermodel.RichTextString)1 Row (org.apache.poi.ss.usermodel.Row)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1 Workbook (org.apache.poi.ss.usermodel.Workbook)1 DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)1 DfIllegalPropertyTypeException (org.dbflute.exception.DfIllegalPropertyTypeException)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1 DfUrlAnalyzer (org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)1 DfUrlAnalyzerFactory (org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory)1 DfFreeGenLazyReflector (org.dbflute.logic.manage.freegen.reflector.DfFreeGenLazyReflector)1 DfAdditionalSchemaInfo (org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo)1