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.phonenumbers.mobileprovider.MobileProvider;
31 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
32 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
33 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
34 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
35 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
38 * An interface for user beans
40 * @author Roland Haeder<roland@mxchange.org>
43 public interface JobsContactWebSessionController extends Serializable {
46 * Returns a list of all found contacts
48 * @return A list of all contacts.
50 List<Contact> allContacts ();
53 * Event observer for newly added users by adminstrator
55 * @param event Event being fired
57 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
60 * Event observer for deleted contact instance by administrator
62 * @param event Event being fired
64 void afterAdminDeletedContactEvent (final AdminDeletedContactEvent event);
67 * Event observer when user confirmed account.
69 * @param event Event being fired
71 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
74 * Updates all data from bean in given contact instance
76 * @param userContact Contact instance to update
78 void updateContactDataFromController (final Contact userContact);
81 * Tries to lookup contact by given id number. If the user is not found a
82 * proper exceptions are thrown.
84 * @param contactId Contact id
86 * @return Contact instance
88 * @throws ContactNotFoundException If the user is not found
90 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
93 * Event observer for new user registrations
95 * @param event User registration event
97 void afterRegistrationEvent (final UserRegisteredEvent event);
100 * Observes events being fired when an administrator has added a new
103 * @param event Event being fired
105 void afterAdminAddedContact (final AdminAddedContactEvent event);
108 * Observes events being fired when an administrator has linked a new user
109 * with existing contact data.
111 * @param event Event being fired
113 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
116 * Event observer for updated contact data by administrators
118 * @param event Updated contact data event
120 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
123 * Event observer for logged-in user
125 * @param event Event instance
127 void afterUserLogin (final UserLoggedInEvent event);
130 * Creates an instance from all properties
132 * @return A contact instance
134 Contact createContactInstance ();
137 * Getter for birth day
144 * Setter for birth day
146 * @param birthday Birth day
148 void setBirthday (final Date birthday);
151 * Getter for ellphone number's carrier
153 * @return Cellphone number's carrier
155 MobileProvider getCellphoneCarrier ();
158 * Setter for cellphone number's carrier prefix
160 * @param cellphoneCarrier Cellphone number's carrier prefix
162 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
165 * Getter for ellphone number
167 * @return Cellphone number
169 Long getCellphoneNumber ();
172 * Setter for ellphone number
174 * @param cellphoneNumber Cellphone number
176 void setCellphoneNumber (final Long cellphoneNumber);
188 * @param city the city to set
190 void setCity (final String city);
193 * Getter for comments
197 String getComment ();
202 * @param comment Comments
204 void setComment (final String comment);
207 * Getter for country instance
209 * @return Country instance
211 Country getCountry ();
214 * Setter for country instance
216 * @param country Country instance
218 void setCountry (final Country country);
221 * Getter for email address
223 * @return Email address
225 String getEmailAddress ();
228 * Setter for email address
230 * @param emailAddress Email address
232 void setEmailAddress (final String emailAddress);
235 * Getter for email address, repeated
237 * @return the emailAddress, repeated
239 String getEmailAddressRepeat ();
242 * Setter for email address repeated
244 * @param emailAddressRepeat the emailAddress to set
246 void setEmailAddressRepeat (final String emailAddressRepeat);
251 * @return the familyName
253 String getFamilyName ();
258 * @param familyName the familyName to set
260 void setFamilyName (final String familyName);
263 * Getter for fax number's area code
265 * @return Fax number's area code
267 Integer getFaxAreaCode ();
270 * Setter for fax number's area code
272 * @param faxAreaCode Fax number's area code
274 void setFaxAreaCode (final Integer faxAreaCode);
277 * Getter for fax's country instance
279 * @return Fax' country instance
281 Country getFaxCountry ();
284 * Setter for fax's country instance
286 * @param faxCountry Fax' country instance
288 void setFaxCountry (final Country faxCountry);
291 * Getter for fax number
295 Long getFaxNumber ();
298 * Setter for fax number
300 * @param faxNumber Fax number
302 void setFaxNumber (final Long faxNumber);
307 * @return the first name
309 String getFirstName ();
314 * @param firstName the first name to set
316 void setFirstName (final String firstName);
319 * Gender of the contact
326 * Gender of the contact
328 * @param gender the gender to set
330 void setGender (final Gender gender);
335 * @return the houseNumber
337 Short getHouseNumber ();
342 * @param houseNumber the houseNumber to set
344 void setHouseNumber (final Short houseNumber);
347 * Getter for house number extension, example: 123a 'a' is then the
348 * extension and 123 is the house number.
350 * @return House number extension
352 String getHouseNumberExtension ();
355 * Setter for house number extension
357 * @param houseNumberExtension House number extension
359 void setHouseNumberExtension (final String houseNumberExtension);
362 * Getter for phone number's area code
364 * @return Phone number's area code
366 Integer getPhoneAreaCode ();
369 * Setter for phone number's area code
371 * @param phoneAreaCode Phone number's area code
373 void setPhoneAreaCode (final Integer phoneAreaCode);
376 * Getter for phone number's country instance
378 * @return Phone number's country instance
380 Country getPhoneCountry ();
383 * Setter for phone number's country instance
385 * @param phoneCountry Phone number's country instance
387 void setPhoneCountry (final Country phoneCountry);
390 * Getter for phone number
392 * @return Phone number
394 Long getPhoneNumber ();
397 * Setter for phone number
399 * @param phoneNumber Phone number
401 void setPhoneNumber (final Long phoneNumber);
413 * @param street the street to set
415 void setStreet (final String street);
427 * @param title the title to set
429 void setTitle (final String title);
434 * @return the zipCode
436 Integer getZipCode ();
441 * @param zipCode the zipCode to set
443 void setZipCode (final Integer zipCode);
446 * Getter for controller type
448 * @return controller type
450 String getControllerType ();
453 * Setter for controller type
455 * @param controllerType Controller type
457 * @deprecated Don't use this method.
460 void setControllerType (final String controllerType);
463 * Checks whether contact instance's email address is used
465 * @param contact Contact instance's email address to check
467 * @return Whether it is already used
469 boolean isEmailAddressRegistered (final Contact contact);
472 * Checks whether all required personal data is set
474 * @return Whether the required personal data is set
476 boolean isRequiredPersonalDataSet ();
479 * Checks whether all required personal data is set for changing them
481 * @return Whether the required personal data is set
483 boolean isRequiredChangePersonalDataSet ();
486 * Checks whether same email addresses have been entered
488 * @return Whether same email addresses have been entered
490 boolean isSameEmailAddressEntered ();
493 * Changes logged-in user's personal data if the current password matches
494 * and TAC + privacy statement has been accepted.
496 * @return New target page
498 String doChangePersonalContactData ();
501 * Returns a list of all selectable contacts for user creation. Contacts
502 * from already existing users are excluded in this list.
504 * @return A list of all selectable contacts
506 List<Contact> selectableContacts ();