/** * Returns the path to the configuration file for the current uri.<p> * * @return the path to the configuration file for the current uri */ public String getConfigPath() { if (m_config != null) { return getCmsObject().getSitePath(m_config.getFile()); } return null; }
/** * Removes a cached XML content from the cache if it matches a given resource.<p> * * @param resource the resource for which the cached XML content should be removed * @param cache the cache from which to remove the XML content */ private <CONTENT extends CmsXmlContent> void removeCachedContent(CmsResource resource, Map<String, CONTENT> cache) { Iterator<Map.Entry<String, CONTENT>> iterator = cache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, CONTENT> entry = iterator.next(); CONTENT content = entry.getValue(); CmsResource contentFile = content.getFile(); if (contentFile.getStructureId().equals(resource.getStructureId()) || contentFile.getResourceId().equals(resource.getResourceId())) { iterator.remove(); } } } }
/** * Returns the required version of the user accepted agreement.<p> * * @return the required version of the user accepted agreement */ public double getRequiredVersion() { if (m_requiredVersion == 0) { String versionStr = getConfigurationContentStringValue(NODE_VERSION); try { m_requiredVersion = Double.parseDouble(versionStr); } catch (Exception e) { // the version number is not in the correct format LOG.error( Messages.get().getBundle().key( Messages.LOG_USERAGREEMENT_WRONG_VERSION_2, versionStr, getConfigurationContent().getFile().getRootPath())); } } return m_requiredVersion; }
siblings = rootCms.readSiblings(content.getFile().getRootPath(), CmsResourceFilter.IGNORE_EXPIRATION);
/** * Contains the visibility handler configuration for a content field path.<p> */ protected static class VisibilityConfiguration { /** The handler instance. */ private I_CmsXmlContentVisibilityHandler m_handler; /** The handler configuration parameters. */ private String m_params; /** * Constructor.<p> * * @param handler the handler instance * @param params the handler configuration parameteres */ protected VisibilityConfiguration(I_CmsXmlContentVisibilityHandler handler, String params) { m_handler = handler; m_params = params; } /** * Returns the visibility handler instance.<p> * * @return the handler instance */ public I_CmsXmlContentVisibilityHandler getHandler() {
|| isMappingUsingDefault(xpath, TITLE_PROPERTY_SHARED_MAPPING) || isMappingUsingDefault(xpath, TITLE_PROPERTY_INDIVIDUAL_MAPPING))) { result = getDefault(cms, document.getFile(), null, xpath, locale);
content.removeValue(REMOVE_PATH, locale, 0); } else if (content.hasValue(ADD_PATH, locale)) { String rootPath = content.getFile().getRootPath(); List<String> optionValues = CmsAddFormatterWidget.getSelectOptionValues(cms, rootPath, false); CmsXmlContentValueSequence addSequence = content.getValueSequence(ADD_PATH_SINGLE_NODE, locale);
siblings = rootCms.readSiblings(content.getFile().getRootPath(), CmsResourceFilter.IGNORE_EXPIRATION);
/** * Returns the preset path set in the given xml content.<p> * * @param config the xml content with the config where to get the preset path from * * @return the preset path set in the given xml content */ private String getConfigPreset(CmsXmlContent config) { String result = null; if (config != null) { Locale locale = OpenCms.getLocaleManager().getDefaultLocale( getCmsObject(), getCmsObject().getSitePath(m_config.getFile())); if (config.getFile().getTypeId() == RESOURCE_TYPE_ID_CONFIG) { result = config.getStringValue(getCmsObject(), NODE_PRESET, locale); } else { result = config.getStringValue(getCmsObject(), NODE_PRESET_NESTED, locale); } } return result; }
I_CmsXmlContentValue value = content.getValue(path, locale, counter); String attributeValue = getDynamicAttributeValue( content.getFile(), value, attributeName,
/** * @see org.opencms.xml.content.I_CmsXmlContentHandler#resolveMapping(org.opencms.file.CmsObject, org.opencms.xml.content.CmsXmlContent, org.opencms.xml.types.I_CmsXmlContentValue) */ public void resolveMapping(CmsObject cms, CmsXmlContent content, I_CmsXmlContentValue value) throws CmsException { if (content.getFile() == null) { throw new CmsXmlException(Messages.get().container(Messages.ERR_XMLCONTENT_RESOLVE_FILE_NOT_FOUND_0)); } // get the mappings for the element name boolean valueIsSimple = value.isSimpleType(); String valuePath = value.getPath(); int valueIndex = value.getIndex(); Locale valueLocale = value.getLocale(); CmsObject rootCms1 = createRootCms(cms); String originalStringValue = null; if (valueIsSimple) { originalStringValue = value.getStringValue(rootCms1); } resolveMapping(cms, content, valuePath, valueIsSimple, valueIndex, valueLocale, originalStringValue); }
throws CmsException, ParseException { I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(content.getFile()); boolean isMacroFromatter = CmsFormatterConfigurationCache.TYPE_MACRO_FORMATTER.equals(type.getTypeName()); if (isMacroFromatter) { m_formatterResource = content.getFile(); m_preview = false; m_extractContent = true; LOG.info("JSP link is null in formatter configuration: " + content.getFile().getRootPath()); return null;
/** * Checks if the content is locale independent.<p> * * @return true if the content is locale independent */ public boolean isLocaleIndependent() { CmsFile file = getFile(); if (CmsResourceTypeXmlContainerPage.isContainerPage(file) || OpenCms.getResourceManager().matchResourceType( CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME, file.getTypeId()) || OpenCms.getResourceManager().matchResourceType( CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_CONFIG_TYPE_NAME, file.getTypeId())) { return true; } try { I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(file); if ((resourceType instanceof CmsResourceTypeLocaleIndependentXmlContent) || (resourceType instanceof CmsResourceTypeXmlAdeConfiguration)) { return true; } } catch (Exception e) { // ignore } return false; }
/** * Parses a dynamic function bean from an in-memory XML content object.<p> * * @param cms the current CMS context * @param content the XML content from which to read the dynamic function bean * * @return the dynamic function bean read from the XML content * * @throws CmsException if something goes wrong */ public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsXmlContent content) throws CmsException { Locale locale = getLocaleToUse(cms, content); String oldSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); CmsResource functionFormatter = getFunctionFormatter(cms); CmsXmlContentRootLocation root = new CmsXmlContentRootLocation(content, locale); CmsDynamicFunctionBean functionBean = parseFunctionBean(cms, root, content.getFile(), functionFormatter); return functionBean; } finally { cms.getRequestContext().setSiteRoot(oldSiteRoot); } }