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

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

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

origin: org.opencms/opencms-core

  /**
   * Copies the contents from a source locale to a number of destination locales by overwriting them.<p>
   *
   * @param content the xml content
   * @param sourceLocale the source locale
   * @param destLocales a list of destination locales
   * @throws CmsException if something goes wrong
   */
  protected void transferContents(CmsXmlContent content, Locale sourceLocale, List<Locale> destLocales)
  throws CmsException {

    for (Iterator<Locale> i = destLocales.iterator(); i.hasNext();) {
      Locale to = i.next();
      if (content.hasLocale(to)) {
        content.removeLocale(to);
      }
      content.copyLocale(sourceLocale, to);
    }
  }
}
origin: org.opencms/opencms-solr

  /**
   * Copies the contents from a source locale to a number of destination locales by overwriting them.<p>
   *  
   * @param content the xml content
   * @param sourceLocale the source locale
   * @param destLocales a list of destination locales
   * @throws CmsException if something goes wrong
   */
  protected void transferContents(CmsXmlContent content, Locale sourceLocale, List destLocales) throws CmsException {

    for (Iterator i = destLocales.iterator(); i.hasNext();) {
      Locale to = (Locale)i.next();
      if (content.hasLocale(to)) {
        content.removeLocale(to);
      }
      content.copyLocale(sourceLocale, to);
    }
  }
}
origin: org.opencms/opencms-solr

/**
 * Initializes the element language for the first call of the editor.<p>
 */
protected void initElementLanguage() {
  // get the default locale for the resource
  List locales = OpenCms.getLocaleManager().getDefaultLocales(getCms(), getParamResource());
  Locale locale = (Locale)locales.get(0);
  if (m_content != null) {
    // to copy anything we need at least one locale
    if ((locales.size() > 1) && (m_content.getLocales().size() > 0) && !m_content.hasLocale(locale)) {
      // required locale not available, check if an existing default locale should be copied as "template"
      try {
        // a list of possible default locales has been set as property, try to find a match                    
        m_content.copyLocale(locales, locale);
        writeContent();
      } catch (CmsException e) {
        // no match was found for the required locale
      }
    }
    if (!m_content.hasLocale(locale)) {
      // value may have changed because of the copy operation
      locale = m_content.getLocales().get(0);
    }
  }
  setParamElementlanguage(locale.toString());
}
origin: org.opencms/opencms-core

  m_content.copyLocale(locales, newLocale);
  addNew = false;
} catch (CmsXmlException e) {
origin: org.opencms/opencms-core

m_content.copyLocale(locales, locale);
origin: org.opencms/opencms-solr

  m_content.copyLocale(locales, newLocale);
  addNew = false;
} catch (CmsXmlException e) {
origin: org.opencms/opencms-core

  content.copyLocale(mainLocale, locale);
} else {
  content.addLocale(cms, locale);
origin: org.opencms/opencms-core

/**
 * @see org.opencms.ade.contenteditor.shared.rpc.I_CmsContentService#copyLocale(java.util.Collection, org.opencms.acacia.shared.CmsEntity)
 */
public void copyLocale(Collection<String> locales, CmsEntity sourceLocale) throws CmsRpcException {
  try {
    CmsUUID structureId = CmsContentDefinition.entityIdToUuid(sourceLocale.getId());
    CmsResource resource = getCmsObject().readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
    CmsFile file = getCmsObject().readFile(resource);
    CmsXmlContent content = getSessionCache().getCacheXmlContent(structureId);
    synchronizeLocaleIndependentForEntity(file, content, Collections.<String> emptyList(), sourceLocale);
    Locale sourceContentLocale = CmsLocaleManager.getLocale(
      CmsContentDefinition.getLocaleFromId(sourceLocale.getId()));
    for (String loc : locales) {
      Locale targetLocale = CmsLocaleManager.getLocale(loc);
      if (content.hasLocale(targetLocale)) {
        content.removeLocale(targetLocale);
      }
      content.copyLocale(sourceContentLocale, targetLocale);
    }
  } catch (Throwable t) {
    error(t);
  }
}
origin: org.opencms/org.opencms.workplace.tools.content

  report.addWarning(container);
} else {
  content.copyLocale(sourceLocale, targetLocale);
  if (m_delete) {
    content.removeLocale(sourceLocale);
org.opencms.xml.contentCmsXmlContentcopyLocale

Javadoc

Copies the content of the given source locale to the given destination locale in this XML document.

Popular methods of CmsXmlContent

  • getValue
  • getStringValue
  • getValues
  • hasLocale
  • getFile
  • getLocales
  • marshal
  • addValue
    Adds a new XML schema type with the default value to the given parent node.
  • getIndexCount
  • hasValue
  • addLocale
  • correctXmlStructure
  • addLocale,
  • correctXmlStructure,
  • getEncoding,
  • getLocaleNode,
  • initDocument,
  • removeLocale,
  • setAutoCorrectionEnabled,
  • toString,
  • visitAllValuesWith

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Github Copilot alternatives
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