Search in sources :

Example 1 with BatchDeleteNonstrictCommand

use of org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method createBatchDeleteNonstrictCommand.

protected BatchDeleteNonstrictCommand createBatchDeleteNonstrictCommand(List<? extends Entity> entityList, DeleteOption<? extends ConditionBean> option) {
    assertBehaviorCommandInvoker("createBatchDeleteNonstrictCommand");
    final BatchDeleteNonstrictCommand cmd = newBatchDeleteNonstrictCommand();
    setupListEntityCommand(cmd, entityList);
    cmd.setDeleteOption(option);
    return cmd;
}
Also used : BatchDeleteNonstrictCommand(org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand)

Example 2 with BatchDeleteNonstrictCommand

use of org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method delegateBatchDeleteNonstrict.

protected int[] delegateBatchDeleteNonstrict(List<? extends Entity> entityList, DeleteOption<? extends ConditionBean> option) {
    if (entityList.isEmpty()) {
        return EMPTY_INT_ARRAY;
    }
    final List<? extends Entity> deletedList = adjustEntityListBeforeBatchDelete(entityList, option, true);
    if (deletedList.isEmpty()) {
        // might be filtered
        return EMPTY_INT_ARRAY;
    }
    final BatchDeleteNonstrictCommand command = createBatchDeleteNonstrictCommand(deletedList, option);
    final OptionalThing<Object> optEntityList = OptionalThing.of(entityList);
    final OptionalThing<DeleteOption<? extends ConditionBean>> optOption = createOptionalDeleteOption(option);
    RuntimeException cause = null;
    try {
        hookBeforeDelete(command, optEntityList, emptyOpt(), optOption);
        return invoke(command);
    } catch (RuntimeException e) {
        cause = e;
        throw e;
    } finally {
        hookFinallyDelete(command, optEntityList, emptyOpt(), optOption, createOptionalCause(cause));
    }
}
Also used : DeleteOption(org.dbflute.bhv.writable.DeleteOption) BatchDeleteNonstrictCommand(org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand) ConditionBean(org.dbflute.cbean.ConditionBean)

Aggregations

BatchDeleteNonstrictCommand (org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand)2 DeleteOption (org.dbflute.bhv.writable.DeleteOption)1 ConditionBean (org.dbflute.cbean.ConditionBean)1