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 org.mxchange.jcontacts.contact.Contact;
23 import org.mxchange.jcontacts.contact.gender.Gender;
24 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
25 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
26 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
27 import org.mxchange.jcountry.data.Country;
28 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
29 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
30 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
31 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
32 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
33 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
36 * An interface for user beans
38 * @author Roland Haeder<roland@mxchange.org>
40 public interface JobsContactWebSessionController extends Serializable {
43 * Minimum password length
45 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
48 * Returns a list of all found contacts
50 * @return A list of all contacts.
52 List<Contact> allContacts ();
55 * Checks whether there are contacts.
57 * @return Whether contacts are there
59 boolean hasContacts ();
62 * Event observer for newly added users by adminstrator
64 * @param event Event being fired
66 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
69 * Event observer when user confirmed account.
71 * @param event Event being fired
73 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
76 * Updates all data from bean in given contact instance
78 * @param userContact Contact instance to update
80 void updateContactDataFromController (final Contact userContact);
83 * Tries to lookup contact by given id number. If the user is not found a
84 * proper exceptions are thrown.
86 * @param contactId Contact id
88 * @return Contact instance
90 * @throws ContactNotFoundException If the user is not found
92 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
95 * Event observer for new user registrations
97 * @param event User registration event
99 void afterRegistrationEvent (final UserRegisteredEvent event);
102 * Observes events being fired when an administrator has added a new
105 * @param event Event being fired
107 void afterAdminAddedContact (final AdminAddedContactEvent event);
110 * Observes events being fired when an administrator has linked a new user
111 * with existing contact data.
113 * @param event Event being fired
115 void afterAdminLinkedUser (final AdminLinkedUserEvent event);
118 * Event observer for updated contact data by administrators
120 * @param event Updated contact data event
122 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
125 * Event observer for logged-in user
127 * @param event Event instance
129 void afterUserLogin (final UserLoggedInEvent event);
132 * Creates an instance from all properties
134 * @return A contact instance
136 Contact createContactInstance ();
139 * Getter for birth day
146 * Setter for birth day
148 * @param birthday Birth day
150 void setBirthday (final Date birthday);
153 * Getter for ellphone number's carrier
155 * @return Cellphone number's carrier
157 MobileProvider getCellphoneCarrier ();
160 * Setter for cellphone number's carrier prefix
162 * @param cellphoneCarrier Cellphone number's carrier prefix
164 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
167 * Getter for ellphone number
169 * @return Cellphone number
171 Long getCellphoneNumber ();
174 * Setter for ellphone number
176 * @param cellphoneNumber Cellphone number
178 void setCellphoneNumber (final Long cellphoneNumber);
190 * @param city the city to set
192 void setCity (final String city);
195 * Getter for comments
199 String getComment ();
204 * @param comment Comments
206 void setComment (final String comment);
209 * Getter for country instance
211 * @return Country instance
213 Country getCountry ();
216 * Setter for country instance
218 * @param country Country instance
220 void setCountry (final Country country);
223 * Getter for email address
225 * @return Email address
227 String getEmailAddress ();
230 * Setter for email address
232 * @param emailAddress Email address
234 void setEmailAddress (final String emailAddress);
237 * Getter for email address, repeated
239 * @return the emailAddress, repeated
241 String getEmailAddressRepeat ();
244 * Setter for email address repeated
246 * @param emailAddressRepeat the emailAddress to set
248 void setEmailAddressRepeat (final String emailAddressRepeat);
253 * @return the familyName
255 String getFamilyName ();
260 * @param familyName the familyName to set
262 void setFamilyName (final String familyName);
265 * Getter for fax number's area code
267 * @return Fax number's area code
269 Integer getFaxAreaCode ();
272 * Setter for fax number's area code
274 * @param faxAreaCode Fax number's area code
276 void setFaxAreaCode (final Integer faxAreaCode);
279 * Getter for fax's country instance
281 * @return Fax' country instance
283 Country getFaxCountry ();
286 * Setter for fax's country instance
288 * @param faxCountry Fax' country instance
290 void setFaxCountry (final Country faxCountry);
293 * Getter for fax number
297 Long getFaxNumber ();
300 * Setter for fax number
302 * @param faxNumber Fax number
304 void setFaxNumber (final Long faxNumber);
309 * @return the first name
311 String getFirstName ();
316 * @param firstName the first name to set
318 void setFirstName (final String firstName);
321 * Gender of the contact
328 * Gender of the contact
330 * @param gender the gender to set
332 void setGender (final Gender gender);
337 * @return the houseNumber
339 Short getHouseNumber ();
344 * @param houseNumber the houseNumber to set
346 void setHouseNumber (final Short houseNumber);
349 * Getter for house number extension, example: 123a 'a' is then the
350 * extension and 123 is the house number.
352 * @return House number extension
354 String getHouseNumberExtension ();
357 * Setter for house number extension
359 * @param houseNumberExtension House number extension
361 void setHouseNumberExtension (final String houseNumberExtension);
364 * Getter for phone number's area code
366 * @return Phone number's area code
368 Integer getPhoneAreaCode ();
371 * Setter for phone number's area code
373 * @param phoneAreaCode Phone number's area code
375 void setPhoneAreaCode (final Integer phoneAreaCode);
378 * Getter for phone number's country instance
380 * @return Phone number's country instance
382 Country getPhoneCountry ();
385 * Setter for phone number's country instance
387 * @param phoneCountry Phone number's country instance
389 void setPhoneCountry (final Country phoneCountry);
392 * Getter for phone number
394 * @return Phone number
396 Long getPhoneNumber ();
399 * Setter for phone number
401 * @param phoneNumber Phone number
403 void setPhoneNumber (final Long phoneNumber);
415 * @param street the street to set
417 void setStreet (final String street);
429 * @param title the title to set
431 void setTitle (final String title);
436 * @return the zipCode
438 Integer getZipCode ();
443 * @param zipCode the zipCode to set
445 void setZipCode (final Integer zipCode);
448 * Getter for controller type
450 * @return controller type
452 String getControllerType ();
455 * Setter for controller type
457 * @param controllerType Controller type
458 * @deprecated Don't use this method.
461 void setControllerType (final String controllerType);
464 * Checks whether contact instance's email address is used
466 * @param contact Contact instance's email address to check
468 * @return Whether it is already used
470 boolean isEmailAddressRegistered (final Contact contact);
473 * Checks whether all required personal data is set
475 * @return Whether the required personal data is set
477 boolean isRequiredPersonalDataSet ();
480 * Checks whether all required personal data is set for changing them
482 * @return Whether the required personal data is set
484 boolean isRequiredChangePersonalDataSet ();
487 * Checks whether same email addresses have been entered
489 * @return Whether same email addresses have been entered
491 boolean isSameEmailAddressEntered ();
494 * Changes logged-in user's personal data if the current password matches
495 * and TAC + privacy statement has been accepted.
497 * @return New target page
499 String doChangePersonalContactData ();
502 * Returns a list of all selectable contacts for user creation. Contacts
503 * from already existing users are excluded in this list.
505 * @return A list of all selectable contacts
507 List<Contact> selectableContacts ();