Gets the virtual resources to add to the root folder.<p>

@param cms the CMS context to use
@return the virtual resources for the root folder

@throws CmsException if something goes wrong
427032
private List<CmsResource> getVirtualResourcesForRoot(CmsObject cms) throws CmsException {

        CmsResource resource = createFakeFolder(BASE_PATH);
        return Arrays.asList(resource);
    }
1225169
private List<String> getPropertyNames(CmsObject cms) throws CmsException {

        List<CmsPropertyDefinition> propDefs = cms.readAllPropertyDefinitions();
        List<String> result = new ArrayList<String>();
        for (CmsPropertyDefinition propDef : propDefs) {
            result.add(propDef.getName());
        }
        return result;
    }
1032690
protected List<CmsResource> getInternalResources(CmsObject cms, Map<String, String> params) throws CmsException {

        synchronized (this) {
            if (m_resources == null) {
                m_resources = getResources(cms, params);
                Iterator<CmsResource> it = m_resources.iterator();
                while (it.hasNext()) {
                    CmsResource resource = it.next();
                    m_resCache.put(resource.getStructureId().toString(), resource);
                }
            }
        }
        return m_resources;
    }
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);
    }
898031
public CmsResource getOrCreateFolder(CmsObject cms) throws CmsException {

        CmsResource result = getFolder(cms);
        if (result != null) {
            return result;
        }
        return createFolder(cms);
    }
9943
protected CmsResource getResource(CmsUUID structureId) throws CmsException {

        if (m_cachedResources.containsKey(structureId)) {
            return m_cachedResources.get(structureId);
        }
        return m_cms.readResource(structureId);
    }
1229999
protected CmsTemplateLoaderFacade getTemplateLoaderFacade(
        CmsObject cms,
        CmsResource resource,
        HttpServletRequest req)
    throws CmsException {

        return OpenCms.getResourceManager().getTemplateLoaderFacade(
            cms,
            req,
            resource,
            getTemplatePropertyDefinition());
    }
976117
public String getSubSiteRoot(CmsObject cms, String rootPath) {

        CmsADEConfigData configData = lookupConfiguration(cms, rootPath);
        String basePath = configData.getBasePath();
        String siteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
        if (siteRoot == null) {
            siteRoot = "";
        }
        if ((basePath == null) || !basePath.startsWith(siteRoot)) {
            // the subsite root should always be below the site root
            return siteRoot;
        } else {
            return basePath;
        }
    }
696937
public List<CmsResource> getAllResources() {

        List<CmsResource> all = new ArrayList<CmsResource>();
        all.addAll(m_folderList);
        all.addAll(m_fileList);
        all.addAll(m_deletedFolderList);

        Collections.sort(all, I_CmsResource.COMPARE_ROOT_PATH);
        return Collections.unmodifiableList(all);
    }
826570
private List<CmsResource> getResources() {

        List<CmsResource> result = new LinkedList<CmsResource>();
        CmsObject cms = getCms();
        CmsResourceFilter filter = CmsResourceFilter.ALL;
        try {
            for (String path : m_paths) {
                List<CmsResource> resources = cms.readResources(path, filter, true);
                // filter out any resource that is no XML content:
                for (CmsResource resource : resources) {
                    if (resource.isFile()) {
                        if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                            result.add(resource);
                        } else if (CmsResourceTypeXmlPage.isXmlPage(resource)) {
                            result.add(resource);
                        }
                    }
                }
            }
        } catch (CmsException e) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_LANGUAGECOPY_READRESOURCES_0), e);
            result = Collections.emptyList();
        }

        return result;
    }
152668
public CmsResourceUtil getResourceUtil() {

        if (m_resourceUtil == null) {
            try {
                m_resourceUtil = new CmsResourceUtil(OpenCms.initCmsObject(getCms()));
                m_resourceUtil.setReferenceProject(getProject());
            } catch (CmsException ex) {
                if (LOG.isErrorEnabled()) {
                    LOG.error(ex.getLocalizedMessage(), ex);
                }
            }
        }
        return m_resourceUtil;
    }
7799
public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {

        CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
        CmsProject project = null;
        switch (getType()) {
            case explorerFolder:
                CmsResource folder = cms.readResource(getStructureId(), filter);
                project = cms.readProject(getProjectId());
                cms.getRequestContext().setSiteRoot(getSiteRoot());
                cms.getRequestContext().setCurrentProject(project);
                String explorerLink = CmsVaadinUtils.getWorkplaceLink()
                    + "#!"
                    + CmsFileExplorerConfiguration.APP_ID
                    + "/"
                    + getProjectId()
                    + "!!"
                    + getSiteRoot()
                    + "!!"
                    + cms.getSitePath(folder);
                return explorerLink;
            case page:
                project = cms.readProject(getProjectId());
                CmsResource target = cms.readResource(getStructureId(), filter);
                CmsResource detailContent = null;
                String link = null;
                cms.getRequestContext().setCurrentProject(project);
                cms.getRequestContext().setSiteRoot(getSiteRoot());
                if (getDetailId() != null) {
                    detailContent = cms.readResource(getDetailId());
                    link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
                        cms,
                        cms.getSitePath(detailContent),
                        cms.getSitePath(target),
                        false);
                } else {
                    link = OpenCms.getLinkManager().substituteLink(cms, target);
                }
                return link;
            default:
                return null;
        }
    }
169830
public static Resource getSmallIconResource(CmsExplorerTypeSettings explorerType, String resourceName) {

        if (explorerType == null) {
            explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
                (resourceName == null) && !CmsResource.isFolder(resourceName)
                ? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME
                : "unknown_folder");
        }

        if (!explorerType.getIconRules().isEmpty() && (resourceName != null)) {
            String extension = CmsResource.getExtension(resourceName);
            if (extension != null) {
                CmsIconRule rule = explorerType.getIconRules().get(extension);
                if ((rule != null) && (rule.getSmallIconStyle() != null)) {
                    return new CmsCssIcon(rule.getSmallIconStyle());
                }
            }
        }
        if (explorerType.getSmallIconStyle() != null) {
            return new CmsCssIcon(explorerType.getSmallIconStyle());
        } else {
            return new ExternalResource(
                CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + explorerType.getOriginalIcon()));
        }
    }
217380
protected List<CmsOrganizationalUnit> getOrgUnits() throws CmsException {

        List<CmsOrganizationalUnit> ret = new ArrayList<CmsOrganizationalUnit>();
        CmsRole role = null;
        if (getParamRole() != null) {
            role = CmsRole.valueOfGroupName(getParamRole());
        }
        String ou = getParamOufqn();
        if (ou == null) {
            ou = "";
        }
        if (role != null) {
            ret.addAll(OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), role.forOrgUnit(ou), true));
        } else {
            ret.addAll(OpenCms.getOrgUnitManager().getOrganizationalUnits(getCms(), ou, true));
        }
        return ret;
    }
872679
protected CmsObject rootCms(CmsObject cms) throws CmsException {

        CmsObject result = OpenCms.initCmsObject(cms);
        result.getRequestContext().setSiteRoot("");
        return result;
    }
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;
    }
620669
protected List<Locale> getLocalesForResource(CmsObject cms, String resource) {

        List<Locale> locales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource);
        if ((locales == null) || locales.isEmpty()) {
            locales = OpenCms.getLocaleManager().getAvailableLocales();
        }
        return locales;
    }