|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.opencms.template.A_CmsTemplate
|
+--com.opencms.template.CmsXmlTemplate
|
+--com.opencms.defaults.CmsShowContent
Generic class for showing information encapsulated by contentdefinition objects. There are mainly two user methods in this template class for this purpose: getEntry and getList. The getEntry method accepts an id or read it from the url parameters (it has to be named id to be found) if given and set datablocks inside the template with values returned by all public get-methods of the contentdefinition that returns a String and have no parameters. This method must be called in the template before acccessing any of this data with process tags. The getList method builds a list of contentdefinition entries. It invokes a filtermethod defined inside a datablock named <filtermethod>. The user parameter of type String passed to the filtermethod is taken from the url parameters or from a default value. The getList method accepts a name and a defaut value in a comma seperated String in this way : name, defaultvalue. The entrys for the list will be filled by appending a processed datablock with the name listentry. Every get-method will be invoked for every entry unless a tag named <method> is given where a commaseperated list of exactly typed get-method names can be given that results in invoking only this methods (for performance improvement if not all values are needed and many get-methods are given). The filtermethod is assumed to have the following signature: filtermehodname(CmsObject, String). If one wants to use filtermethods with other signatures he has to derive from this class and override the method invokeFilterMethod where the filtermethod is actually invoked. For both methods the fully qualified classname of the contentdefinition has to be stated in a datablock with the name <contentdefinition_class>. Note: the method getUniqueId(CmsObject) will be invoked for the contentdefinition class in any case, and the datablock uniqueid can be used in the template to refer to the id of an contentdefinition object
| Field Summary | |
protected static String |
C_CONSTRUCTOR_IS_NOT_SUBCLASS_OF_A_CMSCONTENTDEFINITION
Error message in case the constructor is not a subclass of A_CmsContentDefinition. |
protected static String |
C_CONSTRUCTOR_THROWED_EXCEPTION
Error message if the constructor in case the contentdefinition class throws an exception. |
protected static String |
C_CONTENTDEFINITION_CLASS_DATABLOCK
The name of the datablock containing the contentdefinition's fully qualified classname. |
protected static String |
C_ERROR_TEXT
Error text that will be set inside the template if a get-method throws an exception. |
protected static String |
C_FILTER_PARAMETERS_START
replaces the tagcontent for usermethod "getList" |
protected static String |
C_FILTERMETHOD_DATABLOCK
The name of the datablock containing the name of the filtermethod to use. |
protected static String |
C_ID_PARAMETER
The name of the id parameter. |
protected static String |
C_LISTENTRY_DATABLOCK
The name of the datablock to define a listentry. |
protected static String |
C_METHODS_TO_USE_DATABLOCK
The name of the datablock to define which get-methods to invoke. |
protected static String |
C_MISSING_ID_PARAMETER
Error message for a missing id parameter. |
protected static String |
C_NON_NUMERICAL_ID_PARAMETER
Error message in case a non-numerical id parameter is given. |
| Fields inherited from class com.opencms.template.CmsXmlTemplate |
C_BODY_ELEMENT, C_DEBUG, C_FRAME_SELECTOR, m_cache |
| Fields inherited from interface com.opencms.boot.I_CmsLogChannels |
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING |
| Constructor Summary | |
CmsShowContent()
|
|
| Method Summary | |
CmsCacheDirectives |
getCacheDirectives(CmsObject cms,
String templateFile,
String elementName,
Hashtable parameters,
String templateSelector)
Gets the caching information from the current template class. |
Object |
getEntry(CmsObject cms,
String tagcontent,
A_CmsXmlContent doc,
Object userObject)
Usermethod to fill template datablocks with values of a contentdefinition's get-methods. |
protected ArrayList |
getGetMethods(Class cdClass)
This methods collects all "getXYZ" methods of the contentdefinition. |
protected ArrayList |
getGetMethodsByName(Class cdClass,
String[] names)
This methods collects all get-methods with the names specified in the String array names. |
Object |
getList(CmsObject cms,
String tagcontent,
A_CmsXmlContent doc,
Object userObject)
User-method to build a list of contentdefinition entries. |
protected String |
getUserParameter(Hashtable parameters,
String tagcontent)
Gets the userparameter from tagcontent of the getList method-tag or from url parameters. |
protected Vector |
invokeFilterMethod(CmsObject cms,
Class cdClass,
String name,
String userparameter)
Invokes the filtermethod and returns a Vector of contentdefinition objects returned by the filtermethod. |
protected void |
setDatablocks(CmsXmlTemplateFile template,
A_CmsContentDefinition contentDefinition,
ArrayList methods)
This method automatically fills all datablocks in the template that fit to a special name scheme. |
| Methods inherited from class com.opencms.template.A_CmsTemplate |
debugPrint, isCacheable, isExportable, isProxyPrivateCacheable, isProxyPublicCacheable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.opencms.template.I_CmsTemplate |
isCacheable, isExportable, isProxyPrivateCacheable, isProxyPublicCacheable |
| Field Detail |
protected static final String C_CONTENTDEFINITION_CLASS_DATABLOCK
protected static final String C_FILTERMETHOD_DATABLOCK
protected static final String C_FILTER_PARAMETERS_START
protected static final String C_METHODS_TO_USE_DATABLOCK
protected static final String C_LISTENTRY_DATABLOCK
protected static final String C_MISSING_ID_PARAMETER
protected static final String C_CONSTRUCTOR_THROWED_EXCEPTION
protected static final String C_CONSTRUCTOR_IS_NOT_SUBCLASS_OF_A_CMSCONTENTDEFINITION
protected static final String C_NON_NUMERICAL_ID_PARAMETER
protected static final String C_ERROR_TEXT
protected static final String C_ID_PARAMETER
| Constructor Detail |
public CmsShowContent()
| Method Detail |
public Object getEntry(CmsObject cms,
String tagcontent,
A_CmsXmlContent doc,
Object userObject)
throws CmsException
cms - CmsObject Object for accessing system resources.tagcontent - the tagcontent passed to the method. This can be an id
value which will be used if the parameter id is not found parameters passed
with the request (url parameters).doc - reference to the A_CmsXmlContent object of the initiating XLM document
CmsException - in case of unrecoverable errors
public Object getList(CmsObject cms,
String tagcontent,
A_CmsXmlContent doc,
Object userObject)
throws CmsException
cms - CmsObject Object for accessing system resources.tagcontent - comma separated name, default value pair. The name
is the name of an url parameter which value will be passed to the
filtermethod if given. If the url parameter is not found the default
value will be used as a userparameter for the filtermethod.doc - reference to the A_CmsXmlContent object of the initiating XLM document.
CmsException - in case of unrecoverable errors
protected String getUserParameter(Hashtable parameters,
String tagcontent)
throws CmsException
parameters - Hashtable with the url parameterstagcontent - String with the content of the method tag
CmsExceptionprotected ArrayList getGetMethods(Class cdClass)
cdClass - the class object of the contentdefinition class
protected ArrayList getGetMethodsByName(Class cdClass,
String[] names)
throws NoSuchMethodException
cdClass - the class object of the contentdefinition class
CmsException - in case of unrecoverable errors
NoSuchMethodException
protected void setDatablocks(CmsXmlTemplateFile template,
A_CmsContentDefinition contentDefinition,
ArrayList methods)
throws CmsException
template - The template file of this templatecontentDefinition - The actual content defintion object
CmsException - in case of unrecoverable erros
protected Vector invokeFilterMethod(CmsObject cms,
Class cdClass,
String name,
String userparameter)
throws NoSuchMethodException,
InvocationTargetException,
IllegalAccessException
userparameter - the value of the userparameetr which will be passed to the filtermethod
NoSuchMethodException - if the filtermethod doesn't exist
InvocationTargetException - if the invoked filtermethod throws an exception itself
IllegalAccessException - if the filtermethod is inaccessible
public CmsCacheDirectives getCacheDirectives(CmsObject cms,
String templateFile,
String elementName,
Hashtable parameters,
String templateSelector)
getCacheDirectives in class CmsXmlTemplatecms - CmsObject Object for accessing system resourcestemplateFile - Filename of the template fileelementName - Element name of this template in our parent templateparameters - Hashtable with all template class parameterstemplateSelector - template section that should be processed
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||