|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.utils.tree.FlatFileTreeBuilder
Builds a tree from a flat file - for example an Excel spreadheet saved as a CSV file).
Assumes that the file is organized hierarchically so that the delimiter '|' is used to count the level of the child node:Root Name|Root ID |Child Name|Child ID ||Grandkid Name|Grandkid ID |Child2 Name|child2 ID ||Grand Kid2a Name|Grandkid 2a ID |||Great-grandkid Name|Great-grandkid ID
Level and parent coded by depth of columns and context.
XML Configuration Template:
<TreeBuilder class="com.raritantechnologies.utils.tree.FlatFileTreeBuilder"
fileName="[ name of file containing tree data ]"
delimiter="[ character to use for flat file path delimiter default is '|' ]"
treeName="[ name of output TreeRoot object ]"
treeRootClass="[ optional class name of TreeRoot extension class ]"
treeNodeClass="[ optional class name of TreeNode extension class ]" >
<Columns>
<!-- Columns can be specified one of three ways: -->
<Column ID="[ '_ID_': column value used as nodeID]" />
<Column ID="[ '_NAME_': column value used as name]" />
<Column ID="[ fixed name of column ]" />
</Columns>
<!-- Optional NodeList generators - uses an external SearchSource to add a list -->
<!-- of TreeNodes to a node. Linked via a placehoder in the flat file with the -->
<!-- pattern 'NODE_LIST:[ search source name ]' -->
<NodeListSource sourceName="[ name of search source ]" nameField="[ field in result that provides treeNode name ]"
nestedResultsField="[ field name that can contain nested results ]" >
<Query>
<!-- Fixed query params: passed to search source 'as is' -->
<FixedParam ID="[ name of query param ]" value="[ value of query param ]" />
<!-- Dynamic query param: pass
<RequestParam ID="[ name of query param ]" request="[ name of request param ]" />
</Query>
</NodeListSource>
</TreeBuilder>
| Field Summary |
| Fields inherited from interface com.raritantechnologies.utils.tree.ITreeBuilder |
TEMPLATE |
| Constructor Summary | |
FlatFileTreeBuilder()
|
|
| Method Summary | |
TreeRoot |
buildTree(RaritanPageContext pContext)
|
java.lang.String[] |
getColumnNames()
|
java.lang.String |
getConfigurationXML()
|
java.lang.String |
getConfigurationXML(java.lang.String configurationTemplate)
|
void |
getConfigurationXML(java.io.Writer writer)
|
java.lang.String |
getDelimiter()
|
java.lang.String |
getFileName()
|
java.lang.String |
getTreeName()
|
java.lang.String |
getTreeNodeClass()
|
java.lang.String |
getTreeRootClass()
|
void |
initialize(org.w3c.dom.Element elem)
Initializes the object from an XML tag or element. |
TreeRoot |
refreshTree(TreeRoot theTree,
RaritanPageContext pContext)
Method to enable dynamic or refreshable trees. |
void |
setColumnNames(java.lang.String[] columnNames)
|
void |
setDelimiter(java.lang.String delimiter)
sets the flat file path delimiter |
void |
setFileName(java.lang.String fileName)
|
void |
setTreeName(java.lang.String treeName)
|
void |
setTreeNodeClass(java.lang.String treeNodeClass)
|
void |
setTreeRootClass(java.lang.String treeRootClass)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FlatFileTreeBuilder()
| Method Detail |
public TreeRoot buildTree(RaritanPageContext pContext)
buildTree in interface ITreeBuilder
public TreeRoot refreshTree(TreeRoot theTree,
RaritanPageContext pContext)
ITreeBuilderMethod to enable dynamic or refreshable trees. Static tree builders should implement this by returning the passed in tree object. Dynamic tree builders should implement this by returning the output of their buildTree( ) method or by pruning/growing the given tree as appropriate.
ITreeBuilders that support "lazy tree node evaluation" should use this method to determine which nodes in the tree need to be updated (TreeNode.needsUpdate( ) method returns true.
refreshTree in interface ITreeBuilderpublic void initialize(org.w3c.dom.Element elem)
IConfigurable
initialize in interface IConfigurablepublic void setFileName(java.lang.String fileName)
public java.lang.String getFileName()
public void setDelimiter(java.lang.String delimiter)
public java.lang.String getDelimiter()
public void setTreeName(java.lang.String treeName)
public java.lang.String getTreeName()
public void setTreeRootClass(java.lang.String treeRootClass)
public java.lang.String getTreeRootClass()
public void setTreeNodeClass(java.lang.String treeNodeClass)
public java.lang.String getTreeNodeClass()
public void setColumnNames(java.lang.String[] columnNames)
public java.lang.String[] getColumnNames()
public void getConfigurationXML(java.io.Writer writer)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getConfigurationXML()
public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||