/** * Returns the value sequence for the selected element xpath in this XML content.<p> * * If the given element xpath is not valid according to the schema of this XML content, * <code>null</code> is returned.<p> * * @param xpath the element xpath to get the value sequence for * @param locale the locale to get the value sequence for * * @return the value sequence for the selected element name in this XML content */ public CmsXmlContentValueSequence getValueSequence(String xpath, Locale locale) { I_CmsXmlSchemaType type = m_contentDefinition.getSchemaType(xpath); if (type == null) { return null; } return new CmsXmlContentValueSequence(xpath, locale, this); }
/** * Adds a value element of the type the original xpath indicates * at the selected index to the XML content document.<p> * * The "original xpath" is the path used in the constructor when creating * this value sequence.<p> * * @param cms the current users OpenCms context * @param index the index where to add the new value element * * @return the added XML content value element * * @see CmsXmlContent#addValue(CmsObject, String, Locale, int) * @see #addValue(CmsObject, String, int) * @see #addValue(CmsObject, I_CmsXmlSchemaType, int) */ public I_CmsXmlContentValue addValue(CmsObject cms, int index) { return addValue(cms, getPath(), index); }
/** * Returns <code>true</code> if more elements of this type can be added to the XML content.<p> * * @return <code>true</code> if more elements of this type can be added to the XML content */ public boolean isExtendable() { return getElementCount() < getMaxOccurs(); }
/** * Returns <code>true</code> if elements of this type can be removed from the XML content.<p> * * @return <code>true</code> if elements of this type can be removed from the XML content */ public boolean isReducable() { return getElementCount() > getMinOccurs(); }
pathPrefix + type.getName(), getElementLocale()); int elementCount = elementSequence.getElementCount(); boolean addValue = elementCount < elementSequence.getMaxOccurs(); boolean removeValue = elementCount > elementSequence.getMinOccurs(); elementSequence.addValue(getCms(), 0); disabledElement = true; m_optionalElementPresent = true; I_CmsXmlContentValue value = elementSequence.getValue(j); elementSequence.removeValue(0);
/** Returns the configured sort options, or the empty list if no such options are configured. * @return The configured sort options, or the empty list if no such options are configured. */ private List<I_CmsSearchConfigurationSortOption> getSortOptions() { final List<I_CmsSearchConfigurationSortOption> options = new ArrayList<I_CmsSearchConfigurationSortOption>(); final CmsXmlContentValueSequence sortOptions = m_xml.getValueSequence(XML_ELEMENT_SORTOPTIONS, m_locale); if (sortOptions == null) { return null; } else { for (int i = 0; i < sortOptions.getElementCount(); i++) { final I_CmsSearchConfigurationSortOption option = parseSortOption( sortOptions.getValue(i).getPath() + "/"); if (option != null) { options.add(option); } } return options; } }
/** * Removes the value element of the sequence type at the selected index from XML content document.<p> * * @param index the index where to remove the value element * * @see CmsXmlContent#removeValue(String, Locale, int) */ public void removeValue(int index) { m_content.removeValue(getPath(), getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); } }
int elementCount = elementSequence.getElementCount(); elementSequence.addValue(getCms(), 0); disabledElement = true; m_optionalElementPresent = true; I_CmsXmlContentValue value = elementSequence.getValue(j); I_CmsWidget widget = null; if (type.isSimpleType()) {
/** * Initialize the key set for an xml bundle. */ private void initKeySetForXmlBundle() { // consider only available locales for (Locale l : m_locales) { if (m_xmlBundle.hasLocale(l)) { Set<Object> keys = new HashSet<Object>(); for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) { String msgpath = msg.getPath(); keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l)); } m_keyset.updateKeySet(null, keys); } } }
/** * @see org.opencms.jsp.search.config.parser.I_CmsSearchConfigurationParser#parseFieldFacets() */ @Override public Map<String, I_CmsSearchConfigurationFacetField> parseFieldFacets() { final Map<String, I_CmsSearchConfigurationFacetField> facetConfigs = new LinkedHashMap<String, I_CmsSearchConfigurationFacetField>(); final CmsXmlContentValueSequence fieldFacets = m_xml.getValueSequence(XML_ELEMENT_FIELD_FACETS, m_locale); if (fieldFacets != null) { for (int i = 0; i < fieldFacets.getElementCount(); i++) { final I_CmsSearchConfigurationFacetField config = parseFieldFacet( fieldFacets.getValue(i).getPath() + "/"); if (config != null) { facetConfigs.put(config.getName(), config); } } } return facetConfigs; }
/** * Removes the value element of the sequence type at the selected index from XML content document.<p> * * @param index the index where to remove the value element * * @see CmsXmlContent#removeValue(String, Locale, int) */ public void removeValue(int index) { m_content.removeValue(getPath(), getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); } }
/** * Loads the localization for the current locale from a bundle of type xmlvfsbundle. * It assumes, the content has already been unmarshalled before. * @param locale the locale for which the localization should be loaded */ private void loadLocalizationFromXmlBundle(Locale locale) { CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale); SortedProperties props = new SortedProperties(); if (null != messages) { for (I_CmsXmlContentValue msg : messages.getValues()) { String msgpath = msg.getPath(); props.put( m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale), m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale)); } } m_localizations.put(locale, props); }
/** * @see org.opencms.jsp.search.config.parser.I_CmsSearchConfigurationParser#parseRangeFacets() */ public Map<String, I_CmsSearchConfigurationFacetRange> parseRangeFacets() { final Map<String, I_CmsSearchConfigurationFacetRange> facetConfigs = new LinkedHashMap<String, I_CmsSearchConfigurationFacetRange>(); final CmsXmlContentValueSequence rangeFacets = m_xml.getValueSequence(XML_ELEMENT_RANGE_FACETS, m_locale); if (rangeFacets != null) { for (int i = 0; i < rangeFacets.getElementCount(); i++) { final I_CmsSearchConfigurationFacetRange config = parseRangeFacet( rangeFacets.getValue(i).getPath() + "/"); if (config != null) { facetConfigs.put(config.getName(), config); } } } return facetConfigs; }
/** * Adds a value element of the sequence type at the selected index to the XML content document.<p> * * @param cms the current users OpenCms context * @param index the index where to add the new value element * * @return the added XML content value element * * @see CmsXmlContent#addValue(CmsObject, String, Locale, int) */ public I_CmsXmlContentValue addValue(CmsObject cms, int index) { I_CmsXmlContentValue newValue = m_content.addValue(cms, getPath(), getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); return newValue; }
/** * Adds a value element of the given type * at the selected index to the XML content document.<p> * * @param cms the current users OpenCms context * @param type the type to add * @param index the index where to add the new value element * * @return the added XML content value element * * @see CmsXmlContent#addValue(CmsObject, String, Locale, int) * @see #addValue(CmsObject, String, int) * @see #addValue(CmsObject, int) */ public I_CmsXmlContentValue addValue(CmsObject cms, I_CmsXmlSchemaType type, int index) { String xpath = CmsXmlUtils.concatXpath(CmsXmlUtils.removeLastXpathElement(getPath()), type.getName()); return addValue(cms, xpath, index); }
/** * Returns the value sequence for the selected element name in this XML content.<p> * * If the given element name is not valid according to the schema of this XML content, * <code>null</code> is returned.<p> * * @param name the element name (XML node name) to the the value sequence for * @param locale the locale to get the value sequence for * * @return the value sequence for the selected element name in this XML content */ public CmsXmlContentValueSequence getValueSequence(String name, Locale locale) { I_CmsXmlSchemaType type = m_contentDefinition.getSchemaType(name); if (type == null) { return null; } return new CmsXmlContentValueSequence(name, type, locale, this); }
List<String> optionValues = CmsAddFormatterWidget.getSelectOptionValues(cms, rootPath, false); CmsXmlContentValueSequence addSequence = content.getValueSequence(ADD_PATH_SINGLE_NODE, locale); List<I_CmsXmlContentValue> values = addSequence.getValues(); boolean removeMainAddNode = true; for (int i = values.size() - 1; i >= 0; i--) {
int elementCount = elementSequence.getElementCount(); I_CmsXmlContentValue value = elementSequence.getValue(j);
/** * Adds a value element of the type indicated by the given xpath * at the selected index to the XML content document.<p> * * @param cms the current users OpenCms context * @param xpath the path that indicates the element type in the content definition * @param index the index where to add the new value element * * @return the added XML content value element * * @see CmsXmlContent#addValue(CmsObject, String, Locale, int) * @see #addValue(CmsObject, I_CmsXmlSchemaType, int) * @see #addValue(CmsObject, int) */ public I_CmsXmlContentValue addValue(CmsObject cms, String xpath, int index) { I_CmsXmlContentValue newValue = m_content.addValue(cms, xpath, getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); return newValue; }
Descriptor.N_MESSAGE, Descriptor.LOCALE); for (int i = 0; i < messages.getElementCount(); i++) { String prefix = messages.getValue(i).getPath() + "/"; String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms); if (key == oldKey) {