org.opencms.staticexport
Class CmsLink

java.lang.Object
  extended byorg.opencms.staticexport.CmsLink

public class CmsLink
extends java.lang.Object

A single link entry in the link table.

Since:
6.0.0
Version:
$Revision: 1.27 $
Author:
Carsten Weinholz

Constructor Summary
CmsLink(org.dom4j.Element element, java.lang.String name, java.lang.String type, java.lang.String uri, boolean internal)
          Creates a new link object with a reference to the xml page link element.
CmsLink(org.dom4j.Element element, java.lang.String name, java.lang.String type, java.lang.String target, java.lang.String anchor, java.lang.String query, boolean internal)
          Creates a new link object with a reference to the xml page link element.
CmsLink(java.lang.String name, java.lang.String type, java.lang.String uri, boolean internal)
          Creates a new link object without a reference to the xml page link element.
CmsLink(java.lang.String name, java.lang.String type, java.lang.String target, java.lang.String anchor, java.lang.String query, boolean internal)
          Creates a new link object without a reference to the xml page link element.
 
Method Summary
 java.lang.String getAnchor()
          Returns the anchor of this link.
 java.lang.String getName()
          Returns the macro name of this link.
 java.lang.String getParameter(java.lang.String name)
          Returns the first parameter value for the given parameter name.
 java.util.Map getParameterMap()
          Returns the map of parameters of this link.
 java.util.Set getParameterNames()
          Returns the set of available parameter names for this link.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns all parameter values for the given name.
 java.lang.String getQuery()
          Returns the query of this link.
 java.lang.String getSiteRoot()
          Return the site root of the target if it is internal.
 java.lang.String getTarget()
          Returns the target (destination) of this link.
 java.lang.String getType()
          Returns the type of this link.
 java.lang.String getUri()
          Returns the raw uri of this link.
 java.lang.String getVfsUri()
          Returns the vfs link of the target if it is internal.
 boolean isInternal()
          Returns if the link is internal.
 java.lang.String toString()
           
 void updateLink(java.lang.String uri)
          Updates the uri of this link with a new value.
 void updateLink(java.lang.String target, java.lang.String anchor, java.lang.String query)
          Updates the uri of this link with a new target, anchor and query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsLink

public CmsLink(org.dom4j.Element element,
               java.lang.String name,
               java.lang.String type,
               java.lang.String uri,
               boolean internal)
Creates a new link object with a reference to the xml page link element.

Parameters:
element - the xml link element reference
name - the internal name of this link
type - the type of this link
uri - the link uri
internal - indicates if the link is internal within OpenCms

CmsLink

public CmsLink(org.dom4j.Element element,
               java.lang.String name,
               java.lang.String type,
               java.lang.String target,
               java.lang.String anchor,
               java.lang.String query,
               boolean internal)
Creates a new link object with a reference to the xml page link element.

Parameters:
element - the xml link element reference
name - the internal name of this link
type - the type of this link
target - the link target (without anchor/query)
anchor - the anchor or null
query - the query or null
internal - indicates if the link is internal within OpenCms

CmsLink

public CmsLink(java.lang.String name,
               java.lang.String type,
               java.lang.String uri,
               boolean internal)
Creates a new link object without a reference to the xml page link element.

Parameters:
name - the internal name of this link
type - the type of this link
uri - the link uri
internal - indicates if the link is internal within OpenCms

CmsLink

public CmsLink(java.lang.String name,
               java.lang.String type,
               java.lang.String target,
               java.lang.String anchor,
               java.lang.String query,
               boolean internal)
Creates a new link object without a reference to the xml page link element.

Parameters:
name - the internal name of this link
type - the type of this link
target - the link target (without anchor/query)
anchor - the anchor or null
query - the query or null
internal - indicates if the link is internal within OpenCms
Method Detail

getAnchor

public java.lang.String getAnchor()
Returns the anchor of this link.

Returns:
the anchor or null if undefined

getName

public java.lang.String getName()
Returns the macro name of this link.

Returns:
the macro name name of this link

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the first parameter value for the given parameter name.

Parameters:
name - the name of the parameter
Returns:
the first value for this name or null

getParameterMap

public java.util.Map getParameterMap()
Returns the map of parameters of this link.

Returns:
the map of parameters (Map(String[]))

getParameterNames

public java.util.Set getParameterNames()
Returns the set of available parameter names for this link.

Returns:
a Set of parameter names

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns all parameter values for the given name.

Parameters:
name - the name of the parameter
Returns:
a String[] of all parameter values or null

getQuery

public java.lang.String getQuery()
Returns the query of this link.

Returns:
the query or null if undefined

getSiteRoot

public java.lang.String getSiteRoot()
Return the site root of the target if it is internal.

Returns:
the site root or null

getTarget

public java.lang.String getTarget()
Returns the target (destination) of this link.

Returns:
the target the target (destination) of this link

getType

public java.lang.String getType()
Returns the type of this link.

Returns:
the type of this link

getUri

public java.lang.String getUri()
Returns the raw uri of this link.

Returns:
the uri

getVfsUri

public java.lang.String getVfsUri()
Returns the vfs link of the target if it is internal.

Returns:
the full link destination or null if the link is not internal.

isInternal

public boolean isInternal()
Returns if the link is internal.

Returns:
true if the link is a local link

toString

public java.lang.String toString()
See Also:
Object.toString()

updateLink

public void updateLink(java.lang.String uri)
Updates the uri of this link with a new value.

Also updates the structure of the underlying XML page document this link belongs to.

Note that you can not update the "internal" or "type" values of the link, so the new link must be of same type (A, IMG) and also remain either an internal or external link.

Parameters:
uri - the uri to update this link with scheme://authority/path#anchor?query

updateLink

public void updateLink(java.lang.String target,
                       java.lang.String anchor,
                       java.lang.String query)
Updates the uri of this link with a new target, anchor and query.

If anchor and/or query are null, this features are not used.

Note that you can not update the "internal" or "type" values of the link, so the new link must be of same type (A, IMG) and also remain either an internal or external link.

Also updates the structure of the underlying XML page document this link belongs to.

Parameters:
target - the target (destination) of this link
anchor - the anchor or null if undefined
query - the query or null if undefined