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 * Returns a list of all found contacts
47 * @return A list of all contacts.
49 List<Contact> allContacts ();
52 * Event observer for newly added users by adminstrator
54 * @param event Event being fired
56 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
59 * Event observer when user confirmed account.
61 * @param event Event being fired
63 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
66 * Updates all data from bean in given contact instance
68 * @param userContact Contact instance to update
70 void updateContactDataFromController (final Contact userContact);
73 * Tries to lookup contact by given id number. If the user is not found a
74 * proper exceptions are thrown.
76 * @param contactId Contact id
78 * @return Contact instance
80 * @throws ContactNotFoundException If the user is not found
82 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
85 * Event observer for new user registrations
87 * @param event User registration event
89 void afterRegistrationEvent (final UserRegisteredEvent event);
92 * Observes events being fired when an administrator has added a new
95 * @param event Event being fired
97 void afterAdminAddedContact (final AdminAddedContactEvent event);
100 * Observes events being fired when an administrator has linked a new user
101 * with existing contact data.
103 * @param event Event being fired
105 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
108 * Event observer for updated contact data by administrators
110 * @param event Updated contact data event
112 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
115 * Event observer for logged-in user
117 * @param event Event instance
119 void afterUserLogin (final UserLoggedInEvent event);
122 * Creates an instance from all properties
124 * @return A contact instance
126 Contact createContactInstance ();
129 * Getter for birth day
136 * Setter for birth day
138 * @param birthday Birth day
140 void setBirthday (final Date birthday);
143 * Getter for ellphone number's carrier
145 * @return Cellphone number's carrier
147 MobileProvider getCellphoneCarrier ();
150 * Setter for cellphone number's carrier prefix
152 * @param cellphoneCarrier Cellphone number's carrier prefix
154 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
157 * Getter for ellphone number
159 * @return Cellphone number
161 Long getCellphoneNumber ();
164 * Setter for ellphone number
166 * @param cellphoneNumber Cellphone number
168 void setCellphoneNumber (final Long cellphoneNumber);
180 * @param city the city to set
182 void setCity (final String city);
185 * Getter for comments
189 String getComment ();
194 * @param comment Comments
196 void setComment (final String comment);
199 * Getter for country instance
201 * @return Country instance
203 Country getCountry ();
206 * Setter for country instance
208 * @param country Country instance
210 void setCountry (final Country country);
213 * Getter for email address
215 * @return Email address
217 String getEmailAddress ();
220 * Setter for email address
222 * @param emailAddress Email address
224 void setEmailAddress (final String emailAddress);
227 * Getter for email address, repeated
229 * @return the emailAddress, repeated
231 String getEmailAddressRepeat ();
234 * Setter for email address repeated
236 * @param emailAddressRepeat the emailAddress to set
238 void setEmailAddressRepeat (final String emailAddressRepeat);
243 * @return the familyName
245 String getFamilyName ();
250 * @param familyName the familyName to set
252 void setFamilyName (final String familyName);
255 * Getter for fax number's area code
257 * @return Fax number's area code
259 Integer getFaxAreaCode ();
262 * Setter for fax number's area code
264 * @param faxAreaCode Fax number's area code
266 void setFaxAreaCode (final Integer faxAreaCode);
269 * Getter for fax's country instance
271 * @return Fax' country instance
273 Country getFaxCountry ();
276 * Setter for fax's country instance
278 * @param faxCountry Fax' country instance
280 void setFaxCountry (final Country faxCountry);
283 * Getter for fax number
287 Long getFaxNumber ();
290 * Setter for fax number
292 * @param faxNumber Fax number
294 void setFaxNumber (final Long faxNumber);
299 * @return the first name
301 String getFirstName ();
306 * @param firstName the first name to set
308 void setFirstName (final String firstName);
311 * Gender of the contact
318 * Gender of the contact
320 * @param gender the gender to set
322 void setGender (final Gender gender);
327 * @return the houseNumber
329 Short getHouseNumber ();
334 * @param houseNumber the houseNumber to set
336 void setHouseNumber (final Short houseNumber);
339 * Getter for house number extension, example: 123a 'a' is then the
340 * extension and 123 is the house number.
342 * @return House number extension
344 String getHouseNumberExtension ();
347 * Setter for house number extension
349 * @param houseNumberExtension House number extension
351 void setHouseNumberExtension (final String houseNumberExtension);
354 * Getter for phone number's area code
356 * @return Phone number's area code
358 Integer getPhoneAreaCode ();
361 * Setter for phone number's area code
363 * @param phoneAreaCode Phone number's area code
365 void setPhoneAreaCode (final Integer phoneAreaCode);
368 * Getter for phone number's country instance
370 * @return Phone number's country instance
372 Country getPhoneCountry ();
375 * Setter for phone number's country instance
377 * @param phoneCountry Phone number's country instance
379 void setPhoneCountry (final Country phoneCountry);
382 * Getter for phone number
384 * @return Phone number
386 Long getPhoneNumber ();
389 * Setter for phone number
391 * @param phoneNumber Phone number
393 void setPhoneNumber (final Long phoneNumber);
405 * @param street the street to set
407 void setStreet (final String street);
419 * @param title the title to set
421 void setTitle (final String title);
426 * @return the zipCode
428 Integer getZipCode ();
433 * @param zipCode the zipCode to set
435 void setZipCode (final Integer zipCode);
438 * Getter for controller type
440 * @return controller type
442 String getControllerType ();
445 * Setter for controller type
447 * @param controllerType Controller type
448 * @deprecated Don't use this method.
451 void setControllerType (final String controllerType);
454 * Checks whether contact instance's email address is used
456 * @param contact Contact instance's email address to check
458 * @return Whether it is already used
460 boolean isEmailAddressRegistered (final Contact contact);
463 * Checks whether all required personal data is set
465 * @return Whether the required personal data is set
467 boolean isRequiredPersonalDataSet ();
470 * Checks whether all required personal data is set for changing them
472 * @return Whether the required personal data is set
474 boolean isRequiredChangePersonalDataSet ();
477 * Checks whether same email addresses have been entered
479 * @return Whether same email addresses have been entered
481 boolean isSameEmailAddressEntered ();
484 * Changes logged-in user's personal data if the current password matches
485 * and TAC + privacy statement has been accepted.
487 * @return New target page
489 String doChangePersonalContactData ();
492 * Returns a list of all selectable contacts for user creation. Contacts
493 * from already existing users are excluded in this list.
495 * @return A list of all selectable contacts
497 List<Contact> selectableContacts ();