Class CmsXmlCategoryValue
- java.lang.Object
-
- org.opencms.xml.types.A_CmsXmlContentValue
-
- org.opencms.xml.types.CmsXmlCategoryValue
-
- All Implemented Interfaces:
java.lang.Comparable<I_CmsXmlSchemaType>
,I_CmsWidgetParameter
,I_CmsXmlContentValue
,I_CmsXmlSchemaType
public class CmsXmlCategoryValue extends A_CmsXmlContentValue
Describes the XML content type "OpenCmsVfsFile".This type allows links to internal VFS resources only.
- Since:
- 7.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opencms.xml.types.I_CmsXmlContentValue
I_CmsXmlContentValue.SearchContentType
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NO_LINK
Value to mark that no link is defined, "none".static java.lang.String
TYPE_NAME
The name of this type as used in the XML schema.static java.lang.String
TYPE_VFS_LINK
The vfs link type constant.-
Fields inherited from class org.opencms.xml.types.A_CmsXmlContentValue
m_defaultValue, m_document, m_element, m_locale, m_maxOccurs, m_minOccurs, m_name
-
Fields inherited from interface org.opencms.xml.types.I_CmsXmlSchemaType
XSI_NAMESPACE, XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION
-
-
Constructor Summary
Constructors Constructor Description CmsXmlCategoryValue()
Creates a new, empty schema type descriptor of type "OpenCmsCategoryValue".CmsXmlCategoryValue(java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
Creates a new schema type descriptor for the type "OpenCmsCategoryValue".CmsXmlCategoryValue(I_CmsXmlDocument document, org.dom4j.Element element, java.util.Locale locale, I_CmsXmlSchemaType type)
Creates a new XML content value of type "OpenCmsCategoryValue".
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description I_CmsXmlContentValue
createValue(I_CmsXmlDocument document, org.dom4j.Element element, java.util.Locale locale)
Creates a XML content value object for this type.static void
fillEntry(org.dom4j.Element element, CmsUUID id, java.lang.String rootPath, CmsRelationType type)
Fills the given element with aCmsXmlCategoryValue
for the given data.org.dom4j.Element
generateXml(CmsObject cms, I_CmsXmlDocument document, org.dom4j.Element root, java.util.Locale locale)
Appends an XML for a new, empty node of this schema type to the given root element.java.util.List<CmsLink>
getLinks(CmsObject cms)
Returns the link objects represented by this XML content value.java.lang.String
getPlainText(CmsObject cms)
Returns the value of this XML content node as a plain text String.java.lang.String
getSchemaDefinition()
Returns a String representation of the XML definition for this schema type.java.lang.String
getStringValue(CmsObject cms)
Returns the value of this XML content node as a String.java.lang.String
getTypeName()
Returns the schema type name.boolean
isSearchable()
The default implementation always returnstrue
.I_CmsXmlSchemaType
newInstance(java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
Creates a new instance of this XML schema type initialized with the given values.void
setIdValue(CmsObject cms, CmsUUID id)
Sets the value as a structure id.void
setStringValue(CmsObject cms, java.lang.String value)
Sets the provided String as value of this XML content node.-
Methods inherited from class org.opencms.xml.types.A_CmsXmlContentValue
appendXmlSchema, compareTo, equals, getChoiceMaxOccurs, getContentDefinition, getDefault, getDefault, getDocument, getElement, getId, getIndex, getKey, getLocale, getMaxIndex, getMaxOccurs, getMinOccurs, getName, getPath, getRelationType, getXmlIndex, hasError, hashCode, isChoiceOption, isChoiceType, isSimpleType, moveDown, moveUp, moveValue, readSchemaDefinition, setContentDefinition, setDefault, setKeyPrefix, toString, validateValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opencms.xml.types.I_CmsXmlContentValue
getSearchContentType
-
-
-
-
Field Detail
-
NO_LINK
public static final java.lang.String NO_LINK
Value to mark that no link is defined, "none".- See Also:
- Constant Field Values
-
TYPE_NAME
public static final java.lang.String TYPE_NAME
The name of this type as used in the XML schema.- See Also:
- Constant Field Values
-
TYPE_VFS_LINK
public static final java.lang.String TYPE_VFS_LINK
The vfs link type constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsXmlCategoryValue
public CmsXmlCategoryValue()
Creates a new, empty schema type descriptor of type "OpenCmsCategoryValue".
-
CmsXmlCategoryValue
public CmsXmlCategoryValue(I_CmsXmlDocument document, org.dom4j.Element element, java.util.Locale locale, I_CmsXmlSchemaType type)
Creates a new XML content value of type "OpenCmsCategoryValue".- Parameters:
document
- the XML content instance this value belongs toelement
- the XML element that contains this valuelocale
- the locale this value is created fortype
- the type instance to create the value for
-
CmsXmlCategoryValue
public CmsXmlCategoryValue(java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
Creates a new schema type descriptor for the type "OpenCmsCategoryValue".- Parameters:
name
- the name of the XML node containing the value according to the XML schemaminOccurs
- minimum number of occurrences of this type according to the XML schemamaxOccurs
- maximum number of occurrences of this type according to the XML schema
-
-
Method Detail
-
fillEntry
public static void fillEntry(org.dom4j.Element element, CmsUUID id, java.lang.String rootPath, CmsRelationType type)
Fills the given element with aCmsXmlCategoryValue
for the given data.- Parameters:
element
- the element to fillid
- the id to userootPath
- the path to usetype
- the relation type to use
-
createValue
public I_CmsXmlContentValue createValue(I_CmsXmlDocument document, org.dom4j.Element element, java.util.Locale locale)
Description copied from interface:I_CmsXmlSchemaType
Creates a XML content value object for this type.- Parameters:
document
- the XML content instance this value belongs toelement
- the XML element to create the value fromlocale
- the locale to create the value for- Returns:
- the created XML content value object
- See Also:
I_CmsXmlSchemaType.createValue(I_CmsXmlDocument, org.dom4j.Element, Locale)
-
generateXml
public org.dom4j.Element generateXml(CmsObject cms, I_CmsXmlDocument document, org.dom4j.Element root, java.util.Locale locale)
Description copied from interface:I_CmsXmlSchemaType
Appends an XML for a new, empty node of this schema type to the given root element.This is used to dynamically build a vaild XML content object from an initialized
CmsXmlContentDefinition
class.Important: This method can only be used during initialization of a XML content object, not to add values to an already initialized XML content. To add values after initialization, use
CmsXmlContent.addValue(CmsObject, String, Locale, int)
.- Specified by:
generateXml
in interfaceI_CmsXmlSchemaType
- Overrides:
generateXml
in classA_CmsXmlContentValue
- Parameters:
cms
- the current users OpenCms contextdocument
- the document the XML is generated forroot
- the element to append the XML tolocale
- the locale to generate the element default content for- Returns:
- the generated XML element
- See Also:
I_CmsXmlSchemaType.generateXml(org.opencms.file.CmsObject, org.opencms.xml.I_CmsXmlDocument, org.dom4j.Element, java.util.Locale)
-
getLinks
public java.util.List<CmsLink> getLinks(CmsObject cms)
Returns the link objects represented by this XML content value.- Parameters:
cms
- the cms context, can benull
but in this case no link check is performed- Returns:
- a list of link objects represented by this XML content value
-
getPlainText
public java.lang.String getPlainText(CmsObject cms)
Description copied from interface:I_CmsXmlContentValue
Returns the value of this XML content node as a plain text String.Plain text in this context means a pure textual representation of the content (i.e. without html tags). The plain text may be
null
, too, if there is no sound or useful textual representation (i.e. color values).- Specified by:
getPlainText
in interfaceI_CmsXmlContentValue
- Overrides:
getPlainText
in classA_CmsXmlContentValue
- Parameters:
cms
- an initialized instance of a CmsObject- Returns:
- the value of this XML content node as a plain text String
- See Also:
I_CmsXmlContentValue.getPlainText(org.opencms.file.CmsObject)
-
getSchemaDefinition
public java.lang.String getSchemaDefinition()
Description copied from interface:I_CmsXmlSchemaType
Returns a String representation of the XML definition for this schema type.- Returns:
- a String representation of the XML definition for this schema type
- See Also:
I_CmsXmlSchemaType.getSchemaDefinition()
-
getStringValue
public java.lang.String getStringValue(CmsObject cms) throws CmsRuntimeException
Description copied from interface:I_CmsXmlContentValue
Returns the value of this XML content node as a String.- Parameters:
cms
- an initialized instance of a CmsObject- Returns:
- the value of this XML content node as a String
- Throws:
CmsRuntimeException
- See Also:
I_CmsXmlContentValue.getStringValue(CmsObject)
-
getTypeName
public java.lang.String getTypeName()
Description copied from interface:I_CmsXmlSchemaType
Returns the schema type name.By convention, a XML schema type name has the form
"OpenCms + ${name}"
. Examples are"OpenCmsString"
or"OpenCmsBoolean"
.The schema type name is fixed by the implementation.
- Returns:
- the schema type name
- See Also:
I_CmsXmlSchemaType.getTypeName()
-
isSearchable
public boolean isSearchable()
Description copied from class:A_CmsXmlContentValue
The default implementation always returnstrue
.- Specified by:
isSearchable
in interfaceI_CmsXmlContentValue
- Overrides:
isSearchable
in classA_CmsXmlContentValue
- Returns:
true
in case this value is searchable by default- See Also:
A_CmsXmlContentValue.isSearchable()
-
newInstance
public I_CmsXmlSchemaType newInstance(java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
Description copied from interface:I_CmsXmlSchemaType
Creates a new instance of this XML schema type initialized with the given values.- Parameters:
name
- the name to use in the xml documentminOccurs
- minimum number of occurrencesmaxOccurs
- maximum number of occurrences- Returns:
- a new instance of this XML content type initialized with the given values
- See Also:
I_CmsXmlSchemaType.newInstance(java.lang.String, java.lang.String, java.lang.String)
-
setIdValue
public void setIdValue(CmsObject cms, CmsUUID id)
Sets the value as a structure id.- Parameters:
cms
- the current CMS contextid
- the structure id which should be stored in the category value
-
setStringValue
public void setStringValue(CmsObject cms, java.lang.String value) throws CmsIllegalArgumentException
Description copied from interface:I_CmsXmlContentValue
Sets the provided String as value of this XML content node.This method does provide processing of the content based on the users current OpenCms context. This can be used e.g. for link extraction and replacement in the content.
- Parameters:
cms
- an initialized instance of a CmsObjectvalue
- the value to set- Throws:
CmsIllegalArgumentException
- See Also:
I_CmsXmlContentValue.setStringValue(org.opencms.file.CmsObject, java.lang.String)
-
-