Tabnine Logo
CmsXmlContent.addValue
Code IndexAdd Tabnine to your IDE (free)

How to use
addValue
method
in
org.opencms.xml.content.CmsXmlContent

Best Java code snippets using org.opencms.xml.content.CmsXmlContent.addValue (Showing top 19 results out of 315)

origin: org.opencms/opencms-core

/**
 * Ensures the parent values to the given path are created.<p>
 *
 * @param cms the cms context
 * @param valuePath the value path
 * @param locale the content locale
 */
private void ensureParentValues(CmsObject cms, String valuePath, Locale locale) {
  if (valuePath.contains("/")) {
    String parentPath = valuePath.substring(0, valuePath.lastIndexOf("/"));
    if (!hasValue(parentPath, locale)) {
      ensureParentValues(cms, parentPath, locale);
      int index = CmsXmlUtils.getXpathIndexInt(parentPath) - 1;
      addValue(cms, parentPath, locale, index);
    }
  }
}
origin: org.opencms/opencms-core

/**
 * 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;
}
origin: org.opencms/opencms-core

String value = props.getProperty(key.toString());
if (!value.isEmpty()) {
  m_xmlBundle.addValue(m_cms, "Message", l, i);
  i++;
  m_xmlBundle.getValue("Message[" + i + "]/Key", l).setStringValue(m_cms, key.toString());
origin: org.opencms.modules/org.opencms.frontend.templateone

if (conf != null) {
  conf.addValue(getCmsObject(), NODE_OPTIONALCONFIG, getRequestContext().getLocale(), 0);
  I_CmsXmlContentValue value = conf.getValue(
    NODE_OPTIONALCONFIG + "/headlines.set",
origin: org.opencms/opencms-solr

/**
 * 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;
}
origin: org.opencms/opencms-core

/**
 * Adds the given value to the content document.<p>
 *
 * @param content the content document
 * @param locale the content locale
 * @param path the value XPath
 * @param value the value
 */
protected void addContentValue(CmsXmlContent content, Locale locale, String path, String value) {
  boolean hasValue = content.hasValue(path, locale);
  if (!hasValue) {
    String[] pathElements = path.split("/");
    String currentPath = pathElements[0];
    for (int i = 0; i < pathElements.length; i++) {
      if (i > 0) {
        currentPath = CmsStringUtil.joinPaths(currentPath, pathElements[i]);
      }
      while (!content.hasValue(currentPath, locale)) {
        content.addValue(m_cms, currentPath, locale, CmsXmlUtils.getXpathIndexInt(currentPath) - 1);
      }
    }
  }
  content.getValue(path, locale).setStringValue(m_cms, value);
}
origin: org.opencms/opencms-core

  /**
   * Writes a single item of detail page information to the XML content.<p>
   *
   * @param type the type which the detail page should render
   * @param id the page id of the detail page
   * @param index the position at which the detail page info should be added
   */
  private void writeValue(String type, CmsUUID id, int index) {

    Locale locale = CmsLocaleManager.getLocale("en");
    // todo: check actual locale.
    m_document.addValue(m_cms, N_DETAIL_PAGE, locale, index);
    String typePath = N_DETAIL_PAGE + "[" + (1 + index) + "]/" + N_TYPE;
    I_CmsXmlContentValue typeVal = m_document.getValue(typePath, locale);
    String pagePath = N_DETAIL_PAGE + "[" + (1 + index) + "]/" + N_PAGE;
    CmsXmlVfsFileValue pageVal = (CmsXmlVfsFileValue)m_document.getValue(pagePath, locale);
    typeVal.setStringValue(m_cms, type);
    pageVal.setIdValue(m_cms, id);
  }
}
origin: org.opencms/opencms-core

if ((null != key) && !key.toString().isEmpty()) {
  m_descContent.addValue(m_cms, Descriptor.N_MESSAGE, Descriptor.LOCALE, i);
  i++;
  String messagePrefix = Descriptor.N_MESSAGE + "[" + i + "]/";
origin: org.opencms/opencms-core

I_CmsXmlContentValue field = content.getValue(elementPath, contentLocale, i);
if (field == null) {
  field = content.addValue(cms, elementPath, contentLocale, i);
I_CmsXmlContentValue field = content.getValue(elementPath, contentLocale, i);
if (field == null) {
  field = content.addValue(cms, elementPath, contentLocale, i);
I_CmsXmlContentValue field = content.getValue(elementPath, contentLocale, i);
if (field == null) {
  field = content.addValue(cms, elementPath, contentLocale, i);
I_CmsXmlContentValue field = content.getValue(elementPath, contentLocale, i);
if (field == null) {
  field = content.addValue(cms, elementPath, contentLocale, i);
origin: org.opencms/opencms-core

  value = content.getValue(CmsConfigurationReader.N_MODEL_PAGE, Locale.ENGLISH, i);
} else {
  value = content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, Locale.ENGLISH, i);
  String linkValuePath = value.getPath() + "/" + CmsConfigurationReader.N_MODEL_PAGE;
  I_CmsXmlContentValue linkValue = content.hasValue(linkValuePath, Locale.ENGLISH)
  ? content.getValue(linkValuePath, Locale.ENGLISH)
  : content.addValue(m_cms, linkValuePath, Locale.ENGLISH, 0);
  CmsResource model = m_cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
  linkValue.setStringValue(m_cms, m_cms.getSitePath(model));
I_CmsXmlContentValue disabledValue = content.hasValue(disabledPath, Locale.ENGLISH)
? content.getValue(disabledPath, Locale.ENGLISH)
: content.addValue(m_cms, disabledPath, Locale.ENGLISH, 0);
disabledValue.setStringValue(m_cms, Boolean.toString(disabled));
writeSitemapConfig(content, sitemapConfigFile);
origin: org.opencms/opencms-solr

I_CmsXmlContentValue newValue = addValue(cms, parentElement, type, locale, insertIndex);
origin: org.opencms/opencms-core

I_CmsXmlContentValue newValue = addValue(cms, parentElement, type, locale, insertIndex);
origin: org.opencms/opencms-core

/**
 * Sets the value in all other locales.<p>
 *
 * @param cms the cms context
 * @param value the value
 * @param requiredParent the path to the required parent value
 */
private void setValueForOtherLocales(CmsObject cms, I_CmsXmlContentValue value, String requiredParent) {
  if (!value.isSimpleType()) {
    throw new IllegalArgumentException();
  }
  for (Locale locale : getLocales()) {
    if (locale.equals(value.getLocale())) {
      continue;
    }
    String valuePath = value.getPath();
    if (CmsStringUtil.isEmptyOrWhitespaceOnly(requiredParent) || hasValue(requiredParent, locale)) {
      ensureParentValues(cms, valuePath, locale);
      if (hasValue(valuePath, locale)) {
        I_CmsXmlContentValue localeValue = getValue(valuePath, locale);
        localeValue.setStringValue(cms, value.getStringValue(cms));
      } else {
        int index = CmsXmlUtils.getXpathIndexInt(valuePath) - 1;
        I_CmsXmlContentValue localeValue = addValue(cms, valuePath, locale, index);
        localeValue.setStringValue(cms, value.getStringValue(cms));
      }
    }
  }
}
origin: org.opencms/opencms-core

  content.getValue(target, locale).setStringValue(cms, prop.getValue());
} else {
  content.addValue(cms, target, locale, 0).setStringValue(cms, prop.getValue());
origin: org.opencms/opencms-core

content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, Locale.ENGLISH, i);
origin: org.opencms/opencms-solr

m_content.addValue(getCms(), getParamElementName(), getElementLocale(), index);
origin: org.opencms/opencms-core

content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, locale, 0);
content.getValue(
  CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_PAGE,
origin: org.opencms/opencms-core

  } else {
    m_content.addValue(getCms(), elementPath, getElementLocale(), index);
    elementPath = CmsXmlUtils.createXpathElement(elementPath, index + 1);
      ? CmsXmlUtils.removeFirstXpathElement(pathToChoice)
      : null;
      I_CmsXmlContentValue newVal = m_content.addValue(getCms(), newPath, getElementLocale(), index);
      newPath = newVal.getPath();
m_content.addValue(getCms(), elementPath, getElementLocale(), index);
origin: org.opencms/org.opencms.workplace.tools.modules

      : m_resInfo.getName()));
  configContent.addValue(cms, CmsFormatterBeanParser.N_MATCH, CmsConfigurationReader.DEFAULT_LOCALE, 0);
  configContent.addValue(
    cms,
    CmsFormatterBeanParser.N_MATCH + "/" + CmsFormatterBeanParser.N_WIDTH,
lockTemporary(moduleConfigFile);
CmsXmlContent moduleConfigContent = CmsXmlContentFactory.unmarshal(cms, moduleConfigFile);
I_CmsXmlContentValue resourceTypeValue = moduleConfigContent.addValue(
  cms,
  CmsConfigurationReader.N_RESOURCE_TYPE,
org.opencms.xml.contentCmsXmlContentaddValue

Javadoc

Adds a new XML content value for the given element name and locale at the given index position to this XML content document.

Popular methods of CmsXmlContent

  • getValue
  • getStringValue
  • getValues
  • hasLocale
  • getFile
  • getLocales
  • marshal
  • getIndexCount
  • hasValue
  • addLocale
  • copyLocale
    Copies the content of the given source locale to the given destination locale in this XML document.
  • correctXmlStructure
  • copyLocale,
  • correctXmlStructure,
  • getEncoding,
  • getLocaleNode,
  • initDocument,
  • removeLocale,
  • setAutoCorrectionEnabled,
  • toString,
  • visitAllValuesWith

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Collectors (java.util.stream)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now