/** * 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()); } }
bundleFile.setContents(m_xmlBundle.marshal()); m_cms.writeFile(bundleFile);
return xmlContent.marshal();
/** * 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)); }
return xmlContent.marshal();
/** * 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); }
content.moveLocale(oldLocale, newLocale); LOG.info("Replacing locale " + oldLocale + " -> " + newLocale + " for " + elementResource.getRootPath()); file.setContents(content.marshal()); m_cms.writeFile(file); } catch (CmsXmlException e) {
/** * 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()); } }
newFile.setContents(newContent.marshal());
/** * 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); } }
byte[] newData = content.marshal(); elementFile.setContents(newData); cms.writeFile(elementFile);
newFile.setContents(newContent.marshal());
/** * 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); }
content = newContent.marshal();
file.setContents(content.marshal()); m_cms.writeFile(file); OpenCms.getADEManager().waitForCacheUpdate(false);
content = xmlContent.marshal();
content = newContent.marshal();
String htmlContent = null; if (!validationResult.hasErrors()) { file.setContents(content.marshal());
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);
byte[] contentBytes = content.marshal(); configFile.setContents(contentBytes); CmsLock prevLock = cms.getLock(configRes);