use of org.dbflute.bhv.core.BehaviorCommandMeta 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.bhv.core.BehaviorCommandMeta in project lastaflute by lastaflute.
the class TransactionSavedRecentResult method prepareEntityUpdateKeyMap.
// ===================================================================================
// Entity Update
// =============
protected Map<String, Object> prepareEntityUpdateKeyMap(BehaviorCommandMeta meta) {
// always can get if entity update
final Entity entity = extractArgumentEntity(meta);
if (entity == null) {
// no way, just in case
return Collections.emptyMap();
}
final DBMeta dbmeta = entity.asDBMeta();
final Map<String, Object> keyMap;
final Set<String> uniqueProps = entity.myuniqueDrivenProperties();
if (!uniqueProps.isEmpty()) {
final Map<String, Object> uniqueMap = uniqueProps.stream().map(prop -> {
return dbmeta.findColumnInfo(prop);
}).collect(Collectors.toMap(col -> col.getColumnDbName(), col -> col.read(entity)));
keyMap = uniqueMap;
} else if (dbmeta.hasPrimaryKey() && entity.hasPrimaryKeyValue()) {
keyMap = dbmeta.extractPrimaryKeyMap(entity);
} else {
// no way if entity update, just in case
keyMap = Collections.emptyMap();
}
return keyMap;
}
use of org.dbflute.bhv.core.BehaviorCommandMeta in project lastaflute by lastaflute.
the class RomanticTraceableSqlResultHandler method handle.
@Override
public void handle(SqlResultInfo info) {
final RomanticTransaction tx = TransactionRomanticContext.getRomanticTransaction();
if (tx != null) {
// not saved because of internal object
final BehaviorCommandMeta meta = info.getMeta();
final String tableName = meta.getDBMeta().getTableDispName();
final String command = meta.getCommandName();
final ExecutionTimeInfo timeInfo = info.getExecutionTimeInfo();
final Long beginMillis = timeInfo.getCommandBeforeTimeMillis();
final Long endMillis = timeInfo.getCommandAfterTimeMillis();
final Class<?> resultType = meta.getCommandReturnType();
final Object resultValue = info.getResult();
tx.registerRecentResult(tableName, command, beginMillis, endMillis, resultType, resultValue, meta);
}
}
use of org.dbflute.bhv.core.BehaviorCommandMeta 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;
}
use of org.dbflute.bhv.core.BehaviorCommandMeta in project dbflute-core by dbflute.
the class CallbackContextTest method setupThreeBehaviorCommandHook.
private void setupThreeBehaviorCommandHook(CallbackContext context) {
setupTwoBehaviorCommandHook(context);
context.setBehaviorCommandHook(new BehaviorCommandHook() {
public void hookBefore(BehaviorCommandMeta meta) {
markHere("thirdBefore");
}
public void hookFinally(BehaviorCommandMeta meta, RuntimeException cause) {
markHere("thirdFinally");
}
});
}
Aggregations