1 16 package dlog4j.formbean; 17 18 import java.text.SimpleDateFormat ; 19 import java.util.Date ; 20 import java.util.List ; 21 22 import javax.servlet.http.HttpServletRequest ; 23 24 import org.apache.commons.lang.StringUtils; 25 import org.apache.struts.action.ActionError; 26 import org.apache.struts.action.ActionErrors; 27 import org.apache.struts.action.ActionMapping; 28 29 33 public class SiteForm extends DlogActionForm { 34 35 public final static int STATUS_PENDING = 0x00; public final static int STATUS_NORMAL = 0x01; public final static int STATUS_PAUSE = 0x02; public final static int STATUS_DELETED = 0x04; 40 int id; 41 String name; 42 String displayName; 43 String detail; 44 String icon; 45 String logo; 46 String css; 47 Date createTime; 48 Date lastTime; 49 String url; 50 int status = STATUS_NORMAL; 51 52 List users; 53 List categories; 54 List params; 55 List summaries; 56 57 public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) { 58 ActionErrors errors = new ActionErrors(); 59 if(StringUtils.isEmpty(name)) 60 errors.add("name",new ActionError("not_empty_allow")); 61 if(StringUtils.isEmpty(displayName)) 62 errors.add("displayName",new ActionError("not_empty_allow")); 63 return errors; 64 } 65 66 public SiteForm() {} 67 68 public SiteForm(String sitename) { 69 this.name = sitename; 70 } 71 74 public int getId() { 75 return id; 76 } 77 78 81 public String getName() { 82 return name; 83 } 84 85 88 public void setId(int i) { 89 id = i; 90 } 91 92 95 public void setName(String string) { 96 name = string; 97 } 98 99 102 public List getCategories() { 103 return categories; 104 } 105 106 109 public List getParams() { 110 return params; 111 } 112 113 116 public List getSummaries() { 117 return summaries; 118 } 119 120 123 public List getUsers() { 124 return users; 125 } 126 127 130 public void setCategories(List list) { 131 categories = list; 132 } 133 134 137 public void setParams(List list) { 138 params = list; 139 } 140 141 144 public void setSummaries(List list) { 145 summaries = list; 146 } 147 148 151 public void setUsers(List list) { 152 users = list; 153 } 154 155 public int hashCode() { 156 return id; 157 } 158 public Date getCreateTime() { 159 return createTime; 160 } 161 public void setCreateTime(Date createTime) { 162 this.createTime = createTime; 163 } 164 public String getCss() { 165 return css; 166 } 167 public void setCss(String css) { 168 this.css = css; 169 } 170 public String getDisplayName() { 171 return displayName; 172 } 173 public void setDisplayName(String displayName) { 174 this.displayName = displayName; 175 } 176 public String getIcon() { 177 return icon; 178 } 179 public void setIcon(String icon) { 180 this.icon = icon; 181 } 182 public String getLogo() { 183 return logo; 184 } 185 public void setLogo(String logo) { 186 this.logo = logo; 187 } 188 public int getStatus() { 189 return status; 190 } 191 public void setStatus(int status) { 192 this.status = status; 193 } 194 public String getUrl() { 195 return url; 196 } 197 public void setUrl(String url) { 198 this.url = url; 199 } 200 public String getLastTimeString() { 201 return new SimpleDateFormat ("MM-dd").format((lastTime==null)?new Date ():lastTime); 202 } 203 public Date getLastTime() { 204 return lastTime; 205 } 206 public void setLastTime(Date lastTime) { 207 this.lastTime = lastTime; 208 } 209 public String getDetail() { 210 return detail; 211 } 212 public void setDetail(String detail) { 213 this.detail = detail; 214 } 215 } 216 | Popular Tags |