Loads the children of the already loaded resources.<p>

@throws CmsException if something goes wrong
189437
private void loadChildren() throws CmsException {

        for (CmsResource resource : new ArrayList<CmsResource>(m_knownResources)) {
            if (resource.isFolder()) {
                if (!m_mustLoadChildren.contains(resource)) {
                    continue;
                }
                List<CmsResource> children = getChildren(resource);
                for (CmsResource child : children) {
                    m_knownResources.add(child);
                    m_childMap.put(resource, child);
                }
            }
        }
    }
1090239
private void initMacroContent() throws CmsException {

        I_CmsFormatterBean formatterConfig = OpenCms.getADEManager().getCachedFormatters(
            m_cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
                m_element.getFormatterId());
        if (formatterConfig instanceof CmsMacroFormatterBean) {
            CmsMacroFormatterBean config = (CmsMacroFormatterBean)formatterConfig;
            m_input = config.getMacroInput();
            m_formatterReferences = config.getReferencedFormatters();
            if (m_element.isInMemoryOnly()) {
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(config.getPlaceholderMacroInput())) {
                    m_input = config.getPlaceholderMacroInput();
                }
                if (config.getDefaultContentStructureId() != null) {
                    try {
                        CmsResource defaultContent = m_cms.readResource(
                            ((CmsMacroFormatterBean)formatterConfig).getDefaultContentStructureId());
                        CmsFile defaultFile = m_cms.readFile(defaultContent);
                        m_element = new CmsContainerElementBean(
                            defaultFile,
                            m_element.getFormatterId(),
                            m_element.getIndividualSettings(),
                            true,
                            m_element.editorHash(),
                            m_element.isCreateNew());
                    } catch (CmsException e) {
                        LOG.error("Error reading default content for new resource", e);
                    }
                }
            }
        } else {
            // only as a fall back, should not be used
            m_formatterReferences = new HashMap<String, CmsUUID>();
            CmsResource macroContent = m_cms.readResource(m_element.getFormatterId());
            CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(m_cms, macroContent, m_request);
            m_input = xmlContent.getStringValue(m_cms, CmsFormatterBeanParser.N_MACRO, CmsLocaleManager.MASTER_LOCALE);
            List<I_CmsXmlContentValue> formatters = xmlContent.getValues(
                CmsFormatterBeanParser.N_FORMATTERS,
                CmsLocaleManager.MASTER_LOCALE);
            for (I_CmsXmlContentValue formatterValue : formatters) {
                CmsXmlVfsFileValue file = (CmsXmlVfsFileValue)xmlContent.getValue(
                    formatterValue.getPath() + "/" + CmsFormatterBeanParser.N_FORMATTER,
                    CmsLocaleManager.MASTER_LOCALE);
                String macroName = xmlContent.getStringValue(
                    m_cms,
                    formatterValue.getPath() + "/" + CmsFormatterBeanParser.N_MACRO_NAME,
                    CmsLocaleManager.MASTER_LOCALE);
                m_formatterReferences.put(macroName, file.getLink(m_cms).getStructureId());
            }
        }
    }
911902
public void init(CmsObject cms) {

        m_cms = cms;
        m_result = null;
        m_lastException = null;
        m_pageCount = 0;
        m_nextUrl = null;
        m_prevUrl = null;
    }
1056579
private void deleteResource(CmsResource resource) throws CmsException {

        String path = null;
        CmsObject cms = getCmsObject();
        try {
            path = cms.getSitePath(resource);
            cms.lockResource(path);
            cms.deleteResource(path, CmsResource.DELETE_PRESERVE_SIBLINGS);
            // check if any detail container page resources exist to this resource
            List<CmsResource> detailContainers = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, resource);
            for (CmsResource detailContainer : detailContainers) {
                deleteResource(detailContainer);
            }
        } finally {
            try {
                if (path != null) {
                    getCmsObject().unlockResource(path);
                }
            } catch (Exception e) {
                // should really never happen
                LOG.debug(e.getLocalizedMessage(), e);
            }
        }
    }
248193
public void finish() throws CmsException {

        m_finished = true;
        m_requiresCleanup = false;
        CmsProject project = getProject();
        CmsObject projectCms = OpenCms.initCmsObject(m_adminCms);
        projectCms.getRequestContext().setCurrentProject(project);
        if (m_configuration.isAutoPublish()) {
            // we don't necessarily publish with the user who has the locks on the resources, so we need to steal the locks
            List<CmsResource> projectResources = projectCms.readProjectView(project.getUuid(), CmsResource.STATE_KEEP);
            for (CmsResource projectResource : projectResources) {
                CmsLock lock = projectCms.getLock(projectResource);
                if (!lock.isUnlocked() && !lock.isLockableBy(projectCms.getRequestContext().getCurrentUser())) {
                    projectCms.changeLock(projectResource);
                }
            }
            OpenCms.getPublishManager().publishProject(
                projectCms,
                new CmsLogReport(Locale.ENGLISH, CmsUgcSession.class));
        } else {
            // try to unlock everything - we don't need this in case of auto-publish, since publishing already unlocks the resources
            projectCms.unlockProject(project.getUuid());
        }

    }
1008583
private void init() throws CmsException {

        // first get all installed plugins
        // plugins are subfolders of the "/plugin/" folder with a template
        // property holdding the name of the plugin class
        List resources = m_cms.readResourcesWithProperty(VFS_PATH_PLUGIN_FOLDER, CmsToolManager.HANDLERCLASS_PROPERTY);
        Iterator i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = (CmsResource)i.next();
            // ony check folders
            if (res.isFolder()) {
                String classname = m_cms.readPropertyObject(
                    res.getRootPath(),
                    CmsToolManager.HANDLERCLASS_PROPERTY,
                    false).getValue();
                try {
                    Object objectInstance = Class.forName(classname).newInstance();
                    if (objectInstance instanceof I_CmsContentCheck) {
                        I_CmsContentCheck plugin = (I_CmsContentCheck)objectInstance;
                        plugin.init(m_cms);
                        // store the plugin instance
                        m_plugins.add(plugin);
                        LOG.info(Messages.get().getBundle().key(Messages.LOG_CREATE_PLUGIN_1, classname));
                    } else {
                        LOG.warn(Messages.get().getBundle().key(Messages.LOG_CANNOT_CREATE_PLUGIN_1, classname));
                    }
                } catch (Throwable t) {
                    LOG.error(Messages.get().getBundle().key(Messages.LOG_CANNOT_CREATE_PLUGIN_2, classname, t));
                }
            }
        }
    }
998372
protected void updateSearchRoot() throws CmsException {

        CmsObject newCms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
        newCms.getRequestContext().setSiteRoot((String)m_siteSelect.getValue());
        m_searchRoot.setCmsObject(newCms);
        m_searchRoot.setValue("/");

    }
590283
protected void init() throws CmsException {

        m_cms = OpenCms.initCmsObject(m_cms);
        // we want to use autocorrection when writing XML contents back
        //m_cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE);
        m_cms.getRequestContext().setSiteRoot("");
        List<CmsPair<CmsResource, CmsResource>> allMatchingResources = Lists.newArrayList();
        for (CmsPair<String, String> pair : m_sourceTargetPairs) {
            List<CmsPair<CmsResource, CmsResource>> matchingResources = getMatchingResources(
                pair.getFirst(),
                pair.getSecond());
            allMatchingResources.addAll(matchingResources);
        }
        for (CmsPair<CmsResource, CmsResource> resPair : allMatchingResources) {
            CmsResource source = resPair.getFirst();
            CmsResource target = resPair.getSecond();
            m_translationsById.put(source.getStructureId(), target);
            m_translationsByPath.put(source.getRootPath(), target);
        }
    }
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);
            }
        }
    }
837386
private CmsResource readResource(String resourceName) throws CmsException {

        CmsResource resource = null;
        try {
            resource = getCms().readResource(resourceName, CmsResourceFilter.ALL);
        } catch (CmsVfsResourceNotFoundException e) {
            throw new CmsVfsResourceNotFoundException(
                Messages.get().container(
                    Messages.ERR_RESOURCE_DOES_NOT_EXIST_3,
                    resourceName,
                    getCms().getRequestContext().getCurrentProject().getName(),
                    getCms().getRequestContext().getSiteRoot()),
                e);
        }
        return resource;
    }
214273
protected void findRoot(Collection<CmsResource> resources) throws CmsException {

        m_commonRoot = getCommonSite(resources);
        String commonPath = getCommonAncestorPath(resources);
        try {
            m_rootResource = m_cms.readResource(m_commonRoot, m_filter);
        } catch (CmsVfsResourceNotFoundException e) {
            String currentPath = commonPath;
            String lastWorkingPath = null;
            while (m_cms.existsResource(currentPath, m_filter)) {
                lastWorkingPath = currentPath;
                currentPath = CmsResource.getParentFolder(currentPath);
            }
            m_rootResource = m_cms.readResource(lastWorkingPath, m_filter);
            m_commonRoot = lastWorkingPath;
        }
        m_knownResources.add(m_rootResource);
    }
531709
void reload() {

        CmsRpcAction<CmsResourceStatusBean> action = new CmsRpcAction<CmsResourceStatusBean>() {

            @Override
            public void execute() {

                start(0, true);
                CmsCoreProvider.getVfsService().getResourceStatus(
                    m_structureId,
                    CmsCoreProvider.get().getLocale(),
                    m_includeTargets,
                    m_detailContentId,
                    null,
                    this);
            }

            @Override
            protected void onResponse(CmsResourceStatusBean result) {

                reinitContent(result);
            }
        };
        action.execute();
    }
176801
public void loadRecent(final I_CmsSimpleCallback<List<CmsContainerElementData>> callback) {

        CmsRpcAction<List<CmsContainerElementData>> action = new CmsRpcAction<List<CmsContainerElementData>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(200, true);
                getContainerpageService().getRecentList(
                    CmsCoreProvider.get().getStructureId(),
                    getData().getDetailId(),
                    getPageState(),
                    getLocale(),
                    this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(List<CmsContainerElementData> result) {

                stop(false);
                addElements(result);
                callback.execute(result);
            }
        };
        action.execute();
    }
437291
public void parse(CmsResource resource) throws CmsException {

        CmsFile file = m_cms.readFile(resource);
        m_resource = resource;
        CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
        parse(content);
    }
977433
private void loadCategories() {

        CmsRpcAction<List<CmsCategoryTreeEntry>> action = new CmsRpcAction<List<CmsCategoryTreeEntry>>() {

            @Override
            public void execute() {

                start(200, true);
                CmsCoreProvider.getService().getCategoriesForSitePath(m_dialogBean.getReferenceSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsCategoryTreeEntry> result) {

                m_dialogBean.setCategories(result);
                m_handler.setCategoriesTabContent(result, new ArrayList<String>());
                m_handler.onCategoriesTabSelection();
                stop(false);
            }
        };
        action.execute();
    }
317396
public void save() throws CmsException {

        if (hasChanges()) {
            switch (m_bundleType) {
                case PROPERTY:
                    saveLocalization();
                    saveToPropertyVfsBundle();
                    break;

                case XML:
                    saveLocalization();
                    saveToXmlVfsBundle();

                    break;

                case DESCRIPTOR:
                    break;
                default:
                    throw new IllegalArgumentException();
            }
            if (null != m_descFile) {
                saveToBundleDescriptor();
            }

            resetChanges();
        }

    }
1316729
public void reload() {

        List<CmsResource> settingConfigResources = new ArrayList<>();
        try {
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(TYPE_SETTINGS_CONFIG);
            CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(type);
            settingConfigResources.addAll(m_cms.readResources("/", filter));
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        Map<CmsUUID, List<CmsXmlContentProperty>> settingConfigs = new HashMap<>();
        for (CmsResource resource : settingConfigResources) {
            parseSettingsConfig(resource, settingConfigs);
        }
        m_settingConfigs = settingConfigs;

        List<CmsResource> formatterResources = new ArrayList<CmsResource>();
        try {
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(TYPE_FORMATTER_CONFIG);
            CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(type);
            formatterResources.addAll(m_cms.readResources("/", filter));
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        try {
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(TYPE_MACRO_FORMATTER);
            CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(type);
            formatterResources.addAll(m_cms.readResources("/", filter));
            I_CmsResourceType typeFlex = OpenCms.getResourceManager().getResourceType(TYPE_FLEX_FORMATTER);
            CmsResourceFilter filterFlex = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(typeFlex);
            formatterResources.addAll(m_cms.readResources("/", filterFlex));
            I_CmsResourceType typeFunction = OpenCms.getResourceManager().getResourceType(
                CmsResourceTypeFunctionConfig.TYPE_NAME);
            CmsResourceFilter filterFunction = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(typeFunction);
            formatterResources.addAll(m_cms.readResources("/", filterFunction));
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        Map<CmsUUID, I_CmsFormatterBean> newFormatters = Maps.newHashMap();
        for (CmsResource formatterResource : formatterResources) {
            I_CmsFormatterBean formatterBean = readFormatter(formatterResource.getStructureId());
            if (formatterBean != null) {
                newFormatters.put(formatterResource.getStructureId(), formatterBean);
            }
        }
        m_state = new CmsFormatterConfigurationCacheState(newFormatters);

    }