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.exceptions.ContactNotFoundException;
29 import org.mxchange.jcountry.data.Country;
30 import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
31 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
32 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
33 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
34 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
35 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
36 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
39 * An interface for user beans
41 * @author Roland Haeder<roland@mxchange.org>
44 public interface JobsContactWebSessionController extends Serializable {
47 * Returns a list of all found contacts
49 * @return A list of all contacts.
51 List<Contact> allContacts ();
54 * Event observer for newly added users by adminstrator
56 * @param event Event being fired
58 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
61 * Event observer for deleted contact instance by administrator
63 * @param event Event being fired
65 void afterAdminDeletedContactEvent (final AdminDeletedContactEvent event);
68 * Event observer when user confirmed account.
70 * @param event Event being fired
72 void afterUserConfirmedAccountEvent (final UserConfirmedAccountEvent event);
75 * Event observer when a list with unused mobile numbers is being created
77 * @param event Event being fired
79 void removeMobileNumberFromListEvent(final AdminRemoveMobileNumberFromListEvent event);
82 * Updates all data from bean in given contact instance
84 * @param userContact Contact instance to update
86 void updateContactDataFromController (final Contact userContact);
89 * Tries to lookup contact by given id number. If the user is not found a
90 * proper exceptions are thrown.
92 * @param contactId Contact id
94 * @return Contact instance
96 * @throws ContactNotFoundException If the user is not found
98 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
101 * Event observer for new user registrations
103 * @param event User registration event
105 void afterRegistrationEvent (final UserRegisteredEvent event);
108 * Observes events being fired when an administrator has added a new
111 * @param event Event being fired
113 void afterAdminAddedContact (final AdminAddedContactEvent event);
116 * Observes events being fired when an administrator has linked a new user
117 * with existing contact data.
119 * @param event Event being fired
121 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
124 * Event observer for updated contact data by administrators
126 * @param event Updated contact data event
128 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
131 * Event observer for logged-in user
133 * @param event Event instance
135 void afterUserLogin (final UserLoggedInEvent event);
138 * Creates an instance from all properties
140 * @return A contact instance
142 Contact createContactInstance ();
145 * Getter for birth day
152 * Setter for birth day
154 * @param birthday Birth day
156 void setBirthday (final Date birthday);
159 * Getter for mobile provider
161 * @return Mobile provider
163 MobileProvider getMobileProvider ();
166 * Setter for mobile provider
168 * @param mobileProvider Mobile provider
170 void setMobileProvider (final MobileProvider mobileProvider);
173 * Getter for mobile number
175 * @return Cellphone number
177 Long getMobileNumber ();
180 * Setter for mobile number
182 * @param mobileNumber Cellphone number
184 void setMobileNumber (final Long mobileNumber);
196 * @param city the city to set
198 void setCity (final String city);
201 * Getter for comments
205 String getComment ();
210 * @param comment Comments
212 void setComment (final String comment);
215 * Getter for country instance
217 * @return Country instance
219 Country getCountry ();
222 * Setter for country instance
224 * @param country Country instance
226 void setCountry (final Country country);
229 * Getter for email address
231 * @return Email address
233 String getEmailAddress ();
236 * Setter for email address
238 * @param emailAddress Email address
240 void setEmailAddress (final String emailAddress);
243 * Getter for email address, repeated
245 * @return the emailAddress, repeated
247 String getEmailAddressRepeat ();
250 * Setter for email address repeated
252 * @param emailAddressRepeat the emailAddress to set
254 void setEmailAddressRepeat (final String emailAddressRepeat);
259 * @return the familyName
261 String getFamilyName ();
266 * @param familyName the familyName to set
268 void setFamilyName (final String familyName);
271 * Getter for fax number's area code
273 * @return Fax number's area code
275 Integer getFaxAreaCode ();
278 * Setter for fax number's area code
280 * @param faxAreaCode Fax number's area code
282 void setFaxAreaCode (final Integer faxAreaCode);
285 * Getter for fax's country instance
287 * @return Fax' country instance
289 Country getFaxCountry ();
292 * Setter for fax's country instance
294 * @param faxCountry Fax' country instance
296 void setFaxCountry (final Country faxCountry);
299 * Getter for fax number
303 Long getFaxNumber ();
306 * Setter for fax number
308 * @param faxNumber Fax number
310 void setFaxNumber (final Long faxNumber);
315 * @return the first name
317 String getFirstName ();
322 * @param firstName the first name to set
324 void setFirstName (final String firstName);
327 * Gender of the contact
334 * Gender of the contact
336 * @param gender the gender to set
338 void setGender (final Gender gender);
343 * @return the houseNumber
345 Short getHouseNumber ();
350 * @param houseNumber the houseNumber to set
352 void setHouseNumber (final Short houseNumber);
355 * Getter for house number extension, example: 123a 'a' is then the
356 * extension and 123 is the house number.
358 * @return House number extension
360 String getHouseNumberExtension ();
363 * Setter for house number extension
365 * @param houseNumberExtension House number extension
367 void setHouseNumberExtension (final String houseNumberExtension);
370 * Getter for phone number's area code
372 * @return Phone number's area code
374 Integer getPhoneAreaCode ();
377 * Setter for phone number's area code
379 * @param phoneAreaCode Phone number's area code
381 void setPhoneAreaCode (final Integer phoneAreaCode);
384 * Getter for phone number's country instance
386 * @return Phone number's country instance
388 Country getPhoneCountry ();
391 * Setter for phone number's country instance
393 * @param phoneCountry Phone number's country instance
395 void setPhoneCountry (final Country phoneCountry);
398 * Getter for phone number
400 * @return Phone number
402 Long getPhoneNumber ();
405 * Setter for phone number
407 * @param phoneNumber Phone number
409 void setPhoneNumber (final Long phoneNumber);
421 * @param street the street to set
423 void setStreet (final String street);
435 * @param title the title to set
437 void setTitle (final String title);
442 * @return the zipCode
444 Integer getZipCode ();
449 * @param zipCode the zipCode to set
451 void setZipCode (final Integer zipCode);
454 * Getter for controller type
456 * @return controller type
458 String getControllerType ();
461 * Setter for controller type
463 * @param controllerType Controller type
465 * @deprecated Don't use this method.
468 void setControllerType (final String controllerType);
471 * Checks whether contact instance's email address is used
473 * @param contact Contact instance's email address to check
475 * @return Whether it is already used
477 boolean isEmailAddressRegistered (final Contact contact);
480 * Checks whether all required personal data is set
482 * @return Whether the required personal data is set
484 boolean isRequiredPersonalDataSet ();
487 * Checks whether all required personal data is set for changing them
489 * @return Whether the required personal data is set
491 boolean isRequiredChangePersonalDataSet ();
494 * Checks whether same email addresses have been entered
496 * @return Whether same email addresses have been entered
498 boolean isSameEmailAddressEntered ();
501 * Changes logged-in user's personal data if the current password matches
502 * and TAC + privacy statement has been accepted.
504 * @return New target page
506 String doChangePersonalContactData ();
509 * Returns a list of all selectable contacts for user creation. Contacts
510 * from already existing users are excluded in this list.
512 * @return A list of all selectable contacts
514 List<Contact> selectableContacts ();