2 * Copyright (C) 2016 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.pizzaapplication.beans.contact;
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.update.AdminUpdatedContactEvent;
25 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
26 import org.mxchange.jcountry.data.Country;
27 import org.mxchange.jcustomercore.events.AdminAddedCustomerEvent;
28 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
29 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
30 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
31 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
34 * An interface for user beans
36 * @author Roland Haeder<roland@mxchange.org>
38 public interface PizzaContactWebSessionController extends Serializable {
41 * Minimum password length
43 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
46 * Returns a list of all found contacts
48 * @return A list of all contacts.
50 List<Contact> allContacts();
53 * Updates all data from bean in given contact instance
55 * @param userContact Contact instance to update
57 void updateContactDataFromController (final Contact userContact);
60 * Adds given email address to list
62 * @param contactEmailAddress Email address to add
64 void addEmailAddress (final String contactEmailAddress);
67 * Tries to lookup contact by given id number. If the user is not found a
68 * proper exceptions are thrown.
70 * @param contactId Contact id
72 * @return Contact instance
74 * @throws ContactNotFoundException If the user is not found
76 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
79 * Clears this controller
84 * Event observer for new user registrations
86 * @param event User registration event
88 void afterRegistrationEvent (final UserRegisteredEvent event);
91 * Observes events being fired when an administrator has added a new
94 * @param event Event being fired
96 void afterAdminAddedCustomer (final AdminAddedCustomerEvent event);
99 * Event observer for newly added users by an administrator
101 * @param event Event being fired
103 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
106 * Event observer for updated contact data by admins
108 * @param event Updated contact data event
110 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
113 * Event observer for logged-in user
115 * @param event Event instance
117 void afterUserLogin (final UserLoggedInEvent event);
120 * Creates an instance from all properties
122 * @return A contact instance
124 Contact createContactInstance ();
127 * Getter for birth day
134 * Setter for birth day
136 * @param birthday Birth day
138 void setBirthday (final Date birthday);
141 * Getter for ellphone number's carrier
143 * @return Cellphone number's carrier
145 MobileProvider getCellphoneCarrier ();
148 * Setter for cellphone number's carrier prefix
150 * @param cellphoneCarrier Cellphone number's carrier prefix
152 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
155 * Getter for ellphone number
157 * @return Cellphone number
159 Long getCellphoneNumber ();
162 * Setter for ellphone number
164 * @param cellphoneNumber Cellphone number
166 void setCellphoneNumber (final Long cellphoneNumber);
178 * @param city the city to set
180 void setCity (final String city);
183 * Getter for comments
187 String getComment ();
192 * @param comment Comments
194 void setComment (final String comment);
197 * Getter for country instance
199 * @return Country instance
201 Country getCountry ();
204 * Setter for country instance
206 * @param country Country instance
208 void setCountry (final Country country);
211 * Getter for email address
213 * @return Email address
215 String getEmailAddress ();
218 * Setter for email address
220 * @param emailAddress Email address
222 void setEmailAddress (final String emailAddress);
225 * Getter for email address, repeated
227 * @return the emailAddress, repeated
229 String getEmailAddressRepeat ();
232 * Setter for email address repeated
234 * @param emailAddressRepeat the emailAddress to set
236 void setEmailAddressRepeat (final String emailAddressRepeat);
241 * @return the familyName
243 String getFamilyName ();
248 * @param familyName the familyName to set
250 void setFamilyName (final String familyName);
253 * Getter for fax number's area code
255 * @return Fax number's area code
257 Integer getFaxAreaCode ();
260 * Setter for fax number's area code
262 * @param faxAreaCode Fax number's area code
264 void setFaxAreaCode (final Integer faxAreaCode);
267 * Getter for fax's country instance
269 * @return Fax' country instance
271 Country getFaxCountry ();
274 * Setter for fax's country instance
276 * @param faxCountry Fax' country instance
278 void setFaxCountry (final Country faxCountry);
281 * Getter for fax number
285 Long getFaxNumber ();
288 * Setter for fax number
290 * @param faxNumber Fax number
292 void setFaxNumber (final Long faxNumber);
297 * @return the first name
299 String getFirstName ();
304 * @param firstName the first name to set
306 void setFirstName (final String firstName);
309 * Gender of the contact
316 * Gender of the contact
318 * @param gender the gender to set
320 void setGender (final Gender gender);
325 * @return the houseNumber
327 Short getHouseNumber ();
332 * @param houseNumber the houseNumber to set
334 void setHouseNumber (final Short houseNumber);
337 * Getter for phone number's area code
339 * @return Phone number's area code
341 Integer getPhoneAreaCode ();
344 * Setter for phone number's area code
346 * @param phoneAreaCode Phone number's area code
348 void setPhoneAreaCode (final Integer phoneAreaCode);
351 * Getter for phone number's country instance
353 * @return Phone number's country instance
355 Country getPhoneCountry ();
358 * Setter for phone number's country instance
360 * @param phoneCountry Phone number's country instance
362 void setPhoneCountry (final Country phoneCountry);
365 * Getter for phone number
367 * @return Phone number
369 Long getPhoneNumber ();
372 * Setter for phone number
374 * @param phoneNumber Phone number
376 void setPhoneNumber (final Long phoneNumber);
388 * @param street the street to set
390 void setStreet (final String street);
395 * @return the zipCode
397 Integer getZipCode ();
402 * @param zipCode the zipCode to set
404 void setZipCode (final Integer zipCode);
407 * Checks whether contact instance's email address is used
409 * @param contact Contact instance's email address to check
411 * @return Whether it is already used
413 boolean isEmailAddressRegistered (final Contact contact);
416 * Checks whether all required personal data is set
418 * @return Whether the required personal data is set
420 boolean isRequiredPersonalDataSet ();
423 * Checks whether all required personal data is set for changing them
425 * @return Whether the required personal data is set
427 boolean isRequiredChangePersonalDataSet ();
430 * Checks whether same email addresses have been entered
432 * @return Whether same email addresses have been entered
434 boolean isSameEmailAddressEntered ();
437 * Changes logged-in user's personal data if the current password matches
438 * and TAC + privacy statement has been accepted.
440 * @return New target page
442 String doChangePersonalContactData ();