示例#1
0
 private static void fetchArray(
     final ORecordSchemaAware<?> iRootRecord,
     final Object iUserObject,
     final Map<String, Integer> iFetchPlan,
     Object fieldValue,
     String fieldName,
     final int iCurrentLevel,
     final int iLevelFromRoot,
     final int iFieldDepthLevel,
     final Map<ORID, Integer> parsedRecords,
     final String iFieldPathFromRoot,
     final OFetchListener iListener,
     final OFetchContext iContext)
     throws IOException {
   if (fieldValue instanceof ODocument[]) {
     final ODocument[] linked = (ODocument[]) fieldValue;
     iContext.onBeforeArray(iRootRecord, fieldName, iUserObject, linked);
     for (ODocument d : linked) {
       // GO RECURSIVELY
       final Integer fieldDepthLevel = parsedRecords.get(d.getIdentity());
       if (!d.getIdentity().isValid()
           || (fieldDepthLevel != null && fieldDepthLevel.intValue() == iLevelFromRoot)) {
         removeParsedFromMap(parsedRecords, d);
         iContext.onBeforeDocument(iRootRecord, d, fieldName, iUserObject);
         final Object userObject =
             iListener.fetchLinked(iRootRecord, iUserObject, fieldName, d, iContext);
         processRecord(
             d,
             userObject,
             iFetchPlan,
             iCurrentLevel,
             iLevelFromRoot,
             iFieldDepthLevel,
             parsedRecords,
             iFieldPathFromRoot,
             iListener,
             iContext,
             "");
         iContext.onAfterDocument(iRootRecord, d, fieldName, iUserObject);
       } else {
         iListener.parseLinkedCollectionValue(iRootRecord, d, iUserObject, fieldName, iContext);
       }
     }
     iContext.onAfterArray(iRootRecord, fieldName, iUserObject);
   } else {
     iListener.processStandardField(iRootRecord, fieldValue, fieldName, iContext, iUserObject, "");
   }
 }