use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method setupProcedureSynonym.
// -----------------------------------------------------
// Procedure Synonym
// -----------------
protected void setupProcedureSynonym(List<DfProcedureMeta> procedureList) {
if (_procedureSynonymDataSource == null) {
return;
}
final DfOutsideSqlProperties prop = getOutsideSqlProperties();
final ProcedureSynonymHandlingType handlingType = prop.getProcedureSynonymHandlingType();
if (handlingType.equals(ProcedureSynonymHandlingType.NONE)) {
return;
}
final DfProcedureSynonymExtractor extractor = createProcedureSynonymExtractor();
if (extractor == null) {
// unsupported at the database
return;
}
final Map<String, DfProcedureSynonymMeta> procedureSynonymMap = extractor.extractProcedureSynonymMap();
if (handlingType.equals(ProcedureSynonymHandlingType.INCLUDE)) {
// only add procedure synonyms to the procedure list
} else if (handlingType.equals(ProcedureSynonymHandlingType.SWITCH)) {
log("...Clearing normal procedures: count=" + procedureList.size());
// because of switch
procedureList.clear();
} else {
String msg = "Unexpected handling type of procedure sysnonym: " + handlingType;
throw new IllegalStateException(msg);
}
log("...Adding procedure synonyms as procedure: count=" + procedureSynonymMap.size());
final List<DfProcedureMeta> procedureSynonymList = new ArrayList<DfProcedureMeta>();
for (Entry<String, DfProcedureSynonymMeta> entry : procedureSynonymMap.entrySet()) {
final DfProcedureSynonymMeta metaInfo = entry.getValue();
if (!isSynonymAllowedSchema(metaInfo)) {
continue;
}
// merge synonym to procedure (create copied instance)
final String beforeName = metaInfo.getProcedureMetaInfo().buildProcedureLoggingName();
final DfProcedureMeta mergedProcedure = metaInfo.createMergedProcedure();
final String afterName = mergedProcedure.buildProcedureLoggingName();
log(" " + beforeName + " to " + afterName);
procedureSynonymList.add(mergedProcedure);
}
procedureList.addAll(procedureSynonymList);
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method arrangeProcedureOrder.
protected Map<String, DfProcedureMeta> arrangeProcedureOrder(Map<String, DfProcedureMeta> procedureHandlingMap) {
final Map<String, DfProcedureMeta> procedureOrderedMap = newLinkedHashMap();
final Map<String, DfProcedureMeta> additionalSchemaProcedureMap = newLinkedHashMap();
final Set<Entry<String, DfProcedureMeta>> entrySet = procedureHandlingMap.entrySet();
for (Entry<String, DfProcedureMeta> entry : entrySet) {
final String key = entry.getKey();
final DfProcedureMeta metaInfo = entry.getValue();
if (metaInfo.getProcedureSchema().isAdditionalSchema()) {
additionalSchemaProcedureMap.put(key, metaInfo);
} else {
// main schema
procedureOrderedMap.put(key, metaInfo);
}
}
procedureOrderedMap.putAll(additionalSchemaProcedureMap);
return procedureOrderedMap;
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method doSetupOverloadInfoOracle.
protected void doSetupOverloadInfoOracle(Map<UnifiedSchema, Map<String, Integer>> parameterOverloadInfoMapMap, List<DfProcedureMeta> metaInfoList, DfProcedureSupplementExtractorOracle extractor) {
for (DfProcedureMeta metaInfo : metaInfoList) {
final String catalog = metaInfo.getProcedureCatalog();
final String procedureName = metaInfo.getProcedureName();
final List<DfProcedureColumnMeta> columnList = metaInfo.getProcedureColumnList();
for (DfProcedureColumnMeta columnInfo : columnList) {
final String columnName = columnInfo.getColumnName();
final String key = extractor.generateParameterInfoMapKey(catalog, procedureName, columnName);
// Overload
if (columnInfo.getOverloadNo() == null) {
// if not exists (it might be set by other processes)
final UnifiedSchema procedureSchema = metaInfo.getProcedureSchema();
final Map<String, Integer> overloadMap = parameterOverloadInfoMapMap.get(procedureSchema);
if (overloadMap != null) {
final Integer overloadNo = overloadMap.get(key);
if (overloadNo != null) {
columnInfo.setOverloadNo(overloadNo);
}
}
}
}
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method setupAdditionalSchemaProcedure.
// -----------------------------------------------------
// Additional Schema
// -----------------
protected void setupAdditionalSchemaProcedure(DfSchemaSource dataSource, List<DfProcedureMeta> procedureList) throws SQLException {
if (_suppressAdditionalSchema) {
return;
}
final DfDatabaseProperties databaseProp = getProperties().getDatabaseProperties();
final List<UnifiedSchema> additionalSchemaList = databaseProp.getAdditionalSchemaList();
for (UnifiedSchema additionalSchema : additionalSchemaList) {
final DfAdditionalSchemaInfo schemaInfo = databaseProp.getAdditionalSchemaInfo(additionalSchema);
if (schemaInfo.isSuppressProcedure()) {
continue;
}
final List<DfProcedureMeta> additionalProcedureList = getPlainProcedureList(dataSource, additionalSchema);
procedureList.addAll(additionalProcedureList);
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method doSetupOverloadInfoOracleToDBLink.
protected void doSetupOverloadInfoOracleToDBLink(Map<String, Integer> parameterOverloadInfoMap, List<DfProcedureMeta> metaInfoList, DfProcedureSupplementExtractorOracle extractor) {
for (DfProcedureMeta metaInfo : metaInfoList) {
final String catalog = metaInfo.getProcedureCatalog();
final String procedureName = metaInfo.getProcedureName();
final List<DfProcedureColumnMeta> columnList = metaInfo.getProcedureColumnList();
for (DfProcedureColumnMeta columnInfo : columnList) {
final String columnName = columnInfo.getColumnName();
final String key = extractor.generateParameterInfoMapKey(catalog, procedureName, columnName);
// Overload
if (columnInfo.getOverloadNo() == null) {
// if not exists (it might be set by other processes)
final Integer overloadNo = parameterOverloadInfoMap.get(key);
if (overloadNo != null) {
columnInfo.setOverloadNo(overloadNo);
}
}
}
}
}
Aggregations