public HTable addNestedTable(String tableName, Worksheet worksheet, RepFactory factory) { nestedTable = factory.createHTable(tableName); // mariam nestedTable.setParentHNode(this); worksheet.addNestedTableToDataTable(this, factory); return nestedTable; }
@Override public void prettyPrint(String prefix, PrintWriter pw, RepFactory factory) { pw.print(prefix + " - "); pw.print(factory.getHNode(hNodeId).getColumnName() + "/" + id + "/" + hNodeId + ":"); if (nestedTable != null) { pw.println(); nestedTable.prettyPrint(prefix + " ", pw, factory); } else { pw.println("<" + value.asString() + ">"); } }
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; }
/** * Returns the HNodePath for this node. * * @param factory * @return the HNodePath for this node. */ public HNodePath getHNodePath(RepFactory factory) { HNodePath p1 = new HNodePath(this); // get the table that it belongs to HTable t = factory.getHTable(hTableId); HNode parentNode = t.getParentHNode(); if (parentNode != null) { HNodePath p2 = parentNode.getHNodePath(factory); p1 = HNodePath.concatenate(p2, p1); } return p1; }
public void setValue(CellValue value, NodeStatus status, RepFactory factory) { this.value = value; this.status = status; // Pedro 2012/09/14 if (nestedTable != null) { logger.info( "Node in column '" + factory.getColumnName(hNodeId) + "' contains both value and nested table: " + toString() + " -- setting value '" + value.asString() + "'"); nestedTable.addOrphanValue(value, factory); } }
public void setNestedTable(Table nestedTable, RepFactory factory) { this.nestedTable = nestedTable; // mariam if (nestedTable != null) { nestedTable.setNestedTableInNode(this); // pedro 2012-09-15 if (!value.isEmptyValue()) { logger.info( "Node in column '" + factory.getColumnName(hNodeId) + "' contains both value and nested table: " + toString() + " -- setting value '" + value.asString() + "'"); nestedTable.addOrphanValue(value, factory); } } }
/** * Returns the HTable that this node belongs to. * * @param f * @return the HTable that this node belongs to. */ public HTable getHTable(RepFactory f) { return f.getHTable(hTableId); }