/** * Resolves the mappings for all values of this XML content.<p> * * @param cms the current users OpenCms context */ public void resolveMappings(CmsObject cms) { // iterate through all initialized value nodes in this XML content CmsXmlContentMappingVisitor visitor = new CmsXmlContentMappingVisitor(cms, this); visitAllValuesWith(visitor); }
/** * Unmarshal the XML content with auto-correction. * @param file the file that contains the XML * @return the XML read from the file * @throws CmsXmlException thrown if the XML can't be read. */ private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException { CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); content.setAutoCorrectionEnabled(true); content.correctXmlStructure(m_cms); return content; }
/** * @see org.opencms.xml.I_CmsXmlDocument#validate(org.opencms.file.CmsObject) */ public CmsXmlContentErrorHandler validate(CmsObject cms) { // iterate through all initialized value nodes in this XML content CmsXmlContentValidationVisitor visitor = new CmsXmlContentValidationVisitor(cms); visitAllValuesWith(visitor); return visitor.getErrorHandler(); }
/** * Removes the value element of the sequence type at the selected index from XML content document.<p> * * @param index the index where to remove the value element * * @see CmsXmlContent#removeValue(String, Locale, int) */ public void removeValue(int index) { m_content.removeValue(getPath(), getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); } }
/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest) */ @Override protected I_CmsXmlDocument unmarshalXmlDocument(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException { return CmsXmlContentFactory.unmarshal(cms, resource, req); }
/** * Creates a new instance of the default XML content handler.<p> */ public CmsDefaultXmlContentHandler() { init(); }
/** * Returns <code>true</code> if there is at last one warning in the selected locale.<p> * * @param locale the locale to check * * @return <code>true</code> if there is at last one warning in the selected locale */ public boolean hasWarnings(Locale locale) { return null != getWarnings(locale); }
/** * @see org.opencms.xml.content.CmsXmlContent#setFile(org.opencms.file.CmsFile) */ @Override protected void setFile(CmsFile file) { // just for visibility from the factory super.setFile(file); }
/** * Adds a bookmark for the given value.<p> * * @param value the value to bookmark * @param path the lookup path to use for the bookmark * @param locale the locale to use for the bookmark * @param enabled if true, the value is enabled, if false it is disabled */ protected void addBookmarkForValue(I_CmsXmlContentValue value, String path, Locale locale, boolean enabled) { addBookmark(path, locale, enabled, value); }
/** * Creates a new validation node visitor.<p> * * @param cms the initialized OpenCms user context (required for VFS access) */ public CmsXmlContentValidationVisitor(CmsObject cms) { // start with a new instance of the error handler m_errorHandler = new CmsXmlContentErrorHandler(); // store reference to the provided CmsObject m_cms = cms; }
/** * @see org.opencms.xml.content.I_CmsXmlContentHandler#getJSHeadIncludes(org.opencms.file.CmsObject, org.opencms.file.CmsResource) */ @SuppressWarnings("unused") public Set<String> getJSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException { return getJSHeadIncludes(); }
/** * @see I_CmsXmlContentHandler#getRelationType(String) */ public CmsRelationType getRelationType(String xpath) { return getRelationType(xpath, CmsRelationType.XML_WEAK); }
/** * Finalizes the mappings.<p> * * @throws CmsException if something goes wrong */ public void finalizeMappings() throws CmsException { commitUrlNameMappings(); }
/** * * @see org.opencms.xml.containerpage.I_CmsFormatterBean#getSettings() */ public Map<String, CmsXmlContentProperty> getSettings() { return m_contentHandler.getSettings(m_cms, m_elementResource); }
/** * Creates a new error handler node visitor.<p> * * @param cms the initialized OpenCms user context (required for VFS access) * @param content the XML content to resolve the mappings for */ public CmsXmlContentMappingVisitor(CmsObject cms, CmsXmlContent content) { // store references m_cms = cms; m_content = content; m_handler = content.getHandler(); }
/** * Gets the name of the property.<p> * * @return the name of the property */ public String getName() { return m_propData.getName(); }
/** * Removes the value element of the sequence type at the selected index from XML content document.<p> * * @param index the index where to remove the value element * * @see CmsXmlContent#removeValue(String, Locale, int) */ public void removeValue(int index) { m_content.removeValue(getPath(), getLocale(), index); // re-initialize the value list m_values = m_content.getValues(getPath(), getLocale()); } }
/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest) */ @Override protected I_CmsXmlDocument unmarshalXmlDocument(CmsObject cms, CmsResource resource, ServletRequest req) throws CmsException { return CmsXmlContentFactory.unmarshal(cms, resource, req); }
/** * @see org.opencms.xml.I_CmsXmlDocument#validate(org.opencms.file.CmsObject) */ public CmsXmlContentErrorHandler validate(CmsObject cms) { // iterate through all initialized value nodes in this XML content CmsXmlContentValidationVisitor visitor = new CmsXmlContentValidationVisitor(cms); visitAllValuesWith(visitor); return visitor.getErrorHandler(); }
/** * Resolves the mappings for all values of this XML content.<p> * * @param cms the current users OpenCms context */ public void resolveMappings(CmsObject cms) { // iterate through all initialized value nodes in this XML content CmsXmlContentMappingVisitor visitor = new CmsXmlContentMappingVisitor(cms, this); visitAllValuesWith(visitor); }