it.eng.spagobi.engines.qbe.crosstable.exporter
Class CrosstabExporterUtility

java.lang.Object
  extended by it.eng.spagobi.engines.qbe.crosstable.exporter.CrosstabExporterUtility

public class CrosstabExporterUtility
extends java.lang.Object


Field Summary
static java.lang.String CROSSTAB_JSON_DESCENDANTS_NUMBER
           
 
Constructor Summary
CrosstabExporterUtility()
           
 
Method Summary
protected static void calculateDescendants(org.json.JSONObject json)
          Add descendants_no attribute to each node of rows/columns headers' structure.
protected static int getDepth(org.json.JSONObject node)
          Calculates the path length in the nodes structure in input between the root node and a leaf.
protected static int getDescentantNumber(org.json.JSONObject aNode)
          The descendant number of a node is: -- root[3] -- // the descendant number is the sum of the children | | -- node[2] -- node[1] // the descendant number is the count of the children | | | leaf[0] leaf[0] leaf[0] // leaves have no children
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CROSSTAB_JSON_DESCENDANTS_NUMBER

public static final java.lang.String CROSSTAB_JSON_DESCENDANTS_NUMBER
See Also:
Constant Field Values
Constructor Detail

CrosstabExporterUtility

public CrosstabExporterUtility()
Method Detail

calculateDescendants

protected static void calculateDescendants(org.json.JSONObject json)
                                    throws org.json.JSONException
Add descendants_no attribute to each node of rows/columns headers' structure. descendants_no is useful for merging cells when drawing rows/columns headers' into XLS file.

Throws:
org.json.JSONException

getDescentantNumber

protected static int getDescentantNumber(org.json.JSONObject aNode)
                                  throws org.json.JSONException
The descendant number of a node is: -- root[3] -- // the descendant number is the sum of the children | | -- node[2] -- node[1] // the descendant number is the count of the children | | | leaf[0] leaf[0] leaf[0] // leaves have no children

Parameters:
node - The node of the rows/columns headers' structure
Returns:
Throws:
org.json.JSONException

getDepth

protected static int getDepth(org.json.JSONObject node)
                       throws org.json.JSONException
Calculates the path length in the nodes structure in input between the root node and a leaf. Note that this method assumes the path length to be the same between the root node and any leaf!!!

Parameters:
node - The root node of the tree structure
Returns:
the path length between the root node and a leaf
Throws:
org.json.JSONException