use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method doSetupGreatWallOracle.
// ===================================================================================
// Great Wall
// ==========
protected void doSetupGreatWallOracle(StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap, StringKeyMap<DfTypeStructInfo> structInfoMap, List<DfProcedureMeta> metaInfoList, DfProcedureSupplementExtractorOracle extractor) {
final Set<String> resolvedArrayDispSet = new LinkedHashSet<String>();
final Set<String> resolvedStructDispSet = new LinkedHashSet<String>();
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);
// Array
final DfTypeArrayInfo arrayInfo = parameterArrayInfoMap.get(key);
if (arrayInfo != null) {
resolvedArrayDispSet.add(arrayInfo.toString());
columnInfo.setTypeArrayInfo(arrayInfo);
}
// Struct
final String dbTypeName = columnInfo.getDbTypeName();
final DfTypeStructInfo structInfo = structInfoMap.get(dbTypeName);
if (structInfo != null) {
resolvedStructDispSet.add(structInfo.toString());
columnInfo.setTypeStructInfo(structInfo);
}
}
}
if (!resolvedArrayDispSet.isEmpty()) {
log("Array related to parameter: " + resolvedArrayDispSet.size());
for (String arrayInfo : resolvedArrayDispSet) {
log(" " + arrayInfo);
}
}
if (!resolvedStructDispSet.isEmpty()) {
log("Struct related to parameter: " + resolvedStructDispSet.size());
for (String structInfo : resolvedStructDispSet) {
log(" " + structInfo);
}
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureExtractor method setupProcedureToDBLinkIncluded.
// -----------------------------------------------------
// Included Procedure to DBLink
// ----------------------------
protected void setupProcedureToDBLinkIncluded(List<DfProcedureMeta> procedureList) {
if (_procedureToDBLinkDataSource == null) {
return;
}
final DfProcedureNativeTranslatorOracle translator = new DfProcedureNativeTranslatorOracle(_procedureToDBLinkDataSource);
final DfOutsideSqlProperties prop = getOutsideSqlProperties();
final List<String> procedureNameToDBLinkList = prop.getTargetProcedureNameToDBLinkList();
for (String propertyName : procedureNameToDBLinkList) {
final String packageName;
final String procedureName;
final String dbLinkName;
final String nameResource;
if (propertyName.contains(".")) {
packageName = Srl.substringLastFront(propertyName, ".");
nameResource = Srl.substringLastRear(propertyName, ".");
} else {
packageName = null;
nameResource = propertyName;
}
procedureName = Srl.substringLastFront(nameResource, "@");
dbLinkName = Srl.substringLastRear(nameResource, "@");
final DfProcedureMeta meta = translator.translateProcedureToDBLink(packageName, procedureName, dbLinkName, this);
if (meta == null) {
throwProcedureToDBLinkTranslationFailureException(propertyName, packageName, procedureName, dbLinkName);
}
meta.setIncludedProcedureToDBLink(true);
procedureList.add(meta);
}
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedureNativeTranslatorOracle method createDBLinkProcedureMeta.
protected DfProcedureMeta createDBLinkProcedureMeta(ProcedureNativeInfo nativeInfo, String dbLinkName) {
final DfProcedureMeta procedureMeta = new DfProcedureMeta();
setupProcedureName(nativeInfo, procedureMeta, dbLinkName);
final List<DfProcedureArgumentInfo> argInfoList = nativeInfo.getArgInfoList();
for (DfProcedureArgumentInfo argInfo : argInfoList) {
final DfProcedureColumnMeta columnMeta = new DfProcedureColumnMeta();
columnMeta.setColumnName(argInfo.getArgumentName());
setupProcedureColumnDataType(argInfo, columnMeta);
setupProcedureColumnInOutType(argInfo, columnMeta);
setupProcedureColumnSize(argInfo, columnMeta);
procedureMeta.addProcedureColumn(columnMeta);
}
// assist info (e.g. great walls) is not set here (set later)
return procedureMeta;
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfSchemaHtmlProcedure method getAvailableSchemaProcedureMap.
public Map<String, List<DfProcedureMeta>> getAvailableSchemaProcedureMap(Supplier<DfSchemaSource> dataSourceProvider) throws SQLException {
if (_schemaProcedureMap != null) {
return _schemaProcedureMap;
}
final List<DfProcedureMeta> procedureList = getAvailableProcedureList(dataSourceProvider);
final Map<String, List<DfProcedureMeta>> schemaProcedureListMap = DfCollectionUtil.newLinkedHashMap();
final String mainName = "(main schema)";
for (DfProcedureMeta meta : procedureList) {
final UnifiedSchema procedureSchema = meta.getProcedureSchema();
final String schemaName;
if (procedureSchema != null) {
final String drivenSchema = procedureSchema.getDrivenSchema();
if (drivenSchema != null) {
schemaName = drivenSchema;
} else {
schemaName = procedureSchema.isMainSchema() ? mainName : procedureSchema.getSqlPrefixSchema();
}
} else {
schemaName = "(no schema)";
}
List<DfProcedureMeta> metaList = schemaProcedureListMap.get(schemaName);
if (metaList == null) {
metaList = DfCollectionUtil.newArrayList();
schemaProcedureListMap.put(schemaName, metaList);
}
metaList.add(meta);
}
_schemaProcedureMap = schemaProcedureListMap;
return _schemaProcedureMap;
}
use of org.dbflute.logic.jdbc.metadata.info.DfProcedureMeta in project dbflute-core by dbflute.
the class DfProcedurePmbSetupper method setupProcedure.
// ===================================================================================
// Set up
// ======
public void setupProcedure() throws SQLException {
if (!getOutsideSqlProperties().isGenerateProcedureParameterBean()) {
return;
}
_log.info(" ");
_log.info("...Setting up procedures for generating parameter-beans");
final List<DfProcedureMeta> procedureList = getAvailableProcedureList();
_log.info("");
_log.info("/= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =");
for (DfProcedureMeta procedure : procedureList) {
final Map<String, String> propertyNameTypeMap = DfCollectionUtil.newLinkedHashMap();
final Map<String, String> propertyNameOptionMap = DfCollectionUtil.newLinkedHashMap();
final Map<String, String> propertyNameColumnNameMap = DfCollectionUtil.newLinkedHashMap();
final Map<String, DfProcedureColumnMeta> propertyNameColumnInfoMap = DfCollectionUtil.newLinkedHashMap();
final List<DfProcedureColumnMeta> procedureColumnList = procedure.getProcedureColumnList();
final List<DfProcedureNotParamResultMeta> notParamResultList = procedure.getNotParamResultList();
final String pmbName = convertProcedureNameToPmbName(procedure.getProcedureName());
{
final String procDisp = procedure.buildProcedureLoggingName();
final DfProcedureType procType = procedure.getProcedureType();
_log.info("[" + pmbName + "]: " + procDisp + " // " + procType);
if (procedureColumnList.isEmpty() && notParamResultList.isEmpty()) {
_log.info(" *No Parameter");
}
}
boolean refCustomizeEntity = false;
// Procedure Parameter handling
int index = 0;
for (DfProcedureColumnMeta column : procedureColumnList) {
if (!column.isBindParameter()) {
continue;
}
final String columnName;
{
final String plainColumnName = column.getColumnName();
if (Srl.is_NotNull_and_NotTrimmedEmpty(plainColumnName)) {
columnName = resolveVendorColumnNameHeadable(plainColumnName);
} else {
columnName = "arg" + (index + 1);
}
}
final String propertyName;
{
propertyName = convertColumnNameToPropertyName(columnName);
}
// procedure's overload is unsupported because of this (override property)
propertyNameColumnInfoMap.put(propertyName, column);
final ProcedurePropertyInfo propertyInfo = processProcedureProperty(pmbName, column, propertyName);
final String propertyType = propertyInfo.getPropertyType();
if (propertyInfo.isRefCustomizeEntity()) {
refCustomizeEntity = true;
}
propertyNameTypeMap.put(propertyName, propertyType);
final DfProcedureColumnType procedureColumnType = column.getProcedureColumnType();
propertyNameOptionMap.put(propertyName, procedureColumnType.toString());
propertyNameColumnNameMap.put(propertyName, columnName);
String msg = " " + propertyType + " " + propertyName + ";";
msg = msg + " // " + column.getProcedureColumnType();
msg = msg + "(" + column.getJdbcDefType() + ", " + column.getDbTypeName() + ")";
_log.info(msg);
++index;
}
// NotParamResult handling
for (DfProcedureNotParamResultMeta result : notParamResultList) {
final String propertyName = result.getPropertyName();
final String propertyType;
if (result.hasResultSetColumnInfo()) {
final String entityName = convertProcedurePmbNameToEntityName(pmbName, propertyName);
_entityInfoMap.put(entityName, createEntityInfo(entityName, result.getResultSetColumnInfoMap()));
propertyType = convertProcedureListPropertyType(entityName);
refCustomizeEntity = true;
} else {
propertyType = getProcedureDefaultResultSetPropertyType();
}
propertyNameTypeMap.put(propertyName, propertyType);
propertyNameOptionMap.put(propertyName, DfProcedureColumnType.procedureColumnResult.toString());
propertyNameColumnNameMap.put(propertyName, propertyName);
String msg = " " + propertyType + " " + propertyName + ";";
msg = msg + " // " + DfProcedureColumnType.procedureColumnResult;
_log.info(msg);
}
final DfPmbMetaData parameterBeanMetaData = new DfPmbMetaData();
parameterBeanMetaData.setClassName(pmbName);
parameterBeanMetaData.setPropertyNameTypeMap(propertyNameTypeMap);
parameterBeanMetaData.setPropertyNameOptionMap(propertyNameOptionMap);
parameterBeanMetaData.setProcedureName(procedure.buildProcedureSqlName());
parameterBeanMetaData.setPropertyNameColumnNameMap(propertyNameColumnNameMap);
parameterBeanMetaData.setPropertyNameColumnInfoMap(propertyNameColumnInfoMap);
parameterBeanMetaData.setProcedureCalledBySelect(procedure.isCalledBySelect());
parameterBeanMetaData.setProcedureRefCustomizeEntity(refCustomizeEntity);
_pmbMetaDataMap.put(pmbName, parameterBeanMetaData);
}
_log.info("= = = = = = = = = =/");
_log.info(" ");
}
Aggregations