public List<Object> getChildren(Object node, String tableName, XSQLBluePrint bluePrint) {

    List<Object> children = XSQLODLUtils.getMChildren(node);
    List<Object> result = new LinkedList<Object>();

    for (Object child : children) {

      String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
      if (odlNodeName == null) {
        if (child instanceof DataContainerNode) {
          List<Object> augChidlren = getChildren(child, tableName, bluePrint);
          result.addAll(augChidlren);
        }
        continue;
      }

      XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(odlNodeName);
      if (eNodes == null) {
        continue;
      }

      boolean match = false;
      for (XSQLBluePrintNode enode : eNodes) {
        if (tableName.startsWith(enode.toString())) {
          match = true;
          break;
        }
      }

      if (!match) {
        continue;
      }

      if (child.getClass().getName().endsWith("ImmutableUnkeyedListNode")) {
        result.add(child);
      } else if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
        result.add(child);
      } else if (child.getClass().getName().endsWith("ImmutableAugmentationNode")) {
        List<Object> _children = XSQLODLUtils.getMChildren(child);
        for (Object c : _children) {
          if (c.getClass().getName().endsWith("ImmutableContainerNode")) {
            result.add(c);
          }
        }
      } else if (child.getClass().getName().endsWith("ImmutableMapNode")) {
        result.addAll(XSQLODLUtils.getMChildren(child));
      } else {
        XSQLAdapter.log("Missed Node Data OF Type=" + child.getClass().getName());
      }
    }
    return result;
  }
 private void addToData(
     Record rec, XSQLBluePrintNode bpn, XSQLBluePrint bluePrint, Map<String, Object> fullRecord) {
   XSQLBluePrintNode eNodes[] =
       bluePrint.getBluePrintNodeByODLTableName(XSQLODLUtils.getNodeIdentiofier(rec.element));
   if (bpn != null) {
     for (XSQLColumn c : fieldsInQuery) {
       for (XSQLBluePrintNode eNode : eNodes) {
         if (((XSQLBluePrintNode) c.getBluePrintNode())
             .getBluePrintNodeName()
             .equals(eNode.getBluePrintNodeName())) {
           // Object value = Criteria.getValue(rec.element,
           // c.getName());
           String columnName = c.toString();
           Object value = fullRecord.get(columnName);
           if (value != null) {
             try {
               Object rsValue = c.getResultSetValue(value);
               c.setCharWidth(rsValue.toString().length());
               rec.data.put(columnName, rsValue);
             } catch (Exception err) {
             }
           }
         }
       }
     }
   }
 }
 private void collectColumnValues(RecordsContainer rContainer, XSQLBluePrintNode bpn) {
   Collection<?> subChildren = XSQLODLUtils.getChildrenCollection(rContainer.currentObject);
   Record r = new Record();
   r.element = rContainer.currentObject;
   for (Object stc : subChildren) {
     if (stc.getClass().getName().endsWith("ImmutableUnkeyedListEntryNode")) {
       r.fitCriteria = false;
       rContainer.currentObject = stc;
       collectColumnValues(rContainer, bpn);
     } else if (stc.getClass().getName().endsWith("ImmutableAugmentationNode")) {
       Map<?, ?> values = XSQLODLUtils.getChildren(stc);
       for (Object key : values.keySet()) {
         Object val = values.get(key);
         if (val.getClass().getName().endsWith("ImmutableLeafNode")) {
           Object value = XSQLODLUtils.getValue(val);
           String k = XSQLODLUtils.getNodeName(val);
           if (value != null) {
             r.data.put(bpn.getBluePrintNodeName() + "." + k, value.toString());
           }
         }
       }
     } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) {
       String k = XSQLODLUtils.getNodeName(stc);
       Object value = XSQLODLUtils.getValue(stc);
       if (value != null) {
         r.data.put(bpn.getBluePrintNodeName() + "." + k, value.toString());
       }
     }
   }
   if (r.fitCriteria) {
     rContainer.records.add(r);
   }
 }
  public List<Record> addRecords(
      Object element,
      XSQLBluePrintNode node,
      boolean root,
      String tableName,
      XSQLBluePrint bluePrint) {
    List<Record> result = new LinkedList<Record>();
    String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
    if (node.getODLTableName().equals(nodeID)) {
      XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0];
      RecordsContainer rContainer = new RecordsContainer();
      rContainer.currentObject = element;
      XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName());
      if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) {
        collectColumnValues(rContainer, bpn);
        for (Record r : rContainer.records) {
          if (!(isObjectFitCriteria(r.data, bpn.getBluePrintNodeName()) == 1)) {
            r.fitCriteria = false;
          }
          if (r.fitCriteria) {
            Record rec = new Record();
            rec.element = r.element;
            addToData(rec, bpn, bluePrint, r.data);
            rContainer.fitRecords.add(rec);
          }
        }
        if (rContainer.fitRecords.isEmpty()) return EMPTY_RESULT;
      }
      if (rContainer.records.isEmpty()) {
        Record rec = new Record();
        rec.element = rContainer.currentObject;
        if (root) {
          addRecord(rec.data);
        } else {
          result.add(rec);
        }
      } else {
        for (Record rec : rContainer.fitRecords) {
          if (root) {
            addRecord(rec.data);
          } else {
            result.add(rec);
          }
        }
      }
      return result;
    }

    XSQLBluePrintNode parent = node.getParent();
    List<Record> subRecords = addRecords(element, parent, false, tableName, bluePrint);
    for (Record subRec : subRecords) {
      List<Object> subO = getChildren(subRec.element, tableName, bluePrint);
      if (subO != null) {
        for (Object subData : subO) {
          RecordsContainer rContainer = new RecordsContainer();
          rContainer.currentObject = subData;

          String recID = XSQLODLUtils.getNodeIdentiofier(rContainer.currentObject);
          XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(recID);
          XSQLBluePrintNode bpn = null;
          for (XSQLBluePrintNode eNode : eNodes) {
            bpn = this.tablesInQueryMap.get(eNode.getBluePrintNodeName());
            if (bpn != null) {
              break;
            }
          }
          if (bpn != null) {
            collectColumnValues(rContainer, bpn);
            for (Record r : rContainer.records) {
              if ((isObjectFitCriteria(r.data, bpn.getBluePrintNodeName()) == 1)) {
                Record rec = new Record();
                rec.data.putAll(subRec.data);
                rec.element = r.element;
                addToData(rec, bpn, bluePrint, r.data);
              } else {
                r.fitCriteria = false;
              }
            }
          }
          if (rContainer.records.isEmpty()) {
            Record rec = new Record();
            rec.data.putAll(subRec.data);
            rec.element = rContainer.currentObject;
            if (root) {
              if (!rec.data.isEmpty()) {
                addRecord(rec.data);
              }
            } else {
              result.add(rec);
            }
          } else {
            for (Record r : rContainer.records) {
              r.data.putAll(subRec.data);
              if (r.fitCriteria) {
                if (root) {
                  if (!r.data.isEmpty()) {
                    addRecord(r.data);
                  }
                } else {
                  result.add(r);
                }
              }
            }
          }
        }
      }
    }
    return result;
  }