|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.xml.content.CmsDefaultXmlContentHandler
public class CmsDefaultXmlContentHandler
Default implementation for the XML content handler, will be used by all XML contents that do not provide their own handler.
Field Summary | |
---|---|
static String |
APPINFO_APPINFO
Constant for the "appinfo" element name itself. |
static String |
APPINFO_ATTR_COLLAPSE
Constant for the "collapse" appinfo attribute name. |
static String |
APPINFO_ATTR_CONFIGURATION
Constant for the "configuration" appinfo attribute name. |
static String |
APPINFO_ATTR_DEFAULT
Constant for the "default" appinfo attribute name. |
static String |
APPINFO_ATTR_DESCRIPTION
Constant for the "description" appinfo attribute name. |
static String |
APPINFO_ATTR_ELEMENT
Constant for the "element" appinfo attribute name. |
static String |
APPINFO_ATTR_ERROR
Constant for the "error" appinfo attribute name. |
static String |
APPINFO_ATTR_INVALIDATE
Constant for the "invalidate" appinfo attribute name. |
static String |
APPINFO_ATTR_KEY
Constant for the "key" appinfo attribute name. |
static String |
APPINFO_ATTR_LOCALE
Constant for the "locale" appinfo attribute name. |
static String |
APPINFO_ATTR_MAPTO
Constant for the "mapto" appinfo attribute name. |
static String |
APPINFO_ATTR_MAXWIDTH
Constant for the "maxwidth" appinfo attribute name. |
static String |
APPINFO_ATTR_MESSAGE
Constant for the "message" appinfo attribute name. |
static String |
APPINFO_ATTR_MINWIDTH
Constant for the "minwidth" appinfo attribute name. |
static String |
APPINFO_ATTR_NAME
Constant for the "name" appinfo attribute name. |
static String |
APPINFO_ATTR_NICE_NAME
Constant for the "nice-name" appinfo attribute name. |
static String |
APPINFO_ATTR_PREVIEW
Constant for the "preview" appinfo attribute name. |
static String |
APPINFO_ATTR_REGEX
Constant for the "regex" appinfo attribute name. |
static String |
APPINFO_ATTR_RULE_REGEX
Constant for the "rule-regex" appinfo attribute name. |
static String |
APPINFO_ATTR_RULE_TYPE
Constant for the "rule-type" appinfo attribute name. |
static String |
APPINFO_ATTR_SEARCHCONTENT
Constant for the "searchcontent" appinfo attribute name. |
static String |
APPINFO_ATTR_SELECT_INHERIT
Constant for the "select-inherit" appinfo attribute name. |
static String |
APPINFO_ATTR_TYPE
Constant for the "type" appinfo attribute name. |
static String |
APPINFO_ATTR_TYPE_NODE
Constant for the "node" appinfo attribute value. |
static String |
APPINFO_ATTR_TYPE_PARENT
Constant for the "parent" appinfo attribute value. |
static String |
APPINFO_ATTR_TYPE_WARNING
Constant for the "warning" appinfo attribute value. |
static String |
APPINFO_ATTR_URI
Constant for the "uri" appinfo attribute name. |
static String |
APPINFO_ATTR_USEALL
Constant for the "useall" appinfo attribute name. |
static String |
APPINFO_ATTR_VALUE
Constant for the "value" appinfo attribute name. |
static String |
APPINFO_ATTR_WIDGET
Constant for the "widget" appinfo attribute name. |
static String |
APPINFO_ATTR_WIDGET_CONFIG
Constant for the "widget-config" appinfo attribute name. |
static String |
APPINFO_ATTRIBUTE_TYPE_CSS
Constant for formatter include resource type 'CSS'. |
static String |
APPINFO_ATTRIBUTE_TYPE_JAVASCRIPT
Constant for formatter include resource type 'JAVASCRIPT'. |
static String |
APPINFO_BUNDLE
Constant for the "bundle" appinfo element name. |
static String |
APPINFO_DEFAULT
Constant for the "default" appinfo element name. |
static String |
APPINFO_DEFAULTS
Constant for the "defaults" appinfo element name. |
static String |
APPINFO_FORMATTER
Constant for the "formatter" appinfo element name. |
static String |
APPINFO_FORMATTERS
Constant for the "formatters" appinfo element name. |
static String |
APPINFO_HEAD_INCLUDE
Constant for the "headinclude" appinfo element name. |
static String |
APPINFO_HEAD_INCLUDES
Constant for the "headincludes" appinfo element name. |
static String |
APPINFO_LAYOUT
Constant for the "layout" appinfo element name. |
static String |
APPINFO_LAYOUTS
Constant for the "layouts" appinfo element name. |
static String |
APPINFO_MAPPING
Constant for the "mapping" appinfo element name. |
static String |
APPINFO_MAPPINGS
Constant for the "mappings" appinfo element name. |
static String |
APPINFO_MODELFOLDER
Constant for the "modelfolder" appinfo element name. |
static String |
APPINFO_PREVIEW
Constant for the "preview" appinfo element name. |
static String |
APPINFO_PROPERTYBUNDLE
Constant for the "propertybundle" appinfo element name. |
static String |
APPINFO_RELATION
Constant for the "relation" appinfo element name. |
static String |
APPINFO_RELATIONS
Constant for the "relations" appinfo element name. |
static String |
APPINFO_RESOURCE
Constant for the "resource" appinfo element name. |
static String |
APPINFO_RESOURCEBUNDLE
Constant for the "resourcebundle" appinfo element name. |
static String |
APPINFO_RESOURCEBUNDLES
Constant for the "resourcebundles" appinfo element name. |
static String |
APPINFO_RULE
Constant for the "rule" appinfo element name. |
static String |
APPINFO_SCHEMA_FILE
The file where the default appinfo schema is located. |
static String |
APPINFO_SCHEMA_FILE_TYPES
The file where the default appinfo schema types are located. |
static String |
APPINFO_SCHEMA_SYSTEM_ID
The XML system id for the default appinfo schema types. |
static String |
APPINFO_SCHEMA_TYPES_SYSTEM_ID
The XML system id for the default appinfo schema types. |
static String |
APPINFO_SEARCHSETTING
Constant for the "searchsetting" appinfo element name. |
static String |
APPINFO_SEARCHSETTINGS
Constant for the "searchsettings" appinfo element name. |
static String |
APPINFO_SETTING
Constant for the "setting" appinfo element name. |
static String |
APPINFO_SETTINGS
Constant for the "settings" appinfo element name. |
static String |
APPINFO_TAB
Constant for the "tab" appinfo element name. |
static String |
APPINFO_TABS
Constant for the "tabs" appinfo element name. |
static String |
APPINFO_VALIDATIONRULE
Constant for the "validationrule" appinfo element name. |
static String |
APPINFO_VALIDATIONRULES
Constant for the "validationrules" appinfo element name. |
static String |
APPINFO_XMLBUNDLE
Constant for the "xmlbundle" appinfo element name. |
static String |
ATTRIBUTE_INCLUDE_TYPE_CSS
Constant for head include type attribute: CSS. |
static String |
ATTRIBUTE_INCLUDE_TYPE_JAVASCRIPT
Constant for head include type attribute: java-script. |
protected Map<String,String> |
m_configurationValues
The configuration values for the element widgets (as defined in the annotations). |
protected Set<String> |
m_cssHeadIncludes
The CSS resources to include into the html-page head. |
protected Map<String,String> |
m_defaultValues
The default values for the elements (as defined in the annotations). |
protected Map<String,List<String>> |
m_elementMappings
The element mappings (as defined in the annotations). |
protected Map<String,I_CmsWidget> |
m_elementWidgets
The widgets used for the elements (as defined in the annotations). |
protected CmsFormatterConfiguration |
m_formatterConfiguration
The formatter configuration. |
protected List<CmsFormatterBean> |
m_formatters
The list of formatters from the XSD. |
protected Set<String> |
m_jsHeadIncludes
The java-script resources to include into the html-page head. |
protected List<String> |
m_messageBundleNames
The resource bundle name to be used for localization of this content handler. |
protected String |
m_modelFolder
The folder containing the model file(s) for the content. |
protected String |
m_previewLocation
The preview location (as defined in the annotations). |
protected Map<String,Boolean> |
m_relationChecks
The relation check rules. |
protected Map<String,CmsRelationType> |
m_relations
The relation check rules. |
protected Map<String,Boolean> |
m_searchSettings
The search settings. |
protected Map<String,CmsXmlContentProperty> |
m_settings
The configured settings for the formatters (as defined in the annotations). |
protected List<CmsXmlContentTab> |
m_tabs
The configured tabs. |
protected List<String> |
m_titleMappings
The list of mappings to the "Title" property. |
protected Map<String,String> |
m_validationErrorMessages
The messages for the error validation rules. |
protected Map<String,String> |
m_validationErrorRules
The validation rules that cause an error (as defined in the annotations). |
protected Map<String,String> |
m_validationWarningMessages
The messages for the warning validation rules. |
protected Map<String,String> |
m_validationWarningRules
The validation rules that cause a warning (as defined in the annotations). |
static String |
MACRO_PREVIEW_TEMPFILE
Macro for resolving the preview URI. |
protected static String |
MESSAGE_VALIDATION_DEFAULT_ERROR
Default message for validation errors. |
protected static String |
MESSAGE_VALIDATION_DEFAULT_WARNING
Default message for validation warnings. |
Fields inherited from interface org.opencms.xml.content.I_CmsXmlContentHandler |
---|
ATTRIBUTES, MAPTO_ATTRIBUTE, MAPTO_PERMISSION, MAPTO_PROPERTY, MAPTO_PROPERTY_INDIVIDUAL, MAPTO_PROPERTY_LIST, MAPTO_PROPERTY_LIST_INDIVIDUAL, MAPTO_PROPERTY_LIST_SHARED, MAPTO_PROPERTY_SHARED, MAPTO_URLNAME |
Constructor Summary | |
---|---|
CmsDefaultXmlContentHandler()
Creates a new instance of the default XML content handler. |
Method Summary | |
---|---|
protected void |
addCheckRule(CmsXmlContentDefinition contentDefinition,
String elementName,
String invalidate,
String type)
Adds a check rule for a specified element. |
protected void |
addConfiguration(CmsXmlContentDefinition contentDefinition,
String elementName,
String configurationValue)
Adds a configuration value for an element widget. |
protected void |
addDefault(CmsXmlContentDefinition contentDefinition,
String elementName,
String defaultValue)
Adds a default value for an element. |
protected void |
addDefaultCheckRules(CmsXmlContentDefinition rootContentDefinition,
I_CmsXmlSchemaType schemaType,
String elementPath)
Adds all needed default check rules recursively for the given schema type. |
protected void |
addMapping(CmsXmlContentDefinition contentDefinition,
String elementName,
String mapping)
Adds an element mapping. |
protected void |
addSearchSetting(CmsXmlContentDefinition contentDefinition,
String elementName,
Boolean value)
Adds a search setting for an element. |
protected void |
addValidationRule(CmsXmlContentDefinition contentDefinition,
String elementName,
String regex,
String message,
boolean isWarning)
Adds a validation rule for a specified element. |
protected void |
addWidget(CmsXmlContentDefinition contentDefinition,
String elementName,
String widgetClassOrAlias)
Adds a GUI widget for a specified element. |
String |
getConfiguration(I_CmsXmlSchemaType type)
Returns the configuration String value for the widget used to edit the given XML content schema type. |
Set<String> |
getCSSHeadIncludes()
Returns the resource-independent CSS resources to include into the html-page head. |
Set<String> |
getCSSHeadIncludes(CmsObject cms,
CmsResource resource)
Returns all the CSS resources to include into the html-page head. |
String |
getDefault(CmsObject cms,
I_CmsXmlContentValue value,
Locale locale)
Returns the default String value for the given XML content schema type object in the given XML content. |
CmsFormatterConfiguration |
getFormatterConfiguration(CmsObject cms,
CmsResource resource)
Returns the container page element formatter configuration for a given resource. |
Set<String> |
getJSHeadIncludes()
Returns the resource-independent javascript resources to include into the html-page head. |
Set<String> |
getJSHeadIncludes(CmsObject cms,
CmsResource resource)
Returns all the javascript resources to include into the html-page head. |
protected Locale |
getLocaleForResource(CmsObject cms,
String resource)
Returns the default locale in the content of the given resource. |
List<String> |
getMappings(String elementName)
Returns the all mappings defined for the given element xpath. |
CmsMessages |
getMessages(Locale locale)
Returns the CmsMessages that are used to resolve localized keys
for the given locale in this content handler. |
String |
getModelFolder()
Returns the folder name that contains eventual XML content model files to use for this resource type. |
String |
getPreview(CmsObject cms,
CmsXmlContent content,
String resourcename)
Returns the preview URI for the given XML content value object to be displayed in the editor. |
protected String |
getReferencePath(CmsObject cms,
I_CmsXmlContentValue value)
Returns the category reference path for the given value. |
CmsRelationType |
getRelationType(I_CmsXmlContentValue value)
Deprecated. |
CmsRelationType |
getRelationType(String xpath)
Returns the relation type for the given path. |
Map<String,CmsXmlContentProperty> |
getSettings(CmsObject cms,
CmsResource resource)
Returns the element settings defined for the container page formatters. |
List<CmsXmlContentTab> |
getTabs()
Returns the tabs to be displayed in the editor. |
String |
getTitleMapping(CmsObject cms,
CmsXmlContent document,
Locale locale)
Returns the "Title" mapping set for the given XML content document in the given Locale. |
protected String |
getValidationMessage(CmsObject cms,
I_CmsXmlContentValue value,
String regex,
String valueStr,
boolean matchResult,
boolean isWarning)
Returns the validation message to be displayed if a certain rule was violated. |
I_CmsWidget |
getWidget(I_CmsXmlContentValue value)
Returns the editor widget that should be used for the given XML content value. |
protected void |
init()
Called when this content handler is initialized. |
protected void |
initDefaultValues(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the default values for this content handler. |
protected void |
initFormatters(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the formatters for this content handler. |
protected void |
initHeadIncludes(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the head includes for this content handler. |
void |
initialize(Element appInfoElement,
CmsXmlContentDefinition contentDefinition)
Initializes this content handler for the given XML content definition by analyzing the "appinfo" node. |
protected void |
initLayouts(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the layout for this content handler. |
protected void |
initMappings(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the element mappings for this content handler. |
protected void |
initModelFolder(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the folder containing the model file(s) for this content handler. |
protected void |
initPreview(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the preview location for this content handler. |
protected void |
initRelations(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the relation configuration for this content handler. |
protected void |
initResourceBundle(Element root,
CmsXmlContentDefinition contentDefinition,
boolean single)
Initializes the resource bundle to use for localized messages in this content handler. |
protected void |
initSearchSettings(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the search exclusions values for this content handler. |
protected void |
initSettings(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the element settings for this content handler. |
protected void |
initTabs(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the tabs for this content handler. |
protected void |
initValidationRules(Element root,
CmsXmlContentDefinition contentDefinition)
Initializes the validation rules this content handler. |
void |
invalidateBrokenLinks(CmsObject cms,
CmsXmlContent document)
Performs a check of the given XML document. |
protected boolean |
isInvalidateParent(String xpath)
Returns the is-invalidate-parent flag for the given xpath. |
boolean |
isSearchable(I_CmsXmlContentValue value)
Returns true in case the given value should be searchable with
the integrated full text search. |
protected String |
key(String keyName,
Locale locale)
Returns the localized resource string for a given message key according to the configured resource bundle of this content handler. |
CmsXmlContent |
prepareForUse(CmsObject cms,
CmsXmlContent content)
Prepares the given XML content to be used after it was read from the OpenCms VFS. |
CmsFile |
prepareForWrite(CmsObject cms,
CmsXmlContent content,
CmsFile file)
Prepares the given XML content to be written to the OpenCms VFS. |
protected void |
removeEmptyMappings(CmsObject cms,
CmsXmlContent content)
Removes property values on resources for non-existing, optional elements. |
void |
resolveMapping(CmsObject cms,
CmsXmlContent content,
I_CmsXmlContentValue value)
Resolves the value mappings of the given XML content value, according to the rules of this XML content handler. |
CmsXmlContentErrorHandler |
resolveValidation(CmsObject cms,
I_CmsXmlContentValue value,
CmsXmlContentErrorHandler errorHandler)
Performs a validation of the given XML content value, and saves all errors or warnings found in the provided XML content error handler. |
protected void |
validateAppinfoElement(Element appinfoElement)
Validates if the given appinfo element node from the XML content definition schema
is valid according the the capabilities of this content handler. |
protected CmsXmlContentErrorHandler |
validateCategories(CmsObject cms,
I_CmsXmlContentValue value,
CmsXmlContentErrorHandler errorHandler)
The errorHandler parameter is optional, if null is given a new error handler
instance must be created. |
protected boolean |
validateLink(CmsObject cms,
I_CmsXmlContentValue value,
CmsXmlContentErrorHandler errorHandler)
Validates the given rules against the given value. |
protected CmsXmlContentErrorHandler |
validateValue(CmsObject cms,
I_CmsXmlContentValue value,
CmsXmlContentErrorHandler errorHandler,
Map<String,String> rules,
boolean isWarning)
Validates the given rules against the given value. |
protected CmsXmlContentErrorHandler |
validateValue(CmsObject cms,
I_CmsXmlContentValue value,
String valueStr,
CmsXmlContentErrorHandler errorHandler,
boolean isWarning)
Checks the default XML schema validation rules. |
protected CmsFile |
writeCategories(CmsObject cms,
CmsFile file,
CmsXmlContent content)
Writes the categories if a category widget is present. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String APPINFO_APPINFO
public static final String APPINFO_ATTR_COLLAPSE
public static final String APPINFO_ATTR_CONFIGURATION
public static final String APPINFO_ATTR_DEFAULT
public static final String APPINFO_ATTR_DESCRIPTION
public static final String APPINFO_ATTR_ELEMENT
public static final String APPINFO_ATTR_ERROR
public static final String APPINFO_ATTR_INVALIDATE
public static final String APPINFO_ATTR_KEY
public static final String APPINFO_ATTR_LOCALE
public static final String APPINFO_ATTR_MAPTO
public static final String APPINFO_ATTR_MAXWIDTH
public static final String APPINFO_ATTR_MESSAGE
public static final String APPINFO_ATTR_MINWIDTH
public static final String APPINFO_ATTR_NAME
public static final String APPINFO_ATTR_NICE_NAME
public static final String APPINFO_ATTR_PREVIEW
public static final String APPINFO_ATTR_REGEX
public static final String APPINFO_ATTR_RULE_REGEX
public static final String APPINFO_ATTR_RULE_TYPE
public static final String APPINFO_ATTR_SEARCHCONTENT
public static final String APPINFO_ATTR_SELECT_INHERIT
public static final String APPINFO_ATTR_TYPE
public static final String APPINFO_ATTR_TYPE_NODE
public static final String APPINFO_ATTR_TYPE_PARENT
public static final String APPINFO_ATTR_TYPE_WARNING
public static final String APPINFO_ATTR_URI
public static final String APPINFO_ATTR_USEALL
public static final String APPINFO_ATTR_VALUE
public static final String APPINFO_ATTR_WIDGET
public static final String APPINFO_ATTR_WIDGET_CONFIG
public static final String APPINFO_ATTRIBUTE_TYPE_CSS
public static final String APPINFO_ATTRIBUTE_TYPE_JAVASCRIPT
public static final String APPINFO_BUNDLE
public static final String APPINFO_DEFAULT
public static final String APPINFO_DEFAULTS
public static final String APPINFO_FORMATTER
public static final String APPINFO_FORMATTERS
public static final String APPINFO_HEAD_INCLUDE
public static final String APPINFO_HEAD_INCLUDES
public static final String APPINFO_LAYOUT
public static final String APPINFO_LAYOUTS
public static final String APPINFO_MAPPING
public static final String APPINFO_MAPPINGS
public static final String APPINFO_MODELFOLDER
public static final String APPINFO_PREVIEW
public static final String APPINFO_PROPERTYBUNDLE
public static final String APPINFO_RELATION
public static final String APPINFO_RELATIONS
public static final String APPINFO_RESOURCE
public static final String APPINFO_RESOURCEBUNDLE
public static final String APPINFO_RESOURCEBUNDLES
public static final String APPINFO_RULE
public static final String APPINFO_SCHEMA_FILE
public static final String APPINFO_SCHEMA_FILE_TYPES
public static final String APPINFO_SCHEMA_SYSTEM_ID
public static final String APPINFO_SCHEMA_TYPES_SYSTEM_ID
public static final String APPINFO_SEARCHSETTING
public static final String APPINFO_SEARCHSETTINGS
public static final String APPINFO_SETTING
public static final String APPINFO_SETTINGS
public static final String APPINFO_TAB
public static final String APPINFO_TABS
public static final String APPINFO_VALIDATIONRULE
public static final String APPINFO_VALIDATIONRULES
public static final String APPINFO_XMLBUNDLE
public static final String ATTRIBUTE_INCLUDE_TYPE_CSS
public static final String ATTRIBUTE_INCLUDE_TYPE_JAVASCRIPT
public static final String MACRO_PREVIEW_TEMPFILE
protected static final String MESSAGE_VALIDATION_DEFAULT_ERROR
protected static final String MESSAGE_VALIDATION_DEFAULT_WARNING
protected Map<String,String> m_configurationValues
protected Set<String> m_cssHeadIncludes
protected Map<String,String> m_defaultValues
protected Map<String,List<String>> m_elementMappings
protected Map<String,I_CmsWidget> m_elementWidgets
protected CmsFormatterConfiguration m_formatterConfiguration
protected List<CmsFormatterBean> m_formatters
protected Set<String> m_jsHeadIncludes
protected List<String> m_messageBundleNames
protected String m_modelFolder
protected String m_previewLocation
protected Map<String,Boolean> m_relationChecks
protected Map<String,CmsRelationType> m_relations
protected Map<String,Boolean> m_searchSettings
protected Map<String,CmsXmlContentProperty> m_settings
protected List<CmsXmlContentTab> m_tabs
protected List<String> m_titleMappings
protected Map<String,String> m_validationErrorMessages
protected Map<String,String> m_validationErrorRules
protected Map<String,String> m_validationWarningMessages
protected Map<String,String> m_validationWarningRules
Constructor Detail |
---|
public CmsDefaultXmlContentHandler()
Method Detail |
---|
public String getConfiguration(I_CmsXmlSchemaType type)
I_CmsXmlContentHandler
If no configuration value is available, this method must return null
.
getConfiguration
in interface I_CmsXmlContentHandler
type
- the value to get the widget configuration for
I_CmsXmlContentHandler.getConfiguration(org.opencms.xml.types.I_CmsXmlSchemaType)
public Set<String> getCSSHeadIncludes()
I_CmsXmlContentHandler
getCSSHeadIncludes
in interface I_CmsXmlContentHandler
I_CmsXmlContentHandler.getCSSHeadIncludes()
public Set<String> getCSSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException
I_CmsXmlContentHandler
getCSSHeadIncludes
in interface I_CmsXmlContentHandler
cms
- the current CMS contextresource
- the resource from which to get the head includes
CmsException
- if something goes wrongI_CmsXmlContentHandler.getCSSHeadIncludes(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
public String getDefault(CmsObject cms, I_CmsXmlContentValue value, Locale locale)
I_CmsXmlContentHandler
If a schema type does not have a default value, this method must return null
.
getDefault
in interface I_CmsXmlContentHandler
cms
- the current users OpenCms contextvalue
- the value to get the default forlocale
- the currently selected locale for the value
I_CmsXmlContentHandler.getDefault(org.opencms.file.CmsObject, I_CmsXmlContentValue, java.util.Locale)
public CmsFormatterConfiguration getFormatterConfiguration(CmsObject cms, CmsResource resource)
I_CmsXmlContentHandler
getFormatterConfiguration
in interface I_CmsXmlContentHandler
cms
- the current users OpenCms context, used for selecting the right projectresource
- the resource for which the formatter configuration should be retrieved
I_CmsXmlContentHandler.getFormatterConfiguration(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
public Set<String> getJSHeadIncludes()
I_CmsXmlContentHandler
getJSHeadIncludes
in interface I_CmsXmlContentHandler
I_CmsXmlContentHandler.getJSHeadIncludes()
public Set<String> getJSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException
I_CmsXmlContentHandler
getJSHeadIncludes
in interface I_CmsXmlContentHandler
cms
- the current CMS contextresource
- the resource for which the head includes should be retrieved
CmsException
- if something goes wrongI_CmsXmlContentHandler.getJSHeadIncludes(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
public List<String> getMappings(String elementName)
getMappings
in interface I_CmsXmlContentHandler
elementName
- the element xpath to look up the mapping for
public CmsMessages getMessages(Locale locale)
I_CmsXmlContentHandler
CmsMessages
that are used to resolve localized keys
for the given locale in this content handler.
If no localized messages are configured for this content handler,
this method returns null
.
getMessages
in interface I_CmsXmlContentHandler
locale
- the locale to get the messages for
CmsMessages
that are used to resolve localized keys
for the given locale in this content handlerI_CmsXmlContentHandler.getMessages(java.util.Locale)
public String getModelFolder()
I_CmsXmlContentHandler
getModelFolder
in interface I_CmsXmlContentHandler
I_CmsXmlContentHandler.getModelFolder()
public String getPreview(CmsObject cms, CmsXmlContent content, String resourcename)
I_CmsXmlContentHandler
If null
is returned, no preview is possible for contents using this handler.
getPreview
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextcontent
- the XML content to display the preview URI forresourcename
- the name in the VFS of the resource that is currently edited
I_CmsXmlContentHandler.getPreview(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent, java.lang.String)
@Deprecated public CmsRelationType getRelationType(I_CmsXmlContentValue value)
I_CmsXmlContentHandler
getRelationType
in interface I_CmsXmlContentHandler
value
- the value to get the relation type for
I_CmsXmlContentHandler.getRelationType(I_CmsXmlContentValue)
public CmsRelationType getRelationType(String xpath)
I_CmsXmlContentHandler
getRelationType
in interface I_CmsXmlContentHandler
xpath
- the path to get the relation type for
I_CmsXmlContentHandler.getRelationType(String)
public Map<String,CmsXmlContentProperty> getSettings(CmsObject cms, CmsResource resource)
I_CmsXmlContentHandler
getSettings
in interface I_CmsXmlContentHandler
cms
- the current CMS contextresource
- the resource for which to get the setting definitions
I_CmsXmlContentHandler.getSettings(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
public List<CmsXmlContentTab> getTabs()
I_CmsXmlContentHandler
getTabs
in interface I_CmsXmlContentHandler
I_CmsXmlContentHandler.getTabs()
public String getTitleMapping(CmsObject cms, CmsXmlContent document, Locale locale)
I_CmsXmlContentHandler
getTitleMapping
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextdocument
- the XML content to get the title mapping for (this must be of a type that uses this handler)locale
- the locale to get the title mapping for
I_CmsXmlContentHandler.getTitleMapping(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent, java.util.Locale)
public I_CmsWidget getWidget(I_CmsXmlContentValue value)
I_CmsXmlContentHandler
The handler implementations should use the "appinfo" node of the XML content definition schema to define the mappings of elements to widgets.
getWidget
in interface I_CmsXmlContentHandler
value
- the XML content value to get the widget for
I_CmsXmlContentHandler.getWidget(org.opencms.xml.types.I_CmsXmlContentValue)
public void initialize(Element appInfoElement, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
I_CmsXmlContentHandler
initialize
in interface I_CmsXmlContentHandler
appInfoElement
- the "appinfo" element root node to analyzecontentDefinition
- the XML content definition that XML content handler belongs to
CmsXmlException
- if something goes wrongI_CmsXmlContentHandler.initialize(org.dom4j.Element, org.opencms.xml.CmsXmlContentDefinition)
public void invalidateBrokenLinks(CmsObject cms, CmsXmlContent document)
I_CmsXmlContentHandler
The main difference to the I_CmsXmlContentHandler.resolveValidation(CmsObject, I_CmsXmlContentValue, CmsXmlContentErrorHandler)
method is that this method may silently remove some values, for instance, for broken links.
invalidateBrokenLinks
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextdocument
- the document to resolve the check rules forI_CmsXmlContentHandler.invalidateBrokenLinks(CmsObject, CmsXmlContent)
public boolean isSearchable(I_CmsXmlContentValue value)
I_CmsXmlContentHandler
true
in case the given value should be searchable with
the integrated full text search.For the full text search, the value of all elements in one locale of the XML content are combined to one big text, which is referred to as the "content" in the context of the full text search. With this option, it is possible to hide certain elements from this "content" that does not make sense to include in the full text search.
isSearchable
in interface I_CmsXmlContentHandler
value
- the XML content value to check
true
in case the given value should be searchableI_CmsXmlContentHandler.isSearchable(org.opencms.xml.types.I_CmsXmlContentValue)
public CmsXmlContent prepareForUse(CmsObject cms, CmsXmlContent content)
I_CmsXmlContentHandler
This method is always called after any content is unmarshalled. It can be used to perform customized actions on the given XML content.
prepareForUse
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextcontent
- the XML content to be used as read from the VFS
I_CmsXmlContentHandler.prepareForUse(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent)
public CmsFile prepareForWrite(CmsObject cms, CmsXmlContent content, CmsFile file) throws CmsException
I_CmsXmlContentHandler
This method is always called before any content gets written. It can be used to perform XML validation, pretty - printing or customized actions on the given XML content.
prepareForWrite
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextcontent
- the XML content to be writtenfile
- the resource the XML content in it's current state was unmarshalled from
CmsException
- in case something goes wrongI_CmsXmlContentHandler.prepareForWrite(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent, org.opencms.file.CmsFile)
public void resolveMapping(CmsObject cms, CmsXmlContent content, I_CmsXmlContentValue value) throws CmsException
I_CmsXmlContentHandler
resolveMapping
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextcontent
- the XML content to resolve the mappings forvalue
- the value to resolve the mappings for
CmsException
- if something goes wrongI_CmsXmlContentHandler.resolveMapping(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent, org.opencms.xml.types.I_CmsXmlContentValue)
public CmsXmlContentErrorHandler resolveValidation(CmsObject cms, I_CmsXmlContentValue value, CmsXmlContentErrorHandler errorHandler)
I_CmsXmlContentHandler
The errorHandler parameter is optional, if null
is given a new error handler
instance must be created.
resolveValidation
in interface I_CmsXmlContentHandler
cms
- the current OpenCms user contextvalue
- the value to resolve the validation rules forerrorHandler
- (optional) an error handler instance that contains previous error or warnings
I_CmsXmlContentHandler.resolveValidation(org.opencms.file.CmsObject, org.opencms.xml.types.I_CmsXmlContentValue, org.opencms.xml.content.CmsXmlContentErrorHandler)
protected void addCheckRule(CmsXmlContentDefinition contentDefinition, String elementName, String invalidate, String type) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to add the rule toinvalidate
- false
, to disable link check /
true
or node
, to invalidate just the single node if the link is broken /
parent
, if this rule will invalidate the whole parent node in nested contenttype
- the relation type
CmsXmlException
- in case an unknown element name is usedprotected void addConfiguration(CmsXmlContentDefinition contentDefinition, String elementName, String configurationValue) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to mapconfigurationValue
- the configuration value to use
CmsXmlException
- in case an unknown element name is usedprotected void addDefault(CmsXmlContentDefinition contentDefinition, String elementName, String defaultValue) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to mapdefaultValue
- the default value to use
CmsXmlException
- in case an unknown element name is usedprotected void addDefaultCheckRules(CmsXmlContentDefinition rootContentDefinition, I_CmsXmlSchemaType schemaType, String elementPath) throws CmsXmlException
rootContentDefinition
- the root content definitionschemaType
- the schema type to checkelementPath
- the current element path
CmsXmlException
- if something goes wrongprotected void addMapping(CmsXmlContentDefinition contentDefinition, String elementName, String mapping) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to mapmapping
- the mapping to use
CmsXmlException
- in case an unknown element name is usedprotected void addSearchSetting(CmsXmlContentDefinition contentDefinition, String elementName, Boolean value) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to mapvalue
- the search setting value to store
CmsXmlException
- in case an unknown element name is usedprotected void addValidationRule(CmsXmlContentDefinition contentDefinition, String elementName, String regex, String message, boolean isWarning) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to add the rule toregex
- the validation rule regular expressionmessage
- the message in case validation fails (may be null)isWarning
- if true, this rule is used for warnings, otherwise it's an error
CmsXmlException
- in case an unknown element name is usedprotected void addWidget(CmsXmlContentDefinition contentDefinition, String elementName, String widgetClassOrAlias) throws CmsXmlException
contentDefinition
- the XML content definition this XML content handler belongs toelementName
- the element name to mapwidgetClassOrAlias
- the widget to use as GUI for the element (registered alias or class name)
CmsXmlException
- in case an unknown element name is usedprotected Locale getLocaleForResource(CmsObject cms, String resource)
cms
- the cms contextresource
- the resource path to get the default locale for
protected String getReferencePath(CmsObject cms, I_CmsXmlContentValue value)
cms
- the cms contextvalue
- the xml content value
protected String getValidationMessage(CmsObject cms, I_CmsXmlContentValue value, String regex, String valueStr, boolean matchResult, boolean isWarning)
cms
- the current users OpenCms contextvalue
- the value to validateregex
- the rule that was violatedvalueStr
- the string value of the given valuematchResult
- if false, the rule was negatedisWarning
- if true, this validation indicate a warning, otherwise an error
protected void init()
protected void initDefaultValues(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
Using the default values from the appinfo node, it's possible to have more sophisticated logic for generating the defaults then just using the XML schema "default" attribute.
root
- the "defaults" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the default values belong to
CmsXmlException
- if something goes wrongprotected void initFormatters(Element root, CmsXmlContentDefinition contentDefinition)
root
- the "formatters" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the formatters belong toprotected void initHeadIncludes(Element root, CmsXmlContentDefinition contentDefinition)
root
- the "headincludes" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the head-includes belong toprotected void initLayouts(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
Unless otherwise instructed, the editor uses one specific GUI widget for each
XML value schema type. For example, for a CmsXmlStringValue
the default widget is the CmsInputWidget
.
However, certain values can also use more then one widget, for example you may
also use a CmsCheckboxWidget
for a String value,
and as a result the Strings possible values would be eithe "false"
or "true"
,
but nevertheless be a String.
The widget to use can further be controlled using the widget
attribute.
You can specify either a valid widget alias such as StringWidget
,
or the name of a Java class that implements
.I_CmsWidget
Configuration options to the widget can be passed using the configuration
attribute. You can specify any String as configuration. This String is then passed
to the widget during initialization. It's up to the individual widget implementation
to interpret this configuration String.
root
- the "layouts" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the layout belongs to
CmsXmlException
- if something goes wrongprotected void initMappings(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
Element mappings allow storing values from the XML content in other locations. For example, if you have an element called "Title", it's likely a good idea to store the value of this element also in the "Title" property of a XML content resource.
root
- the "mappings" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the mappings belong to
CmsXmlException
- if something goes wrongprotected void initModelFolder(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
root
- the "modelfolder" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the model folder belongs to
CmsXmlException
- if something goes wrongprotected void initPreview(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
root
- the "preview" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the validation rules belong to
CmsXmlException
- if something goes wrongprotected void initRelations(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
OpenCms performs link checks for all OPTIONAL links defined in XML content values of type OpenCmsVfsFile. However, for most projects in the real world a more fine-grained control over the link check process is required. For these cases, individual relation behavior can be defined for the appinfo node.
Additional here can be defined an optional type for the relations, for instance.
root
- the "relations" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the check rules belong to
CmsXmlException
- if something goes wrongprotected void initResourceBundle(Element root, CmsXmlContentDefinition contentDefinition, boolean single) throws CmsXmlException
root
- the "resourcebundle" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the validation rules belong tosingle
- if true
we process the classic sinle line entry, otherwise it's the multiple line setting
CmsXmlException
- if something goes wrongprotected void initSearchSettings(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
For the full text search, the value of all elements in one locale of the XML content are combined to one big text, which is referred to as the "content" in the context of the full text search. With this option, it is possible to hide certain elements from this "content" that does not make sense to include in the full text search.
root
- the "searchsettings" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the default values belong to
CmsXmlException
- if something goes wrongprotected void initSettings(Element root, CmsXmlContentDefinition contentDefinition)
root
- the "settings" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the element settings belong toprotected void initTabs(Element root, CmsXmlContentDefinition contentDefinition)
root
- the "tabs" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the tabs belong toprotected void initValidationRules(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException
OpenCms always performs XML schema validation for all XML contents. However, for most projects in the real world a more fine-grained control over the validation process is required. For these cases, individual validation rules can be defined for the appinfo node.
root
- the "validationrules" element from the appinfo node of the XML content definitioncontentDefinition
- the content definition the validation rules belong to
CmsXmlException
- if something goes wrongprotected boolean isInvalidateParent(String xpath)
xpath
- the path to get the check rule for
protected String key(String keyName, Locale locale)
If the key was not found in the configured bundle, or no bundle is configured for this
content handler, the return value is
"??? " + keyName + " ???"
.
keyName
- the key for the desired stringlocale
- the locale to get the key from
CmsMessages.formatUnknownKey(String)
,
CmsMessages.isUnknownKey(String)
protected void removeEmptyMappings(CmsObject cms, CmsXmlContent content) throws CmsException
cms
- the current users OpenCms contextcontent
- the XML content to remove the property values for
CmsException
- in case of read/write errors accessing the OpenCms VFSprotected void validateAppinfoElement(Element appinfoElement) throws CmsXmlException
appinfo
element node from the XML content definition schema
is valid according the the capabilities of this content handler.
appinfoElement
- the appinfo
element node to validate
CmsXmlException
- in case the element validation failsprotected CmsXmlContentErrorHandler validateCategories(CmsObject cms, I_CmsXmlContentValue value, CmsXmlContentErrorHandler errorHandler)
null
is given a new error handler
instance must be created.
cms
- the current OpenCms user contextvalue
- the value to resolve the validation rules forerrorHandler
- (optional) an error handler instance that contains previous error or warnings
protected boolean validateLink(CmsObject cms, I_CmsXmlContentValue value, CmsXmlContentErrorHandler errorHandler)
cms
- the current users OpenCms contextvalue
- the value to validateerrorHandler
- the error handler to use in case errors or warnings are detected
protected CmsXmlContentErrorHandler validateValue(CmsObject cms, I_CmsXmlContentValue value, CmsXmlContentErrorHandler errorHandler, Map<String,String> rules, boolean isWarning)
cms
- the current users OpenCms contextvalue
- the value to validateerrorHandler
- the error handler to use in case errors or warnings are detectedrules
- the rules to validate the value againstisWarning
- if true, this validation should be stored as a warning, otherwise as an error
protected CmsXmlContentErrorHandler validateValue(CmsObject cms, I_CmsXmlContentValue value, String valueStr, CmsXmlContentErrorHandler errorHandler, boolean isWarning)
These rules should only be tested if this is not a test for warnings.
cms
- the current users OpenCms contextvalue
- the value to validatevalueStr
- the string value of the given valueerrorHandler
- the error handler to use in case errors or warnings are detectedisWarning
- if true, this validation should be stored as a warning, otherwise as an error
protected CmsFile writeCategories(CmsObject cms, CmsFile file, CmsXmlContent content) throws CmsException
cms
- the cms contextfile
- the filecontent
- the xml content to set the categories for
CmsException
- if something goes wrong
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |