1 25 29 package org.jresearch.gossip.forms; 30 31 import javax.servlet.http.HttpServletRequest ; 32 33 import org.apache.struts.action.ActionError; 34 import org.apache.struts.action.ActionErrors; 35 import org.apache.struts.action.ActionMapping; 36 import org.apache.struts.validator.ValidatorForm; 37 import org.jresearch.gossip.util.HtmlCodec; 38 import org.jresearch.gossip.util.MessageProcessor; 39 40 45 public class MessageForm extends ValidatorForm { 46 47 private String fid; 48 49 private String tid; 50 51 private String block = "0"; 52 53 private String mid; 54 55 private String title; 56 57 private String text; 58 59 private String subscribe; 60 61 private String announce; 62 63 private String email; 64 65 private String name; 66 67 75 public void reset(ActionMapping mapping, HttpServletRequest request) { 76 this.fid = null; 77 this.tid = null; 78 this.block = "0"; 79 this.mid = null; 80 this.title = null; 81 this.text = null; 82 this.subscribe = null; 83 this.announce = null; 84 this.email = null; 85 this.name = null; 86 } 87 88 102 public ActionErrors validate(ActionMapping mapping, 103 HttpServletRequest request) { 104 ActionErrors errors = super.validate(mapping, request); 106 107 if ((this.tid == null || this.tid.equals("")) 108 && (this.title == null || this.title.equals(""))) { 109 errors.add("title", new ActionError("errors.ERR18")); 110 } 111 112 return errors; 113 } 114 115 120 public String getFid() { 121 return fid; 122 } 123 124 129 public String getTid() { 130 return tid; 131 } 132 133 138 public void setFid(String i) { 139 fid = i; 140 } 141 142 147 public void setTid(String i) { 148 tid = i; 149 } 150 151 156 public String getBlock() { 157 return block; 158 } 159 160 165 public void setBlock(String i) { 166 block = i; 167 } 168 169 174 public String getMid() { 175 return mid; 176 } 177 178 183 public void setMid(String string) { 184 mid = string; 185 } 186 187 192 public String getSubscribe() { 193 return subscribe; 194 } 195 196 201 public String getText() { 202 return text; 203 } 204 205 public String getCleanText() { 206 return MessageProcessor.getInstance().cleanup(this.text).trim(); 207 } 208 209 214 public String getTitle() { 215 return title; 216 } 217 218 223 public void setSubscribe(String string) { 224 subscribe = string; 225 } 226 227 232 public void setText(String string) { 233 text = HtmlCodec.trim(string); 234 } 235 236 241 public void setTitle(String string) { 242 title = HtmlCodec.trim(string); 243 } 244 245 250 public String getEmail() { 251 return email; 252 } 253 254 259 public void setEmail(String string) { 260 email = string; 261 } 262 263 268 public String getName() { 269 return name; 270 } 271 272 277 public void setName(String string) { 278 name = string; 279 } 280 281 286 public String getAnnounce() { 287 return announce; 288 } 289 290 295 public void setAnnounce(String string) { 296 announce = string; 297 } 298 } | Popular Tags |