use of org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo in project dbflute-core by dbflute.
the class DfProcedurePmbSetupper method doProcessArrayProperty.
// -----------------------------------------------------
// Array Property
// --------------
protected String doProcessArrayProperty(DfTypeArrayInfo arrayInfo, ProcedurePropertyInfo propertyInfo) {
final String propertyType;
if (arrayInfo.hasNestedArray()) {
// array in array
final DfTypeArrayInfo nestedArrayInfo = arrayInfo.getNestedArrayInfo();
// recursive call
final String nestedType = doProcessArrayProperty(nestedArrayInfo, propertyInfo);
propertyType = getGenericListClassName(nestedType);
} else if (arrayInfo.hasElementStructInfo()) {
// struct in array
final DfTypeStructInfo structInfo = arrayInfo.getElementStructInfo();
propertyType = doProcessStructProperty(structInfo, propertyInfo);
} else {
// scalar in array
final String dbTypeName = arrayInfo.getElementType();
propertyType = findPlainPropertyType(Types.OTHER, dbTypeName, null, null);
}
arrayInfo.setElementJavaNative(propertyType);
return propertyType;
}
use of org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo 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.DfTypeArrayInfo in project dbflute-core by dbflute.
the class DfProcedureExtractor method doResolveAssistInfoOracleToDBLink.
protected void doResolveAssistInfoOracleToDBLink(DfSchemaSource dataSource, List<DfProcedureMeta> metaInfoList, String dbLinkName) {
final DfProcedureSupplementExtractorOracle extractor = getSupplementExtractorOracle(dataSource);
// Overload
final Map<String, Integer> overloadInfoMapMap = extractor.extractParameterOverloadInfoToDBLinkMap(dbLinkName);
doSetupOverloadInfoOracleToDBLink(overloadInfoMapMap, metaInfoList, extractor);
// GreatWall
// DBLink procedure's GreatWalls are unsupported yet
// final StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap = extractor.extractParameterArrayInfoToDBLinkMap();
// final StringKeyMap<DfTypeStructInfo> structInfoMap = extractor.extractStructInfoToDBLinkMap();
// empty
final StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap = StringKeyMap.createAsFlexible();
// empty
final StringKeyMap<DfTypeStructInfo> structInfoMap = StringKeyMap.createAsFlexible();
doSetupGreatWallOracle(parameterArrayInfoMap, structInfoMap, metaInfoList, extractor);
}
use of org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo in project dbflute-core by dbflute.
the class DfProcedureSupplementExtractorOracle method findParameterArrayInfoMap.
protected StringKeyMap<DfTypeArrayInfo> findParameterArrayInfoMap(UnifiedSchema unifiedSchema) {
StringKeyMap<DfTypeArrayInfo> parameterArrayInfoMap = _arrayInfoMapMap.get(unifiedSchema);
if (parameterArrayInfoMap != null) {
return parameterArrayInfoMap;
}
final List<DfProcedureArgumentInfo> argInfoList = findProcedureArgumentInfoList(unifiedSchema);
parameterArrayInfoMap = StringKeyMap.createAsFlexibleOrdered();
final StringKeyMap<DfTypeArrayInfo> flatArrayInfoMap = findFlatArrayInfoMap(unifiedSchema);
for (int i = 0; i < argInfoList.size(); i++) {
final DfProcedureArgumentInfo argInfo = argInfoList.get(i);
final String argumentName = argInfo.getArgumentName();
if (Srl.is_Null_or_TrimmedEmpty(argumentName)) {
continue;
}
final String realTypeName = buildArrayTypeName(argInfo);
final DfTypeArrayInfo foundInfo = flatArrayInfoMap.get(realTypeName);
if (foundInfo == null) {
continue;
}
final DfTypeArrayInfo arrayInfo = new DfTypeArrayInfo(foundInfo.getUnifiedSchema(), foundInfo.getTypeName());
arrayInfo.setElementType(foundInfo.getElementType());
processArrayNestedElement(unifiedSchema, flatArrayInfoMap, arrayInfo);
final String packageName = argInfo.getPackageName();
final String objectName = argInfo.getObjectName();
final String key = generateParameterInfoMapKey(packageName, objectName, argumentName);
parameterArrayInfoMap.put(key, arrayInfo);
}
log("Array Parameter: " + unifiedSchema);
for (Entry<String, DfTypeArrayInfo> entry : parameterArrayInfoMap.entrySet()) {
log(" " + entry.getKey() + " = " + entry.getValue());
}
_arrayInfoMapMap.put(unifiedSchema, parameterArrayInfoMap);
return _arrayInfoMapMap.get(unifiedSchema);
}
use of org.dbflute.logic.jdbc.metadata.info.DfTypeArrayInfo in project dbflute-core by dbflute.
the class DfProcedurePmbSetupper method setupStructAttribute.
protected void setupStructAttribute(DfTypeStructInfo structInfo, ProcedurePropertyInfo propertyInfo) {
final StringKeyMap<DfColumnMeta> attrMap = structInfo.getAttributeInfoMap();
for (DfColumnMeta attrInfo : attrMap.values()) {
// nested array or struct handling
if (attrInfo.hasTypeArrayInfo()) {
// array in struct
final DfTypeArrayInfo typeArrayInfo = attrInfo.getTypeArrayInfo();
if (typeArrayInfo.hasElementStructInfo()) {
// struct in array in struct
registerEntityInfoIfNeeds(typeArrayInfo.getElementStructInfo(), propertyInfo);
}
if (typeArrayInfo.hasElementJavaNative()) {
final String elementJavaNative = typeArrayInfo.getElementJavaNative();
attrInfo.setSql2EntityForcedJavaNative(getGenericListClassName(elementJavaNative));
} else {
final String elementType;
if (typeArrayInfo.hasNestedArray()) {
// array in array in struct
final DfTypeArrayInfo nestedArrayInfo = typeArrayInfo.getNestedArrayInfo();
elementType = getGenericListClassName(doProcessArrayProperty(nestedArrayInfo, propertyInfo));
} else if (typeArrayInfo.hasElementStructInfo()) {
// struct in array in struct
final DfTypeStructInfo elementStructInfo = typeArrayInfo.getElementStructInfo();
elementType = buildStructEntityType(elementStructInfo);
} else {
// scalar in array in struct
elementType = findArrayScalarElementPropertyType(attrInfo.getTypeArrayInfo());
}
typeArrayInfo.setElementJavaNative(elementType);
attrInfo.setSql2EntityForcedJavaNative(getGenericListClassName(elementType));
}
} else if (attrInfo.hasTypeStructInfo()) {
final DfTypeStructInfo nestedStructInfo = attrInfo.getTypeStructInfo();
registerEntityInfoIfNeeds(nestedStructInfo, propertyInfo);
if (nestedStructInfo.hasEntityType()) {
attrInfo.setSql2EntityForcedJavaNative(nestedStructInfo.getEntityType());
} else {
attrInfo.setSql2EntityForcedJavaNative(buildStructEntityType(nestedStructInfo));
}
}
}
}
Aggregations