01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.wiki;
04:
05: import java.util.*;
06:
07: public class WikiPageUtil {
08: public static LinkedList getAncestorsOf(WikiPage page)
09: throws Exception {
10: PageCrawler crawler = page.getPageCrawler();
11: LinkedList ancestors = new LinkedList();
12: WikiPage parent = page;
13: do {
14: parent = parent.getParent();
15: ancestors.add(parent);
16: } while (!crawler.isRoot(parent));
17:
18: return ancestors;
19: }
20:
21: public static LinkedList getAncestorsStartingWith(WikiPage page)
22: throws Exception {
23: LinkedList ancestors = getAncestorsOf(page);
24: ancestors.addFirst(page);
25: return ancestors;
26: }
27: }
|