Search in sources :

Example 1 with ClassificationUndefinedHandlingType

use of org.dbflute.jdbc.ClassificationUndefinedHandlingType in project dbflute-core by dbflute.

the class DfClassificationProperties 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 2 with ClassificationUndefinedHandlingType

use of org.dbflute.jdbc.ClassificationUndefinedHandlingType in project dbflute-core by dbflute.

the class AbstractDBMeta method ccls.

// -----------------------------------------------------
// Write Converter
// ---------------
// these are static to avoid the FindBugs headache
// (implementations of PropertyGateway can be static class)
protected static void ccls(Entity entity, ColumnInfo columnInfo, Object code) {
    // old style, for compatibility, check only on entity after Java8
    if (code == null) {
        // no check null value which means no existence on DB
        return;
    }
    final ClassificationMeta meta = columnInfo.getClassificationMeta();
    if (meta == null) {
        // no way (just in case)
        return;
    }
    final ClassificationUndefinedHandlingType undefinedHandlingType = meta.undefinedHandlingType();
    if (!undefinedHandlingType.isChecked()) {
        // basically no way (not called if no check)
        return;
    }
    final Classification classification = gcls(entity, columnInfo, code);
    if (classification == null) {
        final String tableDbName = columnInfo.getDBMeta().getTableDbName();
        final String columnDbName = columnInfo.getColumnDbName();
        final boolean allowedByOption = entity.myundefinedClassificationAccessAllowed();
        FunCustodial.handleUndefinedClassificationCode(tableDbName, columnDbName, meta, code, allowedByOption);
    }
}
Also used : ClassificationMeta(org.dbflute.jdbc.ClassificationMeta) ClassificationUndefinedHandlingType(org.dbflute.jdbc.ClassificationUndefinedHandlingType) Classification(org.dbflute.jdbc.Classification)

Example 3 with ClassificationUndefinedHandlingType

use of org.dbflute.jdbc.ClassificationUndefinedHandlingType in project dbflute-core by dbflute.

the class DfLittleAdjustmentProperties method getClassificationUndefinedHandlingType.

public ClassificationUndefinedHandlingType getClassificationUndefinedHandlingType() {
    final String defaultValue;
    if (isCompatibleBeforeJava8()) {
        defaultValue = ClassificationUndefinedHandlingType.EXCEPTION.code();
    } else {
        if (hasCheckSelectedClassificationProperty() && isCheckSelectedClassification()) {
            defaultValue = ClassificationUndefinedHandlingType.EXCEPTION.code();
        } else {
            // default after Java8
            defaultValue = ClassificationUndefinedHandlingType.LOGGING.code();
        }
    }
    final String code = doGetClassificationUndefinedHandlingType(defaultValue);
    final ClassificationUndefinedHandlingType handlingType = ClassificationUndefinedHandlingType.codeOf(code);
    if (handlingType == null) {
        throwUnknownClassificationUndefinedHandlingTypeException(code, KEY_littleAdjustmentMap + ".dfprop");
    }
    return handlingType;
}
Also used : ClassificationUndefinedHandlingType(org.dbflute.jdbc.ClassificationUndefinedHandlingType)

Example 4 with ClassificationUndefinedHandlingType

use of org.dbflute.jdbc.ClassificationUndefinedHandlingType in project dbflute-core by dbflute.

the class DfLittleAdjustmentProperties method isPlainCheckClassificationCode.

public boolean isPlainCheckClassificationCode() {
    // for e.g. classificationResource
    final DfLittleAdjustmentProperties prop = getLittleAdjustmentProperties();
    final ClassificationUndefinedHandlingType undefinedHandlingType = prop.getClassificationUndefinedHandlingType();
    if (prop.hasClassificationUndefinedHandlingTypeProperty() && undefinedHandlingType.isChecked()) {
        return true;
    }
    if (prop.isSuppressDefaultCheckClassificationCode()) {
        return false;
    }
    return undefinedHandlingType.isChecked();
}
Also used : ClassificationUndefinedHandlingType(org.dbflute.jdbc.ClassificationUndefinedHandlingType)

Example 5 with ClassificationUndefinedHandlingType

use of org.dbflute.jdbc.ClassificationUndefinedHandlingType 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)

Aggregations

ClassificationUndefinedHandlingType (org.dbflute.jdbc.ClassificationUndefinedHandlingType)11 DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)3 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 DfClassificationProperties (org.dbflute.properties.DfClassificationProperties)2 DfClassificationTop (org.dbflute.properties.assistant.classification.DfClassificationTop)2 Classification (org.dbflute.jdbc.Classification)1 ClassificationMeta (org.dbflute.jdbc.ClassificationMeta)1 DfLittleAdjustmentProperties (org.dbflute.properties.DfLittleAdjustmentProperties)1