use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class SpecifiedColumn method initializeCalcSpecificationIfNeeds.
// ===================================================================================
// CalcSpecification Handling
// ==========================
protected void initializeCalcSpecificationIfNeeds() {
if (_calcSpecification == null) {
_calcSpecification = createEmptyCalcSpecification();
final ConditionBean handlingCB;
if (_baseCB.xisDreamCruiseShip()) {
// to tell option parameters by DreamCruise to base condition-bean
handlingCB = _baseCB.xgetDreamCruiseDeparturePort();
} else {
handlingCB = _baseCB;
}
_calcSpecification.setBaseCB(handlingCB);
}
}
use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class TnAbstractBasicSqlHandler method getSpecifiedLogDateDisplayStyle.
protected BoundDateDisplayStyle getSpecifiedLogDateDisplayStyle() {
if (ConditionBeanContext.isExistConditionBeanOnThread()) {
final ConditionBean cb = ConditionBeanContext.getConditionBeanOnThread();
final BoundDateDisplayStyle specifiedStyle = cb.getLogDateDisplayStyle();
if (specifiedStyle != null) {
return specifiedStyle;
}
}
return null;
}
use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class TnInsertEntityDynamicCommand method execute.
// ===================================================================================
// Execute
// =======
public Object execute(Object[] args) {
final Object bean = extractBeanFromArgsChecked(args);
final InsertOption<ConditionBean> option = extractInsertOptionChecked(args);
prepareStatementConfigOnThreadIfExists(option);
final TnBeanMetaData bmd = _beanMetaData;
final TnPropertyType[] propertyTypes = createInsertPropertyTypes(bmd, bean, _propertyNames, option);
final String sql = filterExecutedSql(createInsertSql(bmd, propertyTypes, option));
return doExecute(bean, propertyTypes, sql, option);
}
use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class BehaviorExceptionThrower method throwDangerousResultSizeException.
public void throwDangerousResultSizeException(FetchBean fetchBean, Throwable cause) {
final int safetyMaxResultSize = fetchBean.getSafetyMaxResultSize();
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("You've already been in DANGER ZONE. (check is working)");
br.addItem("Advice");
br.addElement("The selected size is over the specified safety size.");
br.addElement("Confirm your conditions and table records.");
br.addItem("Safety Max Result Size");
br.addElement(safetyMaxResultSize);
if (fetchBean instanceof ConditionBean) {
final ConditionBean cb = ((ConditionBean) fetchBean);
setupInvalidQueryElement(br, cb);
setupFetchSizeElement(br, cb);
setupDisplaySqlElement(br, cb);
} else {
br.addItem("Fetch Bean");
br.addElement(fetchBean);
if (cause instanceof FetchingOverSafetySizeException) {
final String sql = ((FetchingOverSafetySizeException) cause).getDangerousDisplaySql();
if (sql != null) {
br.addItem("Dangerous SQL");
br.addElement(sql);
}
}
}
final String msg = br.buildExceptionMessage();
throw new DangerousResultSizeException(msg, cause, safetyMaxResultSize);
}
use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class BehaviorExceptionThrower method setupSearchKeyElement.
protected void setupSearchKeyElement(ExceptionMessageBuilder br, Object searchKey) {
if (searchKey instanceof Object[]) {
final Object[] ary = (Object[]) searchKey;
if (ary.length == 1) {
searchKey = ary[0];
} else {
final StringBuilder sb = new StringBuilder();
for (Object obj : ary) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(obj);
}
sb.insert(0, "{").append("}");
searchKey = sb.toString();
}
}
if (searchKey instanceof ConditionBean) {
final ConditionBean cb = (ConditionBean) searchKey;
setupInvalidQueryElement(br, cb);
setupDisplaySqlElement(br, cb);
} else {
br.addItem("Search Condition");
br.addElement(searchKey);
}
}
Aggregations