use of org.dbflute.cbean.chelper.HpMobConnectionMode in project dbflute-core by dbflute.
the class ManualOrderOption method doWhen.
// -----------------------------------------------------
// Assist Helper
// -------------
protected HpMobConnectedBean doWhen(ConditionKey conditionKey, Object orderValue) {
if (orderValue == null && !isManualOrderConditionKeyNullHandling(conditionKey)) {
String msg = "The argument 'orderValue' should not be null: conditionKey=" + conditionKey;
throw new IllegalArgumentException(msg);
}
final HpMobCaseWhenElement addedElement = createElement(conditionKey, orderValue);
if (_connectionMode != null) {
if (_caseWhenAcceptedList.isEmpty()) {
throwManualOrderPreviousConditionNotFoundException(_connectionMode, conditionKey, orderValue);
}
addedElement.setConnectionMode(_connectionMode);
final HpMobCaseWhenElement lastElement = getAcceptedLastElement();
final List<HpMobCaseWhenElement> connectedElementList = lastElement.getConnectedElementList();
if (!connectedElementList.isEmpty()) {
// check same connectors
final HpMobCaseWhenElement previousConnected = connectedElementList.get(connectedElementList.size() - 1);
final HpMobConnectionMode previousMode = previousConnected.getConnectionMode();
if (previousMode != null && !previousMode.equals(addedElement.getConnectionMode())) {
throwManualOrderTwoConnectorUnsupportedException(conditionKey, orderValue, lastElement);
}
}
lastElement.addConnectedElement(addedElement);
} else {
_caseWhenAcceptedList.add(addedElement);
}
return createConnectedBean();
}
Aggregations