001: /*
002: * This program is free software; you can redistribute it and/or modify
003: * it under the terms of the GNU General Public License as published by
004: * the Free Software Foundation; either version 2 of the License, or
005: * (at your option) any later version.
006: *
007: * This program is distributed in the hope that it will be useful,
008: * but WITHOUT ANY WARRANTY; without even the implied warranty of
009: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
010: * GNU Library General Public License for more details.
011: *
012: * You should have received a copy of the GNU General Public License
013: * along with this program; if not, write to the Free Software
014: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
015: */
016: package dlog4j.formbean;
017:
018: import java.text.SimpleDateFormat;
019: import java.util.Date;
020: import java.util.List;
021:
022: import javax.servlet.http.HttpServletRequest;
023:
024: import org.apache.commons.lang.StringUtils;
025: import org.apache.struts.action.ActionError;
026: import org.apache.struts.action.ActionErrors;
027: import org.apache.struts.action.ActionMapping;
028:
029: /**
030: * 子站点
031: * @author Liudong
032: */
033: public class SiteForm extends DlogActionForm {
034:
035: public final static int STATUS_PENDING = 0x00; //已申请尚未开通
036: public final static int STATUS_NORMAL = 0x01; //正常
037: public final static int STATUS_PAUSE = 0x02; //已暂停
038: public final static int STATUS_DELETED = 0x04; //已删除
039:
040: int id;
041: String name;
042: String displayName;
043: String detail;
044: String icon;
045: String logo;
046: String css;
047: Date createTime;
048: Date lastTime;
049: String url;
050: int status = STATUS_NORMAL;
051:
052: List users;
053: List categories;
054: List params;
055: List summaries;
056:
057: public ActionErrors validate(ActionMapping mapping,
058: HttpServletRequest req) {
059: ActionErrors errors = new ActionErrors();
060: if (StringUtils.isEmpty(name))
061: errors.add("name", new ActionError("not_empty_allow"));
062: if (StringUtils.isEmpty(displayName))
063: errors.add("displayName",
064: new ActionError("not_empty_allow"));
065: return errors;
066: }
067:
068: public SiteForm() {
069: }
070:
071: public SiteForm(String sitename) {
072: this .name = sitename;
073: }
074:
075: /**
076: * @return
077: */
078: public int getId() {
079: return id;
080: }
081:
082: /**
083: * @return
084: */
085: public String getName() {
086: return name;
087: }
088:
089: /**
090: * @param i
091: */
092: public void setId(int i) {
093: id = i;
094: }
095:
096: /**
097: * @param string
098: */
099: public void setName(String string) {
100: name = string;
101: }
102:
103: /**
104: * @return
105: */
106: public List getCategories() {
107: return categories;
108: }
109:
110: /**
111: * @return
112: */
113: public List getParams() {
114: return params;
115: }
116:
117: /**
118: * @return
119: */
120: public List getSummaries() {
121: return summaries;
122: }
123:
124: /**
125: * @return
126: */
127: public List getUsers() {
128: return users;
129: }
130:
131: /**
132: * @param list
133: */
134: public void setCategories(List list) {
135: categories = list;
136: }
137:
138: /**
139: * @param list
140: */
141: public void setParams(List list) {
142: params = list;
143: }
144:
145: /**
146: * @param list
147: */
148: public void setSummaries(List list) {
149: summaries = list;
150: }
151:
152: /**
153: * @param list
154: */
155: public void setUsers(List list) {
156: users = list;
157: }
158:
159: public int hashCode() {
160: return id;
161: }
162:
163: public Date getCreateTime() {
164: return createTime;
165: }
166:
167: public void setCreateTime(Date createTime) {
168: this .createTime = createTime;
169: }
170:
171: public String getCss() {
172: return css;
173: }
174:
175: public void setCss(String css) {
176: this .css = css;
177: }
178:
179: public String getDisplayName() {
180: return displayName;
181: }
182:
183: public void setDisplayName(String displayName) {
184: this .displayName = displayName;
185: }
186:
187: public String getIcon() {
188: return icon;
189: }
190:
191: public void setIcon(String icon) {
192: this .icon = icon;
193: }
194:
195: public String getLogo() {
196: return logo;
197: }
198:
199: public void setLogo(String logo) {
200: this .logo = logo;
201: }
202:
203: public int getStatus() {
204: return status;
205: }
206:
207: public void setStatus(int status) {
208: this .status = status;
209: }
210:
211: public String getUrl() {
212: return url;
213: }
214:
215: public void setUrl(String url) {
216: this .url = url;
217: }
218:
219: public String getLastTimeString() {
220: return new SimpleDateFormat("MM-dd")
221: .format((lastTime == null) ? new Date() : lastTime);
222: }
223:
224: public Date getLastTime() {
225: return lastTime;
226: }
227:
228: public void setLastTime(Date lastTime) {
229: this .lastTime = lastTime;
230: }
231:
232: public String getDetail() {
233: return detail;
234: }
235:
236: public void setDetail(String detail) {
237: this.detail = detail;
238: }
239: }
|