KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > webevents > struts > WebEventLocationForm


1 package com.dotmarketing.portlets.webevents.struts;
2
3 import java.text.SimpleDateFormat JavaDoc;
4
5 import javax.servlet.http.HttpServletRequest JavaDoc;
6
7 import org.apache.struts.Globals;
8 import org.apache.struts.action.ActionErrors;
9 import org.apache.struts.action.ActionMapping;
10 import org.apache.struts.action.ActionMessage;
11 import org.apache.struts.validator.ValidatorForm;
12
13 import com.dotmarketing.util.UtilMethods;
14 import com.liferay.portal.util.Constants;
15 import com.dotmarketing.portlets.webevents.factories.WebEventFactory;
16 import com.dotmarketing.portlets.webevents.model.WebEvent;
17
18 public class WebEventLocationForm extends ValidatorForm {
19
20     private static final long serialVersionUID = 1L;
21     
22     private long inode; //identifier
23
private long webEventInode; //persistent
24
private String JavaDoc city; //persistent
25
private String JavaDoc state; //persistent
26
private String JavaDoc title;
27
28     /*DATES*/
29     private java.util.Date JavaDoc startDate; //persistent
30
private String JavaDoc strStartDate;
31     private java.util.Date JavaDoc endDate; //persistent
32
private String JavaDoc strEndDate;
33     private String JavaDoc strStartTime;
34     private String JavaDoc strEndTime;
35
36     private boolean showOnWeb; //persistent
37
private boolean webRegActive; //persistent
38
private String JavaDoc hotelName; //persistent
39

40     /*LINKS*/
41     private long hotelLink; //persistent
42
private String JavaDoc selectedhotelLink; //persistent
43
private long pastEventLink; //persistent
44
private String JavaDoc selectedpastEventLink; //persistent
45

46     private float partnerPrice; //persistent
47
private float nonPartnerPrice; //persistent
48
private String JavaDoc shortDescription; //persistent
49
private String JavaDoc textEmail; //persistent
50
private boolean almostAtCapacity = false; //persistent
51
private boolean full = false; //persistent
52
private boolean defaultContractPartnerPrice = false; //persistent
53

54     public WebEventLocationForm() {
55     }
56
57     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
58         if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.SAVE)) {
59             ActionErrors ae = new ActionErrors();
60             WebEvent event = (WebEvent) WebEventFactory.getWebEvent(webEventInode);
61             
62             if (event.isInstitute() && !UtilMethods.isSet(city)) {
63                 ae.add(Globals.ERROR_KEY,new ActionMessage("message.webeventlocation.city","City"));
64             }
65             if (event.isInstitute() && !UtilMethods.isSet(state)) {
66                 ae.add(Globals.ERROR_KEY,new ActionMessage("message.webeventlocation.state","State"));
67             }
68             /*
69             if (!event.isInstitute() && !UtilMethods.isSet(strStartTime)) {
70                 ae.add(Globals.ERROR_KEY,new ActionMessage("message.webeventlocation.starttime","Start Time"));
71             }
72             if (!event.isInstitute() && !UtilMethods.isSet(strEndTime)) {
73                 ae.add(Globals.ERROR_KEY,new ActionMessage("message.webeventlocation.endtime","End Time"));
74             }*/

75             ae.add(super.validate(mapping, request));
76             return ae;
77         }
78         return null;
79     }
80
81     /**
82      * @return Returns the city.
83      */

84     public String JavaDoc getCity() {
85         return city;
86     }
87
88     /**
89      * @param city The city to set.
90      */

91     public void setCity(String JavaDoc city) {
92         this.city = city;
93     }
94
95     /**
96      * @return Returns the endDate.
97      */

98     public java.util.Date JavaDoc getEndDate() {
99         return endDate;
100     }
101
102     /**
103      * @param endDate The endDate to set.
104      */

105     public void setEndDate(java.util.Date JavaDoc endDate) {
106         this.endDate = endDate;
107     }
108
109     /**
110      * @return Returns the hotelLink.
111      */

112     public long getHotelLink() {
113         return hotelLink;
114     }
115
116     /**
117      * @param hotelLink The hotelLink to set.
118      */

119     public void setHotelLink(long hotelLink) {
120         this.hotelLink = hotelLink;
121     }
122
123     /**
124      * @return Returns the hotelName.
125      */

126     public String JavaDoc getHotelName() {
127         return hotelName;
128     }
129
130     /**
131      * @param hotelName The hotelName to set.
132      */

133     public void setHotelName(String JavaDoc hotelName) {
134         this.hotelName = hotelName;
135     }
136
137     /**
138      * @return Returns the inode.
139      */

140     public long getInode() {
141         return inode;
142     }
143
144     /**
145      * @param inode The inode to set.
146      */

147     public void setInode(long inode) {
148         this.inode = inode;
149     }
150
151     /**
152      * @return Returns the nonPartnerPrice.
153      */

154     public float getNonPartnerPrice() {
155         return nonPartnerPrice;
156     }
157
158     /**
159      * @param nonPartnerPrice The nonPartnerPrice to set.
160      */

161     public void setNonPartnerPrice(float nonPartnerPrice) {
162         this.nonPartnerPrice = nonPartnerPrice;
163     }
164
165     /**
166      * @return Returns the partnerPrice.
167      */

168     public float getPartnerPrice() {
169         return partnerPrice;
170     }
171
172     /**
173      * @param partnerPrice The partnerPrice to set.
174      */

175     public void setPartnerPrice(float partnerPrice) {
176         this.partnerPrice = partnerPrice;
177     }
178
179     /**
180      * @return Returns the pastEventLink.
181      */

182     public long getPastEventLink() {
183         return pastEventLink;
184     }
185
186     /**
187      * @param pastEventLink The pastEventLink to set.
188      */

189     public void setPastEventLink(long pastEventLink) {
190         this.pastEventLink = pastEventLink;
191     }
192
193     /**
194      * @return Returns the shortDescription.
195      */

196     public String JavaDoc getShortDescription() {
197         return shortDescription;
198     }
199
200     /**
201      * @param shortDescription The shortDescription to set.
202      */

203     public void setShortDescription(String JavaDoc shortDescription) {
204         this.shortDescription = shortDescription;
205     }
206
207     /**
208      * @return Returns the showOnWeb.
209      */

210     public boolean isShowOnWeb() {
211         return showOnWeb;
212     }
213
214     /**
215      * @param showOnWeb The showOnWeb to set.
216      */

217     public void setShowOnWeb(boolean showOnWeb) {
218         this.showOnWeb = showOnWeb;
219     }
220
221     /**
222      * @return Returns the startDate.
223      */

224     public java.util.Date JavaDoc getStartDate() {
225         return startDate;
226     }
227
228     /**
229      * @param startDate The startDate to set.
230      */

231     public void setStartDate(java.util.Date JavaDoc startDate) {
232         this.startDate = startDate;
233     }
234
235     /**
236      * @return Returns the state.
237      */

238     public String JavaDoc getState() {
239         return state;
240     }
241
242     /**
243      * @param state The state to set.
244      */

245     public void setState(String JavaDoc state) {
246         this.state = state;
247     }
248
249     /**
250      * @return Returns the textEmail.
251      */

252     public String JavaDoc getTextEmail() {
253         return textEmail;
254     }
255
256     /**
257      * @param textEmail The textEmail to set.
258      */

259     public void setTextEmail(String JavaDoc textEmail) {
260         this.textEmail = textEmail;
261     }
262
263     /**
264      * @return Returns the webEventInode.
265      */

266     public long getWebEventInode() {
267         return webEventInode;
268     }
269
270     /**
271      * @param webEventInode The webEventInode to set.
272      */

273     public void setWebEventInode(long webEventInode) {
274         this.webEventInode = webEventInode;
275     }
276
277     /**
278      * @return Returns the webRegActive.
279      */

280     public boolean isWebRegActive() {
281         return webRegActive;
282     }
283
284     /**
285      * @param webRegActive The webRegActive to set.
286      */

287     public void setWebRegActive(boolean webRegActive) {
288         this.webRegActive = webRegActive;
289     }
290
291     /**
292      * @return Returns the selectedhotelLink.
293      */

294     public String JavaDoc getSelectedhotelLink() {
295         return selectedhotelLink;
296     }
297
298     /**
299      * @param selectedhotelLink The selectedhotelLink to set.
300      */

301     public void setSelectedhotelLink(String JavaDoc selectedhotelLink) {
302         this.selectedhotelLink = selectedhotelLink;
303     }
304
305     /**
306      * @return Returns the selectedpastEventLink.
307      */

308     public String JavaDoc getSelectedpastEventLink() {
309         return selectedpastEventLink;
310     }
311
312     /**
313      * @param selectedpastEventLink The selectedpastEventLink to set.
314      */

315     public void setSelectedpastEventLink(String JavaDoc selectedpastEventLink) {
316         this.selectedpastEventLink = selectedpastEventLink;
317     }
318
319     /**
320      * @return Returns the strEndDate.
321      */

322     public String JavaDoc getStrEndDate() {
323         if (endDate!=null && !UtilMethods.isSet(strEndDate)) {
324             return new SimpleDateFormat JavaDoc("MM/dd/yyyy").format(endDate);
325         }
326         return strEndDate;
327     }
328
329     /**
330      * @param strEndDate The strEndDate to set.
331      */

332     public void setStrEndDate(String JavaDoc strEndDate) {
333         this.strEndDate = strEndDate;
334         try {
335             if (UtilMethods.isSet(strEndTime)) {
336                 this.endDate = new SimpleDateFormat JavaDoc("MM/dd/yyyy H:mm:ss").parse(strEndDate + " " + strEndTime);
337             }
338             else {
339                 this.endDate = new SimpleDateFormat JavaDoc("MM/dd/yyyy").parse(strEndDate);
340             }
341         }
342         catch(Exception JavaDoc ex) {
343         }
344     }
345
346     /**
347      * @return Returns the strStartDate.
348      */

349     public String JavaDoc getStrStartDate() {
350         if (startDate!=null && !UtilMethods.isSet(strStartDate)) {
351             return new SimpleDateFormat JavaDoc("MM/dd/yyyy").format(startDate);
352         }
353         return strStartDate;
354     }
355     /**
356      * @param strStartDate The strStartDate to set.
357      */

358     public void setStrStartDate(String JavaDoc strStartDate) {
359         this.strStartDate = strStartDate;
360         try {
361             if (UtilMethods.isSet(strStartTime)) {
362                 this.startDate = new SimpleDateFormat JavaDoc("MM/dd/yyyy H:mm:ss").parse(strStartDate + " " + strStartTime);
363             }
364             else {
365                 this.startDate = new SimpleDateFormat JavaDoc("MM/dd/yyyy").parse(strStartDate);
366             }
367         }
368         catch(Exception JavaDoc ex) {
369         }
370     }
371
372     /**
373      * @return Returns the title.
374      */

375     public String JavaDoc getTitle() {
376         return title;
377     }
378
379     /**
380      * @param title The title to set.
381      */

382     public void setTitle(String JavaDoc title) {
383         this.title = title;
384     }
385
386     /**
387      * @return Returns the strEndTime.
388      */

389     public String JavaDoc getStrEndTime() {
390         if (endDate!=null && !UtilMethods.isSet(strEndTime)) {
391             return new SimpleDateFormat JavaDoc("H:mm:ss").format(endDate);
392         }
393         return strEndTime;
394     }
395
396     /**
397      * @param strEndTime The strEndTime to set.
398      */

399     public void setStrEndTime(String JavaDoc strEndTime) {
400         this.strEndTime = strEndTime;
401     }
402
403     /**
404      * @return Returns the strStartTime.
405      */

406     public String JavaDoc getStrStartTime() {
407         if (startDate!=null && !UtilMethods.isSet(strStartTime)) {
408             return new SimpleDateFormat JavaDoc("H:mm:ss").format(startDate);
409         }
410         return strStartTime;
411     }
412
413     /**
414      * @param strStartTime The strStartTime to set.
415      */

416     public void setStrStartTime(String JavaDoc strStartTime) {
417         this.strStartTime = strStartTime;
418     }
419
420     public boolean isAlmostAtCapacity() {
421         return almostAtCapacity;
422     }
423
424     public void setAlmostAtCapacity(boolean almostAtCapacity) {
425         this.almostAtCapacity = almostAtCapacity;
426     }
427
428     public boolean isFull() {
429         return full;
430     }
431
432     public void setFull(boolean full) {
433         this.full = full;
434     }
435
436     public boolean isDefaultContractPartnerPrice() {
437         return defaultContractPartnerPrice;
438     }
439
440     public void setDefaultContractPartnerPrice(boolean defaultContractPartnerPrice) {
441         this.defaultContractPartnerPrice = defaultContractPartnerPrice;
442     }
443 }
444
Popular Tags