com.gentics.api.contentnode.parttype
Class AbstractExtensiblePartType

java.lang.Object
  extended by com.gentics.api.contentnode.parttype.AbstractExtensiblePartType
All Implemented Interfaces:
ExtensiblePartType

public abstract class AbstractExtensiblePartType
extends Object
implements ExtensiblePartType

Abstract base implementation of ExtensiblePartType. This class should be the base class for all new implementations of PartTypes. To use extensible parttypes you need to insert a row into the type table of the cms database. Please note that once the row has been inserted, any changes to the row, such as updating the class name, require a tomcat restart (the part type information is cached internally). To avoid id conflicts please calculate your personal id range for now: take the 1st 4 characters of one of the customers cms license keys. convert them from hex to dec. multiply by 1000. this is the lowest allowed id. add 999. thid is the highest allowed id. eg: license key is A2B4-xxxx-xxxx... hex a2b4 is 41652 in decimal. your personal id range is 41652000 - 41652999.


Constructor Summary
AbstractExtensiblePartType()
           
 
Method Summary
 void cleanAfterRender()
          Perform cleanup operations after rendering.
 void clearCache()
          Clear the cache
protected  com.gentics.contentnode.object.parttype.CMSResolver createCMSResolver()
          Creates a new cms resolver and adds it to the stack.
 Map createContext(boolean wrapRenderables)
          Get the context of the parttype.
 Object getCachedObject(Object key)
          Get the object cached for this parttype class with the given key
protected  String getCacheGroup()
          Get the cache group name (=classname)
 void putObjectIntoCache(Object key, Object object)
          Put the given object into the cache
 void removeObjectFromCache(Object key)
          Remove the object with the given key from the cache
 Object resolve(String path)
          Helper method to resolve property paths in the context of the part
 String resolveToString(String path)
          Help method to resolve a property and return it's string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.gentics.api.contentnode.parttype.ExtensiblePartType
render
 

Constructor Detail

AbstractExtensiblePartType

public AbstractExtensiblePartType()
Method Detail

createCMSResolver

protected com.gentics.contentnode.object.parttype.CMSResolver createCMSResolver()
                                                                         throws NodeException
Creates a new cms resolver and adds it to the stack.

Returns:
the cms resolver
Throws:
NodeException

resolve

public Object resolve(String path)
               throws NodeException
Helper method to resolve property paths in the context of the part

Parameters:
path - property path to resolve
Returns:
resolved object or null if path could not be resolved
Throws:
NodeException - when an error occurred while resolving

resolveToString

public String resolveToString(String path)
                       throws NodeException
Help method to resolve a property and return it's string representation.

Parameters:
path - property path to resolve
Returns:
string representation of path
Throws:
NodeException - when an error occurred

createContext

public Map createContext(boolean wrapRenderables)
                  throws NodeException
Get the context of the parttype. The context maps base words to the resolved objects.

Parameters:
wrapRenderables - flag to wrap renderable objects into instances of RenderableResolvable
Returns:
map of base objects
Throws:
NodeException

getCachedObject

public Object getCachedObject(Object key)
Get the object cached for this parttype class with the given key

Parameters:
key - cache key
Returns:
cached object or null

putObjectIntoCache

public void putObjectIntoCache(Object key,
                               Object object)
Put the given object into the cache

Parameters:
key - cache key
object - cached object

removeObjectFromCache

public void removeObjectFromCache(Object key)
Remove the object with the given key from the cache

Parameters:
key - cache key

clearCache

public void clearCache()
Clear the cache


getCacheGroup

protected String getCacheGroup()
Get the cache group name (=classname)

Returns:
cache group name

cleanAfterRender

public void cleanAfterRender()
Description copied from interface: ExtensiblePartType
Perform cleanup operations after rendering. When overwriting this method, make sure to call ExtensiblePartType.cleanAfterRender().

Specified by:
cleanAfterRender in interface ExtensiblePartType


Copyright © 2013 Gentics Software GmbH. All Rights Reserved.