예제 #1
0
  public JSONArray getJSONArrayRepresentation(RepFactory f) throws JSONException {
    JSONArray arr = new JSONArray();
    Stack<HNode> st = new Stack<HNode>();
    st.push(this);
    HTable t = f.getHTable(hTableId);
    HNode parentNode = t.getParentHNode();
    while (parentNode != null) {
      st.push(parentNode);
      t = f.getHTable(parentNode.getHTableId());
      parentNode = t.getParentHNode();
    }

    while (!st.isEmpty()) {
      HNode node = st.pop();
      JSONObject obj = new JSONObject();
      obj.put("columnName", node.getColumnName());
      arr.put(obj);
    }
    return arr;
  }
 private boolean isSamehTableId(String hNodeId1, String hNodeId2, Workspace workspace) {
   HNode hNode1 = workspace.getFactory().getHNode(hNodeId1);
   HNode hNode2 = workspace.getFactory().getHNode(hNodeId2);
   if (hNode1 == null || hNode2 == null) return false;
   return hNode1.getHTableId().equals(hNode2.getHTableId());
 }