1 package org.infoglue.deliver.taglib.content; 2 3 import java.util.ArrayList ; 4 import java.util.HashMap ; 5 import java.util.List ; 6 import java.util.Map ; 7 8 import javax.servlet.jsp.JspException ; 9 import javax.servlet.jsp.JspTagException ; 10 11 import org.infoglue.cms.security.InfoGluePrincipal; 12 import org.infoglue.cms.webservices.elements.RemoteAttachment; 13 14 17 18 public class UpdateContentVersionTag extends InfoGlueWebServiceTag implements ContentVersionParameterInterface 19 { 20 23 private static final long serialVersionUID = -1904980538720103871L; 24 25 28 private String operationName = "updateContentVersion"; 29 30 33 34 private Map contentVersion = new HashMap (); 35 36 private Integer contentVersionId; 37 private Integer stateId; 38 private String versionComment; 39 private Integer languageId; 40 private Integer contentId; 41 private String versionValue; 42 43 46 private InfoGluePrincipal principal; 47 48 51 public UpdateContentVersionTag() 52 { 53 super(); 54 } 55 56 64 public int doStartTag() throws JspException 65 { 66 return EVAL_BODY_INCLUDE; 67 } 68 69 72 public int doEndTag() throws JspException 73 { 74 try 75 { 76 if(this.contentVersionId != null) 77 contentVersion.put("contentVersionId", this.contentVersionId); 78 if(this.contentId != null) 79 contentVersion.put("contentId", this.contentId); 80 if(this.languageId != null) 81 contentVersion.put("languageId", this.languageId); 82 if(this.stateId != null) 83 contentVersion.put("stateId", this.stateId); 84 if(this.versionComment != null) 85 contentVersion.put("versionComment", this.versionComment); 86 if(this.versionValue != null) 87 contentVersion.put("versionValue", this.versionValue); 88 89 this.invokeOperation("contentVersion", contentVersion); 90 } 91 catch (Exception e) 92 { 93 e.printStackTrace(); 94 throw new JspTagException (e.getMessage()); 95 } 96 97 contentVersion.clear(); 98 this.contentId = null; 99 this.contentVersionId = null; 100 this.languageId = null; 101 this.versionComment = null; 102 this.versionValue = null; 103 this.stateId = null; 104 105 return EVAL_PAGE; 106 } 107 108 113 public void addContentVersionAttribute(String name, String value) throws JspException 114 { 115 Map contentVersionAttributes = (Map )this.contentVersion.get("contentVersionAttributes"); 116 if(contentVersionAttributes == null) 117 { 118 contentVersionAttributes = new HashMap (); 119 this.contentVersion.put("contentVersionAttributes", contentVersionAttributes); 120 } 121 122 contentVersionAttributes.put(name, value); 123 } 124 125 130 public void addDigitalAsset(RemoteAttachment remoteAttachment) throws JspException 131 { 132 List digitalAssets = (List )this.contentVersion.get("digitalAssets"); 133 if(digitalAssets == null) 134 { 135 digitalAssets = new ArrayList (); 136 this.contentVersion.put("digitalAssets", digitalAssets); 137 } 138 139 digitalAssets.add(remoteAttachment); 140 } 141 142 145 public void setOperationName(final String operationName) 146 { 147 this.operationName = operationName; 148 } 149 150 153 public void setPrincipal(final String principalString) throws JspException 154 { 155 this.principal = (InfoGluePrincipal) this.evaluate("remoteContentService", "principal", principalString, InfoGluePrincipal.class); 156 } 157 158 public void setContentVersionId(String contentVersionId) throws JspException 159 { 160 this.contentVersionId = evaluateInteger("updateContentVersion", "contentVersionId", contentVersionId); 161 } 162 163 public void setContentId(String contentId) throws JspException 164 { 165 this.contentId = evaluateInteger("updateContentVersion", "contentId", contentId); 166 } 167 168 public void setLanguageId(String languageId) throws JspException 169 { 170 this.languageId = evaluateInteger("updateContentVersion", "languageId", languageId); 171 } 172 173 public void setStateId(String stateId) throws JspException 174 { 175 this.stateId = evaluateInteger("updateContentVersion", "stateId", stateId); 176 } 177 178 public void setVersionComment(String versionComment) throws JspException 179 { 180 this.versionComment = evaluateString("updateContentVersion", "versionComment", versionComment); 181 } 182 183 public void setVersionValue(String versionValue) throws JspException 184 { 185 this.versionValue = evaluateString("updateContentVersion", "versionValue", versionValue); 186 } 187 188 public String getOperationName() 189 { 190 return this.operationName; 191 } 192 } | Popular Tags |