1 10 package org.mmbase.bridge.jsp.taglib; 11 import javax.servlet.jsp.JspTagException ; 12 13 import org.mmbase.bridge.*; 14 import org.mmbase.bridge.util.NodeWrapper; 15 16 import org.mmbase.bridge.jsp.taglib.util.Attribute; 17 import org.mmbase.util.logging.*; 18 19 26 27 public class UnRelatedNodesTag extends ListNodesTag { 28 private static final Logger log = Logging.getLoggerInstance(UnRelatedNodesTag.class); 29 30 protected Attribute role = Attribute.NULL; 31 protected Attribute searchDir = Attribute.NULL; 32 protected Attribute excludeSelf = Attribute.NULL; 33 34 35 public void setRole(String role) throws JspTagException { 36 this.role = getAttribute(role); 37 } 38 39 public void setSearchdir(String search) throws JspTagException { 40 searchDir = getAttribute(search); 41 } 42 43 public void setExcludeself(String e) throws JspTagException { 44 excludeSelf = getAttribute(e); 45 } 46 47 48 49 52 public int doStartTag() throws JspTagException { 53 int superresult = doStartTagHelper(); if (superresult != NOT_HANDLED) { 55 return superresult; 56 } 57 Node parentNode = getNode(); 59 60 if (parentNode == null) { 61 throw new JspTagException ("Could not find parent node!!"); 62 } 63 64 NodeQuery query = getQuery(); 65 66 NodeList relatedNodes = parentNode.getRelatedNodes(query.getNodeManager(), (String ) role.getValue(this), (String ) searchDir.getValue(this)); 67 68 NodesAndTrim result = getNodesAndTrim(query, relatedNodes.size() + 1); 70 71 if (excludeSelf.getBoolean(this, false)) { 72 result.nodeList.remove(parentNode); 73 } 74 result.nodeList.removeAll(relatedNodes); 75 76 return setReturnValues(result.nodeList, result.needsTrim); 77 78 } 79 80 81 } 82 83 | Popular Tags |