for (PLSQLargument inArg : inArguments) {
DatabaseType type = inArg.databaseType;
if (!type.isComplexDatabaseType()) {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode());
} else {
ComplexDatabaseType complexType = (ComplexDatabaseType) type;
if (inArg.inIndex != MIN_VALUE) {
if (type instanceof OracleObjectType) {
super.addNamedArgument(inArg.name, inArg.name, Types.STRUCT, complexType.getCompatibleType());
} else if (complexType instanceof OracleArrayType) {
DatabaseType nestedType = ((OracleArrayType) type).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(inArg.name);
field.setSqlType(Types.STRUCT);
if (nestedType.isComplexDatabaseType()) {
field.setSqlTypeName(((ComplexDatabaseType) nestedType).getCompatibleType());
}
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType(), field);
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
}
} else if (type instanceof PLSQLCollection) {
DatabaseType nestedType = ((PLSQLCollection) type).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(inArg.name);
field.setSqlType(nestedType.getConversionCode());
if (nestedType.isComplexDatabaseType()) {
field.setSqlTypeName(((ComplexDatabaseType) nestedType).getCompatibleType());
}
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType(), field);
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
}
} else {
super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
}
}
}
}
List<PLSQLargument> outArguments = getArguments(arguments, OUT);
outArguments.addAll(inOutArguments);
for (ListIterator<PLSQLargument> outArgsIter = outArguments.listIterator(); outArgsIter.hasNext();) {
PLSQLargument outArg = outArgsIter.next();
newIndex = outArg.databaseType.computeOutIndex(outArg, newIndex, outArgsIter);
}
for (PLSQLargument outArg : outArguments) {
if (outArg.cursorOutput) {
super.useNamedCursorOutputAsResultSet(outArg.name);
} else {
DatabaseType type = outArg.databaseType;
if (!type.isComplexDatabaseType()) {
// for XMLType, we need to set type name parameter (will be "XMLTYPE")
if (type == XMLType) {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), type.getTypeName());
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode());
}
} else {
ComplexDatabaseType complexType = (ComplexDatabaseType) type;
if (outArg.outIndex != MIN_VALUE) {
if (complexType instanceof OracleArrayType) {
DatabaseType nestedType = ((OracleArrayType) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField(outArg.name);
nestedField.setSqlType(Types.STRUCT);
if (nestedType.isComplexDatabaseType()) {
ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
nestedField.setType(complexNestedType.getJavaType());
nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
}
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getTypeName(), complexType.getJavaType(), nestedField);
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getTypeName(), complexType.getJavaType());
}
} else if (complexType instanceof OracleObjectType) {
super.addNamedOutputArgument(outArg.name, outArg.name, Types.STRUCT, complexType.getTypeName(), complexType.getJavaType());
} else if (complexType instanceof PLSQLCollection) {
DatabaseType nestedType = ((PLSQLCollection) complexType).getNestedType();
if (nestedType != null) {
ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField(outArg.name);
nestedField.setSqlType(nestedType.getConversionCode());
if (nestedType.isComplexDatabaseType()) {
ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
nestedField.setType(complexNestedType.getJavaType());
nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
}
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField);
} else {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType());
}