Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Primefaces 如何循环P:treetable数据的TreeNode_Primefaces_Treetable - Fatal编程技术网

Primefaces 如何循环P:treetable数据的TreeNode

Primefaces 如何循环P:treetable数据的TreeNode,primefaces,treetable,Primefaces,Treetable,我想在Java代码中循环TreeTable对象。下面是由树创建的代码 public TreeNode getTreeData() { lstTestProcessByRelease = testProcessBo.findAllTestProcessByReleaseGroupBy(getTestSuite(), getReleaseByTabName()); List<TestProcess> lstTestScenario = new ArrayList<

我想在Java代码中循环TreeTable对象。下面是由树创建的代码

public TreeNode getTreeData()
{

    lstTestProcessByRelease = testProcessBo.findAllTestProcessByReleaseGroupBy(getTestSuite(), getReleaseByTabName());
    List<TestProcess> lstTestScenario = new ArrayList<TestProcess>();
    int parentCount=0;

    root1 = new DefaultTreeNode(new TestProcess("TestScenario","TestCase",0,0),null);

    for(TestProcess tp : lstTestProcessByRelease)
    {
        parentCount = parentCount + 1;
        ExecutionParentOrderValue.put(parentCount, parentCount);
        TreeNode parent = new DefaultTreeNode(new TestProcess(tp.getTestScenarioName(), tp.getTestScenarioName(), 0, parentCount),root1);
        System.out.println("============"+ tp.getTestScenarioName() +"=================");
        System.out.println("Scenario Name (ROWKEY) :"+ parent.getRowKey());
        lstTestScenario = testProcessBo.findAllTestCasesByTestScenarioName(tp.getTestSuite(), tp.getReleaseName(), tp.getTestScenarioName());

        TreeNode child =null;
        int childCount=0;   
        for(TestProcess tc : lstTestScenario)
        {
            childCount = childCount + 1;
            ExecutionChildOrderValue.put(childCount, childCount);
            child = new DefaultTreeNode(new TestProcess(tc.getTestScenarioName(), tc.getTestCaseName(), childCount, parentCount),parent);
            System.out.println("TestCase (ROWKEY) :"+ child.getRowKey());
            System.out.println("Scenario Name :" + tc.getTestScenarioName());
            System.out.println("TestCases Name : " + tc.getTestCaseName());
            System.out.println("   TestScenario ExecNo :" + tc.getTestScenarioExecNo());
            System.out.println("      TestCase ExecNo :" + tc.getTestCaseExecNo());
        }
        System.out.println("");
        System.out.println("");
    }


    return root1;
}
public树节点getTreeData()
{
lstestprocessbyrelease=testProcessBo.findAllTestProcessByReleaseGroupBy(getTestSuite(),getReleaseByTabName());
List lstestscenario=newarraylist();
int parentCount=0;
root1=新的DefaultTreeNode(新的TestProcess(“TestScenario”,“TestCase”,0,0),null);
for(TestProcess tp:lstTestProcessByRelease)
{
parentCount=parentCount+1;
ExecutionParentOrderValue.put(parentCount,parentCount);
TreeNode parent=new DefaultTreeNode(新的测试进程(tp.getTestScenarioName(),tp.getTestScenarioName(),0,parentCount),root1);
System.out.println(“===================”+tp.getTestScenarioName()+”=========================”;
System.out.println(“场景名称(ROWKEY):”+parent.getRowKey());
lstestscenario=testProcessBo.findAllTestCasesByTestScenarioName(tp.getTestSuite(),tp.getReleaseName(),tp.getTestScenarioName());
treenodechild=null;
int childCount=0;
对于(TestProcess tc:lstTestScenario)
{
childCount=childCount+1;
ExecutionChildOrderValue.put(childCount,childCount);
child=newDefaultTreeNode(新的测试过程(tc.getTestScenarioName(),tc.getTestCaseName(),childCount,parentCount),parent);
System.out.println(“TestCase(ROWKEY):”+child.getRowKey());
System.out.println(“场景名称:+tc.getTestScenarioName());
System.out.println(“测试用例名称:+tc.getTestCaseName());
System.out.println(“testscenarioexecno:+tc.getTestScenarioExecNo());
System.out.println(“TestCase ExecNo:+tc.getTestCaseExecNo());
}
System.out.println(“”);
System.out.println(“”);
}
返回根1;
}
如果我想在控制台中循环root1对象并打印数据,该怎么办? 实际上,我想通过root1循环,从树中获取数据,并希望存储在db中。但我不知道如何循环root1对象并在控制台上打印数据

有人能帮我吗

谢谢
Neeraj

您咨询过?有
getChildren()
循环,有
getData()
检索内容。这是针对PrimeFacesV6.0的。请下次提供版本信息。我曾经帮助您快速轻松地制作一个实体中的子列表,每次需要时(通常是一次)我都会填写
SonsList
。您好,谢谢您的回复。这是我的代码,我可以从中获取treedata
List ParentNode=root1.getChildren();对于(TreeNode P:ParentNode){TestProcess x1=(TestProcess)P.getData();Syso(x1.getTestScenarioName());List childNode=P.getChildren();对于(TreeNode c:childNode){TestProcess x=(TestProcess)c.getData();System.out.println(“子数据:+x.getTestScenarioName());}}
您是否查阅了相关信息?有
getChildren()
循环,有
getData()
检索内容。这是针对PrimeFacesV6.0的。请下次提供版本信息。我曾经帮助您快速轻松地制作一个实体中的子列表,每次需要时(通常是一次)我都会填写
SonsList
。您好,谢谢您的回复。这是我的代码,我可以从中获取treedata
List ParentNode=root1.getChildren();对于(TreeNode P:ParentNode){TestProcess x1=(TestProcess)P.getData();Syso(x1.getTestScenarioName());List childNode=P.getChildren();对于(TreeNode c:childNode){TestProcess x=(TestProcess)c.getData();System.out.println(“子数据:+x.getTestScenarioName());}}