// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.wiki;

import fitnesse.wiki.fs.SymbolicPageFactory;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class SymbolicPage extends BaseWikiPage {
  private static final long serialVersionUID = 1L;

  public static final String PROPERTY_NAME = "SymbolicLinks";

  private WikiPage realPage;

  public SymbolicPage(String name, WikiPage realPage, WikiPage parent) {
    super(name, (BaseWikiPage) parent);
    this.realPage = realPage;
  }

  public WikiPage getRealPage() {
    return realPage;
  }

  public WikiPage addChildPage(String name) {
    return realPage.addChildPage(name);
  }

  public boolean hasChildPage(String name) {
    return realPage.hasChildPage(name);
  }

  protected WikiPage getNormalChildPage(String name) {
    WikiPage childPage = realPage.getChildPage(name);
    if (childPage != null && !(childPage instanceof SymbolicPage))
      childPage = new SymbolicPage(name, childPage, this);
    return childPage;
  }

  public void removeChildPage(String name) {
    realPage.removeChildPage(name);
  }

  public List<WikiPage> getNormalChildren() {
    List<?> children = realPage.getChildren();
    List<WikiPage> symChildren = new LinkedList<WikiPage>();
    //...Intentionally exclude symbolic links on symbolic pages
    //   to prevent infinite cyclic symbolic references.
    //TODO: -AcD- we need a better cyclic infinite recursion algorithm here.
    for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
      WikiPage child = (WikiPage) iterator.next();
      symChildren.add(new SymbolicPage(child.getName(), child, this));
    }
    return symChildren;
  }

  public PageData getData() {
    PageData data = realPage.getData();
    data.setWikiPage(this);
    return data;
  }

  public ReadOnlyPageData readOnlyData() { return getData(); }

  @Override
  public Collection<VersionInfo> getVersions() {
    return realPage.getVersions();
  }

  public PageData getDataVersion(String versionName) {
    PageData data = realPage.getDataVersion(versionName);
    data.setWikiPage(this);
    return data;
  }

  public VersionInfo commit(PageData data) {
    return realPage.commit(data);
  }
}

@@ -711,32 +711,44 @@
  realPage;%0A  %7D%0A%0A
+  @Override%0A
   public WikiPag
@@ -769,32 +769,32 @@
 (String name) %7B%0A
-
     return realP
@@ -814,32 +814,44 @@
 age(name);%0A  %7D%0A%0A
+  @Override%0A
   public boolean
@@ -924,16 +924,28 @@
 );%0A  %7D%0A%0A
+  @Override%0A
   protec
@@ -1190,32 +1190,44 @@
 childPage;%0A  %7D%0A%0A
+  @Override%0A
   public void re
@@ -1288,32 +1288,44 @@
 age(name);%0A  %7D%0A%0A
+  @Override%0A
   public List%3CWi
@@ -1889,24 +1889,36 @@
 ldren;%0A  %7D%0A%0A
+  @Override%0A
   public Pag
@@ -2017,32 +2017,44 @@
 turn data;%0A  %7D%0A%0A
+  @Override%0A
   public ReadOnl

Add @Override's to SymbolicPage functions.