use of org.dbflute.bhv.core.command.BatchDeleteCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method createBatchDeleteCommand.
protected BatchDeleteCommand createBatchDeleteCommand(List<? extends Entity> entityList, DeleteOption<? extends ConditionBean> option) {
assertBehaviorCommandInvoker("createBatchDeleteCommand");
final BatchDeleteCommand cmd = newBatchDeleteCommand();
setupListEntityCommand(cmd, entityList);
cmd.setDeleteOption(option);
return cmd;
}
use of org.dbflute.bhv.core.command.BatchDeleteCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateBatchDelete.
protected int[] delegateBatchDelete(List<? extends Entity> entityList, DeleteOption<? extends ConditionBean> option) {
if (entityList.isEmpty()) {
return EMPTY_INT_ARRAY;
}
if (asDBMeta().hasOptimisticLock()) {
final List<? extends Entity> deletedList = adjustEntityListBeforeBatchDelete(entityList, option, false);
if (deletedList.isEmpty()) {
// might be filtered
return EMPTY_INT_ARRAY;
}
final BatchDeleteCommand command = createBatchDeleteCommand(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));
}
} else {
return delegateBatchDeleteNonstrict(entityList, option);
}
}
Aggregations