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.deleted.AdminDeletedContactEvent;
27 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
28 import org.mxchange.jcontacts.events.fax.unlinked.AdminUnlinkedFaxNumberEvent;
29 import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumberEvent;
30 import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
31 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
32 import org.mxchange.jcountry.data.Country;
33 import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
34 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
35 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
36 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
37 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
38 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
39 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
42 * An interface for user beans
44 * @author Roland Haeder<roland@mxchange.org>
47 public interface JobsContactWebSessionController extends Serializable {
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 for deleted contact instance by administrator
66 * @param event Event being fired
68 void afterAdminDeletedContactEvent (final AdminDeletedContactEvent event);
71 * Event observer for unlinked fax contact by administrators
73 * @param event Unlinked fax contact event
75 void afterAdminUnlinkedFaxContactDataEvent (final AdminUnlinkedFaxNumberEvent event);
78 * Event observer for unlinked land-line contact by administrators
80 * @param event Unlinked land-line contact event
82 void afterAdminUnlinkedLandLineContactDataEvent (final AdminUnlinkedLandLineNumberEvent event);
85 * Event observer for unlinked mobile contact by administrators
87 * @param event Unlinked mobile contact event
89 void afterAdminUnlinkedMobileContactDataEvent (final AdminUnlinkedMobileNumberEvent event);
92 * Event observer when user confirmed account.
94 * @param event Event being fired
96 void afterUserConfirmedAccountEventEvent (final UserConfirmedAccountEvent event);
99 * Event observer when a list with unused mobile numbers is being created
101 * @param event Event being fired
103 void removeMobileNumberFromListEvent(final AdminRemoveMobileNumberFromListEvent event);
106 * Updates all data from bean in given contact instance
108 * @param userContact Contact instance to update
110 void updateContactDataFromController (final Contact userContact);
113 * Tries to lookup contact by given id number. If the user is not found a
114 * proper exceptions are thrown.
116 * @param contactId Contact id
118 * @return Contact instance
120 * @throws ContactNotFoundException If the user is not found
122 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
125 * Event observer for new user registrations
127 * @param event User registration event
129 void afterUserRegistrationEvent (final UserRegisteredEvent event);
132 * Observes events being fired when an administrator has added a new
135 * @param event Event being fired
137 void afterAdminAddedContactEvent (final AdminAddedContactEvent event);
140 * Observes events being fired when an administrator has linked a new user
141 * with existing contact data.
143 * @param event Event being fired
145 void afterAdminLinkedUserEvent (final AdminLinkedUserEvent event);
148 * Event observer for updated contact data by administrators
150 * @param event Updated contact data event
152 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
155 * Event observer for logged-in user
157 * @param event Event instance
159 void afterUserLoginEvent (final UserLoggedInEvent event);
162 * Creates an instance from all properties
164 * @return A contact instance
166 Contact createContactInstance ();
169 * Getter for birth day
176 * Setter for birth day
178 * @param birthday Birth day
180 void setBirthday (final Date birthday);
183 * Getter for mobile provider
185 * @return Mobile provider
187 MobileProvider getMobileProvider ();
190 * Setter for mobile provider
192 * @param mobileProvider Mobile provider
194 void setMobileProvider (final MobileProvider mobileProvider);
197 * Getter for mobile number
199 * @return Mobile number
201 Long getMobileNumber ();
204 * Setter for mobile number
206 * @param mobileNumber Mobile number
208 void setMobileNumber (final Long mobileNumber);
220 * @param city the city to set
222 void setCity (final String city);
225 * Getter for comments
229 String getComment ();
234 * @param comment Comments
236 void setComment (final String comment);
239 * Getter for country instance
241 * @return Country instance
243 Country getCountry ();
246 * Setter for country instance
248 * @param country Country instance
250 void setCountry (final Country country);
253 * Getter for email address
255 * @return Email address
257 String getEmailAddress ();
260 * Setter for email address
262 * @param emailAddress Email address
264 void setEmailAddress (final String emailAddress);
267 * Getter for email address, repeated
269 * @return the emailAddress, repeated
271 String getEmailAddressRepeat ();
274 * Setter for email address repeated
276 * @param emailAddressRepeat the emailAddress to set
278 void setEmailAddressRepeat (final String emailAddressRepeat);
283 * @return the familyName
285 String getFamilyName ();
290 * @param familyName the familyName to set
292 void setFamilyName (final String familyName);
295 * Getter for fax number's area code
297 * @return Fax number's area code
299 Integer getFaxAreaCode ();
302 * Setter for fax number's area code
304 * @param faxAreaCode Fax number's area code
306 void setFaxAreaCode (final Integer faxAreaCode);
309 * Getter for fax's country instance
311 * @return Fax' country instance
313 Country getFaxCountry ();
316 * Setter for fax's country instance
318 * @param faxCountry Fax' country instance
320 void setFaxCountry (final Country faxCountry);
323 * Getter for fax number
327 Long getFaxNumber ();
330 * Setter for fax number
332 * @param faxNumber Fax number
334 void setFaxNumber (final Long faxNumber);
339 * @return the first name
341 String getFirstName ();
346 * @param firstName the first name to set
348 void setFirstName (final String firstName);
351 * Gender of the contact
358 * Gender of the contact
360 * @param gender the gender to set
362 void setGender (final Gender gender);
367 * @return the houseNumber
369 Short getHouseNumber ();
374 * @param houseNumber the houseNumber to set
376 void setHouseNumber (final Short houseNumber);
379 * Getter for house number extension, example: 123a 'a' is then the
380 * extension and 123 is the house number.
382 * @return House number extension
384 String getHouseNumberExtension ();
387 * Setter for house number extension
389 * @param houseNumberExtension House number extension
391 void setHouseNumberExtension (final String houseNumberExtension);
394 * Getter for phone number's area code
396 * @return Phone number's area code
398 Integer getLandLineAreaCode ();
401 * Setter for phone number's area code
403 * @param phoneAreaCode Phone number's area code
405 void setLandLineAreaCode (final Integer phoneAreaCode);
408 * Getter for phone number's country instance
410 * @return Phone number's country instance
412 Country getLandLineCountry ();
415 * Setter for phone number's country instance
417 * @param phoneCountry Phone number's country instance
419 void setLandLineCountry (final Country phoneCountry);
422 * Getter for phone number
424 * @return Phone number
426 Long getLandLineNumber ();
429 * Setter for phone number
431 * @param phoneNumber Phone number
433 void setLandLineNumber (final Long phoneNumber);
445 * @param street the street to set
447 void setStreet (final String street);
459 * @param title the title to set
461 void setTitle (final String title);
466 * @return the zipCode
468 Integer getZipCode ();
473 * @param zipCode the zipCode to set
475 void setZipCode (final Integer zipCode);
478 * Getter for controller type
480 * @return controller type
482 String getControllerType ();
485 * Setter for controller type
487 * @param controllerType Controller type
489 * @deprecated Don't use this method.
492 void setControllerType (final String controllerType);
495 * Checks whether contact instance's email address is used
497 * @param contact Contact instance's email address to check
499 * @return Whether it is already used
501 boolean isEmailAddressRegistered (final Contact contact);
504 * Checks whether all required personal data is set
506 * @return Whether the required personal data is set
508 boolean isRequiredPersonalDataSet ();
511 * Checks whether all required personal data is set for changing them
513 * @return Whether the required personal data is set
515 boolean isRequiredChangePersonalDataSet ();
518 * Checks whether same email addresses have been entered
520 * @return Whether same email addresses have been entered
522 boolean isSameEmailAddressEntered ();
525 * Changes logged-in user's personal data if the current password matches
526 * and TAC + privacy statement has been accepted.
528 * @return New target page
530 String doChangePersonalContactData ();
533 * Returns a list of all selectable contacts for user creation. Contacts
534 * from already existing users are excluded in this list.
536 * @return A list of all selectable contacts
538 List<Contact> selectableContacts ();