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.update.AdminUpdatedContactEvent;
25 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
26 import org.mxchange.jcountry.data.Country;
27 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
28 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
29 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
30 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
33 * An interface for user beans
35 * @author Roland Haeder<roland@mxchange.org>
37 public interface JobsContactWebSessionController extends Serializable {
40 * Minimum password length
42 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
45 * Returns a list of all found contacts
47 * @return A list of all contacts.
49 List<Contact> allContacts();
52 * Checks whether there are contacts.
54 * @return Whether contacts are there
56 boolean hasContacts ();
59 * Event observer for newly added users by adminstrator
61 * @param event Event being fired
63 void afterAdminAddedUserEvent (final AdminAddedUserEvent 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 * Adds given email address to list
75 * @param contactEmailAddress Email address to add
77 void addEmailAddress (final String contactEmailAddress);
80 * Tries to lookup contact by given id number. If the user is not found a
81 * proper exceptions are thrown.
83 * @param contactId Contact id
85 * @return Contact instance
87 * @throws ContactNotFoundException If the user is not found
89 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
92 * Event observer for new user registrations
94 * @param event User registration event
96 void afterRegistrationEvent (final UserRegisteredEvent event);
99 * Event observer for updated contact data by admins
101 * @param event Updated contact data event
103 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
106 * Event observer for logged-in user
108 * @param event Event instance
110 void afterUserLogin (final UserLoggedInEvent event);
113 * Creates an instance from all properties
115 * @return A contact instance
117 Contact createContactInstance ();
120 * Getter for birth day
127 * Setter for birth day
129 * @param birthday Birth day
131 void setBirthday (final Date birthday);
134 * Getter for ellphone number's carrier
136 * @return Cellphone number's carrier
138 MobileProvider getCellphoneCarrier ();
141 * Setter for cellphone number's carrier prefix
143 * @param cellphoneCarrier Cellphone number's carrier prefix
145 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
148 * Getter for ellphone number
150 * @return Cellphone number
152 Long getCellphoneNumber ();
155 * Setter for ellphone number
157 * @param cellphoneNumber Cellphone number
159 void setCellphoneNumber (final Long cellphoneNumber);
171 * @param city the city to set
173 void setCity (final String city);
176 * Getter for comments
180 String getComment ();
185 * @param comment Comments
187 void setComment (final String comment);
190 * Getter for country instance
192 * @return Country instance
194 Country getCountry ();
197 * Setter for country instance
199 * @param country Country instance
201 void setCountry (final Country country);
204 * Getter for email address
206 * @return Email address
208 String getEmailAddress ();
211 * Setter for email address
213 * @param emailAddress Email address
215 void setEmailAddress (final String emailAddress);
218 * Getter for email address, repeated
220 * @return the emailAddress, repeated
222 String getEmailAddressRepeat ();
225 * Setter for email address repeated
227 * @param emailAddressRepeat the emailAddress to set
229 void setEmailAddressRepeat (final String emailAddressRepeat);
234 * @return the familyName
236 String getFamilyName ();
241 * @param familyName the familyName to set
243 void setFamilyName (final String familyName);
246 * Getter for fax number's area code
248 * @return Fax number's area code
250 Integer getFaxAreaCode ();
253 * Setter for fax number's area code
255 * @param faxAreaCode Fax number's area code
257 void setFaxAreaCode (final Integer faxAreaCode);
260 * Getter for fax's country instance
262 * @return Fax' country instance
264 Country getFaxCountry ();
267 * Setter for fax's country instance
269 * @param faxCountry Fax' country instance
271 void setFaxCountry (final Country faxCountry);
274 * Getter for fax number
278 Long getFaxNumber ();
281 * Setter for fax number
283 * @param faxNumber Fax number
285 void setFaxNumber (final Long faxNumber);
290 * @return the first name
292 String getFirstName ();
297 * @param firstName the first name to set
299 void setFirstName (final String firstName);
302 * Gender of the contact
309 * Gender of the contact
311 * @param gender the gender to set
313 void setGender (final Gender gender);
318 * @return the houseNumber
320 Short getHouseNumber ();
325 * @param houseNumber the houseNumber to set
327 void setHouseNumber (final Short houseNumber);
330 * Getter for phone number's area code
332 * @return Phone number's area code
334 Integer getPhoneAreaCode ();
337 * Setter for phone number's area code
339 * @param phoneAreaCode Phone number's area code
341 void setPhoneAreaCode (final Integer phoneAreaCode);
344 * Getter for phone number's country instance
346 * @return Phone number's country instance
348 Country getPhoneCountry ();
351 * Setter for phone number's country instance
353 * @param phoneCountry Phone number's country instance
355 void setPhoneCountry (final Country phoneCountry);
358 * Getter for phone number
360 * @return Phone number
362 Long getPhoneNumber ();
365 * Setter for phone number
367 * @param phoneNumber Phone number
369 void setPhoneNumber (final Long phoneNumber);
381 * @param street the street to set
383 void setStreet (final String street);
388 * @return the zipCode
390 Integer getZipCode ();
395 * @param zipCode the zipCode to set
397 void setZipCode (final Integer zipCode);
400 * Checks whether contact instance's email address is used
402 * @param contact Contact instance's email address to check
404 * @return Whether it is already used
406 boolean isEmailAddressRegistered (final Contact contact);
409 * Checks whether all required personal data is set
411 * @return Whether the required personal data is set
413 boolean isRequiredPersonalDataSet ();
416 * Checks whether all required personal data is set for changing them
418 * @return Whether the required personal data is set
420 boolean isRequiredChangePersonalDataSet ();
423 * Checks whether same email addresses have been entered
425 * @return Whether same email addresses have been entered
427 boolean isSameEmailAddressEntered ();
430 * Changes logged-in user's personal data if the current password matches
431 * and TAC + privacy statement has been accepted.
433 * @return New target page
435 String doChangePersonalContactData ();