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;
35 * An interface for user beans
37 * @author Roland Haeder<roland@mxchange.org>
39 public interface JobsContactWebSessionController extends Serializable {
42 * Minimum password length
44 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
47 * Returns a list of all found contacts
49 * @return A list of all contacts.
51 List<Contact> allContacts();
54 * Checks whether there are contacts.
56 * @return Whether contacts are there
58 boolean hasContacts ();
61 * Event observer for newly added users by adminstrator
63 * @param event Event being fired
65 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
68 * Event observer when user confirmed account.
70 * @param event Event being fired
72 void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
75 * Updates all data from bean in given contact instance
77 * @param userContact Contact instance to update
79 void updateContactDataFromController (final Contact userContact);
82 * Tries to lookup contact by given id number. If the user is not found a
83 * proper exceptions are thrown.
85 * @param contactId Contact id
87 * @return Contact instance
89 * @throws ContactNotFoundException If the user is not found
91 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
94 * Event observer for new user registrations
96 * @param event User registration event
98 void afterRegistrationEvent (final UserRegisteredEvent event);
101 * Observes events being fired when an administrator has added a new
104 * @param event Event being fired
106 void afterAdminAddedContact (final AdminAddedContactEvent event);
109 * Event observer for updated contact data by admins
111 * @param event Updated contact data event
113 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
116 * Event observer for logged-in user
118 * @param event Event instance
120 void afterUserLogin (final UserLoggedInEvent event);
123 * Creates an instance from all properties
125 * @return A contact instance
127 Contact createContactInstance ();
130 * Getter for birth day
137 * Setter for birth day
139 * @param birthday Birth day
141 void setBirthday (final Date birthday);
144 * Getter for ellphone number's carrier
146 * @return Cellphone number's carrier
148 MobileProvider getCellphoneCarrier ();
151 * Setter for cellphone number's carrier prefix
153 * @param cellphoneCarrier Cellphone number's carrier prefix
155 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
158 * Getter for ellphone number
160 * @return Cellphone number
162 Long getCellphoneNumber ();
165 * Setter for ellphone number
167 * @param cellphoneNumber Cellphone number
169 void setCellphoneNumber (final Long cellphoneNumber);
181 * @param city the city to set
183 void setCity (final String city);
186 * Getter for comments
190 String getComment ();
195 * @param comment Comments
197 void setComment (final String comment);
200 * Getter for country instance
202 * @return Country instance
204 Country getCountry ();
207 * Setter for country instance
209 * @param country Country instance
211 void setCountry (final Country country);
214 * Getter for email address
216 * @return Email address
218 String getEmailAddress ();
221 * Setter for email address
223 * @param emailAddress Email address
225 void setEmailAddress (final String emailAddress);
228 * Getter for email address, repeated
230 * @return the emailAddress, repeated
232 String getEmailAddressRepeat ();
235 * Setter for email address repeated
237 * @param emailAddressRepeat the emailAddress to set
239 void setEmailAddressRepeat (final String emailAddressRepeat);
244 * @return the familyName
246 String getFamilyName ();
251 * @param familyName the familyName to set
253 void setFamilyName (final String familyName);
256 * Getter for fax number's area code
258 * @return Fax number's area code
260 Integer getFaxAreaCode ();
263 * Setter for fax number's area code
265 * @param faxAreaCode Fax number's area code
267 void setFaxAreaCode (final Integer faxAreaCode);
270 * Getter for fax's country instance
272 * @return Fax' country instance
274 Country getFaxCountry ();
277 * Setter for fax's country instance
279 * @param faxCountry Fax' country instance
281 void setFaxCountry (final Country faxCountry);
284 * Getter for fax number
288 Long getFaxNumber ();
291 * Setter for fax number
293 * @param faxNumber Fax number
295 void setFaxNumber (final Long faxNumber);
300 * @return the first name
302 String getFirstName ();
307 * @param firstName the first name to set
309 void setFirstName (final String firstName);
312 * Gender of the contact
319 * Gender of the contact
321 * @param gender the gender to set
323 void setGender (final Gender gender);
328 * @return the houseNumber
330 Short getHouseNumber ();
335 * @param houseNumber the houseNumber to set
337 void setHouseNumber (final Short houseNumber);
340 * Getter for phone number's area code
342 * @return Phone number's area code
344 Integer getPhoneAreaCode ();
347 * Setter for phone number's area code
349 * @param phoneAreaCode Phone number's area code
351 void setPhoneAreaCode (final Integer phoneAreaCode);
354 * Getter for phone number's country instance
356 * @return Phone number's country instance
358 Country getPhoneCountry ();
361 * Setter for phone number's country instance
363 * @param phoneCountry Phone number's country instance
365 void setPhoneCountry (final Country phoneCountry);
368 * Getter for phone number
370 * @return Phone number
372 Long getPhoneNumber ();
375 * Setter for phone number
377 * @param phoneNumber Phone number
379 void setPhoneNumber (final Long phoneNumber);
391 * @param street the street to set
393 void setStreet (final String street);
398 * @return the zipCode
400 Integer getZipCode ();
405 * @param zipCode the zipCode to set
407 void setZipCode (final Integer zipCode);
410 * Checks whether contact instance's email address is used
412 * @param contact Contact instance's email address to check
414 * @return Whether it is already used
416 boolean isEmailAddressRegistered (final Contact contact);
419 * Checks whether all required personal data is set
421 * @return Whether the required personal data is set
423 boolean isRequiredPersonalDataSet ();
426 * Checks whether all required personal data is set for changing them
428 * @return Whether the required personal data is set
430 boolean isRequiredChangePersonalDataSet ();
433 * Checks whether same email addresses have been entered
435 * @return Whether same email addresses have been entered
437 boolean isSameEmailAddressEntered ();
440 * Changes logged-in user's personal data if the current password matches
441 * and TAC + privacy statement has been accepted.
443 * @return New target page
445 String doChangePersonalContactData ();