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 SymbolicPage extends BaseWikiPage {
08: public static final String PROPERTY_NAME = "SymbolicLinks";
09:
10: private WikiPage realPage;
11:
12: public SymbolicPage(String name, WikiPage realPage, WikiPage parent) {
13: super (name, parent);
14: this .realPage = realPage;
15: }
16:
17: public WikiPage getRealPage() {
18: return realPage;
19: }
20:
21: public WikiPage addChildPage(String name) throws Exception {
22: return realPage.addChildPage(name);
23: }
24:
25: public boolean hasChildPage(String name) throws Exception {
26: return realPage.hasChildPage(name);
27: }
28:
29: protected WikiPage getNormalChildPage(String name) throws Exception {
30: WikiPage childPage = realPage.getChildPage(name);
31: if (childPage != null)
32: childPage = new SymbolicPage(name, childPage, this );
33: return childPage;
34: }
35:
36: public void removeChildPage(String name) throws Exception {
37: realPage.removeChildPage(name);
38: }
39:
40: public List getNormalChildren() throws Exception {
41: List children = realPage.getChildren();
42: List symChildren = new LinkedList();
43: for (Iterator iterator = children.iterator(); iterator
44: .hasNext();) {
45: WikiPage child = (WikiPage) iterator.next();
46: if (!(child instanceof SymbolicPage))
47: symChildren.add(new SymbolicPage(child.getName(),
48: child, this ));
49: }
50: return symChildren;
51: }
52:
53: public PageData getData() throws Exception {
54: PageData data = realPage.getData();
55: data.setWikiPage(this );
56: return data;
57: }
58:
59: public PageData getDataVersion(String versionName) throws Exception {
60: PageData data = realPage.getDataVersion(versionName);
61: data.setWikiPage(this );
62: return data;
63: }
64:
65: public VersionInfo commit(PageData data) throws Exception {
66: return realPage.commit(data);
67: }
68:
69: //TODO Delete these method alone with ProxyPage when the time is right.
70: public boolean hasExtension(String extensionName) {
71: return realPage.hasExtension(extensionName);
72: }
73:
74: public Extension getExtension(String extensionName) {
75: return realPage.getExtension(extensionName);
76: }
77: }
|