/** * Gets the change frequency for a sitemap entry from a list of properties.<p> * * If the change frequency is not defined in the properties, this method will return null.<p> * * @param properties the properties from which the change frequency should be obtained * * @return the change frequency string */ protected static String getChangeFrequency(List<CmsProperty> properties) { CmsProperty prop = CmsProperty.get(CmsPropertyDefinition.PROPERTY_XMLSITEMAP_CHANGEFREQ, properties); if (prop.isNullProperty()) { return null; } String result = prop.getValue().trim(); return result; }
CmsResource res = getCmsObject().readResource(id); List<CmsProperty> properties = getCmsObject().readPropertyObjects(res, false); String title = CmsProperty.get(CmsPropertyDefinition.PROPERTY_TITLE, properties).getValue(); if (title == null) { title = res.getName(); String description = CmsProperty.get(CmsPropertyDefinition.PROPERTY_DESCRIPTION, properties).getValue(); if (description == null) { description = getCmsObject().getSitePath(res); CmsProperty property = CmsProperty.get(propertyName, properties); if (property != null) { CmsClientProperty clientProperty = new CmsClientProperty(
/** * Initializes the comparator key based on the member variables.<p> * * @param resource the resource to use * @param cms the current OpenCms user contxt */ private void init(CmsResource resource, CmsObject cms) { List 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; } }
/** * Initializes the comparator key based on the member variables.<p> * * @param resource the resource to use * @param cms the current OpenCms user contxt */ 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; } }
/** * Gets the page priority from a list of properties.<p> * * If the page priority can't be found among the properties, -1 will be returned.<p> * * @param properties the properties of a resource * * @return the page priority read from the properties, or -1 */ protected static double getPriority(List<CmsProperty> properties) { CmsProperty prop = CmsProperty.get(CmsPropertyDefinition.PROPERTY_XMLSITEMAP_PRIORITY, properties); if (prop.isNullProperty()) { return -1.0; } try { double result = Double.parseDouble(prop.getValue().trim()); return result; } catch (NumberFormatException e) { return -1.0; } }
CmsProperty.get(CmsPriorityResourceCollector.PROPERTY_PRIORITY, properties).getValue()); } catch (NumberFormatException e) { m_priority = CmsPriorityResourceCollector.PRIORITY_STANDARD; m_title = CmsProperty.get(CmsPropertyDefinition.PROPERTY_TITLE, properties).getValue(); if (CmsStringUtil.isEmpty(m_title)) { m_title = "";
/** * Initializes the comparator key based on the member variables.<p> * * @param resource the resource to use * @param cms the current OpenCms user contxt */ private void init(CmsResource resource, CmsObject cms) { List properties; try { properties = cms.readPropertyObjects(resource, false); } catch (CmsException e) { m_priority = 0; m_title = ""; return; } try { m_priority = Integer.parseInt(CmsProperty.get(CmsPriorityResourceCollector.PROPERTY_PRIORITY, properties).getValue()); } catch (NumberFormatException e) { m_priority = CmsPriorityResourceCollector.PRIORITY_STANDARD; } m_title = CmsProperty.get(CmsPropertyDefinition.PROPERTY_TITLE, properties).getValue(); if (CmsStringUtil.isEmpty(m_title)) { m_title = ""; } } }
/** * @see org.apache.commons.collections.Transformer#transform(java.lang.Object) */ public Object transform(Object input) { String result; try { // read the requested history property result = CmsProperty.get( String.valueOf(input), getCmsObject().readHistoryPropertyObjects(m_res)).getValue(); } catch (@SuppressWarnings("unused") CmsException e) { // unable to read history property, return null result = null; } return result; } }
value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_PRIORITY, propertiesSearched).getValue(); if (value != null) { value = value.trim().toLowerCase();
String value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_CATEGORY, propertiesSearched).getValue(); if (CmsStringUtil.isNotEmpty(value)) {
/** * Returns the appropriate locale for the given destination.<p> * * @param destination the destination path (parent must exist) * @param properties the properties to check at first * * @return the locale */ protected Locale getLocale(String destination, List properties) { String localeName = CmsProperty.get(CmsPropertyDefinition.PROPERTY_LOCALE, properties).getValue(); if (localeName != null) { // locale was already set on the files properties return OpenCms.getLocaleManager().getAvailableLocales(localeName).get(0); } // locale not set in properties, read default locales return OpenCms.getLocaleManager().getDefaultLocales(m_cms, CmsResource.getParentFolder(destination)).get(0); }
/** * Returns the appropriate locale for the given destination.<p> * * @param destination the destination path (parent must exist) * @param properties the properties to check at first * * @return the locale */ protected Locale getLocale(String destination, List<CmsProperty> properties) { String localeName = CmsProperty.get(CmsPropertyDefinition.PROPERTY_LOCALE, properties).getValue(); if (localeName != null) { // locale was already set on the files properties return OpenCms.getLocaleManager().getAvailableLocales(localeName).get(0); } // locale not set in properties, read default locales return OpenCms.getLocaleManager().getDefaultLocales(m_cms, CmsResource.getParentFolder(destination)).get(0); }
String propValue = CmsProperty.get(date, properties).getValue(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(propValue)) { try {
Fieldable field; value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_CATEGORY, propertiesSearched).getValue(); if (CmsStringUtil.isNotEmpty(value)) { value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_PRIORITY, propertiesSearched).getValue(); if (value != null) { value = value.trim().toLowerCase();
String propValue = CmsProperty.get(date, properties).getValue(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(propValue)) { try {
/** * Gets the template context provider for a given path.<p> * * @param cms the current CMS context * @param path the path for which the template context provider should be determined * * @return the template context provider for the given path * * @throws CmsException if something goes wrong */ public I_CmsTemplateContextProvider getTemplateContextProvider(CmsObject cms, String path) throws CmsException { CmsResource resource = cms.readResource(path); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(resource); if (loader instanceof A_CmsXmlDocumentLoader) { String propertyName = ((A_CmsXmlDocumentLoader)loader).getTemplatePropertyDefinition(); List<CmsProperty> properties = cms.readPropertyObjects(resource, true); CmsProperty property = CmsProperty.get(propertyName, properties); if ((property != null) && !property.isNullProperty()) { String propertyValue = property.getValue(); if (CmsTemplateContextManager.hasPropertyPrefix(propertyValue)) { return getTemplateContextProvider(removePropertyPrefix(propertyValue)); } } return null; } else { return null; } }
encoding = CmsProperty.get(CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, properties).getValue(); if (encoding == null) { encoding = OpenCms.getSystemInfo().getDefaultEncoding();
encoding = CmsProperty.get(CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, properties).getValue(); if (encoding == null) { encoding = OpenCms.getSystemInfo().getDefaultEncoding();