0

我正在尝试使用以下方法获取将当前文档列为 perant 的所有文档:

 List<DocumentReference>  childDocs = doc.getChildrenReferences(xcontext);

其中 doc 是父 XWikiDocument。

然而,该函数只返回一个空列表,尽管空间中有文档。

如果我打印 doc.getFullName() 它的 AAA.WebHome .. 并且所有 chldren 空间都列在 AAA 下.. 我应该如何引用 doc 才能在列表中说出 AAA.BBB.WebHome ?或者我哪里错了?

我正在尝试编写一个递归函数来删除当前空间中的所有子页面。但无法列出所有子页面。这是递归函数:

public void RECdeleteSpace(XWikiDocument doc, XWikiContext xcontext,boolean toTrash){
      XWiki xwiki = xcontext.getWiki();
      List<DocumentReference> childDocs;
      try {
            childDocs = doc.getChildrenReferences(xcontext);
            System.out.println("REC " + doc.getFullName());
            System.out.println("CHLD " + childDocs.toString());
            System.out.println("----- ");
            Iterator<DocumentReference> docit = childDocs.iterator();
            while (docit.hasNext()) {
                DocumentReference chdocref = docit.next();
                XWikiDocument  chdoc = xwiki.getDocument(chdocref, xcontext);
                System.out.println("DOC: "+chdoc.getFullName());

                RECdeleteSpace(chdoc,xcontext,toTrash);  
            }
          xwiki.deleteDocument(doc, toTrash, xcontext);

      } catch (XWikiException e) {
        // TODO Auto-generated catch block
          e.printStackTrace();
      }

  }

输出只有:

INIT WebHome
REC AAA.WebHome
CHLD []
-----

并且迭代器永远不会去 AAA.BBB.Webhome 或 AAA.BBB.CCC.WebHome

4

0 回答 0