コード例 #1
0
 @Override
 public void endPlsqlTable(String tableName, String typeDDL, String typeDropDDL) {
   ListenerHelper top = stac.pop();
   TableHelper tableHelper = (TableHelper) stac.peek();
   String tableAlias = tableHelper.targetTypeName().toLowerCase();
   ObjectRelationalDataTypeDescriptor ordt = descriptorMap.get(tableAlias);
   if (ordt == null) {
     ordt = new ObjectRelationalDataTypeDescriptor();
     ordt.descriptorIsAggregate();
     ordt.setAlias(tableHelper.tableAlias());
     ordt.setJavaClassName(tableName.toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
     ordt.getQueryManager();
   }
   boolean itemsMappingFound =
       ordt.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME) == null ? false : true;
   if (top.isRecord()) {
     if (!itemsMappingFound) {
       ObjectArrayMapping itemsMapping = new ObjectArrayMapping();
       itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
       itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
       itemsMapping.setStructureName(tableHelper.targetTypeName());
       itemsMapping.setReferenceClassName(((RecordHelper) top).recordName().toLowerCase());
       ordt.addMapping(itemsMapping);
     }
     tableHelper.nestedIsComplex();
   } else {
     if (!itemsMappingFound) {
       ArrayMapping itemsMapping = new ArrayMapping();
       itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
       itemsMapping.setFieldName(ITEMS_MAPPING_FIELD_NAME);
       itemsMapping.useCollectionClass(ArrayList.class);
       itemsMapping.setStructureName(tableHelper.targetTypeName());
       ordt.addMapping(itemsMapping);
     }
     if (top.isTable()) {
       tableHelper.nestedIsComplex();
     }
   }
   if (!itemsMappingFound) {
     descriptorMap.put(tableAlias, ordt);
   }
 }
コード例 #2
0
 @Override
 public void endPlsqlRecordField(String fieldName, int idx) {
   ListenerHelper top = stac.pop();
   ListenerHelper listenerHelper = stac.peek();
   if (listenerHelper.isRecord()) {
     RecordHelper recordHelper = (RecordHelper) stac.peek();
     ObjectRelationalDataTypeDescriptor ordt =
         descriptorMap.get(recordHelper.targetTypeName().toLowerCase());
     String lFieldName = fieldName.toLowerCase();
     if (ordt.getMappingForAttributeName(lFieldName) == null) {
       if (top.isComplex()) {
         if (top.isTable()) {
           if (((TableHelper) top).isNestedComplex()) {
             ObjectArrayMapping objectArrayMapping = new ObjectArrayMapping();
             objectArrayMapping.setAttributeName(lFieldName);
             objectArrayMapping.setFieldName(lFieldName);
             objectArrayMapping.setStructureName(top.targetTypeName());
             objectArrayMapping.setReferenceClassName(
                 ((TableHelper) top).tableName().toLowerCase() + COLLECTION_WRAPPER_SUFFIX);
             ordt.addMapping(objectArrayMapping);
           } else {
             ArrayMapping arrayMapping = new ArrayMapping();
             arrayMapping.setAttributeName(lFieldName);
             arrayMapping.setFieldName(lFieldName);
             arrayMapping.setStructureName(top.targetTypeName());
             ordt.addMapping(arrayMapping);
           }
         } else if (top.isRecord()) {
           StructureMapping structureMapping = new StructureMapping();
           structureMapping.setAttributeName(lFieldName);
           structureMapping.setFieldName(lFieldName);
           structureMapping.setReferenceClassName(((RecordHelper) top).recordName().toLowerCase());
           ordt.addMapping(structureMapping);
         }
       } else {
         ordt.addDirectMapping(lFieldName, lFieldName);
       }
     }
   } else {
     System.identityHashCode(listenerHelper);
   }
 }