org.opencms.xml.content
Class CmsXmlContentValueSequence

java.lang.Object
  extended by org.opencms.xml.content.CmsXmlContentValueSequence

public class CmsXmlContentValueSequence
extends java.lang.Object

Describes the sequence of XML content values of a specific type in an XML content instance.

Since:
6.0.0
Version:
$Revision: 1.19 $
Author:
Alexander Kandzior

Constructor Summary
CmsXmlContentValueSequence(java.lang.String path, I_CmsXmlSchemaType schemaType, java.util.Locale locale, CmsXmlContent content)
          Generates a new content sequence element from the given type, content and content definition.
 
Method Summary
 I_CmsXmlContentValue addValue(CmsObject cms, int index)
          Adds a value element of the sequence type at the selected index to the XML content document.
 int getElementCount()
          Returns the count of XML content values for the selected schema type and locale in the XML content.
 java.lang.String getElementName()
          Returns the XML element node name of this sequence element in the current schema.
 java.util.Locale getLocale()
          Returns the locale this sequence is based on.
 int getMaxOccurs()
          Returns the maximum occurrences of this type in the XML content schema.
 int getMinOccurs()
          Returns the minimum occurrences of this type in the XML content schema.
 java.lang.String getPath()
          Returns the (simplified) Xpath expression that identifies the root node of this content value sequence.
 I_CmsXmlContentValue getValue(int index)
          Returns the XML content values from the index position of this sequence.
 java.util.List<I_CmsXmlContentValue> getValues()
          Returns the list of XML content values for the selected schema type and locale in the XML content.
 I_CmsXmlSchemaType getXmlSchemaType()
          Return the XML schema type of this sequence element.
 boolean isExtendable()
          Returns true if more elements of this type can be added to the XML content.
 boolean isReducable()
          Returns true if elements of this type can be removed from the XML content.
 boolean isSimpleType()
          Returns true if this is a simple type, or false if this type is a nested schema.
 void removeValue(int index)
          Removes the value element of the sequence type at the selected index from XML content document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsXmlContentValueSequence

public CmsXmlContentValueSequence(java.lang.String path,
                                  I_CmsXmlSchemaType schemaType,
                                  java.util.Locale locale,
                                  CmsXmlContent content)
Generates a new content sequence element from the given type, content and content definition.

Parameters:
path - the path in the document to generate the value sequence for
schemaType - the schema type to generate the sequence element for
locale - the locale to get the content values from
content - the XML content to generate the sequence element out of
Method Detail

addValue

public I_CmsXmlContentValue addValue(CmsObject cms,
                                     int index)
Adds a value element of the sequence type at the selected index to the XML content document.

Parameters:
cms - the current users OpenCms context
index - the index where to add the new value element
Returns:
the added XML content value element
See Also:
CmsXmlContent.addValue(CmsObject, String, Locale, int)

getElementCount

public int getElementCount()
Returns the count of XML content values for the selected schema type and locale in the XML content.

Returns:
the count of XML content values for the selected schema type and locale in the XML content

getElementName

public java.lang.String getElementName()
Returns the XML element node name of this sequence element in the current schema.

The XML element node name can be configured in the schema. For example, the node name could be "Title", "Teaser" or "Text". The XML schema controls what node names are allowed.

Returns:
the XML node name of this sequence element in the current schema
See Also:
I_CmsXmlSchemaType.getName()

getLocale

public java.util.Locale getLocale()
Returns the locale this sequence is based on.

Returns:
the locale this sequence is based on

getMaxOccurs

public int getMaxOccurs()
Returns the maximum occurrences of this type in the XML content schema.

Returns:
the maximum occurrences of this type in the XML content schema
See Also:
I_CmsXmlSchemaType.getMaxOccurs()

getMinOccurs

public int getMinOccurs()
Returns the minimum occurrences of this type in the XML content schema.

Returns:
the minimum occurrences of this type in the XML content schema
See Also:
I_CmsXmlSchemaType.getMinOccurs()

getPath

public java.lang.String getPath()
Returns the (simplified) Xpath expression that identifies the root node of this content value sequence.

Returns:
the (simplified) Xpath expression that identifies the root node of this content value sequence

getValue

public I_CmsXmlContentValue getValue(int index)
Returns the XML content values from the index position of this sequence.

Parameters:
index - the index position to get the value from
Returns:
the XML content values from the index position of this sequence

getValues

public java.util.List<I_CmsXmlContentValue> getValues()
Returns the list of XML content values for the selected schema type and locale in the XML content.

Returns:
the list of XML content values for the selected schema type and locale in the XML content
See Also:
getValue(int)

getXmlSchemaType

public I_CmsXmlSchemaType getXmlSchemaType()
Return the XML schema type of this sequence element.

Returns:
the XML schema type of this sequence element

isExtendable

public boolean isExtendable()
Returns true if more elements of this type can be added to the XML content.

Returns:
true if more elements of this type can be added to the XML content

isReducable

public boolean isReducable()
Returns true if elements of this type can be removed from the XML content.

Returns:
true if elements of this type can be removed from the XML content

isSimpleType

public boolean isSimpleType()
Returns true if this is a simple type, or false if this type is a nested schema.

If a value is a nested schema, it must be an instance of CmsXmlNestedContentDefinition.

Returns:
true if this is a simple type, or false if this type is a nested schema
See Also:
CmsXmlNestedContentDefinition

removeValue

public void removeValue(int index)
Removes the value element of the sequence type at the selected index from XML content document.

Parameters:
index - the index where to remove the value element
See Also:
CmsXmlContent.removeValue(String, Locale, int)