]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionController.java
No, putting these methods into admin (request-scoped) controller is not good as no...
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / contact / PizzaContactWebSessionController.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Affero General Public License for more details.
13  *
14  * You should have received a copy of the GNU Affero General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.pizzaapplication.beans.contact;
18
19 import java.io.Serializable;
20 import java.util.Date;
21 import java.util.List;
22 import org.mxchange.jcontacts.contact.Contact;
23 import org.mxchange.jcontacts.contact.gender.Gender;
24 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
25 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
26 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
27 import org.mxchange.jcountry.data.Country;
28 import org.mxchange.jcustomercore.events.customer.added.AdminAddedCustomerEvent;
29 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
30 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
31 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
32 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
33
34 /**
35  * An interface for user beans
36  * <p>
37  * @author Roland Haeder<roland@mxchange.org>
38  */
39 public interface PizzaContactWebSessionController extends Serializable {
40
41         /**
42          * Minimum password length
43          */
44         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
45
46         /**
47          * Returns a list of all found contacts
48          * <p>
49          * @return A list of all contacts.
50          */
51         List<Contact> allContacts();
52
53         /**
54          * Checks whether there are contacts.
55          * <p>
56          * @return Whether contacts are there
57          */
58         boolean hasContacts ();
59
60         /**
61          * Event observer for newly added users by adminstrator
62          * <p>
63          * @param event Event being fired
64          */
65         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
66
67         /**
68          * Updates all data from bean in given contact instance
69          * <p>
70          * @param userContact Contact instance to update
71          */
72         void updateContactDataFromController (final Contact userContact);
73
74         /**
75          * Adds given email address to list
76          * <p>
77          * @param contactEmailAddress Email address to add
78          */
79         void addEmailAddress (final String contactEmailAddress);
80
81         /**
82          * Tries to lookup contact by given id number. If the user is not found a
83          * proper exceptions are thrown.
84          * <p>
85          * @param contactId Contact id
86          * <p>
87          * @return Contact instance
88          * <p>
89          * @throws ContactNotFoundException If the user is not found
90          */
91         Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
92
93         /**
94          * Event observer for new user registrations
95          * <p>
96          * @param event User registration event
97          */
98         void afterRegistrationEvent (final UserRegisteredEvent event);
99
100         /**
101          * Observes events being fired when an administrator has added a new
102          * customer.
103          * <p>
104          * @param event Event being fired
105          */
106         void afterAdminAddedCustomer (final AdminAddedCustomerEvent event);
107
108         /**
109          * Observes events being fired when an administrator has added a new
110          * contact.
111          * <p>
112          * @param event Event being fired
113          */
114         void afterAdminAddedContact (final AdminAddedContactEvent event);
115
116         /**
117          * Event observer for updated contact data by admins
118          * <p>
119          * @param event Updated contact data event
120          */
121         void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
122
123         /**
124          * Event observer for logged-in user
125          * <p>
126          * @param event Event instance
127          */
128         void afterUserLogin (final UserLoggedInEvent event);
129
130         /**
131          * Creates an instance from all properties
132          * <p>
133          * @return A contact instance
134          */
135         Contact createContactInstance ();
136
137         /**
138          * Getter for birth day
139          * <p>
140          * @return Birth day
141          */
142         Date getBirthday ();
143
144         /**
145          * Setter for birth day
146          * <p>
147          * @param birthday Birth day
148          */
149         void setBirthday (final Date birthday);
150
151         /**
152          * Getter for ellphone number's carrier
153          * <p>
154          * @return Cellphone number's carrier
155          */
156         MobileProvider getCellphoneCarrier ();
157
158         /**
159          * Setter for cellphone number's carrier prefix
160          * <p>
161          * @param cellphoneCarrier Cellphone number's carrier prefix
162          */
163         void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
164
165         /**
166          * Getter for ellphone number
167          * <p>
168          * @return Cellphone number
169          */
170         Long getCellphoneNumber ();
171
172         /**
173          * Setter for ellphone number
174          * <p>
175          * @param cellphoneNumber Cellphone number
176          */
177         void setCellphoneNumber (final Long cellphoneNumber);
178
179         /**
180          * City
181          * <p>
182          * @return the city
183          */
184         String getCity ();
185
186         /**
187          * City
188          * <p>
189          * @param city the city to set
190          */
191         void setCity (final String city);
192
193         /**
194          * Getter for comments
195          * <p>
196          * @return Comments
197          */
198         String getComment ();
199
200         /**
201          * Setter for comment
202          * <p>
203          * @param comment Comments
204          */
205         void setComment (final String comment);
206
207         /**
208          * Getter for country instance
209          * <p>
210          * @return Country instance
211          */
212         Country getCountry ();
213
214         /**
215          * Setter for country instance
216          * <p>
217          * @param country Country instance
218          */
219         void setCountry (final Country country);
220
221         /**
222          * Getter for email address
223          * <p>
224          * @return Email address
225          */
226         String getEmailAddress ();
227
228         /**
229          * Setter for email address
230          * <p>
231          * @param emailAddress Email address
232          */
233         void setEmailAddress (final String emailAddress);
234
235         /**
236          * Getter for email address, repeated
237          * <p>
238          * @return the emailAddress, repeated
239          */
240         String getEmailAddressRepeat ();
241
242         /**
243          * Setter for email address repeated
244          * <p>
245          * @param emailAddressRepeat the emailAddress to set
246          */
247         void setEmailAddressRepeat (final String emailAddressRepeat);
248
249         /**
250          * Family name
251          * <p>
252          * @return the familyName
253          */
254         String getFamilyName ();
255
256         /**
257          * Family name
258          * <p>
259          * @param familyName the familyName to set
260          */
261         void setFamilyName (final String familyName);
262
263         /**
264          * Getter for fax number's area code
265          * <p>
266          * @return Fax number's area code
267          */
268         Integer getFaxAreaCode ();
269
270         /**
271          * Setter for fax number's area code
272          * <p>
273          * @param faxAreaCode Fax number's area code
274          */
275         void setFaxAreaCode (final Integer faxAreaCode);
276
277         /**
278          * Getter for fax's country instance
279          * <p>
280          * @return Fax' country instance
281          */
282         Country getFaxCountry ();
283
284         /**
285          * Setter for fax's country instance
286          * <p>
287          * @param faxCountry Fax' country instance
288          */
289         void setFaxCountry (final Country faxCountry);
290
291         /**
292          * Getter for fax number
293          * <p>
294          * @return Fax number
295          */
296         Long getFaxNumber ();
297
298         /**
299          * Setter for fax number
300          * <p>
301          * @param faxNumber Fax number
302          */
303         void setFaxNumber (final Long faxNumber);
304
305         /**
306          * First name
307          * <p>
308          * @return the first name
309          */
310         String getFirstName ();
311
312         /**
313          * First name
314          * <p>
315          * @param firstName the first name to set
316          */
317         void setFirstName (final String firstName);
318
319         /**
320          * Gender of the contact
321          * <p>
322          * @return the gender
323          */
324         Gender getGender ();
325
326         /**
327          * Gender of the contact
328          * <p>
329          * @param gender the gender to set
330          */
331         void setGender (final Gender gender);
332
333         /**
334          * House number
335          * <p>
336          * @return the houseNumber
337          */
338         Short getHouseNumber ();
339
340         /**
341          * House number
342          * <p>
343          * @param houseNumber the houseNumber to set
344          */
345         void setHouseNumber (final Short houseNumber);
346
347         /**
348          * Getter for phone number's area code
349          * <p>
350          * @return Phone number's area code
351          */
352         Integer getPhoneAreaCode ();
353
354         /**
355          * Setter for phone number's area code
356          * <p>
357          * @param phoneAreaCode Phone number's area code
358          */
359         void setPhoneAreaCode (final Integer phoneAreaCode);
360
361         /**
362          * Getter for phone number's country instance
363          * <p>
364          * @return Phone number's country instance
365          */
366         Country getPhoneCountry ();
367
368         /**
369          * Setter for phone number's country instance
370          * <p>
371          * @param phoneCountry Phone number's country instance
372          */
373         void setPhoneCountry (final Country phoneCountry);
374
375         /**
376          * Getter for phone number
377          * <p>
378          * @return Phone number
379          */
380         Long getPhoneNumber ();
381
382         /**
383          * Setter for phone number
384          * <p>
385          * @param phoneNumber Phone number
386          */
387         void setPhoneNumber (final Long phoneNumber);
388
389         /**
390          * Street
391          * <p>
392          * @return the street
393          */
394         String getStreet ();
395
396         /**
397          * Street
398          * <p>
399          * @param street the street to set
400          */
401         void setStreet (final String street);
402
403         /**
404          * ZIP code
405          * <p>
406          * @return the zipCode
407          */
408         Integer getZipCode ();
409
410         /**
411          * ZIP code
412          * <p>
413          * @param zipCode the zipCode to set
414          */
415         void setZipCode (final Integer zipCode);
416
417         /**
418          * Checks whether contact instance's email address is used
419          * <p>
420          * @param contact Contact instance's email address to check
421          * <p>
422          * @return Whether it is already used
423          */
424         boolean isEmailAddressRegistered (final Contact contact);
425
426         /**
427          * Checks whether all required personal data is set
428          * <p>
429          * @return Whether the required personal data is set
430          */
431         boolean isRequiredPersonalDataSet ();
432
433         /**
434          * Checks whether all required personal data is set for changing them
435          * <p>
436          * @return Whether the required personal data is set
437          */
438         boolean isRequiredChangePersonalDataSet ();
439
440         /**
441          * Checks whether same email addresses have been entered
442          * <p>
443          * @return Whether same email addresses have been entered
444          */
445         boolean isSameEmailAddressEntered ();
446
447         /**
448          * Changes logged-in user's personal data if the current password matches
449          * and TAC + privacy statement has been accepted.
450          * <p>
451          * @return New target page
452          */
453         String doChangePersonalContactData ();
454
455 }