use of org.dbflute.bhv.core.BehaviorCommandMeta in project dbflute-core by dbflute.
the class CallbackContextTest method test_BehaviorCommandHook_twoSet_noInherits.
// -----------------------------------------------------
// No Inherits
// -----------
public void test_BehaviorCommandHook_twoSet_noInherits() throws Exception {
// ## Arrange ##
CallbackContext context = new CallbackContext();
assertNull(context.getBehaviorCommandHook());
// ## Act ##
context.setBehaviorCommandHook(new BehaviorCommandHook() {
public void hookBefore(BehaviorCommandMeta meta) {
fail();
}
public void hookFinally(BehaviorCommandMeta meta, RuntimeException cause) {
fail();
}
});
context.setBehaviorCommandHook(new BehaviorCommandHook() {
public void hookBefore(BehaviorCommandMeta meta) {
markHere("secondBefore");
}
public void hookFinally(BehaviorCommandMeta meta, RuntimeException cause) {
markHere("secondFinally");
}
@Override
public boolean inheritsExistingHook() {
return false;
}
});
// ## Assert ##
BehaviorCommandHook hook = context.getBehaviorCommandHook();
assertFalse(hook.inheritsExistingHook());
hook.hookBefore(null);
hook.hookFinally(null, null);
assertMarked("secondBefore");
assertMarked("secondFinally");
}
use of org.dbflute.bhv.core.BehaviorCommandMeta in project dbflute-core by dbflute.
the class TnAbstractEntityDynamicCommand method doFilterExecutedSqlByCallbackFilter.
protected String doFilterExecutedSqlByCallbackFilter(String executedSql) {
final SqlStringFilter sqlStringFilter = getSqlStringFilter();
if (sqlStringFilter != null) {
final BehaviorCommandMeta meta = ResourceContext.behaviorCommand();
final String filteredSql = sqlStringFilter.filterEntityUpdate(meta, executedSql);
return filteredSql != null ? filteredSql : executedSql;
}
return executedSql;
}
use of org.dbflute.bhv.core.BehaviorCommandMeta in project dbflute-core by dbflute.
the class TnAbstractQueryDynamicCommand method filterSqlStringByCallbackFilter.
protected String filterSqlStringByCallbackFilter(String executedSql) {
final SqlStringFilter sqlStringFilter = getSqlStringFilter();
if (sqlStringFilter != null) {
final BehaviorCommandMeta meta = ResourceContext.behaviorCommand();
final String filteredSql = sqlStringFilter.filterQueryUpdate(meta, executedSql);
return filteredSql != null ? filteredSql : executedSql;
}
return executedSql;
}
Aggregations