use of org.dbflute.hook.SqlStringFilter in project lastaflute by lastaflute.
the class SimpleAsyncManager method extractSqlCounter.
// ===================================================================================
// SQL Counter
// ===========
protected OptionalThing<ExecutedSqlCounter> extractSqlCounter() {
final CallbackContext context = CallbackContext.getCallbackContextOnThread();
if (context == null) {
return OptionalThing.empty();
}
final SqlStringFilter filter = context.getSqlStringFilter();
if (filter == null || !(filter instanceof ExecutedSqlCounter)) {
return OptionalThing.empty();
}
return OptionalThing.of(((ExecutedSqlCounter) filter));
}
use of org.dbflute.hook.SqlStringFilter in project lastaflute by lastaflute.
the class SimpleAsyncManager method doInheritCallbackContext.
protected CallbackContext doInheritCallbackContext(ConcurrentAsyncCall call) {
// null allowed
final CallbackContext src = CallbackContext.getCallbackContextOnThread();
if (src == null) {
return null;
}
final CallbackContext dest = newCallbackContext();
final ConcurrentAsyncOption option = call.option();
final ConcurrentAsyncOption defaultOption = defaultConcurrentAsyncOption;
if (isInherit(option.getBehaviorCommandHookType(), defaultOption.getBehaviorCommandHookType())) {
final BehaviorCommandHook hook = src.getBehaviorCommandHook();
if (hook != null) {
dest.setBehaviorCommandHook(hook);
}
}
if (isInherit(option.getSqlFireHookType(), defaultOption.getSqlFireHookType())) {
final SqlFireHook hook = src.getSqlFireHook();
if (hook != null) {
dest.setSqlFireHook(hook);
}
} else {
// as default
dest.setSqlFireHook(createDefaultSqlFireHook(call));
}
if (isInherit(option.getSqlLogHandlerType(), defaultOption.getSqlLogHandlerType())) {
final SqlLogHandler handler = src.getSqlLogHandler();
if (handler != null) {
dest.setSqlLogHandler(handler);
}
}
if (isInherit(option.getSqlResultHandlerType(), defaultOption.getSqlResultHandlerType())) {
final SqlResultHandler handler = src.getSqlResultHandler();
if (handler != null) {
dest.setSqlResultHandler(handler);
}
} else {
dest.setSqlResultHandler(createDefaultSqlResultHandler(call));
}
if (isInherit(option.getSqlStringFilterType(), defaultOption.getSqlStringFilterType())) {
final SqlStringFilter filter = src.getSqlStringFilter();
if (filter != null) {
dest.setSqlStringFilter(filter);
}
} else {
// as default
dest.setSqlStringFilter(createDefaultSqlStringFilter(call));
}
return dest;
}
use of org.dbflute.hook.SqlStringFilter in project dbflute-core by dbflute.
the class SelectCBExecution method doFilterExecutedSqlByCallbackFilter.
protected String doFilterExecutedSqlByCallbackFilter(String executedSql) {
final SqlStringFilter sqlStringFilter = getSqlStringFilter();
if (sqlStringFilter != null) {
final BehaviorCommandMeta meta = ResourceContext.behaviorCommand();
final String filteredSql = sqlStringFilter.filterSelectCB(meta, executedSql);
return filteredSql != null ? filteredSql : executedSql;
}
return executedSql;
}
use of org.dbflute.hook.SqlStringFilter in project dbflute-core by dbflute.
the class TnProcedureCommand method doFilterExecutedSqlByCallbackFilter.
protected String doFilterExecutedSqlByCallbackFilter(String executedSql) {
final SqlStringFilter sqlStringFilter = getSqlStringFilter();
if (sqlStringFilter != null) {
final BehaviorCommandMeta meta = ResourceContext.behaviorCommand();
final String filteredSql = sqlStringFilter.filterProcedure(meta, executedSql);
return filteredSql != null ? filteredSql : executedSql;
}
return executedSql;
}
use of org.dbflute.hook.SqlStringFilter in project dbflute-core by dbflute.
the class AbstractOutsideSqlExecution method doFilterExecutedSqlByCallbackFilter.
protected String doFilterExecutedSqlByCallbackFilter(String executedSql) {
final SqlStringFilter sqlStringFilter = getSqlStringFilter();
if (sqlStringFilter != null) {
final BehaviorCommandMeta meta = ResourceContext.behaviorCommand();
final String filteredSql = sqlStringFilter.filterOutsideSql(meta, executedSql);
return filteredSql != null ? filteredSql : executedSql;
}
return executedSql;
}
Aggregations