KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dlog4j > formbean > SiteForm


1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  */

16 package dlog4j.formbean;
17
18 import java.text.SimpleDateFormat JavaDoc;
19 import java.util.Date JavaDoc;
20 import java.util.List JavaDoc;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
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 /**
30  * 子站点
31  * @author Liudong
32  */

33 public class SiteForm extends DlogActionForm {
34     
35     public final static int STATUS_PENDING = 0x00; //已申请尚未开通
36
public final static int STATUS_NORMAL = 0x01; //正常
37
public final static int STATUS_PAUSE = 0x02; //已暂停
38
public final static int STATUS_DELETED = 0x04; //已删除
39

40     int id;
41     String JavaDoc name;
42     String JavaDoc displayName;
43     String JavaDoc detail;
44     String JavaDoc icon;
45     String JavaDoc logo;
46     String JavaDoc css;
47     Date JavaDoc createTime;
48     Date JavaDoc lastTime;
49     String JavaDoc url;
50     int status = STATUS_NORMAL;
51     
52     List JavaDoc users;
53     List JavaDoc categories;
54     List JavaDoc params;
55     List JavaDoc summaries;
56
57     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc 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 JavaDoc sitename) {
69         this.name = sitename;
70     }
71     /**
72      * @return
73      */

74     public int getId() {
75         return id;
76     }
77
78     /**
79      * @return
80      */

81     public String JavaDoc getName() {
82         return name;
83     }
84
85     /**
86      * @param i
87      */

88     public void setId(int i) {
89         id = i;
90     }
91
92     /**
93      * @param string
94      */

95     public void setName(String JavaDoc string) {
96         name = string;
97     }
98
99     /**
100      * @return
101      */

102     public List JavaDoc getCategories() {
103         return categories;
104     }
105
106     /**
107      * @return
108      */

109     public List JavaDoc getParams() {
110         return params;
111     }
112
113     /**
114      * @return
115      */

116     public List JavaDoc getSummaries() {
117         return summaries;
118     }
119
120     /**
121      * @return
122      */

123     public List JavaDoc getUsers() {
124         return users;
125     }
126
127     /**
128      * @param list
129      */

130     public void setCategories(List JavaDoc list) {
131         categories = list;
132     }
133
134     /**
135      * @param list
136      */

137     public void setParams(List JavaDoc list) {
138         params = list;
139     }
140
141     /**
142      * @param list
143      */

144     public void setSummaries(List JavaDoc list) {
145         summaries = list;
146     }
147
148     /**
149      * @param list
150      */

151     public void setUsers(List JavaDoc list) {
152         users = list;
153     }
154
155     public int hashCode() {
156         return id;
157     }
158     public Date JavaDoc getCreateTime() {
159         return createTime;
160     }
161     public void setCreateTime(Date JavaDoc createTime) {
162         this.createTime = createTime;
163     }
164     public String JavaDoc getCss() {
165         return css;
166     }
167     public void setCss(String JavaDoc css) {
168         this.css = css;
169     }
170     public String JavaDoc getDisplayName() {
171         return displayName;
172     }
173     public void setDisplayName(String JavaDoc displayName) {
174         this.displayName = displayName;
175     }
176     public String JavaDoc getIcon() {
177         return icon;
178     }
179     public void setIcon(String JavaDoc icon) {
180         this.icon = icon;
181     }
182     public String JavaDoc getLogo() {
183         return logo;
184     }
185     public void setLogo(String JavaDoc 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 JavaDoc getUrl() {
195         return url;
196     }
197     public void setUrl(String JavaDoc url) {
198         this.url = url;
199     }
200     public String JavaDoc getLastTimeString() {
201         return new SimpleDateFormat JavaDoc("MM-dd").format((lastTime==null)?new Date JavaDoc():lastTime);
202     }
203     public Date JavaDoc getLastTime() {
204         return lastTime;
205     }
206     public void setLastTime(Date JavaDoc lastTime) {
207         this.lastTime = lastTime;
208     }
209     public String JavaDoc getDetail() {
210         return detail;
211     }
212     public void setDetail(String JavaDoc detail) {
213         this.detail = detail;
214     }
215 }
216
Popular Tags