com.flexive.shared
Class ContentLinkFormatter

java.lang.Object
  extended by com.flexive.shared.ContentLinkFormatter

public class ContentLinkFormatter
extends java.lang.Object

Provides the default mapper for content URIs. The format method takes a FxPK identifying an object and returns an URI for the given object.

Version:
$Rev: 597 $
Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
protected ContentLinkFormatter()
          Protected c'tor to avoid instantiation
 
Method Summary
protected  java.lang.String format(java.lang.String formatString, FxPaths.Item item)
           
 java.lang.String format(java.lang.String formatString, FxPaths paths)
          Uses the given format string to create an URI for the given tree path items.
 java.lang.String format(java.lang.String formatString, FxPK pk)
          Uses the given format string to create a hyperlink for the given primary key.
static ContentLinkFormatter getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentLinkFormatter

protected ContentLinkFormatter()
Protected c'tor to avoid instantiation

Method Detail

getInstance

public static ContentLinkFormatter getInstance()

format

public java.lang.String format(java.lang.String formatString,
                               FxPK pk)

Uses the given format string to create a hyperlink for the given primary key. Supported placeholders are:

%{pk} The primary key in "dot" notation. For example, new FxPK(42, 1) results in "42.1" being substituted in the URI.
%{id} The object ID.
%{version} The object version.

Parameters:
formatString - the input format string. For example, "/content/%{id}.html"
pk - the content PK to be formatted
Returns:
the resulting hyperlink

format

public java.lang.String format(java.lang.String formatString,
                               FxPaths paths)

Uses the given format string to create an URI for the given tree path items. If more than one path is contained in the given parameter, the paths are joined with a ',' character. Supported placeholders are:

%{pk} The primary key in "dot" notation. For example, new FxPK(42, 1) results in "42.1" being substituted in the URI.
%{id} The object ID.
%{version} The object version.
%{nodeId} The tree node ID.
%{caption} The item caption (will be URL-escaped).
%{caption20} The item caption, abbreviated to max. 20 characters (will be URL-escaped).

Parameters:
formatString - the input format string. For example, "/content/%{id}.html"
paths - the tree paths to be formatted
Returns:
the resulting URI string

format

protected java.lang.String format(java.lang.String formatString,
                                  FxPaths.Item item)