Class CmsXmlVfsFileValue
- All Implemented Interfaces:
Comparable<I_CmsXmlSchemaType>,I_CmsWidgetParameter,I_CmsXmlContentValue,I_CmsXmlSchemaType,I_CmsJsonFormattableValue
- Direct Known Subclasses:
CmsXmlVfsImageValue
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.CmsSearchContentConfig, I_CmsXmlContentValue.SearchContentType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue to mark that no link is defined, "none".static final StringThe name of this type as used in the XML schema.static final StringThe 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_nameFields inherited from interface org.opencms.xml.types.I_CmsXmlSchemaType
XSI_NAMESPACE, XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, empty schema type descriptor of type "OpenCmsVfsFile".CmsXmlVfsFileValue(String name, String minOccurs, String maxOccurs) Creates a new schema type descriptor for the type "OpenCmsVfsFile".CmsXmlVfsFileValue(I_CmsXmlDocument document, org.dom4j.Element element, Locale locale, I_CmsXmlSchemaType type) Creates a new XML content value of type "OpenCmsVfsFile". -
Method Summary
Modifier and TypeMethodDescriptioncreateValue(I_CmsXmlDocument document, org.dom4j.Element element, Locale locale) Creates a XML content value object for this type.static voidfillEntry(org.dom4j.Element element, CmsUUID id, String rootPath, CmsRelationType type) Fills the given element with aCmsXmlVfsFileValuefor the given data.org.dom4j.ElementgenerateXml(CmsObject cms, I_CmsXmlDocument document, org.dom4j.Element root, Locale locale) Appends an XML for a new, empty node of this schema type to the given root element.Returns the link object represented by this XML content value.getPlainText(CmsObject cms) Returns the value of this XML content node as a plain text String.Returns a String representation of the XML definition for this schema type.getStringValue(CmsObject cms) Returns the value of this XML content node as a String.Returns the schema type name.Returns the raw data from the XML value as a CmsLink, without any consistency checks.booleanThe default implementation always returnstrue.newInstance(String name, String minOccurs, String maxOccurs) Creates a new instance of this XML schema type initialized with the given values.voidsetIdValue(CmsObject cms, CmsUUID id) Sets the value as a structure id.voidsetStringValue(CmsObject cms, String value) Sets the provided String as value of this XML content node.Gets the JSON representation of the value.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, validateValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opencms.xml.types.I_CmsXmlContentValue
getSearchContentConfig
-
Field Details
-
NO_LINK
Value to mark that no link is defined, "none".- See Also:
-
TYPE_NAME
The name of this type as used in the XML schema.- See Also:
-
TYPE_VFS_LINK
The vfs link type constant.- See Also:
-
-
Constructor Details
-
CmsXmlVfsFileValue
public CmsXmlVfsFileValue()Creates a new, empty schema type descriptor of type "OpenCmsVfsFile". -
CmsXmlVfsFileValue
public CmsXmlVfsFileValue(I_CmsXmlDocument document, org.dom4j.Element element, Locale locale, I_CmsXmlSchemaType type) Creates a new XML content value of type "OpenCmsVfsFile".- 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
-
CmsXmlVfsFileValue
Creates a new schema type descriptor for the type "OpenCmsVfsFile".- 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 Details
-
fillEntry
public static void fillEntry(org.dom4j.Element element, CmsUUID id, String rootPath, CmsRelationType type) Fills the given element with aCmsXmlVfsFileValuefor 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, Locale locale) Description copied from interface:I_CmsXmlSchemaTypeCreates a XML content value object for this type.- Specified by:
createValuein interfaceI_CmsXmlSchemaType- 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:
-
generateXml
public org.dom4j.Element generateXml(CmsObject cms, I_CmsXmlDocument document, org.dom4j.Element root, Locale locale) Description copied from interface:I_CmsXmlSchemaTypeAppends 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
CmsXmlContentDefinitionclass.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:
generateXmlin interfaceI_CmsXmlSchemaType- Overrides:
generateXmlin 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:
-
getLink
Returns the link object represented by this XML content value.- Parameters:
cms- the cms context, can benullbut in this case no link check is performed- Returns:
- the link object represented by this XML content value (will return null for an empty link)
-
getPlainText
Description copied from interface:I_CmsXmlContentValueReturns 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:
getPlainTextin interfaceI_CmsXmlContentValue- Overrides:
getPlainTextin 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:
-
getSchemaDefinition
Description copied from interface:I_CmsXmlSchemaTypeReturns a String representation of the XML definition for this schema type.- Specified by:
getSchemaDefinitionin interfaceI_CmsXmlSchemaType- Returns:
- a String representation of the XML definition for this schema type
- See Also:
-
getStringValue
Description copied from interface:I_CmsXmlContentValueReturns the value of this XML content node as a String.- Specified by:
getStringValuein interfaceI_CmsWidgetParameter- Specified by:
getStringValuein interfaceI_CmsXmlContentValue- Parameters:
cms- an initialized instance of a CmsObject- Returns:
- the value of this XML content node as a String
- Throws:
CmsRuntimeException- See Also:
-
getTypeName
Description copied from interface:I_CmsXmlSchemaTypeReturns 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.
- Specified by:
getTypeNamein interfaceI_CmsXmlSchemaType- Returns:
- the schema type name
- See Also:
-
getUncheckedLink
Returns the raw data from the XML value as a CmsLink, without any consistency checks.- Returns:
- the unchecked data from the XML as a CmsLink
-
isSearchable
Description copied from class:A_CmsXmlContentValueThe default implementation always returnstrue.- Specified by:
isSearchablein interfaceI_CmsXmlContentValue- Overrides:
isSearchablein classA_CmsXmlContentValue- Returns:
truein case this value is searchable by default- See Also:
-
newInstance
Description copied from interface:I_CmsXmlSchemaTypeCreates a new instance of this XML schema type initialized with the given values.- Specified by:
newInstancein interfaceI_CmsXmlSchemaType- 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:
-
setIdValue
Sets the value as a structure id.- Parameters:
cms- the current CMS contextid- the structure id which should be stored in the file value
-
setStringValue
Description copied from interface:I_CmsXmlContentValueSets 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.
- Specified by:
setStringValuein interfaceI_CmsWidgetParameter- Specified by:
setStringValuein interfaceI_CmsXmlContentValue- Parameters:
cms- an initialized instance of a CmsObjectvalue- the value to set- Throws:
CmsIllegalArgumentException- See Also:
-
toJson
Description copied from interface:I_CmsJsonFormattableValueGets the JSON representation of the value.- Specified by:
toJsonin interfaceI_CmsJsonFormattableValue- Parameters:
cms- the CMS context- Returns:
- the JSON representation of the value
- See Also:
-