use of org.dbflute.cbean.ckey.ConditionKey in project dbflute-core by dbflute.
the class ManualOrderOption method doBindCaseWhen.
protected HpMobCaseWhenElement doBindCaseWhen(HpManualOrderThemeListHandler handler, HpMobCaseWhenElement element) {
final ConditionKey conditionKey = element.getConditionKey();
final Object orderValue = resolveBoundValue(handler, element.getOrderValue(), false);
final HpMobCaseWhenElement boundElement = createElement(conditionKey, orderValue);
boundElement.setConnectionMode(element.getConnectionMode());
boundElement.setThenValue(resolveBoundValue(handler, element.getThenValue(), _suppressThenBinding));
return boundElement;
}
use of org.dbflute.cbean.ckey.ConditionKey in project dbflute-core by dbflute.
the class AbstractConditionQuery method regROO.
// ===================================================================================
// RangeOf Query
// =============
protected void regROO(Number minNumber, Number maxNumber, ConditionValue cvalue, String columnDbName, RangeOfOption option) {
assertObjectNotNull("option(RangeOfOption)", option);
if (option.hasCalculationRange()) {
final ConditionBean dreamCruiseCB = xgetBaseCB().xcreateDreamCruiseCB();
option.xinitCalculationRange(xgetBaseCB(), dreamCruiseCB);
}
// this RangeOf process is very similar to FromTo process
final ConditionKey minKey = option.getMinNumberConditionKey();
final ConditionKeyPrepareResult minResult = prepareQueryNoCheck(minKey, minNumber, cvalue, columnDbName);
final ConditionKey maxKey = option.getMaxNumberConditionKey();
final ConditionKeyPrepareResult maxResult = prepareQueryNoCheck(maxKey, maxNumber, cvalue, columnDbName);
final boolean needsAndPart = isOrScopeQueryDirectlyUnder() && minResult.newClause() && maxResult.newClause();
if (needsAndPart) {
xgetSqlClause().beginOrScopeQueryAndPart();
}
try {
if (minResult.newClause()) {
setupConditionValueAndRegisterWhereClause(minKey, minNumber, cvalue, columnDbName, option);
}
if (maxResult.newClause()) {
setupConditionValueAndRegisterWhereClause(maxKey, maxNumber, cvalue, columnDbName, option);
}
if (minResult.invalid() && maxResult.invalid()) {
xhandleRangeOfBothSideInvalidQuery(minNumber, maxNumber, columnDbName, option, minKey, maxKey);
} else if (minResult.invalid() || maxResult.invalid()) {
xhandleRangeOfOneSideInvalidQuery(minNumber, maxNumber, columnDbName, option, minKey, maxKey);
}
} finally {
if (needsAndPart) {
xgetSqlClause().endOrScopeQueryAndPart();
}
}
}
use of org.dbflute.cbean.ckey.ConditionKey in project dbflute-core by dbflute.
the class AbstractConditionQuery method handleInvalidQueryList.
protected void handleInvalidQueryList(List<ConditionKey> keyList, List<? extends Object> valueList, String columnDbName) {
if (keyList.size() != valueList.size()) {
String msg = "The argument 'keyList' should have the same size as 'valueList':";
msg = msg + " keyList=" + keyList + ", valueList=" + valueList;
throw new IllegalArgumentException(msg);
}
final HpInvalidQueryInfo[] invalidQueryInfoAry = new HpInvalidQueryInfo[keyList.size()];
int index = 0;
for (ConditionKey key : keyList) {
final Object value = valueList.get(index);
invalidQueryInfoAry[index] = xcreateInvalidQueryInfo(key, value, columnDbName);
++index;
}
xdoHandleInvalidQuery(columnDbName, invalidQueryInfoAry);
}
use of org.dbflute.cbean.ckey.ConditionKey in project dbflute-core by dbflute.
the class AbstractConditionQuery method regFTQ.
// ===================================================================================
// FromTo Query
// ============
protected void regFTQ(Date fromDate, Date toDate, ConditionValue cvalue, String columnDbName, FromToOption option) {
assertObjectNotNull("option(FromToOption)", option);
// for fixed option
filterFromToOption(columnDbName, option);
// this FromTo process is very similar to RangeOf process
final Date filteredFromDate = option.filterFromDate(fromDate);
final ConditionKey fromKey = option.getFromDateConditionKey();
final ConditionKeyPrepareResult fromResult = prepareQueryNoCheck(fromKey, filteredFromDate, cvalue, columnDbName);
final Date filteredToDate = option.filterToDate(toDate);
final ConditionKey toKey = option.getToDateConditionKey();
final ConditionKeyPrepareResult toResult = prepareQueryNoCheck(toKey, filteredToDate, cvalue, columnDbName);
final boolean needsAndPart = isOrScopeQueryDirectlyUnder() && fromResult.newClause() && toResult.newClause();
if (needsAndPart) {
xgetSqlClause().beginOrScopeQueryAndPart();
}
try {
if (fromResult.newClause()) {
final Object registered = filterFromToRegisteredDate(option, filteredFromDate, columnDbName);
setupConditionValueAndRegisterWhereClause(fromKey, registered, cvalue, columnDbName);
}
if (toResult.newClause()) {
final Object registered = filterFromToRegisteredDate(option, filteredToDate, columnDbName);
setupConditionValueAndRegisterWhereClause(toKey, registered, cvalue, columnDbName);
}
if (fromResult.invalid() && toResult.invalid()) {
xhandleFromToBothSideInvalidQuery(fromDate, toDate, columnDbName, option, fromKey, toKey);
} else if (fromResult.invalid() || toResult.invalid()) {
xhandleFromToOneSideInvalidQuery(fromDate, toDate, columnDbName, option, fromKey, toKey);
}
} finally {
if (needsAndPart) {
xgetSqlClause().endOrScopeQueryAndPart();
}
}
}
use of org.dbflute.cbean.ckey.ConditionKey in project dbflute-core by dbflute.
the class ManualOrderOption method doWhen_FromTo.
protected HpMobConnectedBean doWhen_FromTo(Date fromDate, Date toDate, FromToOption option) {
assertFromToOption(option);
assertFromToDateBothExistsOrOneSideAllowed(fromDate, toDate, option);
final ConditionKey fromDateConditionKey = option.getFromDateConditionKey();
final ConditionKey toDateConditionKey = option.getToDateConditionKey();
final Date filteredFromDate = option.filterFromDate(fromDate);
final Date filteredToDate = option.filterToDate(toDate);
return doWhen(fromDateConditionKey, filteredFromDate).doAnd(toDateConditionKey, filteredToDate);
}
Aggregations