1 package org.nextime.ion.backoffice.form; 2 3 import javax.servlet.http.HttpServletRequest ; 4 5 import org.apache.struts.action.ActionError; 6 import org.apache.struts.action.ActionErrors; 7 import org.apache.struts.action.ActionForm; 8 import org.apache.struts.action.ActionMapping; 9 10 public class CreatePublicationForm extends ActionForm { 11 12 private String name; 13 private String type; 14 private String workflow; 15 16 19 public ActionErrors myValidate(HttpServletRequest request) { 20 ActionErrors errors = new ActionErrors(); 21 if( "".equals(getName()) ) { 22 ActionError error = new ActionError("error.createPublication.nameMissing"); 23 errors.add("name",error); 24 } 25 if( "".equals(getType()) ) { 26 ActionError error = new ActionError("error.createPublication.typeMissing"); 27 errors.add("type",error); 28 } 29 if( "".equals(getWorkflow()) ) { 30 ActionError error = new ActionError("error.general.missingField"); 31 errors.add("workflow",error); 32 } 33 return errors; 34 } 35 36 37 40 public void reset(ActionMapping arg0, HttpServletRequest arg1) { 41 setName(null); 42 setType(null); 43 setWorkflow(null); 44 } 45 46 47 51 public String getName() { 52 return name; 53 } 54 55 56 60 public String getType() { 61 return type; 62 } 63 64 65 69 public void setName(String name) { 70 this.name = name; 71 } 72 73 74 78 public void setType(String type) { 79 this.type = type; 80 } 81 82 83 87 public String getWorkflow() { 88 return workflow; 89 } 90 91 95 public void setWorkflow(String workflow) { 96 this.workflow = workflow; 97 } 98 99 } 100 101 | Popular Tags |