stac.pop();
ObjectRelationalDataTypeDescriptor ordt3 =
descriptorMap.get(sqlArrayTypeHelper2.arrayTypename());
DatabaseMapping dm3 = ordt3.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
if (dm3 == null) {
ObjectArrayMapping objArrayMapping = new ObjectArrayMapping();
objArrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
objArrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
objArrayMapping.setStructureName(sqlArrayTypeHelper2.arrayTypename().toUpperCase());
objArrayMapping.setReferenceClassName(ordt.getJavaClassName());
objArrayMapping.useCollectionClass(ArrayList.class);
ordt3.addMapping(objArrayMapping);
}
// more stack peeking
if (stac.peek().isAttribute()) {
listenerHelper4 = stac.peek();
}
}
else {
listenerHelper4 = listenerHelper3;
}
if (listenerHelper4.isAttribute()) {
// type built above used in field definition of object further up stack
AttributeFieldHelper fieldHelper = (AttributeFieldHelper)listenerHelper4;
stac.pop();
ListenerHelper listenerHelper5 = stac.peek();
if (listenerHelper5.isObject()) {
ObjectTypeHelper objectTypeHelper = (ObjectTypeHelper)listenerHelper5;
ObjectRelationalDataTypeDescriptor ordt2 =
descriptorMap.get(objectTypeHelper.objectTypename());
String fieldName = fieldHelper.attributeFieldName();
DatabaseMapping dm2 =
ordt2.getMappingForAttributeName(fieldName.toLowerCase());
if (dm2 == null) {
ordt2.addFieldOrdering(fieldName);
// simple or complex array?
if (listenerHelper4 == listenerHelper3) {
ArrayMapping arrayMapping2 = new ArrayMapping();
arrayMapping2.setAttributeName(fieldName.toLowerCase());
arrayMapping2.setFieldName(fieldName);
arrayMapping2.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
arrayMapping2.useCollectionClass(ArrayList.class);
DatabaseField nestedField = new DatabaseField("");
nestedField.setSqlType(typecode);
nestedField.setColumnDefinition(sqlTypeName);
ObjectRelationalDatabaseField field =
(ObjectRelationalDatabaseField)arrayMapping2.getField();
field.setNestedTypeField(nestedField);
ordt2.addMapping(arrayMapping2);
}
else {
ObjectArrayMapping objArrayMapping2 = new ObjectArrayMapping();
objArrayMapping2.setAttributeName(fieldName.toLowerCase());
objArrayMapping2.setFieldName(fieldName);
String structureName = "";
String referenceClassName = "";
if (listenerHelper3.isObject()) {
ObjectTypeHelper objectTypeHelper2 =
(ObjectTypeHelper)listenerHelper3;
structureName =
objectTypeHelper2.objectTypename().toUpperCase();
ObjectRelationalDataTypeDescriptor ordt3 =
descriptorMap.get(objectTypeHelper2.objectTypename());
referenceClassName = ordt3.getJavaClassName();
}
else if (listenerHelper3.isArray()) {
SqlArrayTypeHelper sqlArrayTypeHelper3 =
(SqlArrayTypeHelper)listenerHelper3;
structureName =
sqlArrayTypeHelper3.arrayTypename().toUpperCase();
ObjectRelationalDataTypeDescriptor ordt3 =
descriptorMap.get(sqlArrayTypeHelper3.arrayTypename());
referenceClassName = ordt3.getJavaClassName();
}
else {
// ??
}
objArrayMapping2.setStructureName(structureName);
objArrayMapping2.setReferenceClassName(referenceClassName);
objArrayMapping2.useCollectionClass(ArrayList.class);
ordt2.addMapping(objArrayMapping2);
}
}
// last attribute, pop ObjectTypeHelper off stack
int numAttributes = objectTypeHelper.decrNumAttributes();