Returns the search field mappings declared within the XSD.<p>

@param cms the CmsObject
@param resource the resource

@return the fields to map
486761
protected Set<CmsSearchField> getXSDMappings(CmsObject cms, CmsResource resource) {

        try {
            if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                I_CmsXmlContentHandler handler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource);
                if ((handler != null) && !handler.getSearchFields().isEmpty()) {
                    return handler.getSearchFields();
                }
            }
        } catch (CmsException e) {
            LOG.error(e.getMessage(), e);
        }
        return null;
    }
1157690
public Map<String, String> getParameters(CmsObject cms) {

        Map<String, String> result = new LinkedHashMap<String, String>(m_parameters);
        if (cms != null) {
            String userParamsStr = (String)(cms.getRequestContext().getCurrentUser().getAdditionalInfo().get(
                "ADE_PARAMS"));
            if (userParamsStr != null) {
                Map<String, String> userParams = CmsStringUtil.splitAsMap(userParamsStr, "|", ":");
                result.putAll(userParams);
            }
        }
        return result;
    }
887813
private static CmsXmlContainerPage getCache(CmsObject cms, CmsResource resource, boolean keepEncoding) {

        if (resource instanceof I_CmsHistoryResource) {
            return null;
        }
        return getCache().getCacheContainerPage(
            getCache().getCacheKey(resource.getStructureId(), keepEncoding),
            cms.getRequestContext().getCurrentProject().isOnlineProject());
    }
1168054
protected CmsLink getXsdLink(CmsObject cms, CmsXmlContent xmlContent) {

        String schema = xmlContent.getContentDefinition().getSchemaLocation();
        if (schema.startsWith(CmsXmlEntityResolver.OPENCMS_SCHEME)) {
            if (CmsXmlEntityResolver.isInternalId(schema)) {
                return null;
            }
            schema = schema.substring(CmsXmlEntityResolver.OPENCMS_SCHEME.length() - 1);
        } else if (CmsXmlEntityResolver.isCachedSystemId(schema)) {
            // schema may not exist as a VFS file because it has just been cached (some test cases do this)
            return null;
        }
        try {
            CmsResource schemaRes = cms.readResource(cms.getRequestContext().removeSiteRoot(schema));
            CmsLink xsdLink = new CmsLink(
                null,
                CmsRelationType.XSD,
                schemaRes.getStructureId(),
                schemaRes.getRootPath(),
                true);
            return xsdLink;
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        return null;
    }
1229806
public Map<String, String> getPropertySearch() {

        if (m_propertiesSearch == null) {
            try {
                List<CmsProperty> properties = m_cms.readPropertyObjects(this, true);
                m_propertiesSearch = CmsProperty.toMap(properties);
            } catch (CmsException e) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(e.getMessage(), e);
                }
            }
        }
        return m_propertiesSearch;
    }
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);
    }
15570
public List<CmsResource> getResults(CmsObject cms, String collectorName, String parameter) throws CmsException {

        synchronized (this) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_COLLECTOR_GET_RESULTS_START_0));
            }
            if (parameter == null) {
                parameter = m_collectorParameter;
            }
            List<CmsResource> resources = new ArrayList<CmsResource>();
            if (getWp().getList() != null) {
                Iterator<CmsListItem> itItems = getListItems(parameter).iterator();
                while (itItems.hasNext()) {
                    CmsListItem item = itItems.next();
                    resources.add(getResource(cms, item));
                }
            } else {
                Map<String, String> params = CmsStringUtil.splitAsMap(
                    parameter,
                    I_CmsListResourceCollector.SEP_PARAM,
                    I_CmsListResourceCollector.SEP_KEYVAL);
                resources = getInternalResources(cms, params);
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(
                        Messages.LOG_COLLECTOR_GET_RESULTS_END_1,
                        new Integer(resources.size())));
            }
            return resources;
        }
    }
581697
public CmsSitemapTreeNodeData getData(CmsResource resource) {

        try {
            CmsVfsSitemapService svc = new CmsVfsSitemapService();
            CmsObject cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
            cms.getRequestContext().setSiteRoot("");
            svc.setCms(cms);

            CmsClientSitemapEntry ent = svc.getChildren(resource.getRootPath(), resource.getStructureId(), 0);
            CmsSitemapTreeNodeData data = new CmsSitemapTreeNodeData(
                m_localeContext.getRootLocale(),
                m_localeContext.getComparisonLocale());
            data.setClientEntry(ent);
            data.initialize(cms);
            return data;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }

    }
965380
protected List<CmsResourceStatusRelationBean> getSiblings(CmsObject cms, String locale, CmsResource resource)
    throws CmsException {

        List<CmsResourceStatusRelationBean> result = new ArrayList<CmsResourceStatusRelationBean>();
        for (CmsResource sibling : cms.readSiblings(resource, CmsResourceFilter.ALL)) {
            if (sibling.getStructureId().equals(resource.getStructureId())) {
                continue;
            }
            try {
                CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(
                    cms,
                    sibling,
                    resource.getRootPath());
                if (permissionInfo.hasViewPermission()) {
                    CmsResourceStatusRelationBean relationBean = createRelationBean(
                        cms,
                        locale,
                        sibling,
                        permissionInfo);
                    result.add(relationBean);
                }
            } catch (CmsException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }
125276
protected CmsBrokenLinkBean createSitemapBrokenLinkBean(CmsResource resource) throws CmsException {

        CmsProperty titleProp = m_cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, true);
        String typeName = OpenCms.getResourceManager().getResourceType(resource).getTypeName();
        String defaultTitle = CmsResource.getName(resource.getRootPath());
        String title = titleProp.getValue(defaultTitle);
        String path = m_cms.getSitePath(resource);
        String subtitle = path;
        return new CmsBrokenLinkBean(resource.getStructureId(), title, subtitle, typeName);
    }
743288
public List<CmsVariationBean> getVariations(String resource) {

        List<String> ret = (List<String>)(m_filePaths.get(resource));
        List<CmsVariationBean> res = new ArrayList<CmsVariationBean>();
        if (ret == null) {
            return new ArrayList<CmsVariationBean>();
        }
        for (String r : ret) {
            res.add(new CmsVariationBean(r));
        }
        return res;
    }
1171682
@SuppressWarnings("deprecation")
    private List<CmsResource> searchResources() {

        getReport().println(
            Messages.get().container(Messages.RPT_SOURCESEARCH_START_COLLECTING_FILES_TO_SEARCH_IN_0),
            I_CmsReport.FORMAT_HEADLINE);

        List<CmsResource> resources = new ArrayList<CmsResource>();
        if (m_settings.isSolrSearch()) {
            CmsSolrIndex index = OpenCms.getSearchManager().getIndexSolr(m_settings.getSource());
            if (index != null) {
                CmsSolrQuery query = new CmsSolrQuery(
                    null,
                    CmsRequestUtil.createParameterMap(m_settings.getQuery() + "&fl=path,type"));
                List<String> rootPaths = new ArrayList<>(m_settings.getPaths().size());
                String siteRoot = getCms().getRequestContext().getSiteRoot();
                for (String path : m_settings.getPaths()) {
                    rootPaths.add(path.startsWith(siteRoot) ? path : getCms().addSiteRoot(path));
                }
                query.setSearchRoots(rootPaths);
                if ((m_settings.getTypesArray() != null) && (m_settings.getTypesArray().length > 0)) {
                    query.setResourceTypes(m_settings.getTypesArray());
                }
                query.setRows(new Integer(MAX_PROCESSED_SOLR_RESULTS));
                query.ensureParameters();
                try {
                    resources.addAll(
                        index.search(getCms(), query, true, null, false, null, MAX_PROCESSED_SOLR_RESULTS));
                } catch (CmsSearchException e) {
                    LOG.error(e.getMessage(), e);
                }
            }
        } else {
            CmsResourceFilter filter = CmsResourceFilter.ALL.addExcludeState(
                CmsResource.STATE_DELETED).addRequireVisible();
            List<CmsResourceFilter> filterList = new ArrayList<CmsResourceFilter>();
            if ((m_settings.getTypesArray() != null) && (m_settings.getTypesArray().length > 0)) {
                for (String resTypeName : m_settings.getTypesArray()) {
                    try {
                        int typeId = OpenCms.getResourceManager().getResourceType(resTypeName).getTypeId();
                        filterList.add(((CmsResourceFilter)filter.clone()).addRequireType(typeId));
                    } catch (CmsLoaderException e) {
                        // noop
                    } catch (NullPointerException e) {
                        // noop
                    }
                }
            }
            if (filterList.size() == 1) {
                filter = filterList.get(0);
            }

            // iterate over all selected paths
            Iterator<String> iterPaths = m_settings.getPaths().iterator();

            if (!m_settings.getType().isPropertySearch()) {
                filter = filter.addRequireFile();
            }
            while (iterPaths.hasNext()) {
                String path = iterPaths.next();
                try {
                    if (m_settings.getType().isPropertySearch()) {
                        resources.addAll(
                            getCms().readResourcesWithProperty(path, m_settings.getProperty().getName(), null, filter));
                    } else {
                        // only read resources which are files and not deleted, which are in the current time range window and where the current
                        // user has the sufficient permissions to read them

                        List<CmsResource> tmpResources = getCms().readResources(path, filter);
                        List<String> subsites = null;
                        if (m_settings.ignoreSubSites()) {
                            subsites = OpenCms.getADEManager().getSubSitePaths(getCms(), path);
                            subsites.remove(
                                OpenCms.getADEManager().getSubSiteRoot(
                                    getCms(),
                                    getCms().readResource(path).getRootPath()));
                        }
                        Iterator<CmsResource> iterator = tmpResources.iterator();
                        while (iterator.hasNext()) {
                            CmsResource r = iterator.next();
                            boolean remove = true;
                            if (filterList.size() > 1) {
                                for (CmsResourceFilter f : filterList) {
                                    if (f.isValid(getCms().getRequestContext(), r)) {
                                        remove = false;
                                    }
                                }
                            } else {
                                remove = false;
                            }
                            if ((subsites != null) & !remove) {
                                if (subsites.contains(
                                    OpenCms.getADEManager().getSubSiteRoot(getCms(), r.getRootPath()))) {
                                    remove = true;
                                }
                            }
                            if (remove) {
                                iterator.remove();
                            }
                        }

                        if ((tmpResources != null) && !tmpResources.isEmpty()) {
                            resources.addAll(tmpResources);
                        }
                    }
                } catch (CmsException e) {
                    // an error occured
                    LOG.error(Messages.get().container(Messages.RPT_SOURCESEARCH_ERROR_READING_RESOURCES_1, path), e);
                    getReport().println(
                        Messages.get().container(Messages.RPT_SOURCESEARCH_ERROR_READING_RESOURCES_1, path),
                        I_CmsReport.FORMAT_ERROR);
                }
            }
        }
        return resources;
    }
995314
public static Map<String, CmsXmlContentProperty> resolveMacrosInProperties(
        Map<String, CmsXmlContentProperty> properties,
        I_CmsMacroResolver resolver) {

        Map<String, CmsXmlContentProperty> result = new LinkedHashMap<String, CmsXmlContentProperty>();
        for (Map.Entry<String, CmsXmlContentProperty> entry : properties.entrySet()) {
            String key = entry.getKey();
            CmsXmlContentProperty prop = entry.getValue();
            result.put(key, resolveMacrosInProperty(prop, resolver));
        }
        return result;
    }
689542
private List<I_CmsSearchFieldMapping> getMappings() {

        CmsSearchManager manager = OpenCms.getSearchManager();
        I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration());
        CmsLuceneField field;
        List<I_CmsSearchFieldMapping> result = null;
        Iterator<CmsSearchField> itFields;
        if (fieldConfig != null) {
            itFields = fieldConfig.getFields().iterator();
            while (itFields.hasNext()) {
                field = (CmsLuceneField)itFields.next();
                if (field.getName().equals(getParamField())) {
                    result = field.getMappings();
                }
            }
        } else {
            result = Collections.emptyList();
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1,
                        A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION));
            }
        }
        return result;
    }
1025771
private void init(CmsResource resource, CmsObject cms) {

        List<CmsProperty> properties;

        try {
            properties = cms.readPropertyObjects(resource, false);
        } catch (CmsException e) {
            m_priority = 0;
            m_date = 0;
            return;
        }

        try {
            m_priority = Integer.parseInt(
                CmsProperty.get(CmsPriorityResourceCollector.PROPERTY_PRIORITY, properties).getValue());
        } catch (NumberFormatException e) {
            m_priority = CmsPriorityResourceCollector.PRIORITY_STANDARD;
        }

        try {
            m_date = Long.parseLong(CmsProperty.get(PROPERTY_DATE, properties).getValue());
        } catch (NumberFormatException e) {
            m_date = 0;
        }
    }
60212
private void parseSettingsConfig(CmsResource resource, Map<CmsUUID, List<CmsXmlContentProperty>> settingConfigs) {

        List<CmsXmlContentProperty> settingConfig = new ArrayList<>();

        try {
            CmsFile settingFile = m_cms.readFile(resource);
            CmsXmlContent settingContent = CmsXmlContentFactory.unmarshal(m_cms, settingFile);
            CmsXmlContentRootLocation location = new CmsXmlContentRootLocation(settingContent, Locale.ENGLISH);
            for (I_CmsXmlContentValueLocation settingLoc : location.getSubValues(CmsFormatterBeanParser.N_SETTING)) {
                CmsXmlContentProperty setting = CmsConfigurationReader.parseProperty(
                    m_cms,
                    settingLoc).getPropertyData();
                settingConfig.add(setting);
            }
            settingConfigs.put(resource.getStructureId(), settingConfig);
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
367459
public void parse(CmsResource resource) throws CmsException {

        CmsFile file = m_cms.readFile(resource);
        parse(file);
    }