/** * Removes all values of the given path in the other locales.<p> * * @param elementPath the element path * @param sourceLocale the source locale */ private void removeValuesInOtherLocales(String elementPath, Locale sourceLocale) { for (Locale locale : getLocales()) { if (locale.equals(sourceLocale)) { continue; } while (hasValue(elementPath, locale)) { removeValue(elementPath, locale, 0); } } }
/** * Removes all surplus values of locale independent fields in the other locales.<p> * * @param elementPath the element path * @param valueCount the value count * @param sourceLocale the source locale */ private void removeSurplusValuesInOtherLocales(String elementPath, int valueCount, Locale sourceLocale) { for (Locale locale : getLocales()) { if (locale.equals(sourceLocale)) { continue; } List<I_CmsXmlContentValue> localeValues = getValues(elementPath, locale); for (int i = valueCount; i < localeValues.size(); i++) { removeValue(elementPath, locale, 0); } } }
boolean removeAll = Boolean.valueOf(removeAllStringValue).booleanValue(); if (removeAll && content.hasValue(REMOVE_PATH, locale)) { content.removeValue(REMOVE_PATH, locale, 0); } else if (content.hasValue(ADD_PATH, locale)) { String rootPath = content.getFile().getRootPath(); removeMainAddNode = false; } else { content.removeValue(ADD_PATH_SINGLE_NODE, locale, i); content.removeValue(ADD_PATH, locale, 0);
/** * Removes the old detail page information from the XML content.<p> * * @throws CmsException if something goes wrong */ private void removeOldValues() throws CmsException { Locale locale = getLocale(); I_CmsXmlContentValue value = m_document.getValue(N_DETAIL_PAGE, locale); do { value = m_document.getValue(N_DETAIL_PAGE, locale); if (value != null) { m_document.removeValue(value.getPath(), locale, 0); } } while (value != null); }
/** * 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()); } }
/** * 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()); } }
/** * Deletes the given value path from the content document.<p> * * @param content the content document * @param locale the content locale * @param path the value XPath */ protected void deleteContentValue(CmsXmlContent content, Locale locale, String path) { boolean hasValue = content.hasValue(path, locale); if (hasValue) { int index = CmsXmlUtils.getXpathIndexInt(path) - 1; I_CmsXmlContentValue val = content.getValue(path, locale); if (index >= val.getMinOccurs()) { content.removeValue(path, locale, index); } else { val.setStringValue(m_cms, ""); } } }
/** * Removes an existing inheritance container entry with a given name from the configuration file.<p> * * This does nothing if no such entry actually exists.<p> * * @param cms the current CMS context * @param content the XML content * @param locale the locale from which to remove the entry * @param name the name of the entry * */ protected void removeExistingEntry(CmsObject cms, CmsXmlContent content, Locale locale, String name) { if (!content.hasLocale(locale)) { return; } String entriesXpath = N_CONFIGURATION; List<I_CmsXmlContentValue> values = content.getValues(entriesXpath, locale); int valueIndex = 0; for (I_CmsXmlContentValue value : values) { String valueXpath = value.getPath(); I_CmsXmlContentValue nameValue = content.getValue(CmsXmlUtils.concatXpath(valueXpath, N_NAME), locale); String currentName = nameValue.getStringValue(cms); if (currentName.equals(name)) { content.removeValue(valueXpath, locale, valueIndex); break; } valueIndex += 1; } }
content.removeValue(value.getName(), value.getLocale(), value.getIndex()); modified = true; } catch (CmsRuntimeException ex) {
/** * Removes a model page from the sitemap configuration.<p> * * @param sitemapConfig the sitemap configuration resource * @param structureId the structure id of the model page to remove * * @throws CmsException if something goes wrong */ public void removeModelPage(CmsResource sitemapConfig, CmsUUID structureId) throws CmsException { CmsFile sitemapConfigFile = m_cms.readFile(sitemapConfig); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, sitemapConfigFile); CmsConfigurationReader reader = new CmsConfigurationReader(m_cms); reader.parseConfiguration(m_adeConfig.getBasePath(), content); List<CmsModelPageConfig> modelPageConfigs = reader.getModelPageConfigs(); int i = 0; for (CmsModelPageConfig config : modelPageConfigs) { if (config.getResource().getStructureId().equals(structureId)) { break; } i += 1; } if (i < modelPageConfigs.size()) { content.removeValue(CmsConfigurationReader.N_MODEL_PAGE, Locale.ENGLISH, i); } writeSitemapConfig(content, sitemapConfigFile); }
content.removeValue(value.getName(), value.getLocale(), value.getIndex()); modified = true; } catch (CmsRuntimeException ex) {
m_content.removeValue(getParamElementName(), getElementLocale(), index); } else {
content.removeValue(CmsConfigurationReader.N_MODEL_PAGE, locale, defaultValueIndex); content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, locale, 0); content.getValue(
m_content.removeValue(getParamElementName(), getElementLocale(), index); m_content.removeValue(xpath, getElementLocale(), CmsXmlUtils.getXpathIndexInt(xpath) - 1);