com.ecyrd.jspwiki
Class WikiPage

java.lang.Object
  extended by com.ecyrd.jspwiki.WikiPage
All Implemented Interfaces:
Cloneable, Comparable
Direct Known Subclasses:
Attachment

public class WikiPage
extends Object
implements Cloneable, Comparable

Simple wrapper class for the Wiki page attributes. The Wiki page content is moved around in Strings, though.


Field Summary
static String ALIAS
           
static String DESCRIPTION
          "Summary" is a short summary of the page.
static String REDIRECT
           
static String SIZE
           
 
Constructor Summary
WikiPage(WikiEngine engine, String name)
           
 
Method Summary
 Object clone()
          Creates a deep clone of a WikiPage.
 int compareTo(Object o)
           
 Acl getAcl()
          Returns the Acl for this page.
 Object getAttribute(String key)
          A WikiPage may have a number of attributes, which might or might not be available.
 Map getAttributes()
          Returns the full attributes Map, in case external code needs to iterate through the attributes.
 String getAuthor()
          Returns author name, or null, if no author has been defined.
 Date getLastModified()
          Returns the date when this page was last modified.
 String getName()
           
 long getSize()
           
 int getVersion()
          Returns the version that this WikiPage instance represents.
 String getWiki()
          Returns the wiki nanme for this page
 boolean hasMetadata()
          Returns true if the page has valid metadata; that is, it has been parsed.
 void invalidateMetadata()
          This method will remove all metadata from the page.
 Object removeAttribute(String key)
          Removes an attribute from the page, if it exists.
 void setAcl(Acl acl)
           
 void setAttribute(String key, Object attribute)
          Sets an metadata attribute.
 void setAuthor(String author)
           
 void setHasMetadata()
           
 void setLastModified(Date date)
           
 void setSize(long size)
           
 void setVersion(int version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DESCRIPTION

public static final String DESCRIPTION
"Summary" is a short summary of the page. It is a String.

See Also:
Constant Field Values

ALIAS

public static final String ALIAS
See Also:
Constant Field Values

REDIRECT

public static final String REDIRECT
See Also:
Constant Field Values

SIZE

public static final String SIZE
See Also:
Constant Field Values
Constructor Detail

WikiPage

public WikiPage(WikiEngine engine,
                String name)
Method Detail

getName

public String getName()

getAttribute

public Object getAttribute(String key)
A WikiPage may have a number of attributes, which might or might not be available. Typically attributes are things that do not need to be stored with the wiki page to the page repository, but are generated on-the-fly. A provider is not required to save them, but they can do that if they really want.

Parameters:
key - The key using which the attribute is fetched
Returns:
The attribute. If the attribute has not been set, returns null.

setAttribute

public void setAttribute(String key,
                         Object attribute)
Sets an metadata attribute.


getAttributes

public Map getAttributes()
Returns the full attributes Map, in case external code needs to iterate through the attributes.


removeAttribute

public Object removeAttribute(String key)
Removes an attribute from the page, if it exists.

Returns:
If the attribute existed, returns the object.
Since:
2.1.111

getLastModified

public Date getLastModified()
Returns the date when this page was last modified.


setLastModified

public void setLastModified(Date date)

setVersion

public void setVersion(int version)

getVersion

public int getVersion()
Returns the version that this WikiPage instance represents.


getSize

public long getSize()
Since:
2.1.109

setSize

public void setSize(long size)
Since:
2.1.109

getAcl

public Acl getAcl()
Returns the Acl for this page. May return null, in case there is no ACL defined for this page, or it has not yet been received.


setAcl

public void setAcl(Acl acl)

setAuthor

public void setAuthor(String author)

getAuthor

public String getAuthor()
Returns author name, or null, if no author has been defined.


getWiki

public String getWiki()
Returns the wiki nanme for this page


invalidateMetadata

public void invalidateMetadata()
This method will remove all metadata from the page.


hasMetadata

public boolean hasMetadata()
Returns true if the page has valid metadata; that is, it has been parsed.


setHasMetadata

public void setHasMetadata()

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Creates a deep clone of a WikiPage. Strings are not cloned, since they're immutable.

Overrides:
clone in class Object

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable