2 * Copyright (C) 2016 Roland Häder
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 javax.ejb.Local;
23 import org.mxchange.jcontacts.contact.Contact;
24 import org.mxchange.jcontacts.contact.gender.Gender;
25 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
26 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
27 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
28 import org.mxchange.jcountry.data.Country;
29 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
30 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
31 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
32 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
33 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
34 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
37 * An interface for user beans
39 * @author Roland Häder<roland@mxchange.org>
42 public interface PizzaContactWebSessionController extends Serializable {
45 * Minimum password length
47 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
50 * Returns a list of all found contacts
52 * @return A list of all contacts.
54 List<Contact> allContacts ();
57 * Event observer for newly added users by adminstrator
59 * @param event Event being fired
61 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
64 * Event observer when user confirmed account.
66 * @param event Event being fired
68 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
71 * Updates all data from bean in given contact instance
73 * @param userContact Contact instance to update
75 void updateContactDataFromController (final Contact userContact);
78 * Tries to lookup contact by given id number. If the user is not found a
79 * proper exceptions are thrown.
81 * @param contactId Contact id
83 * @return Contact instance
85 * @throws ContactNotFoundException If the user is not found
87 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
90 * Event observer for new user registrations
92 * @param event User registration event
94 void afterRegistrationEvent (final UserRegisteredEvent event);
97 * Observes events being fired when an administrator has added a new
100 * @param event Event being fired
102 void afterAdminAddedContact (final AdminAddedContactEvent event);
105 * Observes events being fired when an administrator has linked a new user
106 * with existing contact data.
108 * @param event Event being fired
110 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
113 * Event observer for updated contact data by administrators
115 * @param event Updated contact data event
117 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
120 * Event observer for logged-in user
122 * @param event Event instance
124 void afterUserLogin (final UserLoggedInEvent event);
127 * Creates an instance from all properties
129 * @return A contact instance
131 Contact createContactInstance ();
134 * Getter for birth day
141 * Setter for birth day
143 * @param birthday Birth day
145 void setBirthday (final Date birthday);
148 * Getter for ellphone number's carrier
150 * @return Cellphone number's carrier
152 MobileProvider getCellphoneCarrier ();
155 * Setter for cellphone number's carrier prefix
157 * @param cellphoneCarrier Cellphone number's carrier prefix
159 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
162 * Getter for ellphone number
164 * @return Cellphone number
166 Long getCellphoneNumber ();
169 * Setter for ellphone number
171 * @param cellphoneNumber Cellphone number
173 void setCellphoneNumber (final Long cellphoneNumber);
185 * @param city the city to set
187 void setCity (final String city);
190 * Getter for comments
194 String getComment ();
199 * @param comment Comments
201 void setComment (final String comment);
204 * Getter for country instance
206 * @return Country instance
208 Country getCountry ();
211 * Setter for country instance
213 * @param country Country instance
215 void setCountry (final Country country);
218 * Getter for email address
220 * @return Email address
222 String getEmailAddress ();
225 * Setter for email address
227 * @param emailAddress Email address
229 void setEmailAddress (final String emailAddress);
232 * Getter for email address, repeated
234 * @return the emailAddress, repeated
236 String getEmailAddressRepeat ();
239 * Setter for email address repeated
241 * @param emailAddressRepeat the emailAddress to set
243 void setEmailAddressRepeat (final String emailAddressRepeat);
248 * @return the familyName
250 String getFamilyName ();
255 * @param familyName the familyName to set
257 void setFamilyName (final String familyName);
260 * Getter for fax number's area code
262 * @return Fax number's area code
264 Integer getFaxAreaCode ();
267 * Setter for fax number's area code
269 * @param faxAreaCode Fax number's area code
271 void setFaxAreaCode (final Integer faxAreaCode);
274 * Getter for fax's country instance
276 * @return Fax' country instance
278 Country getFaxCountry ();
281 * Setter for fax's country instance
283 * @param faxCountry Fax' country instance
285 void setFaxCountry (final Country faxCountry);
288 * Getter for fax number
292 Long getFaxNumber ();
295 * Setter for fax number
297 * @param faxNumber Fax number
299 void setFaxNumber (final Long faxNumber);
304 * @return the first name
306 String getFirstName ();
311 * @param firstName the first name to set
313 void setFirstName (final String firstName);
316 * Gender of the contact
323 * Gender of the contact
325 * @param gender the gender to set
327 void setGender (final Gender gender);
332 * @return the houseNumber
334 Short getHouseNumber ();
339 * @param houseNumber the houseNumber to set
341 void setHouseNumber (final Short houseNumber);
344 * Getter for house number extension, example: 123a 'a' is then the
345 * extension and 123 is the house number.
347 * @return House number extension
349 String getHouseNumberExtension ();
352 * Setter for house number extension
354 * @param houseNumberExtension House number extension
356 void setHouseNumberExtension (final String houseNumberExtension);
359 * Getter for phone number's area code
361 * @return Phone number's area code
363 Integer getPhoneAreaCode ();
366 * Setter for phone number's area code
368 * @param phoneAreaCode Phone number's area code
370 void setPhoneAreaCode (final Integer phoneAreaCode);
373 * Getter for phone number's country instance
375 * @return Phone number's country instance
377 Country getPhoneCountry ();
380 * Setter for phone number's country instance
382 * @param phoneCountry Phone number's country instance
384 void setPhoneCountry (final Country phoneCountry);
387 * Getter for phone number
389 * @return Phone number
391 Long getPhoneNumber ();
394 * Setter for phone number
396 * @param phoneNumber Phone number
398 void setPhoneNumber (final Long phoneNumber);
410 * @param street the street to set
412 void setStreet (final String street);
424 * @param title the title to set
426 void setTitle (final String title);
431 * @return the zipCode
433 Integer getZipCode ();
438 * @param zipCode the zipCode to set
440 void setZipCode (final Integer zipCode);
443 * Getter for controller type
445 * @return controller type
447 String getControllerType ();
450 * Setter for controller type
452 * @param controllerType Controller type
453 * @deprecated Don't use this method.
456 void setControllerType (final String controllerType);
459 * Checks whether contact instance's email address is used
461 * @param contact Contact instance's email address to check
463 * @return Whether it is already used
465 boolean isEmailAddressRegistered (final Contact contact);
468 * Checks whether all required personal data is set
470 * @return Whether the required personal data is set
472 boolean isRequiredPersonalDataSet ();
475 * Checks whether all required personal data is set for changing them
477 * @return Whether the required personal data is set
479 boolean isRequiredChangePersonalDataSet ();
482 * Checks whether same email addresses have been entered
484 * @return Whether same email addresses have been entered
486 boolean isSameEmailAddressEntered ();
489 * Changes logged-in user's personal data if the current password matches
490 * and TAC + privacy statement has been accepted.
492 * @return New target page
494 String doChangePersonalContactData ();
497 * Returns a list of all selectable contacts for user creation. Contacts
498 * from already existing users are excluded in this list.
500 * @return A list of all selectable contacts
502 List<Contact> selectableContacts ();