1 10 package org.mmbase.bridge.jsp.taglib.security; 11 import org.mmbase.bridge.jsp.taglib.util.Attribute; 12 import org.mmbase.bridge.jsp.taglib.Condition; 13 import org.mmbase.bridge.jsp.taglib.CloudReferrerTag; 14 15 import javax.servlet.jsp.JspTagException ; 16 17 18 24 25 public class MayCreateTag extends CloudReferrerTag implements Condition { 26 27 protected Attribute type = Attribute.NULL; 28 protected Attribute inverse = Attribute.NULL; 29 30 public void setInverse(String b) throws JspTagException { 31 inverse = getAttribute(b); 32 } 33 protected boolean getInverse() throws JspTagException { 34 return inverse.getBoolean(this, false); 35 } 36 37 public void setType(String t) throws JspTagException { 38 type = getAttribute(t); 39 } 40 41 public int doStartTag() throws JspTagException { 42 if ((getCloudVar().getNodeManager(type.getString(this)).mayCreateNode()) != getInverse()) { 43 return EVAL_BODY; 44 } else { 45 return SKIP_BODY; 46 } 47 } 48 49 public int doAfterBody() throws JspTagException { 50 if (EVAL_BODY == EVAL_BODY_BUFFERED) { try{ 52 if(bodyContent != null) { 53 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 54 } 55 } catch(java.io.IOException e){ 56 throw new JspTagException ("IO Error: " + e.getMessage()); 57 } 58 } 59 return SKIP_BODY; 60 } 61 62 } 63 | Popular Tags |