Returns a list of resource wrappers created from the input list of resources.

@param cms the current OpenCms user context
@param list the list to create the resource wrapper list from

@return the list of wrapped resources.
335309
public static List<CmsJspResourceWrapper> convertResourceList(CmsObject cms, List<CmsResource> list) {

        List<CmsJspResourceWrapper> result = new ArrayList<CmsJspResourceWrapper>(list.size());
        for (CmsResource res : list) {
            result.add(CmsJspResourceWrapper.wrap(cms, res));
        }
        return result;
    }
1156695
public List<CmsRole> getRolesForResource(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException {

        return m_securityManager.getRolesForResource(cms.getRequestContext(), user, resource);
    }
900239
protected Map<String, List<CmsResource>> createFolderLookupMap(List<CmsResource> resources) {

        Map<String, List<CmsResource>> result = new HashMap<String, List<CmsResource>>(128);
        Iterator<CmsResource> i = resources.iterator();
        while (i.hasNext()) {
            CmsResource res = i.next();
            String folderPath = CmsResource.getFolderPath(res.getRootPath());
            List<CmsResource> folderContent = result.get(folderPath);
            if (folderContent == null) {
                folderContent = new ArrayList<CmsResource>(32);
                result.put(folderPath, folderContent);
            }
            folderContent.add(res);
        }

        return result;
    }
680727
public CmsPublishResourcesList getPublishResourcesList() throws JspException {

        if (getPublishList() != null) {
            return new CmsPublishResourcesList(
                getJsp(),
                getParentFolder(),
                Boolean.valueOf(getParamRelatedresources()).booleanValue());
        }

        return null;
    }
76609
protected List<CmsPublishedResource> findRelatedContainerPages(
        CmsObject adminCms,
        List<CmsPublishedResource> updateResources) {

        Set<CmsResource> elementGroups = new HashSet<CmsResource>();
        Set<CmsResource> containerPages = new HashSet<CmsResource>();
        int containerPageTypeId = -1;
        try {
            containerPageTypeId = CmsResourceTypeXmlContainerPage.getContainerPageTypeId();
        } catch (CmsLoaderException e) {
            // will happen during setup, when container page type is not available yet
            LOG.info(e.getLocalizedMessage(), e);
        }
        if (containerPageTypeId != -1) {
            for (CmsPublishedResource pubRes : updateResources) {
                try {
                    if (OpenCms.getResourceManager().getResourceType(
                        pubRes.getType()) instanceof CmsResourceTypeXmlContent) {
                        CmsRelationFilter filter = CmsRelationFilter.relationsToStructureId(pubRes.getStructureId());
                        filter.filterStrong();
                        List<CmsRelation> relations = adminCms.readRelations(filter);
                        for (CmsRelation relation : relations) {
                            CmsResource res = relation.getSource(adminCms, CmsResourceFilter.ALL);
                            if (CmsResourceTypeXmlContainerPage.isContainerPage(res)) {
                                containerPages.add(res);
                                if (CmsDetailOnlyContainerUtil.isDetailContainersPage(
                                    adminCms,
                                    adminCms.getSitePath(res))) {
                                    addDetailContent(adminCms, containerPages, adminCms.getSitePath(res));
                                }
                            } else if (OpenCms.getResourceManager().getResourceType(
                                res.getTypeId()).getTypeName().equals(
                                    CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME)) {
                                elementGroups.add(res);
                            }
                        }
                    }
                    if (containerPageTypeId == pubRes.getType()) {
                        addDetailContent(
                            adminCms,
                            containerPages,
                            adminCms.getRequestContext().removeSiteRoot(pubRes.getRootPath()));
                    }
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            for (CmsResource pubRes : elementGroups) {
                try {
                    CmsRelationFilter filter = CmsRelationFilter.relationsToStructureId(pubRes.getStructureId());
                    filter.filterStrong();
                    List<CmsRelation> relations = adminCms.readRelations(filter);
                    for (CmsRelation relation : relations) {
                        CmsResource res = relation.getSource(adminCms, CmsResourceFilter.ALL);
                        if (CmsResourceTypeXmlContainerPage.isContainerPage(res)) {
                            containerPages.add(res);
                            if (CmsDetailOnlyContainerUtil.isDetailContainersPage(
                                adminCms,
                                adminCms.getSitePath(res))) {
                                addDetailContent(adminCms, containerPages, adminCms.getSitePath(res));
                            }
                        }
                    }
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            // add all found container pages as published resource objects to the list
            for (CmsResource page : containerPages) {
                CmsPublishedResource pubCont = new CmsPublishedResource(page);
                if (!updateResources.contains(pubCont)) {
                    // ensure container page is added only once
                    updateResources.add(pubCont);
                }
            }
        }
        return updateResources;
    }
845873
private List<CmsDecorationMap> getDecorationMaps(CmsObject cms, List<CmsResource> decorationListFiles) {

        List<CmsDecorationMap> decorationMaps = new ArrayList<CmsDecorationMap>();
        Iterator<CmsResource> i = decorationListFiles.iterator();
        while (i.hasNext()) {
            CmsResource res = i.next();
            try {
                CmsDecorationMap decMap = (CmsDecorationMap)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(
                    cms,
                    res.getRootPath());
                if (decMap == null) {
                    decMap = new CmsDecorationMap(cms, res, this);
                    CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, res.getRootPath(), decMap);
                }

                decorationMaps.add(decMap);
            } catch (CmsException e) {
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.LOG_DECORATION_DEFINITION_CREATE_MAP_2,
                            res.getName(),
                            e));
                }
            }
        }
        return decorationMaps;
    }
272868
protected List<CmsResource> readTree(String rootPath) throws CmsException {

        rootPath = CmsFileUtil.removeTrailingSeparator(rootPath);
        CmsResource base = m_cms.readResource(rootPath);

        I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(base);
        List<CmsResource> result = new ArrayList<CmsResource>();
        if (resType.isFolder()) {
            rootPath = CmsStringUtil.joinPaths(rootPath, "/");
            List<CmsResource> subResources = m_cms.readResources(rootPath, CmsResourceFilter.ALL, true);
            result.add(base);
            result.addAll(subResources);
        } else {
            result.add(base);
        }
        for (CmsResource resource : result) {
            m_cachedResources.put(resource.getStructureId(), resource);
        }

        return result;
    }
1030784
public static List<CmsResource> getDetailOnlyResources(CmsObject cms, CmsResource resource) {

        List<CmsResource> result = new ArrayList<CmsResource>();
        Set<String> resourcePaths = new HashSet<String>();
        String sitePath = cms.getSitePath(resource);
        for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
            resourcePaths.add(getDetailOnlyPageNameWithoutLocaleCheck(sitePath, locale.toString()));
        }
        // in case the deprecated locale less detail container resource exists
        resourcePaths.add(getDetailOnlyPageNameWithoutLocaleCheck(sitePath, null));
        // add the locale independent detail container resource
        resourcePaths.add(getDetailOnlyPageNameWithoutLocaleCheck(sitePath, LOCALE_ALL));
        for (String path : resourcePaths) {
            try {
                CmsResource detailContainers = cms.readResource(path, CmsResourceFilter.IGNORE_EXPIRATION);
                result.add(detailContainers);
            } catch (CmsException e) {
                // will happen in case resource does not exist, ignore
            }
        }
        return result;
    }
538049
public static CmsResourceTypeStatResultList init(CmsResourceTypeStatResultList resList) {

        if (resList == null) {
            return new CmsResourceTypeStatResultList();
        }

        resList.deleteOld();
        return resList;
    }
207256
public List<CmsResource> getUsersPubList(CmsObject cms) throws CmsException {

        return m_securityManager.getUsersPubList(cms.getRequestContext());
    }
226752
public static List<String> getManagableOUs(CmsObject cms) {

        List<String> ous = new ArrayList<String>();
        try {
            for (CmsRole role : OpenCms.getRoleManager().getRolesOfUser(
                cms,
                cms.getRequestContext().getCurrentUser().getName(),
                "",
                true,
                false,
                true)) {
                if (role.getRoleName().equals(CmsRole.ACCOUNT_MANAGER.getRoleName())) {
                    if (role.getOuFqn().equals("")) {
                        ous.add(0, role.getOuFqn());
                    } else {
                        ous.add(role.getOuFqn());
                    }
                }
            }
        } catch (CmsException e) {
            //
        }
        return ous;
    }
888329
protected List<String> getSiblingsList(CmsObject cms, String resPath) {

        List<String> siblings = new ArrayList<String>();
        try {
            List<CmsResource> li = cms.readSiblings(resPath, CmsResourceFilter.ALL);
            for (int i = 0, l = li.size(); i < l; i++) {
                String vfsName = (li.get(i)).getRootPath();
                siblings.add(vfsName);
            }
        } catch (CmsVfsResourceNotFoundException e) {
            // resource not found, probably because the export user has no read permission on the resource, ignore
        } catch (CmsSecurityException e) {
            // security exception, probably because the export user has no read permission on the resource, ignore
        } catch (CmsException e) {
            // ignore, nothing to do about this
            if (LOG.isWarnEnabled()) {
                LOG.warn(Messages.get().getBundle().key(Messages.LOG_FETCHING_SIBLINGS_FAILED_1, resPath), e);
            }
        }
        if (!siblings.contains(resPath)) {
            // always add the resource itself, this has to be done because if the resource was
            // deleted during publishing, the sibling lookup above will produce no results
            siblings.add(resPath);
        }
        return siblings;
    }
1310544
protected List<CmsResource> getSitemapSubEntryResources(String rootPath) throws CmsException {

        CmsObject rootCms = OpenCms.initCmsObject(getCmsObject());
        List<CmsResource> result = new ArrayList<CmsResource>();
        rootCms.getRequestContext().setSiteRoot("");
        CmsJspNavBuilder navBuilder = new CmsJspNavBuilder(rootCms);
        for (CmsJspNavElement navElement : navBuilder.getNavigationForFolder(
            rootPath,
            Visibility.all,
            CmsResourceFilter.ONLY_VISIBLE)) {
            if ((navElement != null) && navElement.isInNavigation()) {
                result.add(navElement.getResource());
            }
        }
        return result;
    }
639316
protected List<CmsResource> getCategoryItems() {

        List<CmsResource> result = Collections.emptyList();
        if (CmsStringUtil.isNotEmpty(getParamGalleryPath())) {
            try {
                CmsCategoryService service = CmsCategoryService.getInstance();
                // get the edited resource if present
                String editedResource = "/";
                if (CmsStringUtil.isNotEmpty(getParamResource())) {
                    editedResource = CmsResource.getFolderPath(getParamResource());
                }
                // read the matching resources for the category
                result = service.readCategoryResources(getCms(), getParamGalleryPath(), true, editedResource);
                // filter the matched resources to get only the specific items as result
                int resTypeId = getGalleryItemsTypeId();
                if (resTypeId != -1) {
                    List<CmsResource> unfiltered = new ArrayList<CmsResource>(result);
                    result = new ArrayList<CmsResource>(unfiltered.size());
                    Iterator<CmsResource> i = unfiltered.iterator();
                    while (i.hasNext()) {
                        CmsResource res = i.next();
                        if (res.getTypeId() == resTypeId) {
                            result.add(res);
                        }
                    }
                }
            } catch (CmsException e) {
                // error reading resources
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            } catch (NullPointerException e) {
                // ignore this exception
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
        return result;
    }
62543
protected List<String> getResourceNamesFromParam(Map<String, String> params) {

        String resourcesParam = "/";
        if (params.containsKey(I_CmsListResourceCollector.PARAM_RESOURCES)) {
            resourcesParam = params.get(I_CmsListResourceCollector.PARAM_RESOURCES);
        }
        if (resourcesParam.length() == 0) {
            return Collections.emptyList();
        }
        return CmsStringUtil.splitAsList(resourcesParam, "#");
    }
914651
public List<CmsLink> getLinks(CmsObject cms) {

        List<CmsLink> result = new ArrayList<CmsLink>();

        @SuppressWarnings("unchecked")
        List<Element> linkElements = m_element.elements(CmsXmlPage.NODE_LINK);
        for (Element linkElement : linkElements) {
            if (linkElement == null) {
                String uri = m_element.getText();
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(uri)) {
                    setStringValue(cms, uri);
                }
            }
            CmsLinkUpdateUtil.updateType(linkElement, getRelationType(getPath()));
            CmsLink link = new CmsLink(linkElement);
            link.checkConsistency(cms);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(link.getTarget())) {
                continue;
            }
            result.add(link);
        }
        return result;
    }
324026
private List<CmsResource> idsToResources(CmsObject cms, List<CmsUUID> ids) {

        List<CmsResource> result = new ArrayList<CmsResource>();
        for (CmsUUID id : ids) {
            try {
                CmsResource resource = cms.readResource(id, CmsResourceFilter.ALL);
                result.add(resource);
            } catch (CmsException e) {
                // should never happen
                logError(e);
            }
        }
        return result;
    }