1 16 17 package org.apache.webapp.admin.resources; 18 19 import java.util.List ; 20 import java.util.ArrayList ; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import org.apache.struts.action.ActionError; 24 import org.apache.struts.action.ActionErrors; 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.webapp.admin.LabelValueBean; 28 29 import java.lang.reflect.Constructor ; 30 31 38 39 public final class UserDatabaseForm extends BaseForm { 40 41 42 44 45 47 50 private String domain = null; 51 52 55 public String getDomain() { 56 return this.domain; 57 } 58 59 62 public void setDomain(String domain) { 63 this.domain = domain; 64 } 65 66 69 private String name = null; 70 71 public String getName() { 72 return (this.name); 73 } 74 75 public void setName(String name) { 76 this.name = name; 77 } 78 79 82 private String path = null; 83 84 public String getPath() { 85 return (this.path); 86 } 87 88 public void setPath(String path) { 89 this.path = path; 90 } 91 92 95 private String type = null; 96 97 public String getType() { 98 return (this.type); 99 } 100 101 public void setType(String type) { 102 this.type = type; 103 } 104 105 108 private String factory = null; 109 110 public String getFactory() { 111 return (this.factory); 112 } 113 114 public void setFactory(String factory) { 115 this.factory = factory; 116 } 117 118 121 private String description = null; 122 123 public String getDescription() { 124 return (this.description); 125 } 126 127 public void setDescription(String description) { 128 this.description = description; 129 } 130 131 133 139 public void reset(ActionMapping mapping, HttpServletRequest request) { 140 141 super.reset(mapping, request); 142 name = null; 143 type = null; 144 path = null; 145 factory = null; 146 description = null; 147 148 } 149 150 160 161 private ActionErrors errors = null; 162 163 public ActionErrors validate(ActionMapping mapping, 164 HttpServletRequest request) { 165 166 errors = new ActionErrors(); 167 168 String submit = request.getParameter("submit"); 169 171 if ((name == null) || (name.length() < 1)) { 173 errors.add("name", 174 new ActionError("resources.error.name.required")); 175 } 176 177 if ((path == null) || (path.length() < 1)) { 179 errors.add("path", 180 new ActionError("resources.error.path.required")); 181 } 182 183 if ((name != null) && (name.indexOf('"') >= 0)) { 185 errors.add("name", 186 new ActionError("users.error.quotes")); 187 } 188 189 if ((path != null) && (path.indexOf('"') > 0)) { 191 errors.add("path", 192 new ActionError("users.error.quotes")); 193 } 194 195 if ((description != null) && (description.indexOf('"') > 0)) { 197 errors.add("description", 198 new ActionError("users.error.quotes")); 199 } 200 return (errors); 202 } 203 204 } 205 | Popular Tags |