Finds relations from the target root folder or its children to the source root folder or its children.<p>

@return the list of relations from the target to the source

@throws CmsException if something goes wrong
770134
protected List<CmsRelation> findRelationsFromTargetToSource() throws CmsException {

        List<CmsRelation> relations = m_cms.readRelations(
            CmsRelationFilter.SOURCES.filterPath(m_targetPath).filterIncludeChildren());
        List<CmsRelation> result = new ArrayList<CmsRelation>();
        for (CmsRelation rel : relations) {
            if (isInTargets(rel.getSourcePath()) && isInSources(rel.getTargetPath())) {
                result.add(rel);
            }
        }
        return result;
    }
32384
protected CmsUserSearchParameters getSearchParams() throws CmsException {

        CmsListState state = getListState();
        CmsUserSearchParameters params = new CmsUserSearchParameters();
        String searchFilter = state.getFilter();
        params.setSearchFilter(searchFilter);
        if (!otherOrgUnitsVisible()) {
            CmsOrganizationalUnit ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), getParamOufqn());
            params.setOrganizationalUnit(ou);
        }
        params.setPaging(getList().getMaxItemsPerPage(), state.getPage());
        CmsRole role = CmsRole.valueOf(getCms().readGroup(getParamRole()));
        Set<CmsGroup> roleGroups = OpenCms.getRoleManager().getRoleGroups(getCms(), role, false);
        params.setAnyGroups(roleGroups);
        params.setSorting(getSortKey(state.getColumn()), state.getOrder().equals(CmsListOrderEnum.ORDER_ASCENDING));
        params.setFilterByGroupOu(false);
        return params;
    }
430855
private List<CmsSearchIndexSource> searchIndexSources() {

        CmsSearchManager manager = OpenCms.getSearchManager();
        return new LinkedList<CmsSearchIndexSource>(manager.getSearchIndexSources().values());

    }
1017313
public List<CmsResource> getMatchedResources() {

        if (m_replace) {
            // re-read the resources to include changes
            List<CmsResource> result = new ArrayList<CmsResource>();
            for (CmsResource resource : m_matchedResources) {
                try {
                    result.add(getCms().readResource(resource.getStructureId()));
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            return result;
        } else {
            return new ArrayList<CmsResource>(m_matchedResources);
        }
    }
241513
public List<TopicRelationship> getPrevTopicRelationships() {
        ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>();
        for (TopicRelationship relationship : topicRelationships) {
            if (relationship.getType() == RelationshipType.PREVIOUS) {
                relationships.add(relationship);
            }
        }
        for (TargetRelationship relationship : topicTargetRelationships) {
            if (relationship.getType() == RelationshipType.PREVIOUS) {
                relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(),
                        relationship.getType()));
            }
        }
        return relationships;
    }
847725
public List<TopicRelationship> getTopicRelationships() {
        ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships);
        for (final TargetRelationship relationship : topicTargetRelationships) {
            relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(),
                    relationship.getType()));
        }
        return relationships;
    }
646440
public List<TopicRelationship> getLinkListTopicRelationships() {
        final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>();
        for (final TopicRelationship relationship : topicRelationships) {
            if (relationship.getType() == RelationshipType.LINKLIST) {
                relationships.add(relationship);
            }
        }
        for (final TargetRelationship relationship : topicTargetRelationships) {
            if (relationship.getType() == RelationshipType.LINKLIST) {
                relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(),
                        relationship.getType()));
            }
        }
        return relationships;
    }
797685
public List<CmsResource> getAllResources() {

        List<CmsResource> result = Lists.newArrayList();
        result.add(m_primaryResource);
        for (CmsResource res : getSecondaryResources()) {
            result.add(res);
        }
        return result;
    }
1237324
protected void copyLocaleRelations() throws CmsException {

        long start = System.currentTimeMillis();
        List<CmsRelation> localeRelations = m_cms.readRelations(
            CmsRelationFilter.ALL.filterType(CmsRelationType.LOCALE_VARIANT));
        for (CmsRelation rel : localeRelations) {
            if (isInSources(rel.getSourcePath()) && isInSources(rel.getTargetPath())) {
                CmsResource newRelationSource = m_translationsById.get(rel.getSourceId());
                CmsResource newRelationTarget = m_translationsById.get(rel.getTargetId());
                if ((newRelationSource != null) && (newRelationTarget != null)) {
                    try {
                        m_cms.addRelationToResource(
                            newRelationSource,
                            newRelationTarget,
                            CmsRelationType.LOCALE_VARIANT.getName());
                    } catch (CmsException e) {
                        LOG.error("Could not transfer locale relation: " + e.getLocalizedMessage(), e);
                    }
                } else {
                    LOG.warn("Could not transfer locale relation because source/target not found in copy: " + rel);
                }
            }
        }
        long end = System.currentTimeMillis();
        LOG.info("Copied locale relations, took " + (end - start) + "ms");
    }
437229
public static List<CmsRelationType> filterDefinedInContent(Collection<CmsRelationType> relationTypes) {

        List<CmsRelationType> result = new ArrayList<CmsRelationType>(relationTypes);
        Iterator<CmsRelationType> it = result.iterator();
        while (it.hasNext()) {
            CmsRelationType type = it.next();
            if (!type.isDefinedInContent()) {
                it.remove();
            }
        }
        return result;
    }
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);
    }
288293
public static List<CmsRelationType> getAll() {

        List<CmsRelationType> all = new ArrayList<CmsRelationType>(Arrays.asList(VALUE_ARRAY));
        all.addAll(OpenCms.getResourceManager().getRelationTypes());
        return Collections.unmodifiableList(all);
    }
74609
public List<CmsContainerElementBean> getRecentList(CmsObject cms) throws CmsException {

        CmsUser user = cms.getRequestContext().getCurrentUser();
        Object obj = user.getAdditionalInfo(ADDINFO_ADE_RECENT_LIST);

        List<CmsContainerElementBean> recentList = new ArrayList<CmsContainerElementBean>();
        if (obj instanceof String) {
            try {
                JSONArray array = new JSONArray((String)obj);
                for (int i = 0; i < array.length(); i++) {
                    try {
                        recentList.add(elementFromJson(array.getJSONObject(i)));
                    } catch (Throwable e) {
                        // should never happen, catches wrong or no longer existing values
                        LOG.warn(e.getLocalizedMessage());
                    }
                }
            } catch (Throwable e) {
                // should never happen, catches json parsing
                LOG.warn(e.getLocalizedMessage());
            }
        } else {
            // save to be better next time
            saveRecentList(cms, recentList);
        }

        return recentList;
    }
1081403
public List<CoNLLWord> findChildren(CoNLLWord word, String relation)
    {
        List<CoNLLWord> result = new LinkedList<CoNLLWord>();
        for (CoNLLWord other : this)
        {
            if (other.HEAD == word && other.DEPREL.equals(relation))
                result.add(other);
        }
        return result;
    }
175732
public List<TopicRelationship> getRelatedTopicRelationships() {
        final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>();
        /* Check the topic to topic relationships for related relationships */
        for (final TopicRelationship relationship : topicRelationships) {
            if (relationship.getType() == RelationshipType.REFER_TO) {
                relationships.add(relationship);
            }
        }
        /* Check the topic to target relationships for related relationships */
        for (final TargetRelationship relationship : topicTargetRelationships) {
            if (relationship.getType() == RelationshipType.REFER_TO) {
                relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(),
                        relationship.getType()));
            }
        }
        return relationships;
    }
794221
public void addRelationToResource(String resourceName, String targetPath, String type) throws CmsException {

        createRelation(resourceName, targetPath, type, false);
    }
1011803
public List<Relation> getRelations(Collection<Long> relationIds)
	{
		if(relationIds.isEmpty()) return Collections.emptyList();
		return getSomeElements(RELATION + "s?" + RELATION + "s=" + toCommaList(relationIds), Relation.class);
	}