Writes the synchronization list of the current sync process to the
server file system. <p>

The file can be found in the synchronization folder
@throws CmsException if something goes wrong
504864
private void writeSyncList() throws CmsException {

        // the sync list file in the server file system
        File syncListFile;
        syncListFile = new File(m_destinationPathInRfs, SYNCLIST_FILENAME);

        // prepare the streams to write the data
        FileOutputStream fOut = null;
        PrintWriter pOut = null;
        try {
            fOut = new FileOutputStream(syncListFile);
            pOut = new PrintWriter(fOut);
            pOut.println(CmsSynchronizeList.getFormatDescription());

            // get all keys from the hash map and make an iterator on it
            Iterator<CmsSynchronizeList> values = m_newSyncList.values().iterator();
            // loop through all values and write them to the sync list file in
            // a human readable format
            while (values.hasNext()) {
                CmsSynchronizeList sync = values.next();
                //fOut.write(sync.toString().getBytes());
                pOut.println(sync.toString());
            }
        } catch (IOException e) {
            throw new CmsDbIoException(Messages.get().container(Messages.ERR_IO_WRITE_SYNCLIST_0), e);
        } finally {
            // close all streams that were used
            try {
                if (pOut != null) {
                    pOut.flush();
                    pOut.close();
                }
                if (fOut != null) {
                    fOut.flush();
                    fOut.close();
                }
            } catch (IOException e) {
                // ignore
            }
        }
    }
282561
protected void doLoadNextFile() throws CmsException {

        super.doLoadNextResource();
        if (m_resource == null) {
            return;
        }

        // upgrade the resource to a file
        CmsFile file = m_cms.readFile(m_resource);

        // unmarshal the XML content from the resource, don't use unmarshal(CmsObject, CmsResource)
        // as no support for getting the historic version that has been cached by a CmsHistoryResourceHandler
        // will come from there!
        m_content = CmsXmlContentFactory.unmarshal(m_cms, file, pageContext.getRequest());

        // check if locale is available
        m_contentLocale = m_locale;
        if (!m_content.hasLocale(m_contentLocale)) {
            Iterator<Locale> it = OpenCms.getLocaleManager().getDefaultLocales().iterator();
            while (it.hasNext()) {
                Locale locale = it.next();
                if (m_content.hasLocale(locale)) {
                    // found a matching locale
                    m_contentLocale = locale;
                    break;
                }
            }
        }
    }
790889
private void mergePages() throws CmsException {

        int size = m_foldersEqualnames.size();
        if (size > 0) {

            m_report.println(
                Messages.get().container(Messages.RPT_MERGE_PAGES_BEGIN_1, String.valueOf(size)),
                I_CmsReport.FORMAT_HEADLINE);
            String defaultLocale = CmsLocaleManager.getDefaultLocale().toString();
            String locale2 = m_cms.readPropertyObject(getParamFolder2(), "locale", true).getValue(defaultLocale);

            // lock the source and the target folder
            m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
            m_report.print(
                org.opencms.report.Messages.get().container(
                    org.opencms.report.Messages.RPT_ARGUMENT_1,
                    getParamFolder1()));
            m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
            m_cms.lockResource(getParamFolder1());
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);

            m_report.print(Messages.get().container(Messages.RPT_LOCK_FOLDER_0), I_CmsReport.FORMAT_NOTE);
            m_report.print(
                org.opencms.report.Messages.get().container(
                    org.opencms.report.Messages.RPT_ARGUMENT_1,
                    getParamFolder2()));
            m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
            m_cms.lockResource(getParamFolder2());
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);

            // now loop through all collected resources
            int count = 1;
            Iterator i = m_foldersEqualnames.iterator();
            while (i.hasNext()) {
                String resFolder1Name = (String)i.next();
                try {
                    String resFolder2Name = getResourceNameInOtherFolder(
                        resFolder1Name,
                        getParamFolder1(),
                        getParamFolder2());
                    m_report.print(org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_SUCCESSION_2,
                        String.valueOf(count++),
                        String.valueOf(size)), I_CmsReport.FORMAT_NOTE);
                    m_report.print(Messages.get().container(Messages.RPT_PROCESS_0), I_CmsReport.FORMAT_NOTE);
                    m_report.print(
                        org.opencms.report.Messages.get().container(
                            org.opencms.report.Messages.RPT_ARGUMENT_1,
                            resFolder1Name));
                    m_report.print(Messages.get().container(Messages.RPT_DOUBLE_ARROW_0), I_CmsReport.FORMAT_NOTE);
                    m_report.print(
                        org.opencms.report.Messages.get().container(
                            org.opencms.report.Messages.RPT_ARGUMENT_1,
                            resFolder2Name));
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));

                    // get the content of the resource in folder1
                    String locale = m_cms.readPropertyObject(resFolder1Name, "locale", true).getValue(defaultLocale);
                    m_report.print(
                        Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder1Name, locale),
                        I_CmsReport.FORMAT_NOTE);
                    CmsResource resFolder1 = m_cms.readResource(resFolder1Name, CmsResourceFilter.IGNORE_EXPIRATION);
                    CmsFile fileFolder1 = m_cms.readFile(resFolder1);
                    CmsXmlPage pageFolder1 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder1);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // get the content of the resource in folder2
                    locale = m_cms.readPropertyObject(resFolder2Name, "locale", true).getValue(defaultLocale);
                    m_report.print(
                        Messages.get().container(Messages.RPT_READ_CONTENT_2, resFolder2Name, locale),
                        I_CmsReport.FORMAT_NOTE);
                    CmsResource resFolder2 = m_cms.readResource(resFolder2Name, CmsResourceFilter.IGNORE_EXPIRATION);
                    CmsFile fileFolder2 = m_cms.readFile(resFolder2);
                    CmsXmlPage pageFolder2 = CmsXmlPageFactory.unmarshal(m_cms, fileFolder2);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // now get all the text elements from the resource in folder 2 which match the the locale of folder 2
                    Locale loc = CmsLocaleManager.getLocale(locale2);
                    List textElements2 = pageFolder2.getNames(loc);
                    Iterator j = textElements2.iterator();
                    while (j.hasNext()) {
                        String textElementName = (String)j.next();
                        m_report.print(
                            Messages.get().container(Messages.RPT_PROCESS_TEXT_ELEM_1, textElementName),
                            I_CmsReport.FORMAT_NOTE);
                        // get the text element from the resource in folder 2...
                        String textElement = pageFolder2.getValue(textElementName, loc).getStringValue(m_cms);
                        // and set it in the resource in folder 1...
                        // WARNING: An existing content will be overwritten!
                        if (!pageFolder1.hasValue(textElementName, loc)) {
                            pageFolder1.addValue(textElementName, loc);
                        }
                        pageFolder1.setStringValue(m_cms, textElementName, loc, textElement);
                        m_report.println(
                            org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                            I_CmsReport.FORMAT_OK);
                    }
                    // the resource in folder 1 now has all text elements in both locales, so update it in the vfs

                    m_report.print(
                        Messages.get().container(Messages.RPT_WRITE_CONTENT_1, resFolder1Name),
                        I_CmsReport.FORMAT_NOTE);
                    fileFolder1.setContents(pageFolder1.marshal());
                    m_cms.writeFile(fileFolder1);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // save all properties from the resource in folder2
                    m_report.print(
                        Messages.get().container(Messages.RPT_READ_PROPERTIES_1, resFolder2Name),
                        I_CmsReport.FORMAT_NOTE);
                    List properties = m_cms.readPropertyObjects(resFolder2Name, false);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // the next thing to do is to delete the old resource in folder 2
                    m_report.print(
                        Messages.get().container(Messages.RPT_DELETE_PAGE_1, resFolder2Name),
                        I_CmsReport.FORMAT_NOTE);
                    m_cms.deleteResource(resFolder2Name, CmsResource.DELETE_PRESERVE_SIBLINGS);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // copy a sibling of the resource from folder 1 to folder 2
                    m_report.print(
                        Messages.get().container(Messages.RPT_COPY_2, resFolder1Name, resFolder2Name),
                        I_CmsReport.FORMAT_NOTE);
                    m_cms.copyResource(resFolder1Name, resFolder2Name, CmsResource.COPY_AS_SIBLING);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    // restore the properties at the sibling in folder 2
                    m_report.print(
                        Messages.get().container(Messages.RPT_RESORE_PROPERTIES_1, resFolder2Name),
                        I_CmsReport.FORMAT_NOTE);
                    m_cms.writePropertyObjects(resFolder2Name, properties);
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);

                    resFolder1 = null;
                    resFolder2 = null;
                    fileFolder1 = null;
                    fileFolder2 = null;
                    pageFolder1 = null;
                    pageFolder2 = null;

                } catch (CmsException e) {
                    m_report.println(e);
                }

            }
            // lock the source and the target folder
            m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder1()), I_CmsReport.FORMAT_NOTE);
            m_cms.unlockResource(getParamFolder1());
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);

            m_report.print(Messages.get().container(Messages.RPT_UNLOCK_1, getParamFolder2()), I_CmsReport.FORMAT_NOTE);
            m_cms.unlockResource(getParamFolder2());
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);

            m_report.println(Messages.get().container(Messages.RPT_MERGE_PAGES_END_0), I_CmsReport.FORMAT_HEADLINE);
        }
    }
1248737
private boolean writeContent(CmsObject cmsObject, I_CmsReport report, CmsFile file, byte[] content) {

        boolean success = true;

        // get current lock from file
        try {
            // try to lock the resource
            if (!lockResource(cmsObject, file, report)) {
                report.println(
                    Messages.get().container(Messages.RPT_SOURCESEARCH_LOCKED_FILE_0, cmsObject.getSitePath(file)),
                    I_CmsReport.FORMAT_ERROR);
                success = false;
            }
        } catch (CmsException e) {
            report.println(
                Messages.get().container(Messages.RPT_SOURCESEARCH_LOCKED_FILE_0, cmsObject.getSitePath(file)),
                I_CmsReport.FORMAT_ERROR);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getMessageContainer(), e);
            }
            success = false;
        }

        // write the file content
        try {
            file.setContents(content);
            cmsObject.writeFile(file);
        } catch (Exception e) {
            m_errorUpdate += 1;
            report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                I_CmsReport.FORMAT_ERROR);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.toString());
            }
            success = false;
        }

        // unlock the resource
        try {
            cmsObject.unlockResource(cmsObject.getSitePath(file));
        } catch (CmsException e) {
            m_errorUpdate += 1;
            report.println(
                Messages.get().container(Messages.RPT_SOURCESEARCH_UNLOCK_FILE_0),
                I_CmsReport.FORMAT_WARNING);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getMessageContainer(), e);
            }
            success = false;
        }

        if (success) {
            // successfully updated
            report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);
        }

        return success;
    }
1316631
public void writeContainerPage(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {

        // keep unused containers
        CmsContainerPageBean savePage = cleanupContainersContainers(cms, cntPage);
        savePage = removeEmptyContainers(cntPage);
        // Replace existing locales with master locale
        for (Locale locale : getLocales()) {
            removeLocale(locale);
        }
        Locale masterLocale = CmsLocaleManager.MASTER_LOCALE;
        addLocale(cms, masterLocale);

        // add the nodes to the raw XML structure
        Element parent = getLocaleNode(masterLocale);
        saveContainerPage(cms, parent, savePage);
        initDocument(m_document, m_encoding, m_contentDefinition);
    }
95579
private void writePointerLink(CmsResource res) throws CmsException {

        String resPath = getCms().getSitePath(res);
        String currentPropertyValue = getParamPropertyValue();
        boolean locked = true;
        CmsLock lock = getCms().getLock(res);
        if (lock.isUnlocked()) {
            // lock resource before operation
            getCms().lockResource(resPath);
            locked = false;
        }
        CmsFile file = getCms().readFile(res);
        file.setContents(currentPropertyValue.getBytes());
        checkLock(getCms().getSitePath(res));
        getCms().writeFile(file);
        if (!locked) {
            // unlock the resource
            getCms().unlockResource(resPath);
        }
    }
108612
public void moveTo(String cmsNewPath) throws CmsException {

        ensureLock();
        m_cms.moveResource(m_cms.getSitePath(m_resource), cmsNewPath);
        CmsUUID id = m_resource.getStructureId();
        CmsResource updatedRes = m_cms.readResource(id, CmsJlanDiskInterface.STANDARD_FILTER);
        m_resource = updatedRes;
        updateFromResource();
    }
390455
protected void touchFiles() throws CmsException {

        Date touchDate = m_dateField.getDate();
        boolean validDate = touchDate != null;
        long touchTime = touchDate != null ? touchDate.getTime() : 0;
        boolean recursive = m_modifySubresourcesField.getValue().booleanValue();
        boolean rewriteContent = m_rewriteContentField.getValue().booleanValue();
        List<CmsUUID> changedIds = Lists.newArrayList();
        for (CmsResource resource : m_context.getResources()) {
            CmsLockActionRecord actionRecord = null;
            try {
                actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource);
                touchSingleResource(
                    m_context.getCms().getSitePath(resource),
                    touchTime,
                    recursive,
                    validDate,
                    rewriteContent);
                changedIds.add(resource.getStructureId());
            } finally {
                if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) {
                    try {
                        m_context.getCms().unlockResource(resource);
                    } catch (CmsLockException e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                    }
                }

            }

        }
        m_context.finish(changedIds);

    }
295654
public void saveProperties(CmsPropertyChangeSet changes) throws CmsException {

        CmsObject cms = m_cms;
        CmsUUID structureId = changes.getTargetStructureId();
        if (m_overrideStructureId != null) {
            structureId = m_overrideStructureId;
        }
        CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
        CmsLockActionRecord actionRecord = CmsLockUtil.ensureLock(cms, resource);
        try {
            Map<String, CmsProperty> ownProps = getPropertiesByName(cms.readPropertyObjects(resource, false));
            // determine if the title property should be changed in case of a 'NavText' change
            boolean changeOwnTitle = shouldChangeTitle(ownProps);

            String hasNavTextChange = null;
            List<CmsProperty> ownPropertyChanges = new ArrayList<CmsProperty>();
            for (CmsPropertyModification propMod : changes.getChanges()) {
                if (propMod.isFileNameProperty()) {
                    // in case of the file name property, the resource needs to be renamed
                    if ((m_overrideStructureId == null) && !resource.getStructureId().equals(propMod.getId())) {
                        if (propMod.getId() != null) {
                            throw new IllegalStateException("Invalid structure id in property changes.");
                        }
                    }
                    CmsResource.checkResourceName(propMod.getValue());
                    String oldSitePath = CmsFileUtil.removeTrailingSeparator(cms.getSitePath(resource));
                    String parentPath = CmsResource.getParentFolder(oldSitePath);
                    String newSitePath = CmsFileUtil.removeTrailingSeparator(
                        CmsStringUtil.joinPaths(parentPath, propMod.getValue()));
                    if (!oldSitePath.equals(newSitePath)) {
                        cms.moveResource(oldSitePath, newSitePath);
                    }
                    // read the resource again to update name and path
                    resource = cms.readResource(resource.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
                } else {
                    CmsProperty propToModify = null;
                    if ((m_overrideStructureId != null) || resource.getStructureId().equals(propMod.getId())) {

                        if (CmsPropertyDefinition.PROPERTY_NAVTEXT.equals(propMod.getName())) {
                            hasNavTextChange = propMod.getValue();
                        } else if (CmsPropertyDefinition.PROPERTY_TITLE.equals(propMod.getName())) {
                            changeOwnTitle = false;
                        }
                        propToModify = ownProps.get(propMod.getName());
                        if (propToModify == null) {
                            propToModify = new CmsProperty(propMod.getName(), null, null);
                        }
                        ownPropertyChanges.add(propToModify);
                    } else {
                        throw new IllegalStateException("Invalid structure id in property changes!");
                    }
                    String newValue = propMod.getValue();
                    if (newValue == null) {
                        newValue = "";
                    }
                    if (propMod.isStructureValue()) {
                        propToModify.setStructureValue(newValue);
                    } else {
                        propToModify.setResourceValue(newValue);
                    }
                }
            }
            if (hasNavTextChange != null) {
                if (changeOwnTitle) {
                    CmsProperty titleProp = ownProps.get(CmsPropertyDefinition.PROPERTY_TITLE);
                    if (titleProp == null) {
                        titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, null, null);
                    }
                    titleProp.setStructureValue(hasNavTextChange);
                    ownPropertyChanges.add(titleProp);
                }
            }
            if (!ownPropertyChanges.isEmpty()) {
                cms.writePropertyObjects(resource, ownPropertyChanges);
            }
        } finally {
            if (actionRecord.getChange() == LockChange.locked) {
                cms.unlockResource(resource);
            }
        }

    }
767214
public static void createFolder(CmsObject cms, String rootPath) throws CmsException {

        CmsObject rootCms = OpenCms.initCmsObject(cms);
        rootCms.getRequestContext().setSiteRoot("");
        List<String> parents = new ArrayList<String>();
        String currentPath = rootPath;
        while (currentPath != null) {
            if (rootCms.existsResource(currentPath)) {
                break;
            }
            parents.add(currentPath);
            currentPath = CmsResource.getParentFolder(currentPath);
        }
        parents = Lists.reverse(parents);
        for (String parent : parents) {
            try {
                rootCms.createResource(
                    parent,
                    OpenCms.getResourceManager().getResourceType(CmsResourceTypeFolder.getStaticTypeName()));
                try {
                    rootCms.unlockResource(parent);
                } catch (CmsException e) {
                    // may happen if parent folder is locked also
                    if (LOG.isInfoEnabled()) {
                        LOG.info(e);
                    }
                }
            } catch (CmsVfsResourceAlreadyExistsException e) {
                // nop
            }
        }
    }
1310965
public void publishResources(List<CmsResource> resources) throws CmsException {

        CmsObject cms = m_cms;
        I_CmsReport report = new CmsWorkplaceReport(
            cms.getRequestContext().getLocale(),
            cms.getRequestContext().getSiteRoot(),
            null);
        CmsPublishManager publishManager = OpenCms.getPublishManager();
        CmsPublishList publishList = publishManager.getPublishListAll(m_cms, resources, false, true);
        OpenCms.getPublishManager().publishProject(m_cms, report, publishList);
    }
1292599
protected void saveContainerPage(CmsObject cms, Element parent, CmsContainerPageBean cntPage) throws CmsException {

        parent.clearContent();

        // save containers in a defined order
        List<String> containerNames = new ArrayList<String>(cntPage.getNames());
        Collections.sort(containerNames);

        for (String containerName : containerNames) {
            CmsContainerBean container = cntPage.getContainers().get(containerName);

            // the container
            Element cntElement = parent.addElement(XmlNode.Containers.name());
            cntElement.addElement(XmlNode.Name.name()).addCDATA(container.getName());
            cntElement.addElement(XmlNode.Type.name()).addCDATA(container.getType());
            if (container.isNestedContainer()) {
                cntElement.addElement(XmlNode.ParentInstanceId.name()).addCDATA(container.getParentInstanceId());
            }
            if (container.isRootContainer()) {
                cntElement.addElement(XmlNode.IsRootContainer.name()).addText(Boolean.TRUE.toString());
            }

            // the elements
            for (CmsContainerElementBean element : container.getElements()) {
                Element elemElement = cntElement.addElement(XmlNode.Elements.name());

                // the element
                Element uriElem = elemElement.addElement(XmlNode.Uri.name());
                CmsResource uriRes = fillResource(cms, uriElem, element.getId());
                Element formatterElem = elemElement.addElement(XmlNode.Formatter.name());
                fillResource(cms, formatterElem, element.getFormatterId());
                if (element.isCreateNew()) {
                    Element createNewElem = elemElement.addElement(XmlNode.CreateNew.name());
                    createNewElem.addText(Boolean.TRUE.toString());
                }
                // the properties
                Map<String, String> properties = element.getIndividualSettings();
                Map<String, CmsXmlContentProperty> propertiesConf = OpenCms.getADEManager().getElementSettings(
                    cms,
                    uriRes);

                CmsXmlContentPropertyHelper.saveProperties(cms, elemElement, properties, propertiesConf);
            }
        }
    }
825816
protected void saveData() throws CmsException {

        CmsObject cms = m_context.getCms();
        for (CmsResource resource : m_context.getResources()) {
            CmsLockActionRecord actionRecord = null;
            try {
                actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource);

                String secureValue = (String)m_secureField.getValue();
                String exportValue = (String)m_exportField.getValue();
                String exportname = m_exportNameField.getValue();
                CmsProperty secureProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_SECURE, secureValue, null);
                CmsProperty exportProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_EXPORT, exportValue, null);
                CmsProperty exportNameProp = new CmsProperty(
                    CmsPropertyDefinition.PROPERTY_EXPORTNAME,
                    exportname,
                    null);
                boolean internal = m_internalField.getValue().booleanValue();

                cms.writePropertyObjects(resource, Arrays.asList(secureProp, exportProp, exportNameProp));
                resource.setInternal(internal);
                cms.writeResource(resource);
            } finally {
                if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) {
                    try {
                        cms.unlockResource(resource);
                    } catch (CmsLockException e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                    }
                }
            }
        }
    }
759786
public void initialize(CmsObject cms) throws CmsException {

        List<CmsOrganizationalUnit> ous = getOrganizationalUnits(cms, "", true);
        for (CmsOrganizationalUnit ou : ous) {
            try {
                m_securityManager.initializeOrgUnit(cms.getRequestContext(), ou);
            } catch (CmsInitException e) {
                LOG.error("Error while initializing OU " + ou.getName() + ": " + e.getLocalizedMessage(), e);
            }
        }
    }
61195
public void save(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {

        save(cms, cntPage, false);
    }
370675
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());
        }
    }
527859
void save() {

        try {
            byte[] content = m_codeMirror.getValue().getBytes(m_file.getEncoding());
            m_file.getFile().setContents(content);
            A_CmsUI.getCmsObject().writeFile(m_file.getFile());
            m_changed = false;
            m_save.setEnabled(false);
            m_saveAndExit.setEnabled(false);
        } catch (Exception e) {
            CmsErrorDialog.showErrorDialog(e);
        }
    }