1 23 24 package org.infoglue.deliver.taglib.management; 25 26 import javax.servlet.jsp.JspException ; 27 28 import org.infoglue.cms.entities.content.ContentVersionVO; 29 import org.infoglue.cms.security.InfoGluePrincipal; 30 import org.infoglue.deliver.taglib.TemplateControllerTag; 31 32 public class PrincipalPropertyTag extends TemplateControllerTag 33 { 34 private static final long serialVersionUID = 4050206323348354355L; 35 36 private String userName; 37 private InfoGluePrincipal principal; 38 private String attributeName; 39 40 public PrincipalPropertyTag() 41 { 42 super(); 43 } 44 45 public int doEndTag() throws JspException 46 { 47 if(userName != null && !userName.equals("")) 48 { 49 setResultAttribute(this.getController().getPrincipalPropertyValue(getController().getPrincipal(userName), attributeName)); 50 } 51 else if(principal != null) 52 { 53 setResultAttribute(getController().getPrincipalPropertyValue(principal, attributeName)); 54 } 55 else 56 { 57 setResultAttribute(getController().getPrincipalPropertyValue(attributeName)); 58 } 59 60 return EVAL_PAGE; 61 } 62 63 public void setUserName(final String userName) throws JspException 64 { 65 this.userName = evaluateString("principal", "userName", userName); 66 } 67 68 public void setPrincipal(final String principalString) throws JspException 69 { 70 this.principal = (InfoGluePrincipal)evaluate("principal", "principal", principalString, InfoGluePrincipal.class); 71 } 72 73 public void setAttributeName(final String attributeName) throws JspException 74 { 75 this.attributeName = evaluateString("principal", "attributeName", attributeName); 76 } 77 78 } 79 | Popular Tags |