Codota Logo
CmsXmlContent.marshal
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain CmsXmlContent
private void myMethod () {
CmsXmlContent c =
  • Codota IconCmsObject cms;CmsFile file;CmsXmlContentFactory.unmarshal(cms, file)
  • Codota IconCmsObject cmsObject;CmsObject cms;CmsResource resource;CmsXmlContentFactory.unmarshal(cmsObject, cms.readFile(resource))
  • Smart code suggestions by Codota
}
origin: org.opencms/opencms-core

/**
 * Save the values to the bundle descriptor.
 * @throws CmsException thrown if saving fails.
 */
private void saveToBundleDescriptor() throws CmsException {
  if (null != m_descFile) {
    m_removeDescriptorOnCancel = false;
    updateBundleDescriptorContent();
    m_descFile.getFile().setContents(m_descContent.marshal());
    m_cms.writeFile(m_descFile.getFile());
  }
}
origin: org.opencms/opencms-core

bundleFile.setContents(m_xmlBundle.marshal());
m_cms.writeFile(bundleFile);
origin: org.opencms/org.opencms.workplace.tools.searchindex

return xmlContent.marshal();
origin: org.opencms/opencms-core

/**
 * Writes the new detail page information to the configuration file.<p>
 *
 * @param infos the new detail page information
 * @param newId the id to use for new pages
 *
 * @throws CmsException if something goes wrong
 */
public void updateAndSave(List<CmsDetailPageInfo> infos, CmsUUID newId) throws CmsException {
  //lock(m_cms, m_resource);
  getDocument();
  removeOldValues();
  writeDetailPageInfos(infos, newId);
  m_document.setAutoCorrectionEnabled(true);
  m_document.correctXmlStructure(m_cms);
  byte[] content = m_document.marshal();
  m_file.setContents(content);
  m_cms.writeFile(m_file);
  //m_cms.unlockResource(m_cms.getSitePath(m_resource));
}
origin: org.opencms/opencms-core

return xmlContent.marshal();
origin: org.opencms/org.opencms.workplace.tools.modules

/**
 * Adds the given messages to the vfs message bundle.<p>
 *
 * @param messages the messages
 * @param vfsBundleFile the bundle file
 *
 * @throws CmsException if something goes wrong writing the file
 */
private void addMessagesToVfsBundle(Map<String, String> messages, CmsFile vfsBundleFile) throws CmsException {
  lockTemporary(vfsBundleFile);
  CmsObject cms = getCms();
  CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, vfsBundleFile);
  Locale locale = CmsLocaleManager.getDefaultLocale();
  if (!content.hasLocale(locale)) {
    content.addLocale(cms, locale);
  }
  Element root = content.getLocaleNode(locale);
  for (Entry<String, String> entry : messages.entrySet()) {
    Element message = root.addElement(CmsVfsBundleLoaderXml.N_MESSAGE);
    Element key = message.addElement(CmsVfsBundleLoaderXml.N_KEY);
    key.setText(entry.getKey());
    Element value = message.addElement(CmsVfsBundleLoaderXml.N_VALUE);
    value.setText(entry.getValue());
  }
  content.initDocument();
  vfsBundleFile.setContents(content.marshal());
  cms.writeFile(vfsBundleFile);
}
origin: org.opencms/opencms-core

  content.moveLocale(oldLocale, newLocale);
  LOG.info("Replacing locale " + oldLocale + " -> " + newLocale + " for " + elementResource.getRootPath());
  file.setContents(content.marshal());
  m_cms.writeFile(file);
} catch (CmsXmlException e) {
origin: org.opencms/opencms-core

/**
 * Saves the content values to the sessions edit resource.<p>
 *
 * @param contentValues the content values by XPath
 *
 * @return the validation handler
 *
 * @throws CmsUgcException if writing the content fails
 */
public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException {
  checkNotFinished();
  try {
    CmsFile file = m_cms.readFile(m_editResource);
    CmsXmlContent content = addContentValues(file, contentValues);
    CmsXmlContentErrorHandler errorHandler = content.validate(m_cms);
    if (!errorHandler.hasErrors()) {
      file.setContents(content.marshal());
      // the file content might have been modified during the write operation
      file = m_cms.writeFile(file);
    }
    return errorHandler;
  } catch (CmsException e) {
    LOG.error(e.getLocalizedMessage(), e);
    throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
  }
}
origin: org.opencms/opencms-core

newFile.setContents(newContent.marshal());
origin: org.opencms/opencms-core

/**
 * Writes a sitemap configuration back to the VFS.<p>
 *
 * @param content the content to write
 * @param sitemapConfigFile the file to which the sitemap config should be written
 *
 * @throws CmsXmlException if an XML processing error occurs
 * @throws CmsException if something goes wrong
 */
private void writeSitemapConfig(CmsXmlContent content, CmsFile sitemapConfigFile)
throws CmsXmlException, CmsException {
  content.correctXmlStructure(m_cms);
  byte[] contentBytes = content.marshal();
  sitemapConfigFile.setContents(contentBytes);
  try {
    CmsLock lock = m_cms.getLock(sitemapConfigFile);
    if (lock.isUnlocked() || !lock.isOwnedBy(m_cms.getRequestContext().getCurrentUser())) {
      m_cms.lockResourceTemporary(sitemapConfigFile);
    }
    m_cms.writeFile(sitemapConfigFile);
  } finally {
    m_cms.unlockResource(sitemapConfigFile);
  }
}
origin: org.opencms/opencms-core

byte[] newData = content.marshal();
elementFile.setContents(newData);
cms.writeFile(elementFile);
origin: org.opencms/opencms-solr

newFile.setContents(newContent.marshal());
origin: org.opencms/opencms-core

/**
 * Saves the inheritance group.<p>
 *
 * @param resource the inheritance group resource
 * @param inheritanceContainer the inherited group container data
 *
 * @throws CmsException if something goes wrong
 */
private void saveInheritanceGroup(CmsResource resource, CmsInheritanceContainer inheritanceContainer)
throws CmsException {
  CmsObject cms = getCmsObject();
  CmsFile file = cms.readFile(resource);
  CmsXmlContent document = CmsXmlContentFactory.unmarshal(cms, file);
  for (Locale docLocale : document.getLocales()) {
    document.removeLocale(docLocale);
  }
  Locale locale = Locale.ENGLISH;
  document.addLocale(cms, locale);
  document.getValue("Title", locale).setStringValue(cms, inheritanceContainer.getTitle());
  document.getValue("Description", locale).setStringValue(cms, inheritanceContainer.getDescription());
  document.getValue("ConfigName", locale).setStringValue(cms, inheritanceContainer.getName());
  byte[] content = document.marshal();
  file.setContents(content);
  cms.writeFile(file);
}
origin: org.opencms/opencms-solr

content = newContent.marshal();
origin: org.opencms/opencms-core

file.setContents(content.marshal());
m_cms.writeFile(file);
OpenCms.getADEManager().waitForCacheUpdate(false);
origin: org.opencms/opencms-core

content = xmlContent.marshal();
origin: org.opencms/opencms-core

content = newContent.marshal();
origin: org.opencms/opencms-core

String htmlContent = null;
if (!validationResult.hasErrors()) {
  file.setContents(content.marshal());
origin: org.opencms/org.opencms.workplace.tools.modules

    CmsConfigurationReader.DEFAULT_LOCALE);
  enabledValue.setStringValue(cms, Boolean.TRUE.toString());
  configFile.setContents(configContent.marshal());
  cms.writeFile(configFile);
  CmsConfigurationReader.DEFAULT_LOCALE);
typeValue.setStringValue(cms, m_resInfo.getName());
moduleConfigFile.setContents(moduleConfigContent.marshal());
cms.writeFile(moduleConfigFile);
origin: org.opencms/opencms-core

byte[] contentBytes = content.marshal();
configFile.setContents(contentBytes);
CmsLock prevLock = cms.getLock(configRes);
org.opencms.xml.contentCmsXmlContentmarshal

Popular methods of CmsXmlContent

  • getValue
  • getStringValue
  • getValues
  • hasLocale
  • getFile
  • getLocales
  • addValue
    Adds a new XML schema type with the default value to the given parent node.
  • 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

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • addToBackStack (FragmentTransaction)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • 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
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now