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.jjobs.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 Haeder<roland@mxchange.org>
42 public interface JobsContactWebSessionController 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 * Getter for all contacts having current cellphone instance linked
59 * @return List of all linked contacts
61 List<Contact> allCellphoneContacts ();
64 * Checks whether there are contacts.
66 * @return Whether contacts are there
68 boolean hasContacts ();
71 * Event observer for newly added users by adminstrator
73 * @param event Event being fired
75 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
78 * Event observer when user confirmed account.
80 * @param event Event being fired
82 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
85 * Updates all data from bean in given contact instance
87 * @param userContact Contact instance to update
89 void updateContactDataFromController (final Contact userContact);
92 * Tries to lookup contact by given id number. If the user is not found a
93 * proper exceptions are thrown.
95 * @param contactId Contact id
97 * @return Contact instance
99 * @throws ContactNotFoundException If the user is not found
101 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
104 * Event observer for new user registrations
106 * @param event User registration event
108 void afterRegistrationEvent (final UserRegisteredEvent event);
111 * Observes events being fired when an administrator has added a new
114 * @param event Event being fired
116 void afterAdminAddedContact (final AdminAddedContactEvent event);
119 * Observes events being fired when an administrator has linked a new user
120 * with existing contact data.
122 * @param event Event being fired
124 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
127 * Event observer for updated contact data by administrators
129 * @param event Updated contact data event
131 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
134 * Event observer for logged-in user
136 * @param event Event instance
138 void afterUserLogin (final UserLoggedInEvent event);
141 * Creates an instance from all properties
143 * @return A contact instance
145 Contact createContactInstance ();
148 * Getter for birth day
155 * Setter for birth day
157 * @param birthday Birth day
159 void setBirthday (final Date birthday);
162 * Getter for ellphone number's carrier
164 * @return Cellphone number's carrier
166 MobileProvider getCellphoneCarrier ();
169 * Setter for cellphone number's carrier prefix
171 * @param cellphoneCarrier Cellphone number's carrier prefix
173 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
176 * Getter for ellphone number
178 * @return Cellphone number
180 Long getCellphoneNumber ();
183 * Setter for ellphone number
185 * @param cellphoneNumber Cellphone number
187 void setCellphoneNumber (final Long cellphoneNumber);
199 * @param city the city to set
201 void setCity (final String city);
204 * Getter for comments
208 String getComment ();
213 * @param comment Comments
215 void setComment (final String comment);
218 * Getter for country instance
220 * @return Country instance
222 Country getCountry ();
225 * Setter for country instance
227 * @param country Country instance
229 void setCountry (final Country country);
232 * Getter for email address
234 * @return Email address
236 String getEmailAddress ();
239 * Setter for email address
241 * @param emailAddress Email address
243 void setEmailAddress (final String emailAddress);
246 * Getter for email address, repeated
248 * @return the emailAddress, repeated
250 String getEmailAddressRepeat ();
253 * Setter for email address repeated
255 * @param emailAddressRepeat the emailAddress to set
257 void setEmailAddressRepeat (final String emailAddressRepeat);
262 * @return the familyName
264 String getFamilyName ();
269 * @param familyName the familyName to set
271 void setFamilyName (final String familyName);
274 * Getter for fax number's area code
276 * @return Fax number's area code
278 Integer getFaxAreaCode ();
281 * Setter for fax number's area code
283 * @param faxAreaCode Fax number's area code
285 void setFaxAreaCode (final Integer faxAreaCode);
288 * Getter for fax's country instance
290 * @return Fax' country instance
292 Country getFaxCountry ();
295 * Setter for fax's country instance
297 * @param faxCountry Fax' country instance
299 void setFaxCountry (final Country faxCountry);
302 * Getter for fax number
306 Long getFaxNumber ();
309 * Setter for fax number
311 * @param faxNumber Fax number
313 void setFaxNumber (final Long faxNumber);
318 * @return the first name
320 String getFirstName ();
325 * @param firstName the first name to set
327 void setFirstName (final String firstName);
330 * Gender of the contact
337 * Gender of the contact
339 * @param gender the gender to set
341 void setGender (final Gender gender);
346 * @return the houseNumber
348 Short getHouseNumber ();
353 * @param houseNumber the houseNumber to set
355 void setHouseNumber (final Short houseNumber);
358 * Getter for house number extension, example: 123a 'a' is then the
359 * extension and 123 is the house number.
361 * @return House number extension
363 String getHouseNumberExtension ();
366 * Setter for house number extension
368 * @param houseNumberExtension House number extension
370 void setHouseNumberExtension (final String houseNumberExtension);
373 * Getter for phone number's area code
375 * @return Phone number's area code
377 Integer getPhoneAreaCode ();
380 * Setter for phone number's area code
382 * @param phoneAreaCode Phone number's area code
384 void setPhoneAreaCode (final Integer phoneAreaCode);
387 * Getter for phone number's country instance
389 * @return Phone number's country instance
391 Country getPhoneCountry ();
394 * Setter for phone number's country instance
396 * @param phoneCountry Phone number's country instance
398 void setPhoneCountry (final Country phoneCountry);
401 * Getter for phone number
403 * @return Phone number
405 Long getPhoneNumber ();
408 * Setter for phone number
410 * @param phoneNumber Phone number
412 void setPhoneNumber (final Long phoneNumber);
424 * @param street the street to set
426 void setStreet (final String street);
438 * @param title the title to set
440 void setTitle (final String title);
445 * @return the zipCode
447 Integer getZipCode ();
452 * @param zipCode the zipCode to set
454 void setZipCode (final Integer zipCode);
457 * Getter for controller type
459 * @return controller type
461 String getControllerType ();
464 * Setter for controller type
466 * @param controllerType Controller type
467 * @deprecated Don't use this method.
470 void setControllerType (final String controllerType);
473 * Checks whether contact instance's email address is used
475 * @param contact Contact instance's email address to check
477 * @return Whether it is already used
479 boolean isEmailAddressRegistered (final Contact contact);
482 * Checks whether all required personal data is set
484 * @return Whether the required personal data is set
486 boolean isRequiredPersonalDataSet ();
489 * Checks whether all required personal data is set for changing them
491 * @return Whether the required personal data is set
493 boolean isRequiredChangePersonalDataSet ();
496 * Checks whether same email addresses have been entered
498 * @return Whether same email addresses have been entered
500 boolean isSameEmailAddressEntered ();
503 * Changes logged-in user's personal data if the current password matches
504 * and TAC + privacy statement has been accepted.
506 * @return New target page
508 String doChangePersonalContactData ();
511 * Returns a list of all selectable contacts for user creation. Contacts
512 * from already existing users are excluded in this list.
514 * @return A list of all selectable contacts
516 List<Contact> selectableContacts ();