pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.site.map
Class SitemapNode

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.util.entity.Node
          extended by org.torweg.pulse.site.map.SitemapNode
All Implemented Interfaces:
java.io.Serializable, JDOMable, INameable, INamed

@Entity
@Indexed
@FullTextFilterDefs(value={@FullTextFilterDef(name="uniqueContents",impl=SitemapNodeUniqueContentFilter.class,cache=INSTANCE_AND_DOCIDSETRESULTS),@FullTextFilterDef(name="inRoles",impl=SitemapNodeRoleFilterFactory.class,cache=INSTANCE_AND_DOCIDSETRESULTS),@FullTextFilterDef(name="inSection",impl=SitemapNodeSectionTagFilterFactory.class,cache=INSTANCE_AND_DOCIDSETRESULTS),@FullTextFilterDef(name="duration",impl=SitemapNodeDurationFilterFactory.class,cache=INSTANCE_AND_DOCIDSETRESULTS)})
public class SitemapNode
extends Node
implements INameable, JDOMable, java.io.Serializable

a SitemapNode is an entry in the websites Sitemap.

The View of the SitemapNode represents the association of the SitemapNode with a specific Content. Moreover, the SitemapNode may contain a set of attributes which may be used during XSL transformation or OutputEvents to customize the output.

Version:
$Revision: 1822 $
Author:
Thomas Weber, Daniel Dietz
See Also:
Sitemap, View, SitemapDisabledActions, SitemapNodeUniqueContentFilter, Serialized Form

Nested Class Summary
static class SitemapNode.Type
          The different Types available for SitemapNodes.
 
Constructor Summary
protected SitemapNode()
          Deprecated. 
  SitemapNode(java.lang.String n, java.util.Locale loc)
          creates a new SitemapNode with the given name and Locale.
  SitemapNode(java.lang.String n, java.util.Locale loc, SitemapNode.Type t)
          creates a new SitemapNode with the given name, Locale and Type.
  SitemapNode(java.lang.String n, java.util.Locale loc, View v)
          creates a new SitemapNode with the given name, Locale and View.
  SitemapNode(java.lang.String n, java.util.Locale loc, View v, SitemapNode.Type t)
          creates a new SitemapNode with the given name, Locale, View and Type.
 
Method Summary
 void addChild(int pos, Node n)
          adds a new SitemapNode at a given position to the list children of this SitemapNode if Locales match.
 void addChild(Node n)
          Adds a new SitemapNode to the children of this SitemapNode if Locales match.
 boolean addRole(Role rl)
          Adds a Role to the SitemapNode's Set of Roles.
 void adoptSettingsFrom(SitemapNode sitemapNode)
          Adopts the following settings from the given SitemapNode: roles (are being overridden) visibility sectionTag attributes (are being overridden) duration (startDate/endDate) .
 void clearRoles()
          Removes all roles form the SitemapNode.
 org.jdom.Element deserializeToJDOM()
          this will deserialize the state of the JDOMable as a JDOM Element.
 org.jdom.Element deserializeToJDOMShallow()
          returns the SitemapNode as an Element excluding all children and view information.
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
           
 Command getCommand(Command template)
          returns the Command that produces the view associated with the SitemapNode.
 java.lang.Long getContentId()
          returns the id of the Content referenced by the SitemapNode's View.
 Duration getDuration()
          returns the Duration of the SitemapNode or null if no duration has been set.
 java.util.Locale getLocale()
           
 java.lang.String getName()
          returns the name.
 java.lang.StringBuilder getPathBuilder()
          Returns a StringBuilder with the Sitemap-path of the SitemapNode.
 java.util.Set<Role> getRoles()
          Returns a shallow copy of the SitemapNode's Collection of Roles.
 SitemapSectionTag getSectionTag()
          Returns the SitemapSectionTag of the SitemapNode.
 SitemapNode.Type getType()
          Returns the Type of the SitemapNode.
 View getView()
           
 boolean isVisible()
           
 void putAttribute(java.lang.String key, java.lang.String value)
          adds an attribute to the SitemapNode.
 boolean removeAttribute(java.lang.String key)
          removes an attribute from the SitemapNode.
 void removeDuration()
          removes the Duration from the SitemapNode.
 boolean removeRole(AbstractAccessControlObject rl)
          Removes a Role from the SitemapNode's Set of Roles if it is part of it.
 void removeView()
          removes the View from the SitemapNode.
 void setAttributes(java.util.Map<java.lang.String,java.lang.String> att)
           
<E extends Node>
void
setChildren(java.util.List<E> nodeList)
          sets the children of the SitemapNode if Locales match.
 void setDuration(Duration validity)
          sets the Duration for the SitemapNode.
 void setLocale(java.util.Locale loc)
          sets the Locale of the SitemapNode.
 void setName(java.lang.String n)
          sets a new name for the SitemapNode.
 void setSectionTag(SitemapSectionTag tag)
          Sets the SitemapSectionTag for the SitemapNode.
 void setType(SitemapNode.Type t)
          Sets the Type for the SitemapNode.
 void setView(View v)
           
 void setVisible(boolean v)
          sets the visibility of the SitemapNode.
 net.sf.json.JSONObject toJSON()
          /** returns a JSONObject representation of the SitemapNode.
 
Methods inherited from class org.torweg.pulse.util.entity.Node
getChild, getChildIndex, getChildren, getParent, hasChildren, removeChild
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SitemapNode

@Deprecated
protected SitemapNode()
Deprecated. 

protected constructor for HibernateTM.


SitemapNode

public SitemapNode(java.lang.String n,
                   java.util.Locale loc)
creates a new SitemapNode with the given name and Locale.

Parameters:
n - the name
loc - the Locale

SitemapNode

public SitemapNode(java.lang.String n,
                   java.util.Locale loc, SitemapNode.Type t)
creates a new SitemapNode with the given name, Locale and Type.

Parameters:
n - the name
loc - the Locale
t - the Type

SitemapNode

public SitemapNode(java.lang.String n,
                   java.util.Locale loc, View v)
creates a new SitemapNode with the given name, Locale and View.

Parameters:
n - the name
loc - the Locale
v - the View to be associated with the SitemapNode

SitemapNode

public SitemapNode(java.lang.String n,
                   java.util.Locale loc, View v, SitemapNode.Type t)
creates a new SitemapNode with the given name, Locale, View and Type.

Parameters:
n - the name
loc - the Locale
v - the View to be associated with the SitemapNode
t - the Type
Method Detail

setLocale

public final void setLocale(java.util.Locale loc)
sets the Locale of the SitemapNode.

Parameters:
loc - the Locale to be set

getLocale

public final java.util.Locale getLocale()
Returns:
returns the Locale of the SitemapNode

setName

public final void setName(java.lang.String n)
sets a new name for the SitemapNode.

Specified by:
setName in interface INameable
Parameters:
n - the name to be set

getName

public final java.lang.String getName()
Description copied from interface: INamed
returns the name.

Specified by:
getName in interface INamed
Returns:
returns the name of the SitemapNode.

setType

public final void setType(SitemapNode.Type t)
Sets the Type for the SitemapNode.

Parameters:
t - the type to set

getType

public final SitemapNode.Type getType()
Returns the Type of the SitemapNode.

Returns:
the type

addChild

public void addChild(Node n)
Adds a new SitemapNode to the children of this SitemapNode if Locales match.

Overrides:
addChild in class Node
Parameters:
n - the SitemapNode to be added.

addChild

public void addChild(int pos, Node n)
adds a new SitemapNode at a given position to the list children of this SitemapNode if Locales match.

Overrides:
addChild in class Node
Parameters:
pos - the position in the list of children
n - the SitemapNode to become a child of this SitemapNode.

setChildren

public <E extends Node> void setChildren(java.util.List<E> nodeList)
sets the children of the SitemapNode if Locales match.

Overrides:
setChildren in class Node
Type Parameters:
E - a class extending Node
Parameters:
nodeList - the list of child SitemapNodes

getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Returns:
Returns the attributes.

setAttributes

public void setAttributes(java.util.Map<java.lang.String,java.lang.String> att)
Parameters:
att - The attributes to set.

putAttribute

public void putAttribute(java.lang.String key,
                         java.lang.String value)
adds an attribute to the SitemapNode.

Parameters:
key - the key
value - the value

removeAttribute

public boolean removeAttribute(java.lang.String key)
removes an attribute from the SitemapNode.

Parameters:
key - the key of the attribute to be removed
Returns:
true, if the attribute could be removed. Otherwise false.

getView

public final View getView()
Returns:
Returns the view.

setView

public final void setView(View v)
Parameters:
v - The view to set.

removeView

public final void removeView()
removes the View from the SitemapNode.


getContentId

public final java.lang.Long getContentId()
returns the id of the Content referenced by the SitemapNode's View.

Returns:
the id of the Content or null

getCommand

public Command getCommand(Command template)
returns the Command that produces the view associated with the SitemapNode.

If the View is null, the returned Command is the template with an updated SitemapNodeID that matches the ID of the SitemapNode.

Parameters:
template - the Command template
Returns:
the Command that produces the view associated with the SitemapNode.

isVisible

public final boolean isVisible()
Returns:
Returns true, if the SitemapNode is visible.

setVisible

public final void setVisible(boolean v)
sets the visibility of the SitemapNode.

Parameters:
v - true to make the SitemapNode visible, false to hide the SitemapNode.

getRoles

public final java.util.Set<Role> getRoles()
Returns a shallow copy of the SitemapNode's Collection of Roles.

Attention: Since the returned Set is not a reference to the SitemapNode's internal Collection, any modifications to its state will get lost. However, modifications to the state of the Set's elements will be consistent.

For example: Adding/Deleting a Role to/from the Set will not have any effect, when the SitemapNode is saved. On the other hand, modifications to a Role in the Set will be made persistent, when the Role is saved.

Returns:
the Roles associated with the User

addRole

public final boolean addRole(Role rl)
Adds a Role to the SitemapNode's Set of Roles. If it already is part of the Set, it will not be added.

Parameters:
rl - the Role to be added
Returns:
true if the Set changed as a result of the call

removeRole

public final boolean removeRole(AbstractAccessControlObject rl)
Removes a Role from the SitemapNode's Set of Roles if it is part of it.

Parameters:
rl - the Role to be removed
Returns:
true if the Set changed as a result of the call

clearRoles

public final void clearRoles()
Removes all roles form the SitemapNode.


setSectionTag

public final void setSectionTag(SitemapSectionTag tag)
Sets the SitemapSectionTag for the SitemapNode.

Parameters:
tag - the sectionTag to set

getSectionTag

public final SitemapSectionTag getSectionTag()
Returns the SitemapSectionTag of the SitemapNode.

Returns:
the sectionTag

setDuration

public final void setDuration(Duration validity)
sets the Duration for the SitemapNode.

Parameters:
validity - the validity

getDuration

public final Duration getDuration()
returns the Duration of the SitemapNode or null if no duration has been set.

Returns:
the validity or null

removeDuration

public final void removeDuration()
removes the Duration from the SitemapNode.


adoptSettingsFrom

public final void adoptSettingsFrom(SitemapNode sitemapNode)
Adopts the following settings from the given SitemapNode: .

Parameters:
sitemapNode - the SitemapNode to adopt the settings from

getPathBuilder

public final java.lang.StringBuilder getPathBuilder()
Returns a StringBuilder with the Sitemap-path of the SitemapNode. System.getProperty("file.separator") will be used as path-separator.

Returns:
a StringBuilder with the Sitemap-path of the SitemapNode

deserializeToJDOM

public final org.jdom.Element deserializeToJDOM()
Description copied from interface: JDOMable
this will deserialize the state of the JDOMable as a JDOM Element.

Specified by:
deserializeToJDOM in interface JDOMable
Returns:
the SitemapNode as an Element

deserializeToJDOMShallow

public final org.jdom.Element deserializeToJDOMShallow()
returns the SitemapNode as an Element excluding all children and view information.

Returns:
the SitemapNode as an Element excluding all children and view information

toJSON

public final net.sf.json.JSONObject toJSON()
/** returns a JSONObject representation of the SitemapNode.

Overrides:
toJSON in class Node
Returns:
a JSONObject representation of the SitemapNode