use of org.dbflute.exception.IllegalConditionBeanOperationException in project dbflute-core by dbflute.
the class FunctionFilterOption method doProcessDateAdd.
protected String doProcessDateAdd(String functionExp, int index, Object addedValue, String propertyName, boolean minus) {
if (addedValue == null) {
return functionExp;
}
if (!isDateTypeColumn()) {
// if info is null, means e.g. mystic
String msg = "The column should be Date type for the function e.g. addDay():";
msg = msg + " column=" + _targetColumnInfo;
throw new IllegalConditionBeanOperationException(msg);
}
if (isDatabaseMySQL()) {
return doProcessDateAddMySQL(functionExp, index, addedValue, propertyName, minus);
} else if (isDatabasePostgreSQL()) {
return doProcessDateAddPostgreSQL(functionExp, index, addedValue, propertyName, minus);
} else if (isDatabaseOracle()) {
return doProcessDateAddOracle(functionExp, index, addedValue, propertyName, minus);
} else if (isDatabaseDB2()) {
return doProcessDateAddDB2(functionExp, index, addedValue, propertyName, minus);
} else if (isDatabaseSQLServer()) {
return doProcessDateAddSQLServer(functionExp, index, addedValue, propertyName, minus);
} else if (isDatabaseH2()) {
// same as SQLServer
return doProcessDateAddSQLServer(functionExp, index, addedValue, propertyName, minus);
} else {
String msg = "Unsupported database to the function addXxx(): " + propertyName;
throw new IllegalConditionBeanOperationException(msg);
}
}
use of org.dbflute.exception.IllegalConditionBeanOperationException in project dbflute-core by dbflute.
the class ConditionKey method resolveCompoundColumn.
protected ColumnRealName resolveCompoundColumn(ColumnRealName baseRealName, ConditionOption option) {
if (option == null || !option.hasCompoundColumn()) {
return baseRealName;
}
if (!option.hasStringConnector()) {
// basically no way
String msg = "The option should have string connector when compound column is specified: " + option;
throw new IllegalConditionBeanOperationException(msg);
}
final List<SpecifiedColumn> compoundColumnList = option.getCompoundColumnList();
final List<ColumnRealName> realNameList = new ArrayList<ColumnRealName>();
// already cipher
realNameList.add(doResolveCompoundColumnOption(option, baseRealName));
for (SpecifiedColumn specifiedColumn : compoundColumnList) {
realNameList.add(doResolveCompoundColumnOption(option, doResolveCompoundColumnCipher(option, specifiedColumn)));
}
final OnQueryStringConnector stringConnector = option.getStringConnector();
final String connected = stringConnector.connect(realNameList.toArray());
return ColumnRealName.create(null, new ColumnSqlName(connected));
}
use of org.dbflute.exception.IllegalConditionBeanOperationException in project dbflute-core by dbflute.
the class HpCalcSpecification method throwSpecifiedConditionBeanNotFoundException.
protected void throwSpecifiedConditionBeanNotFoundException() {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the specified condition-bean.");
br.addItem("Advice");
br.addElement("You should call specify(cb) before building statements.");
br.addItem("Specify Query");
br.addElement(_specifyQuery);
br.addItem("Calculation List");
if (!_calculationList.isEmpty()) {
for (HpCalcElement element : _calculationList) {
br.addElement(element);
}
} else {
br.addElement("*No calculation");
}
final String msg = br.buildExceptionMessage();
throw new IllegalConditionBeanOperationException(msg);
}
use of org.dbflute.exception.IllegalConditionBeanOperationException in project dbflute-core by dbflute.
the class HpCalcSpecification method throwCalculationColumnRelationUnresolvedException.
protected void throwCalculationColumnRelationUnresolvedException(String targetExp, SpecifiedColumn calculationColumn) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The relation for the calculation column was unresolved.");
br.addItem("Advice");
br.addElement("For example, you cannot use relation columns for calculation");
br.addElement("on set clause of update. (because of relation unresolved)");
br.addItem("Base ConditionBean");
br.addElement(_baseCB.getClass().getName());
br.addItem("Specified Column");
br.addElement(targetExp);
br.addItem("Calculation Column");
br.addElement(calculationColumn);
final String msg = br.buildExceptionMessage();
throw new IllegalConditionBeanOperationException(msg);
}
use of org.dbflute.exception.IllegalConditionBeanOperationException in project dbflute-core by dbflute.
the class UpdateOption method throwVaryingUpdateSpecifyCalculatonUnsupportedException.
protected void throwVaryingUpdateSpecifyCalculatonUnsupportedException(String columnDbName) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("VaryingUpdate with SpecifyCalculation is unsupported.");
br.addItem("Advice");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" option.self(cb -> {");
br.addElement(" cb.specify().columnPurchaseCount().plus(1); // *NG");
br.addElement(" }).multiply(3);");
br.addElement(" (o):");
br.addElement(" option.self(cb -> {");
br.addElement(" cb.specify().columnPurchaseCount();");
br.addElement(" }).plus(1).multiply(3); // OK");
br.addItem("Specified Column");
br.addElement(columnDbName);
final String msg = br.buildExceptionMessage();
// because of specified by ConditionBean
throw new IllegalConditionBeanOperationException(msg);
}
Aggregations