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 * Checks whether there are contacts.
56 * @return Whether contacts are there
58 boolean hasContacts ();
61 * Event observer for newly added users by adminstrator
63 * @param event Event being fired
65 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
68 * Updates all data from bean in given contact instance
70 * @param userContact Contact instance to update
72 void updateContactDataFromController (final Contact userContact);
75 * Adds given email address to list
77 * @param contactEmailAddress Email address to add
79 void addEmailAddress (final String contactEmailAddress);
82 * Tries to lookup contact by given id number. If the user is not found a
83 * proper exceptions are thrown.
85 * @param contactId Contact id
87 * @return Contact instance
89 * @throws ContactNotFoundException If the user is not found
91 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
94 * Event observer for new user registrations
96 * @param event User registration event
98 void afterRegistrationEvent (final UserRegisteredEvent event);
101 * Observes events being fired when an administrator has added a new
104 * @param event Event being fired
106 void afterAdminAddedCustomer (final AdminAddedCustomerEvent event);
109 * Observes events being fired when an administrator has added a new
112 * @param event Event being fired
114 void afterAdminAddedContact (final AdminAddedContactEvent event);
117 * Event observer for updated contact data by admins
119 * @param event Updated contact data event
121 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
124 * Event observer for logged-in user
126 * @param event Event instance
128 void afterUserLogin (final UserLoggedInEvent event);
131 * Creates an instance from all properties
133 * @return A contact instance
135 Contact createContactInstance ();
138 * Getter for birth day
145 * Setter for birth day
147 * @param birthday Birth day
149 void setBirthday (final Date birthday);
152 * Getter for ellphone number's carrier
154 * @return Cellphone number's carrier
156 MobileProvider getCellphoneCarrier ();
159 * Setter for cellphone number's carrier prefix
161 * @param cellphoneCarrier Cellphone number's carrier prefix
163 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
166 * Getter for ellphone number
168 * @return Cellphone number
170 Long getCellphoneNumber ();
173 * Setter for ellphone number
175 * @param cellphoneNumber Cellphone number
177 void setCellphoneNumber (final Long cellphoneNumber);
189 * @param city the city to set
191 void setCity (final String city);
194 * Getter for comments
198 String getComment ();
203 * @param comment Comments
205 void setComment (final String comment);
208 * Getter for country instance
210 * @return Country instance
212 Country getCountry ();
215 * Setter for country instance
217 * @param country Country instance
219 void setCountry (final Country country);
222 * Getter for email address
224 * @return Email address
226 String getEmailAddress ();
229 * Setter for email address
231 * @param emailAddress Email address
233 void setEmailAddress (final String emailAddress);
236 * Getter for email address, repeated
238 * @return the emailAddress, repeated
240 String getEmailAddressRepeat ();
243 * Setter for email address repeated
245 * @param emailAddressRepeat the emailAddress to set
247 void setEmailAddressRepeat (final String emailAddressRepeat);
252 * @return the familyName
254 String getFamilyName ();
259 * @param familyName the familyName to set
261 void setFamilyName (final String familyName);
264 * Getter for fax number's area code
266 * @return Fax number's area code
268 Integer getFaxAreaCode ();
271 * Setter for fax number's area code
273 * @param faxAreaCode Fax number's area code
275 void setFaxAreaCode (final Integer faxAreaCode);
278 * Getter for fax's country instance
280 * @return Fax' country instance
282 Country getFaxCountry ();
285 * Setter for fax's country instance
287 * @param faxCountry Fax' country instance
289 void setFaxCountry (final Country faxCountry);
292 * Getter for fax number
296 Long getFaxNumber ();
299 * Setter for fax number
301 * @param faxNumber Fax number
303 void setFaxNumber (final Long faxNumber);
308 * @return the first name
310 String getFirstName ();
315 * @param firstName the first name to set
317 void setFirstName (final String firstName);
320 * Gender of the contact
327 * Gender of the contact
329 * @param gender the gender to set
331 void setGender (final Gender gender);
336 * @return the houseNumber
338 Short getHouseNumber ();
343 * @param houseNumber the houseNumber to set
345 void setHouseNumber (final Short houseNumber);
348 * Getter for phone number's area code
350 * @return Phone number's area code
352 Integer getPhoneAreaCode ();
355 * Setter for phone number's area code
357 * @param phoneAreaCode Phone number's area code
359 void setPhoneAreaCode (final Integer phoneAreaCode);
362 * Getter for phone number's country instance
364 * @return Phone number's country instance
366 Country getPhoneCountry ();
369 * Setter for phone number's country instance
371 * @param phoneCountry Phone number's country instance
373 void setPhoneCountry (final Country phoneCountry);
376 * Getter for phone number
378 * @return Phone number
380 Long getPhoneNumber ();
383 * Setter for phone number
385 * @param phoneNumber Phone number
387 void setPhoneNumber (final Long phoneNumber);
399 * @param street the street to set
401 void setStreet (final String street);
406 * @return the zipCode
408 Integer getZipCode ();
413 * @param zipCode the zipCode to set
415 void setZipCode (final Integer zipCode);
418 * Checks whether contact instance's email address is used
420 * @param contact Contact instance's email address to check
422 * @return Whether it is already used
424 boolean isEmailAddressRegistered (final Contact contact);
427 * Checks whether all required personal data is set
429 * @return Whether the required personal data is set
431 boolean isRequiredPersonalDataSet ();
434 * Checks whether all required personal data is set for changing them
436 * @return Whether the required personal data is set
438 boolean isRequiredChangePersonalDataSet ();
441 * Checks whether same email addresses have been entered
443 * @return Whether same email addresses have been entered
445 boolean isSameEmailAddressEntered ();
448 * Changes logged-in user's personal data if the current password matches
449 * and TAC + privacy statement has been accepted.
451 * @return New target page
453 String doChangePersonalContactData ();