Search in sources :

Example 1 with CommonColumnAutoSetupper

use of org.dbflute.hook.CommonColumnAutoSetupper in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method setupCommonColumnOfInsertIfNeeds.

/**
 * Set up common columns of insert if it needs.
 * @param entity The entity for insert. (NotNull)
 * @param option The optional option of insert. (NotNull, EmptyAllowed: when no option)
 */
protected void setupCommonColumnOfInsertIfNeeds(Entity entity, OptionalThing<InsertOption<? extends ConditionBean>> option) {
    if (option.filter(op -> op.isCommonColumnAutoSetupDisabled()).isPresent()) {
        return;
    }
    final CommonColumnAutoSetupper setupper = getCommonColumnAutoSetupper();
    assertCommonColumnAutoSetupperNotNull();
    setupper.handleCommonColumnOfInsertIfNeeds(entity);
}
Also used : OptimisticLockColumnValueNullException(org.dbflute.exception.OptimisticLockColumnValueNullException) BehaviorCommandMeta(org.dbflute.bhv.core.BehaviorCommandMeta) DeleteNonstrictEntityCommand(org.dbflute.bhv.core.command.DeleteNonstrictEntityCommand) QueryUpdateCBCommand(org.dbflute.bhv.core.command.QueryUpdateCBCommand) Entity(org.dbflute.Entity) DeleteOption(org.dbflute.bhv.writable.DeleteOption) UniqueInfo(org.dbflute.dbmeta.info.UniqueInfo) OptionalThing(org.dbflute.optional.OptionalThing) BatchDeleteNonstrictCommand(org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) BatchUpdateCommand(org.dbflute.bhv.core.command.BatchUpdateCommand) UpdateEntityCommand(org.dbflute.bhv.core.command.UpdateEntityCommand) ArrayList(java.util.ArrayList) DeleteEntityCommand(org.dbflute.bhv.core.command.DeleteEntityCommand) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) UpdateNonstrictEntityCommand(org.dbflute.bhv.core.command.UpdateNonstrictEntityCommand) ConditionBean(org.dbflute.cbean.ConditionBean) QueryDeleteCBCommand(org.dbflute.bhv.core.command.QueryDeleteCBCommand) UpdateOption(org.dbflute.bhv.writable.UpdateOption) CommonColumnAutoSetupper(org.dbflute.hook.CommonColumnAutoSetupper) IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException) SpecifyQuery(org.dbflute.cbean.scoping.SpecifyQuery) InsertEntityCommand(org.dbflute.bhv.core.command.InsertEntityCommand) QueryInsertSetupper(org.dbflute.bhv.writable.QueryInsertSetupper) BatchDeleteCommand(org.dbflute.bhv.core.command.BatchDeleteCommand) WritableOptionCall(org.dbflute.bhv.writable.WritableOptionCall) Set(java.util.Set) ResourceContext(org.dbflute.bhv.core.context.ResourceContext) BatchUpdateNonstrictCommand(org.dbflute.bhv.core.command.BatchUpdateNonstrictCommand) AbstractBatchUpdateCommand(org.dbflute.bhv.core.command.AbstractBatchUpdateCommand) BatchInsertCommand(org.dbflute.bhv.core.command.BatchInsertCommand) DBMeta(org.dbflute.dbmeta.DBMeta) List(java.util.List) EntityAlreadyDeletedException(org.dbflute.exception.EntityAlreadyDeletedException) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) EntityAlreadyUpdatedException(org.dbflute.exception.EntityAlreadyUpdatedException) InsertOption(org.dbflute.bhv.writable.InsertOption) QueryInsertCBCommand(org.dbflute.bhv.core.command.QueryInsertCBCommand) CommonColumnAutoSetupper(org.dbflute.hook.CommonColumnAutoSetupper)

Example 2 with CommonColumnAutoSetupper

use of org.dbflute.hook.CommonColumnAutoSetupper in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method setupCommonColumnOfUpdateIfNeeds.

/**
 * Set up common columns of update if it needs.
 * @param entity The entity for update. (NotNull)
 * @param option The optional option of update. (NotNull, EmptyAllowed: when no option)
 */
protected void setupCommonColumnOfUpdateIfNeeds(Entity entity, OptionalThing<UpdateOption<? extends ConditionBean>> option) {
    if (option.filter(op -> op.isCommonColumnAutoSetupDisabled()).isPresent()) {
        return;
    }
    final CommonColumnAutoSetupper setupper = getCommonColumnAutoSetupper();
    assertCommonColumnAutoSetupperNotNull();
    setupper.handleCommonColumnOfUpdateIfNeeds(entity);
}
Also used : OptimisticLockColumnValueNullException(org.dbflute.exception.OptimisticLockColumnValueNullException) BehaviorCommandMeta(org.dbflute.bhv.core.BehaviorCommandMeta) DeleteNonstrictEntityCommand(org.dbflute.bhv.core.command.DeleteNonstrictEntityCommand) QueryUpdateCBCommand(org.dbflute.bhv.core.command.QueryUpdateCBCommand) Entity(org.dbflute.Entity) DeleteOption(org.dbflute.bhv.writable.DeleteOption) UniqueInfo(org.dbflute.dbmeta.info.UniqueInfo) OptionalThing(org.dbflute.optional.OptionalThing) BatchDeleteNonstrictCommand(org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) BatchUpdateCommand(org.dbflute.bhv.core.command.BatchUpdateCommand) UpdateEntityCommand(org.dbflute.bhv.core.command.UpdateEntityCommand) ArrayList(java.util.ArrayList) DeleteEntityCommand(org.dbflute.bhv.core.command.DeleteEntityCommand) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) UpdateNonstrictEntityCommand(org.dbflute.bhv.core.command.UpdateNonstrictEntityCommand) ConditionBean(org.dbflute.cbean.ConditionBean) QueryDeleteCBCommand(org.dbflute.bhv.core.command.QueryDeleteCBCommand) UpdateOption(org.dbflute.bhv.writable.UpdateOption) CommonColumnAutoSetupper(org.dbflute.hook.CommonColumnAutoSetupper) IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException) SpecifyQuery(org.dbflute.cbean.scoping.SpecifyQuery) InsertEntityCommand(org.dbflute.bhv.core.command.InsertEntityCommand) QueryInsertSetupper(org.dbflute.bhv.writable.QueryInsertSetupper) BatchDeleteCommand(org.dbflute.bhv.core.command.BatchDeleteCommand) WritableOptionCall(org.dbflute.bhv.writable.WritableOptionCall) Set(java.util.Set) ResourceContext(org.dbflute.bhv.core.context.ResourceContext) BatchUpdateNonstrictCommand(org.dbflute.bhv.core.command.BatchUpdateNonstrictCommand) AbstractBatchUpdateCommand(org.dbflute.bhv.core.command.AbstractBatchUpdateCommand) BatchInsertCommand(org.dbflute.bhv.core.command.BatchInsertCommand) DBMeta(org.dbflute.dbmeta.DBMeta) List(java.util.List) EntityAlreadyDeletedException(org.dbflute.exception.EntityAlreadyDeletedException) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) EntityAlreadyUpdatedException(org.dbflute.exception.EntityAlreadyUpdatedException) InsertOption(org.dbflute.bhv.writable.InsertOption) QueryInsertCBCommand(org.dbflute.bhv.core.command.QueryInsertCBCommand) CommonColumnAutoSetupper(org.dbflute.hook.CommonColumnAutoSetupper)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 Set (java.util.Set)2 Entity (org.dbflute.Entity)2 BehaviorCommandMeta (org.dbflute.bhv.core.BehaviorCommandMeta)2 AbstractBatchUpdateCommand (org.dbflute.bhv.core.command.AbstractBatchUpdateCommand)2 BatchDeleteCommand (org.dbflute.bhv.core.command.BatchDeleteCommand)2 BatchDeleteNonstrictCommand (org.dbflute.bhv.core.command.BatchDeleteNonstrictCommand)2 BatchInsertCommand (org.dbflute.bhv.core.command.BatchInsertCommand)2 BatchUpdateCommand (org.dbflute.bhv.core.command.BatchUpdateCommand)2 BatchUpdateNonstrictCommand (org.dbflute.bhv.core.command.BatchUpdateNonstrictCommand)2 DeleteEntityCommand (org.dbflute.bhv.core.command.DeleteEntityCommand)2 DeleteNonstrictEntityCommand (org.dbflute.bhv.core.command.DeleteNonstrictEntityCommand)2 InsertEntityCommand (org.dbflute.bhv.core.command.InsertEntityCommand)2 QueryDeleteCBCommand (org.dbflute.bhv.core.command.QueryDeleteCBCommand)2 QueryInsertCBCommand (org.dbflute.bhv.core.command.QueryInsertCBCommand)2 QueryUpdateCBCommand (org.dbflute.bhv.core.command.QueryUpdateCBCommand)2 UpdateEntityCommand (org.dbflute.bhv.core.command.UpdateEntityCommand)2 UpdateNonstrictEntityCommand (org.dbflute.bhv.core.command.UpdateNonstrictEntityCommand)2 ResourceContext (org.dbflute.bhv.core.context.ResourceContext)2