1 package org.infoglue.deliver.taglib.management; 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.entities.management.UserPropertiesVO; 12 import org.infoglue.cms.security.InfoGluePrincipal; 13 import org.infoglue.deliver.taglib.TemplateControllerTag; 14 import org.infoglue.deliver.util.webservices.DynamicWebservice; 15 16 17 20 21 public class RemoteUserPropertiesServiceTag extends TemplateControllerTag 22 { 23 26 private static final long serialVersionUID = -1904980538720103871L; 27 28 31 private String targetEndpointAddress; 32 33 36 private String operationName; 37 38 41 private InfoGluePrincipal principal; 42 43 46 private Integer languageId; 47 private Integer contentTypeDefinitionId; 48 private Map userPropertiesAttributesMap = new HashMap (); 49 50 53 public RemoteUserPropertiesServiceTag() 54 { 55 super(); 56 } 57 58 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.principal == null) 77 this.principal = this.getController().getPrincipal(); 78 79 final DynamicWebservice ws = new DynamicWebservice(principal); 80 81 ws.setTargetEndpointAddress(targetEndpointAddress); 82 ws.setOperationName(operationName); 83 ws.setReturnType(Boolean .class); 84 85 if(this.languageId == null) 86 ws.addArgument("languageId", this.getController().getLanguageId()); 87 else 88 ws.addArgument("languageId", this.languageId); 89 90 ws.addArgument("contentTypeDefinitionId", this.contentTypeDefinitionId); 91 ws.addArgument("userPropertiesAttributesMap", userPropertiesAttributesMap); 92 93 ws.callService(); 94 setResultAttribute(ws.getResult()); 95 } 96 catch(Exception e) 97 { 98 e.printStackTrace(); 99 throw new JspTagException (e.getMessage()); 100 } 101 102 return EVAL_PAGE; 103 } 104 105 108 public void setTargetEndpointAddress(final String targetEndpointAddress) throws JspException 109 { 110 this.targetEndpointAddress = evaluateString("remoteContentService", "targetEndpointAddress", targetEndpointAddress); 111 } 112 113 116 public void setOperationName(final String operationName) 117 { 118 this.operationName = operationName; 119 } 120 121 124 public void setPrincipal(final String principalString) throws JspException 125 { 126 this.principal = (InfoGluePrincipal) this.evaluate("remoteContentService", "principal", principalString, InfoGluePrincipal.class); 127 } 128 129 132 public void setLanguageId(final String languageIdString) throws JspException 133 { 134 this.languageId = this.evaluateInteger("remoteUserPropertiesService", "languageId", languageIdString); 135 } 136 137 140 public void setContentTypeDefinitionId(final String contentTypeDefinitionIdString) throws JspException 141 { 142 this.contentTypeDefinitionId = this.evaluateInteger("remoteUserPropertiesService", "contentTypeDefinitionId", contentTypeDefinitionIdString); 143 } 144 145 150 public void addUserPropertiesAttribute(String name, String value) throws JspException 151 { 152 this.userPropertiesAttributesMap.put(name, value); 153 } 154 155 } | Popular Tags |