package gov.nih.nci.cananolab.dto.common;

import gov.nih.nci.cananolab.util.ClassUtils;

import java.util.List;

public class TreeNodeBean implements Comparable<TreeNodeBean> {
	private String nodeName;
	private Integer order;
	private Integer indentLevel; // root node indent level = 0;
	private boolean hasGrandChildrenFlag;
	
	public TreeNodeBean(String nodeName, int order, int indentLevel) {
		this.nodeName = nodeName;
		this.order = order;
		this.indentLevel = indentLevel;
	}

	public int getIndentLevel() {
		return indentLevel;
	}

	public String getNodeName() {
		return nodeName;
	}

	public int getOrder() {
		return order;
	}

	public int compareTo(TreeNodeBean tnb) {
		return order.compareTo(tnb.getOrder());
	}

	public boolean hasGrandChildern() {
		return hasGrandChildrenFlag;
	}

	public void setHasGrandChildrenFlag(String childClassName) throws Exception {
		if(childClassName == null) {
			hasGrandChildrenFlag = false;
			return;
		}
		List<String> subclassList = ClassUtils
			.getChildClassNames(childClassName);
		if(subclassList == null || subclassList.size() == 0)
			hasGrandChildrenFlag = false;
		else
			hasGrandChildrenFlag = true;
		
	}
	
}

@@ -40,79 +40,8 @@
 n;%0A%0A
-import gov.nih.nci.cananolab.util.ClassUtils;%0A%0Aimport java.util.List;%0A%0A
 publ
@@ -233,34 +233,34 @@
 an hasGrandChild
-r
 e
+r
 nFlag;%0A%09%0A%09public
@@ -707,26 +707,26 @@
 asGrandChild
-r
 e
+r
 nFlag;%0A%09%7D%0A%0A%09
@@ -736,16 +736,18 @@
 lic 
-void set
+boolean is
 HasG
@@ -759,92 +759,131 @@
 hild
-r
 e
+r
 nFlag(
-String childClassName) throws Exception %7B%0A%09%09if(childClassName == null
+) %7B%0A%09%09return hasGrandChildernFlag;%0A%09%7D%0A%0A%09public void setHasGrandChildernFlag(boolean hasGrandChildernFlag
 ) %7B%0A%09%09
-%09
+this.
 hasG
@@ -887,34 +887,34 @@
 asGrandChild
-r
 e
+r
 nFlag = 
 false;%0A%09%09%09re
@@ -905,244 +905,261 @@
 g = 
-false;%0A%09%09%09return;%0A%09%09%7D%0A%09%09List%3CString%3E subclassList = ClassUtils%0A%09%09%09.getChildClassNames(childClassName);%0A%09%09if(subclassList == null %7C%7C subclassList.size() == 0)%0A%09%09%09hasGrandChildrenFlag = false;%0A%09%09else%0A%09%09%09hasGrandChildrenFlag = true;%0A%09%09%0A%09%7D%0A%09
+hasGrandChildernFlag;%0A%09%7D%0A%0A%09public void setIndentLevel(Integer indentLevel) %7B%0A%09%09this.indentLevel = indentLevel;%0A%09%7D%0A%0A%09public void setNodeName(String nodeName) %7B%0A%09%09this.nodeName = nodeName;%0A%09%7D%0A%0A%09public void setOrder(Integer order) %7B%0A%09%09this.order = order;%0A%09%7D
 %0A%7D%0A

move setGrandChildrenFlag method to ClassUtil.java