/** * Returns the relation type for the given path.<p> * * @param path the element path * * @return the relation type */ protected CmsRelationType getRelationType(String path) { CmsRelationType result = getContentDefinition().getContentHandler().getRelationType(path); I_CmsXmlDocument document = getDocument(); if (document != null) { // the relations set in the main content definition override relations set in the nested definition result = document.getContentDefinition().getContentHandler().getRelationType(getPath(), result); } else { LOG.warn("Missing document while evaluating relation type for " + path); } return result; }
/** * Fills a {@link CmsXmlVfsFileValue} with the resource identified by the given id.<p> * * @param cms the current CMS context * @param element the XML element to fill * @param res the resource to use */ protected void fillResource(CmsObject cms, Element element, CmsResource res) { String xpath = element.getPath(); int pos = xpath.lastIndexOf("/" + XmlNode.GroupContainers.name() + "/"); if (pos > 0) { xpath = xpath.substring(pos + 1); } CmsRelationType type = getHandler().getRelationType(xpath); CmsXmlVfsFileValue.fillEntry(element, res.getStructureId(), res.getRootPath(), type); }
/** * Fills a {@link CmsXmlVfsFileValue} with the resource identified by the given id.<p> * * @param cms the current CMS context * @param element the XML element to fill * @param resourceId the ID identifying the resource to use * * @return the resource * * @throws CmsException if the resource can not be read */ protected CmsResource fillResource(CmsObject cms, Element element, CmsUUID resourceId) throws CmsException { String xpath = element.getPath(); int pos = xpath.lastIndexOf("/" + XmlNode.Containers.name() + "/"); if (pos > 0) { xpath = xpath.substring(pos + 1); } CmsRelationType type = getHandler().getRelationType(xpath); CmsResource res = cms.readResource(resourceId, CmsResourceFilter.IGNORE_EXPIRATION); CmsXmlVfsFileValue.fillEntry(element, res.getStructureId(), res.getRootPath(), type); return res; }
/** * Returns the link object represented by this XML content value.<p> * * @param cms the cms context, can be <code>null</code> but in this case no link check is performed * * @return the link object represented by this XML content value */ public CmsLink getLink(CmsObject cms) { Element linkElement = m_element.element(CmsXmlPage.NODE_LINK); if (linkElement == null) { String uri = m_element.getText(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(uri)) { setStringValue(cms, uri); } linkElement = m_element.element(CmsXmlPage.NODE_LINK); if (linkElement == null) { return null; } } CmsLinkUpdateUtil.updateType(linkElement, getContentDefinition().getContentHandler().getRelationType(this)); CmsLink link = new CmsLink(linkElement); // link management check link.checkConsistency(cms); if (CmsStringUtil.isEmptyOrWhitespaceOnly(link.getTarget())) { return null; } return link; }
setStringValue(cms, m_element.getText()); } else { CmsLinkUpdateUtil.updateType(linkElement, getContentDefinition().getContentHandler().getRelationType( this)); CmsLink link = new CmsLink(linkElement);
return; CmsRelationType type = getContentDefinition().getContentHandler().getRelationType(this); CmsLink link = new CmsLink("vfsLink", type, path, true);
CmsRelationType type; if (internal) { type = getContentDefinition().getContentHandler().getRelationType(this); } else {