org.opencms.frontend.templateone
Class CmsTemplateParts

java.lang.Object
  extended by org.opencms.frontend.templateone.CmsTemplateParts
All Implemented Interfaces:
org.opencms.main.I_CmsEventListener

public final class CmsTemplateParts
extends java.lang.Object
implements org.opencms.main.I_CmsEventListener

Stores static Strings to generate HTML output parts for the template in a Map.

An instance of this class is stored in the OpenCms runtime properties.

Since:
6.0.0

Field Summary
static java.lang.String KEY_ILLEGAL
          Key name for an illegal key.
 
Fields inherited from interface org.opencms.main.I_CmsEventListener
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_FULLSTATIC_EXPORT, EVENT_GROUP_MODIFIED, EVENT_LOGIN_USER, EVENT_OU_MODIFIED, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_REBUILD_SEARCHINDEXES, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCE_MOVED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_SITEMAP_CHANGED, EVENT_UPDATE_EXPORTS, EVENT_USER_MODIFIED, KEY_CHANGE, KEY_DBCONTEXT, KEY_GROUP_ID, KEY_GROUP_NAME, KEY_INDEX_NAMES, KEY_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_USER_ACTION, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, VALUE_GROUP_MODIFIED_ACTION_CREATE, VALUE_GROUP_MODIFIED_ACTION_DELETE, VALUE_GROUP_MODIFIED_ACTION_WRITE, VALUE_OU_MODIFIED_ACTION_CREATE, VALUE_OU_MODIFIED_ACTION_DELETE, VALUE_USER_MODIFIED_ACTION_ADD_USER_TO_GROUP, VALUE_USER_MODIFIED_ACTION_CREATE_USER, VALUE_USER_MODIFIED_ACTION_DELETE_USER, VALUE_USER_MODIFIED_ACTION_REMOVE_USER_FROM_GROUP, VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD, VALUE_USER_MODIFIED_ACTION_SET_OU, VALUE_USER_MODIFIED_ACTION_WRITE_USER
 
Method Summary
 void addPart(java.lang.String partKey, java.lang.String value)
          Sets a part in the cache with the specified key and value.
 void cmsEvent(org.opencms.main.CmsEvent event)
          Implements the CmsEvent interface, clears the template parts on publish and clear cache events.
static CmsTemplateParts getInstance()
          Returns an instance of the class fetched from the application context attribute.
 java.lang.String getPart(java.lang.String partKey)
          Returns a previously cached part of template one with the specified key, or null, if no part is found.
 java.lang.String includePart(java.lang.String target, java.lang.String element, java.lang.String layout, org.opencms.jsp.CmsJspActionElement jsp)
          Returns the content of the specified JSP target file depending on the element and the layout to display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_ILLEGAL

public static final java.lang.String KEY_ILLEGAL
Key name for an illegal key.

See Also:
Constant Field Values
Method Detail

getInstance

public static CmsTemplateParts getInstance()
Returns an instance of the class fetched from the application context attribute.

Returns:
an instance of the class

addPart

public void addPart(java.lang.String partKey,
                    java.lang.String value)
Sets a part in the cache with the specified key and value.

Parameters:
partKey - the key to identify the part
value - the value to cache

cmsEvent

public void cmsEvent(org.opencms.main.CmsEvent event)
Implements the CmsEvent interface, clears the template parts on publish and clear cache events.

Specified by:
cmsEvent in interface org.opencms.main.I_CmsEventListener
Parameters:
event - CmsEvent that has occurred

getPart

public java.lang.String getPart(java.lang.String partKey)
Returns a previously cached part of template one with the specified key, or null, if no part is found.

Parameters:
partKey - the key to identify the part
Returns:
a previously cached part of template one with the specified key

includePart

public java.lang.String includePart(java.lang.String target,
                                    java.lang.String element,
                                    java.lang.String layout,
                                    org.opencms.jsp.CmsJspActionElement jsp)
Returns the content of the specified JSP target file depending on the element and the layout to display.

Parameters:
target - the target uri of the file in the OpenCms VFS (can be relative or absolute)
element - the element (template selector) to display from the target
layout - the layout type of the template to get
jsp - the JSP page to generate the content with
Returns:
the content of the JSP target file