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);
}
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);
}
}
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;
}
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();
}
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);
}
Aggregations