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.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;
35 * An interface for user beans
37 * @author Roland Haeder<roland@mxchange.org>
39 public interface PizzaContactWebSessionController extends Serializable {
42 * Minimum password length
44 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
47 * Returns a list of all found contacts
49 * @return A list of all contacts.
51 List<Contact> allContacts();
54 * Updates all data from bean in given contact instance
56 * @param userContact Contact instance to update
58 void updateContactDataFromController (final Contact userContact);
61 * Adds given email address to list
63 * @param contactEmailAddress Email address to add
65 void addEmailAddress (final String contactEmailAddress);
68 * Tries to lookup contact by given id number. If the user is not found a
69 * proper exceptions are thrown.
71 * @param contactId Contact id
73 * @return Contact instance
75 * @throws ContactNotFoundException If the user is not found
77 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
80 * Event observer for new user registrations
82 * @param event User registration event
84 void afterRegistrationEvent (final UserRegisteredEvent event);
87 * Observes events being fired when an administrator has added a new
90 * @param event Event being fired
92 void afterAdminAddedCustomer (final AdminAddedCustomerEvent event);
95 * Observes events being fired when an administrator has added a new
98 * @param event Event being fired
100 void afterAdminAddedContact (final AdminAddedContactEvent event);
103 * Event observer for newly added users by an administrator
105 * @param event Event being fired
107 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
110 * Event observer for updated contact data by admins
112 * @param event Updated contact data event
114 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
117 * Event observer for logged-in user
119 * @param event Event instance
121 void afterUserLogin (final UserLoggedInEvent event);
124 * Creates an instance from all properties
126 * @return A contact instance
128 Contact createContactInstance ();
131 * Getter for birth day
138 * Setter for birth day
140 * @param birthday Birth day
142 void setBirthday (final Date birthday);
145 * Getter for ellphone number's carrier
147 * @return Cellphone number's carrier
149 MobileProvider getCellphoneCarrier ();
152 * Setter for cellphone number's carrier prefix
154 * @param cellphoneCarrier Cellphone number's carrier prefix
156 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
159 * Getter for ellphone number
161 * @return Cellphone number
163 Long getCellphoneNumber ();
166 * Setter for ellphone number
168 * @param cellphoneNumber Cellphone number
170 void setCellphoneNumber (final Long cellphoneNumber);
182 * @param city the city to set
184 void setCity (final String city);
187 * Getter for comments
191 String getComment ();
196 * @param comment Comments
198 void setComment (final String comment);
201 * Getter for country instance
203 * @return Country instance
205 Country getCountry ();
208 * Setter for country instance
210 * @param country Country instance
212 void setCountry (final Country country);
215 * Getter for email address
217 * @return Email address
219 String getEmailAddress ();
222 * Setter for email address
224 * @param emailAddress Email address
226 void setEmailAddress (final String emailAddress);
229 * Getter for email address, repeated
231 * @return the emailAddress, repeated
233 String getEmailAddressRepeat ();
236 * Setter for email address repeated
238 * @param emailAddressRepeat the emailAddress to set
240 void setEmailAddressRepeat (final String emailAddressRepeat);
245 * @return the familyName
247 String getFamilyName ();
252 * @param familyName the familyName to set
254 void setFamilyName (final String familyName);
257 * Getter for fax number's area code
259 * @return Fax number's area code
261 Integer getFaxAreaCode ();
264 * Setter for fax number's area code
266 * @param faxAreaCode Fax number's area code
268 void setFaxAreaCode (final Integer faxAreaCode);
271 * Getter for fax's country instance
273 * @return Fax' country instance
275 Country getFaxCountry ();
278 * Setter for fax's country instance
280 * @param faxCountry Fax' country instance
282 void setFaxCountry (final Country faxCountry);
285 * Getter for fax number
289 Long getFaxNumber ();
292 * Setter for fax number
294 * @param faxNumber Fax number
296 void setFaxNumber (final Long faxNumber);
301 * @return the first name
303 String getFirstName ();
308 * @param firstName the first name to set
310 void setFirstName (final String firstName);
313 * Gender of the contact
320 * Gender of the contact
322 * @param gender the gender to set
324 void setGender (final Gender gender);
329 * @return the houseNumber
331 Short getHouseNumber ();
336 * @param houseNumber the houseNumber to set
338 void setHouseNumber (final Short houseNumber);
341 * Getter for phone number's area code
343 * @return Phone number's area code
345 Integer getPhoneAreaCode ();
348 * Setter for phone number's area code
350 * @param phoneAreaCode Phone number's area code
352 void setPhoneAreaCode (final Integer phoneAreaCode);
355 * Getter for phone number's country instance
357 * @return Phone number's country instance
359 Country getPhoneCountry ();
362 * Setter for phone number's country instance
364 * @param phoneCountry Phone number's country instance
366 void setPhoneCountry (final Country phoneCountry);
369 * Getter for phone number
371 * @return Phone number
373 Long getPhoneNumber ();
376 * Setter for phone number
378 * @param phoneNumber Phone number
380 void setPhoneNumber (final Long phoneNumber);
392 * @param street the street to set
394 void setStreet (final String street);
399 * @return the zipCode
401 Integer getZipCode ();
406 * @param zipCode the zipCode to set
408 void setZipCode (final Integer zipCode);
411 * Checks whether contact instance's email address is used
413 * @param contact Contact instance's email address to check
415 * @return Whether it is already used
417 boolean isEmailAddressRegistered (final Contact contact);
420 * Checks whether all required personal data is set
422 * @return Whether the required personal data is set
424 boolean isRequiredPersonalDataSet ();
427 * Checks whether all required personal data is set for changing them
429 * @return Whether the required personal data is set
431 boolean isRequiredChangePersonalDataSet ();
434 * Checks whether same email addresses have been entered
436 * @return Whether same email addresses have been entered
438 boolean isSameEmailAddressEntered ();
441 * Changes logged-in user's personal data if the current password matches
442 * and TAC + privacy statement has been accepted.
444 * @return New target page
446 String doChangePersonalContactData ();