1 23 package org.infoglue.deliver.taglib.content; 24 25 import java.util.ArrayList ; 26 import java.util.HashMap ; 27 import java.util.List ; 28 import java.util.Map ; 29 30 import javax.servlet.jsp.JspException ; 31 import javax.servlet.jsp.JspTagException ; 32 33 import org.infoglue.deliver.taglib.AbstractTag; 34 35 41 public class ContentParameterTag extends AbstractTag 42 { 43 46 private static final long serialVersionUID = 4482006814634520239L; 47 48 51 private Map contentMap = new HashMap (); 52 53 56 public ContentParameterTag() 57 { 58 super(); 59 } 60 61 67 public int doStartTag() throws JspException 68 { 69 return EVAL_BODY_INCLUDE; 70 } 71 72 79 public int doEndTag() throws JspException 80 { 81 addContentMap(); 82 83 contentMap = new HashMap (); 84 85 return EVAL_PAGE; 86 } 87 88 93 protected void addContentMap() throws JspException 94 { 95 final RemoteContentServiceTag parent = (RemoteContentServiceTag) findAncestorWithClass(this, RemoteContentServiceTag.class); 96 if(parent == null) 97 { 98 throw new JspTagException ("ContentParameterTag must have a RemoteContentServiceTag ancestor."); 99 } 100 101 ((RemoteContentServiceTag) parent).addContentMap(contentMap); 102 } 103 104 110 public void setName(final String name) throws JspException 111 { 112 this.contentMap.put("name", evaluateString("parameter", "name", name)); 113 } 114 115 121 public void setRepositoryId(final String repositoryId) throws JspException 122 { 123 this.contentMap.put("repositoryId", evaluateInteger("parameter", "repositoryId", repositoryId)); 124 } 125 126 132 public void setParentContentId(final String parentContentId) throws JspException 133 { 134 this.contentMap.put("parentContentId", evaluateInteger("parameter", "parentContentId", parentContentId)); 135 } 136 137 143 public void setContentTypeDefinitionId(final String contentTypeDefinitionId) throws JspException 144 { 145 this.contentMap.put("contentTypeDefinitionId", evaluateInteger("parameter", "contentTypeDefinitionId", contentTypeDefinitionId)); 146 } 147 148 151 public void addContentVersion(final Map contentVersion) 152 { 153 List contentVersions = (List )this.contentMap.get("contentVersions"); 154 if(contentVersions == null) 155 { 156 contentVersions = new ArrayList (); 157 this.contentMap.put("contentVersions", contentVersions); 158 } 159 160 contentVersions.add(contentVersion); 161 } 162 163 public void clear() 164 { 165 contentMap.clear(); 166 } 167 } 168 | Popular Tags |