Search in sources :

Example 11 with ConditionBean

use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.

the class SelectScalarCBCommand method beforeGettingSqlExecution.

// ===================================================================================
// Process Callback
// ================
public void beforeGettingSqlExecution() {
    assertStatus("beforeGettingSqlExecution");
    final ConditionBean cb = _conditionBean;
    ConditionBeanContext.setConditionBeanOnThread(cb);
    // *Point!
    cb.getSqlClause().classifySelectClauseType(_selectClauseType);
}
Also used : ConditionBean(org.dbflute.cbean.ConditionBean)

Example 12 with ConditionBean

use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.

the class ManualOrderOption method resolveDreamCruiseExp.

protected Object resolveDreamCruiseExp(Object plainValue) {
    final SpecifiedColumn specifiedColumn = (SpecifiedColumn) plainValue;
    final String columnExp = specifiedColumn.toColumnRealName().toString();
    if (specifiedColumn.hasSpecifyCalculation()) {
        specifiedColumn.xinitSpecifyCalculation();
        final HpCalcSpecification<ConditionBean> calcSpecification = specifiedColumn.getSpecifyCalculation();
        return calcSpecification.buildStatementToSpecifidName(columnExp);
    }
    return columnExp;
}
Also used : SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 13 with ConditionBean

use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.

the class ConditionKey method resolveCalculationColumn.

protected ColumnRealName resolveCalculationColumn(ColumnRealName columnRealName, ConditionOption option) {
    if (option == null) {
        return columnRealName;
    }
    if (option instanceof RangeOfOption) {
        final RangeOfOption rangeOfOption = (RangeOfOption) option;
        if (rangeOfOption.hasCalculationRange()) {
            final HpCalcSpecification<ConditionBean> calculationRange = rangeOfOption.getCalculationRange();
            final String calculated = calculationRange.buildStatementToSpecifidName(columnRealName.toString());
            return toColumnRealName(calculated);
        }
    }
    return columnRealName;
}
Also used : RangeOfOption(org.dbflute.cbean.coption.RangeOfOption) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 14 with ConditionBean

use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method delegateBatchUpdateNonstrict.

protected int[] delegateBatchUpdateNonstrict(List<? extends Entity> entityList, UpdateOption<? extends ConditionBean> option) {
    if (entityList.isEmpty()) {
        return EMPTY_INT_ARRAY;
    }
    final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
    adjustEntityListBeforeBatchUpdate(entityList, option, true);
    if (entityList.isEmpty()) {
        // might be filtered
        return EMPTY_INT_ARRAY;
    }
    final BatchUpdateNonstrictCommand command = createBatchUpdateNonstrictCommand(entityList, option);
    RuntimeException cause = null;
    try {
        hookBeforeUpdate(command, entityList, emptyOpt(), optOption);
        return invoke(command);
    } catch (RuntimeException e) {
        cause = e;
        throw e;
    } finally {
        hookFinallyUpdate(command, entityList, emptyOpt(), optOption, createOptionalCause(cause));
    }
}
Also used : BatchUpdateNonstrictCommand(org.dbflute.bhv.core.command.BatchUpdateNonstrictCommand) UpdateOption(org.dbflute.bhv.writable.UpdateOption) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 15 with ConditionBean

use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method delegateQueryDelete.

protected int delegateQueryDelete(ConditionBean cb, DeleteOption<? extends ConditionBean> option) {
    final OptionalThing<DeleteOption<? extends ConditionBean>> optOption = createOptionalDeleteOption(option);
    adjustEntityBeforeQueryDelete(cb, optOption);
    final QueryDeleteCBCommand command = createQueryDeleteCBCommand(cb, option);
    final OptionalThing<ConditionBean> optCB = OptionalThing.of(cb);
    RuntimeException cause = null;
    try {
        hookBeforeDelete(command, emptyOpt(), optCB, optOption);
        return invoke(command);
    } catch (RuntimeException e) {
        cause = e;
        throw e;
    } finally {
        hookFinallyDelete(command, emptyOpt(), optCB, optOption, createOptionalCause(cause));
    }
}
Also used : DeleteOption(org.dbflute.bhv.writable.DeleteOption) QueryDeleteCBCommand(org.dbflute.bhv.core.command.QueryDeleteCBCommand) ConditionBean(org.dbflute.cbean.ConditionBean)

Aggregations

ConditionBean (org.dbflute.cbean.ConditionBean)45 DeleteOption (org.dbflute.bhv.writable.DeleteOption)7 UpdateOption (org.dbflute.bhv.writable.UpdateOption)7 ArrayList (java.util.ArrayList)5 InsertOption (org.dbflute.bhv.writable.InsertOption)5 Entity (org.dbflute.Entity)4 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)4 List (java.util.List)3 AbstractBatchUpdateCommand (org.dbflute.bhv.core.command.AbstractBatchUpdateCommand)3 BatchDeleteCommand (org.dbflute.bhv.core.command.BatchDeleteCommand)3 BatchDeleteNonstrictCommand (org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand)3 BatchInsertCommand (org.dbflute.bhv.core.command.BatchInsertCommand)3 BatchUpdateCommand (org.dbflute.bhv.core.command.BatchUpdateCommand)3 BatchUpdateNonstrictCommand (org.dbflute.bhv.core.command.BatchUpdateNonstrictCommand)3 DeleteEntityCommand (org.dbflute.bhv.core.command.DeleteEntityCommand)3 DeleteNonstrictEntityCommand (org.dbflute.bhv.core.command.DeleteNonstrictEntityCommand)3 InsertEntityCommand (org.dbflute.bhv.core.command.InsertEntityCommand)3 QueryDeleteCBCommand (org.dbflute.bhv.core.command.QueryDeleteCBCommand)3 QueryInsertCBCommand (org.dbflute.bhv.core.command.QueryInsertCBCommand)3 QueryUpdateCBCommand (org.dbflute.bhv.core.command.QueryUpdateCBCommand)3