]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionController.java
Imported new way into + ignored .gitcommits (please cherry-pick this)
[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.jphone.phonenumbers.mobileprovider.MobileProvider;
29 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
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 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
34
35 /**
36  * An interface for user beans
37  * <p>
38  * @author Roland Haeder<roland@mxchange.org>
39  */
40 public interface PizzaContactWebSessionController extends Serializable {
41
42         /**
43          * Minimum password length
44          */
45         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
46
47         /**
48          * Returns a list of all found contacts
49          * <p>
50          * @return A list of all contacts.
51          */
52         List<Contact> allContacts ();
53
54         /**
55          * Checks whether there are contacts.
56          * <p>
57          * @return Whether contacts are there
58          */
59         boolean hasContacts ();
60
61         /**
62          * Event observer for newly added users by adminstrator
63          * <p>
64          * @param event Event being fired
65          */
66         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
67
68         /**
69          * Event observer when user confirmed account.
70          * <p>
71          * @param event Event being fired
72          */
73         void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
74
75         /**
76          * Updates all data from bean in given contact instance
77          * <p>
78          * @param userContact Contact instance to update
79          */
80         void updateContactDataFromController (final Contact userContact);
81
82         /**
83          * Tries to lookup contact by given id number. If the user is not found a
84          * proper exceptions are thrown.
85          * <p>
86          * @param contactId Contact id
87          * <p>
88          * @return Contact instance
89          * <p>
90          * @throws ContactNotFoundException If the user is not found
91          */
92         Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
93
94         /**
95          * Event observer for new user registrations
96          * <p>
97          * @param event User registration event
98          */
99         void afterRegistrationEvent (final UserRegisteredEvent event);
100
101         /**
102          * Observes events being fired when an administrator has added a new
103          * contact.
104          * <p>
105          * @param event Event being fired
106          */
107         void afterAdminAddedContact (final AdminAddedContactEvent event);
108
109         /**
110          * Observes events being fired when an administrator has linked a new user
111          * with existing contact data.
112          * <p>
113          * @param event Event being fired
114          */
115         void afterAdminLinkedUser (final AdminLinkedUserEvent event);
116
117         /**
118          * Event observer for updated contact data by administrators
119          * <p>
120          * @param event Updated contact data event
121          */
122         void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
123
124         /**
125          * Event observer for logged-in user
126          * <p>
127          * @param event Event instance
128          */
129         void afterUserLogin (final UserLoggedInEvent event);
130
131         /**
132          * Creates an instance from all properties
133          * <p>
134          * @return A contact instance
135          */
136         Contact createContactInstance ();
137
138         /**
139          * Getter for birth day
140          * <p>
141          * @return Birth day
142          */
143         Date getBirthday ();
144
145         /**
146          * Setter for birth day
147          * <p>
148          * @param birthday Birth day
149          */
150         void setBirthday (final Date birthday);
151
152         /**
153          * Getter for ellphone number's carrier
154          * <p>
155          * @return Cellphone number's carrier
156          */
157         MobileProvider getCellphoneCarrier ();
158
159         /**
160          * Setter for cellphone number's carrier prefix
161          * <p>
162          * @param cellphoneCarrier Cellphone number's carrier prefix
163          */
164         void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
165
166         /**
167          * Getter for ellphone number
168          * <p>
169          * @return Cellphone number
170          */
171         Long getCellphoneNumber ();
172
173         /**
174          * Setter for ellphone number
175          * <p>
176          * @param cellphoneNumber Cellphone number
177          */
178         void setCellphoneNumber (final Long cellphoneNumber);
179
180         /**
181          * City
182          * <p>
183          * @return the city
184          */
185         String getCity ();
186
187         /**
188          * City
189          * <p>
190          * @param city the city to set
191          */
192         void setCity (final String city);
193
194         /**
195          * Getter for comments
196          * <p>
197          * @return Comments
198          */
199         String getComment ();
200
201         /**
202          * Setter for comment
203          * <p>
204          * @param comment Comments
205          */
206         void setComment (final String comment);
207
208         /**
209          * Getter for country instance
210          * <p>
211          * @return Country instance
212          */
213         Country getCountry ();
214
215         /**
216          * Setter for country instance
217          * <p>
218          * @param country Country instance
219          */
220         void setCountry (final Country country);
221
222         /**
223          * Getter for email address
224          * <p>
225          * @return Email address
226          */
227         String getEmailAddress ();
228
229         /**
230          * Setter for email address
231          * <p>
232          * @param emailAddress Email address
233          */
234         void setEmailAddress (final String emailAddress);
235
236         /**
237          * Getter for email address, repeated
238          * <p>
239          * @return the emailAddress, repeated
240          */
241         String getEmailAddressRepeat ();
242
243         /**
244          * Setter for email address repeated
245          * <p>
246          * @param emailAddressRepeat the emailAddress to set
247          */
248         void setEmailAddressRepeat (final String emailAddressRepeat);
249
250         /**
251          * Family name
252          * <p>
253          * @return the familyName
254          */
255         String getFamilyName ();
256
257         /**
258          * Family name
259          * <p>
260          * @param familyName the familyName to set
261          */
262         void setFamilyName (final String familyName);
263
264         /**
265          * Getter for fax number's area code
266          * <p>
267          * @return Fax number's area code
268          */
269         Integer getFaxAreaCode ();
270
271         /**
272          * Setter for fax number's area code
273          * <p>
274          * @param faxAreaCode Fax number's area code
275          */
276         void setFaxAreaCode (final Integer faxAreaCode);
277
278         /**
279          * Getter for fax's country instance
280          * <p>
281          * @return Fax' country instance
282          */
283         Country getFaxCountry ();
284
285         /**
286          * Setter for fax's country instance
287          * <p>
288          * @param faxCountry Fax' country instance
289          */
290         void setFaxCountry (final Country faxCountry);
291
292         /**
293          * Getter for fax number
294          * <p>
295          * @return Fax number
296          */
297         Long getFaxNumber ();
298
299         /**
300          * Setter for fax number
301          * <p>
302          * @param faxNumber Fax number
303          */
304         void setFaxNumber (final Long faxNumber);
305
306         /**
307          * First name
308          * <p>
309          * @return the first name
310          */
311         String getFirstName ();
312
313         /**
314          * First name
315          * <p>
316          * @param firstName the first name to set
317          */
318         void setFirstName (final String firstName);
319
320         /**
321          * Gender of the contact
322          * <p>
323          * @return the gender
324          */
325         Gender getGender ();
326
327         /**
328          * Gender of the contact
329          * <p>
330          * @param gender the gender to set
331          */
332         void setGender (final Gender gender);
333
334         /**
335          * House number
336          * <p>
337          * @return the houseNumber
338          */
339         Short getHouseNumber ();
340
341         /**
342          * House number
343          * <p>
344          * @param houseNumber the houseNumber to set
345          */
346         void setHouseNumber (final Short houseNumber);
347
348         /**
349          * Getter for house number extension, example: 123a 'a' is then the
350          * extension and 123 is the house number.
351          * <p>
352          * @return House number extension
353          */
354         String getHouseNumberExtension ();
355
356         /**
357          * Setter for house number extension
358          * <p>
359          * @param houseNumberExtension House number extension
360          */
361         void setHouseNumberExtension (final String houseNumberExtension);
362
363         /**
364          * Getter for phone number's area code
365          * <p>
366          * @return Phone number's area code
367          */
368         Integer getPhoneAreaCode ();
369
370         /**
371          * Setter for phone number's area code
372          * <p>
373          * @param phoneAreaCode Phone number's area code
374          */
375         void setPhoneAreaCode (final Integer phoneAreaCode);
376
377         /**
378          * Getter for phone number's country instance
379          * <p>
380          * @return Phone number's country instance
381          */
382         Country getPhoneCountry ();
383
384         /**
385          * Setter for phone number's country instance
386          * <p>
387          * @param phoneCountry Phone number's country instance
388          */
389         void setPhoneCountry (final Country phoneCountry);
390
391         /**
392          * Getter for phone number
393          * <p>
394          * @return Phone number
395          */
396         Long getPhoneNumber ();
397
398         /**
399          * Setter for phone number
400          * <p>
401          * @param phoneNumber Phone number
402          */
403         void setPhoneNumber (final Long phoneNumber);
404
405         /**
406          * Street
407          * <p>
408          * @return the street
409          */
410         String getStreet ();
411
412         /**
413          * Street
414          * <p>
415          * @param street the street to set
416          */
417         void setStreet (final String street);
418
419         /**
420          * ZIP code
421          * <p>
422          * @return the zipCode
423          */
424         Integer getZipCode ();
425
426         /**
427          * ZIP code
428          * <p>
429          * @param zipCode the zipCode to set
430          */
431         void setZipCode (final Integer zipCode);
432
433         /**
434          * Getter for controller type
435          * <p>
436          * @return controller type
437          */
438         String getControllerType ();
439
440         /**
441          * Setter for controller type
442          * <p>
443          * @param controllerType Controller type
444          * @deprecated Don't use this method.
445          */
446         @Deprecated
447         void setControllerType (final String controllerType);
448
449         /**
450          * Checks whether contact instance's email address is used
451          * <p>
452          * @param contact Contact instance's email address to check
453          * <p>
454          * @return Whether it is already used
455          */
456         boolean isEmailAddressRegistered (final Contact contact);
457
458         /**
459          * Checks whether all required personal data is set
460          * <p>
461          * @return Whether the required personal data is set
462          */
463         boolean isRequiredPersonalDataSet ();
464
465         /**
466          * Checks whether all required personal data is set for changing them
467          * <p>
468          * @return Whether the required personal data is set
469          */
470         boolean isRequiredChangePersonalDataSet ();
471
472         /**
473          * Checks whether same email addresses have been entered
474          * <p>
475          * @return Whether same email addresses have been entered
476          */
477         boolean isSameEmailAddressEntered ();
478
479         /**
480          * Changes logged-in user's personal data if the current password matches
481          * and TAC + privacy statement has been accepted.
482          * <p>
483          * @return New target page
484          */
485         String doChangePersonalContactData ();
486
487         /**
488          * Returns a list of all selectable contacts for user creation. Contacts
489          * from already existing users are excluded in this list.
490          * <p>
491          * @return A list of all selectable contacts
492          */
493         List<Contact> selectableContacts ();
494
495 }