com.gentics.api.portalnode.connector
Class PortalConnectorHelper

java.lang.Object
  extended by com.gentics.api.portalnode.connector.PortalConnectorHelper

public final class PortalConnectorHelper
extends Object

A helper class for the Gentics Portal.Connector.
Currently can be used to replace plinks within a page content.

Author:
herbert

Method Summary
static void clearCache(Datasource datasource)
          Clear the object and attribute cache for all objects in the given datasource
static void clearCache(Datasource datasource, String contentId)
          Clear the object and attribute cache of the given object in the given datasource
static void clearQueryCache(Datasource datasource)
          Clear the query caches for the given datasource
static Resolvable getLanguageVariant(Resolvable page, String languageCode, Datasource ds)
          This helper method can be used to fetch a given language variant for the given page object (which was published from Gentics Content.Node).
static String replacePLinks(String content, PLinkReplacer replacer)
          Can be used to replace the plink tags within a content of a page with URLs.
A plink has the syntax of: <plink id="contentid" /> - It may contain additional attributes after id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

replacePLinks

public static String replacePLinks(String content,
                                   PLinkReplacer replacer)
Can be used to replace the plink tags within a content of a page with URLs.
A plink has the syntax of: <plink id="contentid" /> - It may contain additional attributes after id. The use of this helper is optional, the plinks can as well be replaced by hand.

Parameters:
content - The content string of the page.
replacer - A resolver used to resolve contentids to links.
Returns:
the whole pagecontent, plinks replaced with urls using the given replacer.
See Also:
PLinkReplacer

getLanguageVariant

public static final Resolvable getLanguageVariant(Resolvable page,
                                                  String languageCode,
                                                  Datasource ds)
                                           throws NodeException
This helper method can be used to fetch a given language variant for the given page object (which was published from Gentics Content.Node). It first tries to get the object linked by the attribute "content_[languageCode]" and if that fails, it fetches the page with same contentset_id and content_language set to the requested content_language

Parameters:
page - page for which the language variant shall be fetched
languageCode - language code of the language variant
ds - datasource that holds the page objects
Returns:
language variant or null if not found
Throws:
NodeException

clearCache

public static void clearCache(Datasource datasource)
Clear the object and attribute cache for all objects in the given datasource

Parameters:
datasource - datasource

clearCache

public static void clearCache(Datasource datasource,
                              String contentId)
Clear the object and attribute cache of the given object in the given datasource

Parameters:
datasource - datasource
contentId - content id

clearQueryCache

public static void clearQueryCache(Datasource datasource)
Clear the query caches for the given datasource

Parameters:
datasource - datasource


Copyright © 2013 Gentics Software GmbH. All Rights Reserved.