KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > mailinglists > struts > MailingListForm


1 package com.dotmarketing.portlets.mailinglists.struts;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import org.apache.struts.action.ActionErrors;
5 import org.apache.struts.action.ActionMapping;
6 import org.apache.struts.action.ActionMessage;
7 import org.apache.struts.validator.ValidatorForm;
8
9 import com.liferay.portal.util.Constants;
10
11 /** @author Hibernate CodeGenerator */
12 public class MailingListForm extends ValidatorForm {
13
14     private static final long serialVersionUID = 1L;
15
16     /*** WEB ASSET FIELDS FOR THE FORM ***/
17     /** nullable persistent field */
18     private String JavaDoc title;
19     private boolean publicList;
20     private String JavaDoc newSubscribers;
21     private boolean ignoreHeaders;
22     private int subscriberCount;
23     private long inode;
24     
25     //Fields to add a single subscriber
26
private String JavaDoc firstName;
27     private String JavaDoc middleName;
28     private String JavaDoc lastName;
29     private String JavaDoc email;
30     private String JavaDoc street1;
31     private String JavaDoc street2;
32     private String JavaDoc city;
33     private String JavaDoc state;
34     private String JavaDoc zip;
35     private String JavaDoc country;
36     private String JavaDoc phone;
37
38     public MailingListForm() {
39     }
40
41    
42     /**
43      * Returns the publicList.
44      * @return boolean
45      */

46     public boolean isPublicList() {
47         return publicList;
48     }
49
50     /**
51      * Returns the title.
52      * @return String
53      */

54     public String JavaDoc getTitle() {
55         return title;
56     }
57
58     /**
59      * Sets the publicList.
60      * @param publicList The publicList to set
61      */

62     public void setPublicList(boolean publicList) {
63         this.publicList = publicList;
64     }
65
66     /**
67      * Sets the title.
68      * @param title The title to set
69      */

70     public void setTitle(String JavaDoc title) {
71         this.title = title;
72     }
73
74     /**
75      * Returns the newSubscribers.
76      * @return String
77      */

78     public String JavaDoc getNewSubscribers() {
79         return newSubscribers;
80     }
81
82     /**
83      * Sets the newSubscribers.
84      * @param newSubscribers The newSubscribers to set
85      */

86     public void setNewSubscribers(String JavaDoc newSubscribers) {
87         this.newSubscribers = newSubscribers;
88     }
89
90     /**
91      * Returns the subscriberCount.
92      * @return int
93      */

94     public int getSubscriberCount() {
95         return subscriberCount;
96     }
97
98     /**
99      * Sets the subscriberCount.
100      * @param subscriberCount The subscriberCount to set
101      */

102     public void setSubscriberCount(int subscriberCount) {
103         this.subscriberCount = subscriberCount;
104     }
105
106     /**
107      * Returns the inode.
108      * @return long
109      */

110     public long getInode() {
111         return inode;
112     }
113
114     /**
115      * Sets the inode.
116      * @param inode The inode to set
117      */

118     public void setInode(long inode) {
119         this.inode = inode;
120     }
121
122     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
123         if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.ADD)) {
124             return super.validate(mapping, request);
125         } else if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.UPDATE)) {
126             ActionErrors errors = new ActionErrors ();
127             if (email.equals("")) {
128                 ActionMessage error = new ActionMessage ("prompt.mailingListEmailRequired");
129                 errors.add("email", error);
130             }
131             if (firstName.equals("")) {
132                 ActionMessage error = new ActionMessage ("prompt.mailingListFirstName");
133                 errors.add("firstName", error);
134             }
135             if (lastName.equals("")) {
136                 ActionMessage error = new ActionMessage ("prompt.mailingListLastName");
137                 errors.add("lastName", error);
138             }
139             if (errors.size() == 0)
140                 return super.validate(mapping, request);
141             return errors;
142         }
143         return null;
144     }
145
146
147     public String JavaDoc getCity() {
148         return city;
149     }
150     public void setCity(String JavaDoc city) {
151         this.city = city;
152     }
153     public String JavaDoc getCountry() {
154         return country;
155     }
156     public void setCountry(String JavaDoc country) {
157         this.country = country;
158     }
159     public String JavaDoc getEmail() {
160         return email;
161     }
162     public void setEmail(String JavaDoc email) {
163         this.email = email;
164     }
165     public String JavaDoc getFirstName() {
166         return firstName;
167     }
168     public void setFirstName(String JavaDoc firstName) {
169         this.firstName = firstName;
170     }
171     public String JavaDoc getLastName() {
172         return lastName;
173     }
174     public void setLastName(String JavaDoc lastName) {
175         this.lastName = lastName;
176     }
177     public String JavaDoc getMiddleName() {
178         return middleName;
179     }
180     public void setMiddleName(String JavaDoc middleName) {
181         this.middleName = middleName;
182     }
183     public String JavaDoc getPhone() {
184         return phone;
185     }
186     public void setPhone(String JavaDoc phone) {
187         this.phone = phone;
188     }
189     public String JavaDoc getState() {
190         return state;
191     }
192     public void setState(String JavaDoc state) {
193         this.state = state;
194     }
195     public String JavaDoc getStreet1() {
196         return street1;
197     }
198     public void setStreet1(String JavaDoc street1) {
199         this.street1 = street1;
200     }
201     public String JavaDoc getStreet2() {
202         return street2;
203     }
204     public void setStreet2(String JavaDoc street2) {
205         this.street2 = street2;
206     }
207     public String JavaDoc getZip() {
208         return zip;
209     }
210     public void setZip(String JavaDoc zip) {
211         this.zip = zip;
212     }
213     
214     /**
215      * @return Returns the ignoreHeaders.
216      */

217     public boolean isIgnoreHeaders() {
218         return ignoreHeaders;
219     }
220     /**
221      * @param ignoreHeaders The ignoreHeaders to set.
222      */

223     public void setIgnoreHeaders(boolean ignoreHeaders) {
224         this.ignoreHeaders = ignoreHeaders;
225     }
226 }
227
Popular Tags