1 23 24 package org.infoglue.deliver.taglib.content; 25 26 import javax.servlet.jsp.JspException ; 27 28 import org.infoglue.cms.entities.content.ContentVO; 29 import org.infoglue.deliver.taglib.component.ComponentLogicTag; 30 31 34 public class ContentTag extends ComponentLogicTag 35 { 36 private static final long serialVersionUID = 3258135773294113587L; 37 38 private Integer siteNodeId; 39 private Integer contentId; 40 private String propertyName; 41 private boolean useInheritance = true; 42 43 public ContentTag() 44 { 45 super(); 46 } 47 48 public int doEndTag() throws JspException 49 { 50 produceResult(getContent()); 51 return EVAL_PAGE; 52 } 53 54 private ContentVO getContent() throws JspException 55 { 56 if(this.contentId != null) 57 return this.getController().getContent(this.contentId); 58 else if(this.propertyName != null) 59 if(this.siteNodeId != null) 60 return this.getComponentLogic().getBoundContent(siteNodeId, propertyName, useInheritance); 61 else 62 return this.getComponentLogic().getBoundContent(propertyName, useInheritance); 63 else if(this.getController().getContentId() != null && this.getController().getContentId().intValue() > -1) 64 return this.getController().getContent(); 65 else 66 return null; 67 } 68 69 public void setContentId(String contentId) throws JspException 70 { 71 this.contentId = evaluateInteger("content", "contentId", contentId); 72 } 73 74 public void setPropertyName(String propertyName) throws JspException 75 { 76 this.propertyName = evaluateString("content", "propertyName", propertyName); 77 } 78 79 public void setUseInheritance(boolean useInheritance) 80 { 81 this.useInheritance = useInheritance; 82 } 83 84 public void setSiteNodeId(String siteNodeId) throws JspException 85 { 86 this.siteNodeId = evaluateInteger("content", "siteNodeId", siteNodeId); 87 } 88 } | Popular Tags |