Class PageReference

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparable<EntityReference>

    public class PageReference
    extends AbstractLocalizedEntityReference
    Represents a reference to a page. Note that nested pages are supported. A page is essentially the same thing as a document. A document represents the data displayed in a wiki page, stored in a Document object. Both a PageReference and a DocumentReference point to a Document.

    In XWiki 7.2, we introduced the ability to have pages inside pages (we called it Nested Pages). We did that by creating a space to represent a Nested Page. Indeed, a space always has WebHome document and this document contains the content of the Nested Page. In other words all Nested Page are located in WebHome documents.

    This means that a reference to a Nested Page always ends with WebHome, which is an implementation detail, and hard to remember and use (e.g. A.B.C.WebHome). Thus we introduced the concept of a Page Reference to reference a Nested Page and this allows us to drop the Webhome part in the reference (e.g. A.B.C).

    Since:
    10.6RC1
    Version:
    $Id: d211c512c8fa5741cd9d8b75ca8a582b97fe6555 $
    See Also:
    Serialized Form
    • Field Detail

      • TYPE_PROVIDER

        public static final Type TYPE_PROVIDER
        The Type for a Provider<PageReference>.
    • Constructor Detail

      • PageReference

        public PageReference​(EntityReference reference)
        Special constructor that transforms a generic entity reference into a PageReference. It checks the validity of the passed reference (ie correct type).
        Parameters:
        reference - the entity reference to transforms
        Throws:
        IllegalArgumentException - if the passed reference is not a valid page reference
      • PageReference

        protected PageReference​(EntityReference reference,
                                EntityReference oldReference,
                                EntityReference newReference)
        Clone a page reference, but replace one of the parent in the chain by a new one.
        Parameters:
        reference - the reference that is cloned
        oldReference - the old parent that will be replaced
        newReference - the new parent that will replace oldReference in the chain
      • PageReference

        public PageReference​(String pageName,
                             WikiReference parent)
        Create a page reference based on a page name and a parent wiki reference.
        Parameters:
        pageName - the name of the page
        parent - the wiki reference
      • PageReference

        public PageReference​(String pageName,
                             PageReference parent)
        Create a page reference based on a page name and a parent page reference.
        Parameters:
        pageName - the name of the page
        parent - the page reference
      • PageReference

        public PageReference​(String pageName,
                             EntityReference parent)
        Create a page reference based on a page name and a parent entity reference. The entity reference may be either a wiki or a page reference.
        Parameters:
        pageName - the name of the page
        parent - the entity reference
      • PageReference

        public PageReference​(String pageName,
                             EntityReference parent,
                             Locale locale)
        Create a page reference based on a page name and a parent entity reference. The entity reference may be either a wiki or a page reference.
        Parameters:
        pageName - the name of the page
        parent - the entity reference
        locale - the Locale of the page.
      • PageReference

        public PageReference​(EntityReference reference,
                             Locale locale)
        Clone an EntityReference and change/add the passed Locale.
        Parameters:
        reference - the reference to clone
        locale - the Locale of the new reference
      • PageReference

        public PageReference​(String wikiName,
                             List<String> pageNames)
        Create a page reference based on a page name and a parent page reference.
        Parameters:
        wikiName - the name of the wiki
        pageNames - the pages names
      • PageReference

        public PageReference​(String wikiName,
                             List<String> pageNames,
                             Locale locale)
        Create a page reference based on a page name and a parent page reference.
        Parameters:
        wikiName - the name of the wiki
        pageNames - the pages names
        locale - the Locale of the entity.
      • PageReference

        public PageReference​(String wikiName,
                             String pageName,
                             String... pageNames)
        Create a page reference based on a page name and a parent page reference.
        Parameters:
        wikiName - the name of the wiki
        pageName - the root page name
        pageNames - the children page names
      • PageReference

        public PageReference​(LocalPageReference localPageReference,
                             WikiReference wikiReference)
        Create a new page reference from local page reference and wiki reference.
        Parameters:
        localPageReference - the page reference without the wiki reference
        wikiReference - the wiki reference
      • PageReference

        public PageReference​(EntityReference reference,
                             EntityReference parent)
        Clone an PageReference, but use the specified parent for its new parent.
        Parameters:
        reference - the reference to clone
        parent - the new parent to use
        Since:
        10.8RC1