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.login.UserLoggedInEvent;
30 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
31 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
34 * An interface for user beans
36 * @author Roland Haeder<roland@mxchange.org>
38 public interface JobsContactWebSessionController extends Serializable {
41 * Minimum password length
43 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
46 * Returns a list of all found contacts
48 * @return A list of all contacts.
50 List<Contact> allContacts();
53 * Checks whether there are contacts.
55 * @return Whether contacts are there
57 boolean hasContacts ();
60 * Event observer for newly added users by adminstrator
62 * @param event Event being fired
64 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
67 * Updates all data from bean in given contact instance
69 * @param userContact Contact instance to update
71 void updateContactDataFromController (final Contact userContact);
74 * Tries to lookup contact by given id number. If the user is not found a
75 * proper exceptions are thrown.
77 * @param contactId Contact id
79 * @return Contact instance
81 * @throws ContactNotFoundException If the user is not found
83 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
86 * Event observer for new user registrations
88 * @param event User registration event
90 void afterRegistrationEvent (final UserRegisteredEvent event);
93 * Observes events being fired when an administrator has added a new
96 * @param event Event being fired
98 void afterAdminAddedContact (final AdminAddedContactEvent event);
101 * Event observer for updated contact data by admins
103 * @param event Updated contact data event
105 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
108 * Event observer for logged-in user
110 * @param event Event instance
112 void afterUserLogin (final UserLoggedInEvent event);
115 * Creates an instance from all properties
117 * @return A contact instance
119 Contact createContactInstance ();
122 * Getter for birth day
129 * Setter for birth day
131 * @param birthday Birth day
133 void setBirthday (final Date birthday);
136 * Getter for ellphone number's carrier
138 * @return Cellphone number's carrier
140 MobileProvider getCellphoneCarrier ();
143 * Setter for cellphone number's carrier prefix
145 * @param cellphoneCarrier Cellphone number's carrier prefix
147 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
150 * Getter for ellphone number
152 * @return Cellphone number
154 Long getCellphoneNumber ();
157 * Setter for ellphone number
159 * @param cellphoneNumber Cellphone number
161 void setCellphoneNumber (final Long cellphoneNumber);
173 * @param city the city to set
175 void setCity (final String city);
178 * Getter for comments
182 String getComment ();
187 * @param comment Comments
189 void setComment (final String comment);
192 * Getter for country instance
194 * @return Country instance
196 Country getCountry ();
199 * Setter for country instance
201 * @param country Country instance
203 void setCountry (final Country country);
206 * Getter for email address
208 * @return Email address
210 String getEmailAddress ();
213 * Setter for email address
215 * @param emailAddress Email address
217 void setEmailAddress (final String emailAddress);
220 * Getter for email address, repeated
222 * @return the emailAddress, repeated
224 String getEmailAddressRepeat ();
227 * Setter for email address repeated
229 * @param emailAddressRepeat the emailAddress to set
231 void setEmailAddressRepeat (final String emailAddressRepeat);
236 * @return the familyName
238 String getFamilyName ();
243 * @param familyName the familyName to set
245 void setFamilyName (final String familyName);
248 * Getter for fax number's area code
250 * @return Fax number's area code
252 Integer getFaxAreaCode ();
255 * Setter for fax number's area code
257 * @param faxAreaCode Fax number's area code
259 void setFaxAreaCode (final Integer faxAreaCode);
262 * Getter for fax's country instance
264 * @return Fax' country instance
266 Country getFaxCountry ();
269 * Setter for fax's country instance
271 * @param faxCountry Fax' country instance
273 void setFaxCountry (final Country faxCountry);
276 * Getter for fax number
280 Long getFaxNumber ();
283 * Setter for fax number
285 * @param faxNumber Fax number
287 void setFaxNumber (final Long faxNumber);
292 * @return the first name
294 String getFirstName ();
299 * @param firstName the first name to set
301 void setFirstName (final String firstName);
304 * Gender of the contact
311 * Gender of the contact
313 * @param gender the gender to set
315 void setGender (final Gender gender);
320 * @return the houseNumber
322 Short getHouseNumber ();
327 * @param houseNumber the houseNumber to set
329 void setHouseNumber (final Short houseNumber);
332 * Getter for phone number's area code
334 * @return Phone number's area code
336 Integer getPhoneAreaCode ();
339 * Setter for phone number's area code
341 * @param phoneAreaCode Phone number's area code
343 void setPhoneAreaCode (final Integer phoneAreaCode);
346 * Getter for phone number's country instance
348 * @return Phone number's country instance
350 Country getPhoneCountry ();
353 * Setter for phone number's country instance
355 * @param phoneCountry Phone number's country instance
357 void setPhoneCountry (final Country phoneCountry);
360 * Getter for phone number
362 * @return Phone number
364 Long getPhoneNumber ();
367 * Setter for phone number
369 * @param phoneNumber Phone number
371 void setPhoneNumber (final Long phoneNumber);
383 * @param street the street to set
385 void setStreet (final String street);
390 * @return the zipCode
392 Integer getZipCode ();
397 * @param zipCode the zipCode to set
399 void setZipCode (final Integer zipCode);
402 * Checks whether contact instance's email address is used
404 * @param contact Contact instance's email address to check
406 * @return Whether it is already used
408 boolean isEmailAddressRegistered (final Contact contact);
411 * Checks whether all required personal data is set
413 * @return Whether the required personal data is set
415 boolean isRequiredPersonalDataSet ();
418 * Checks whether all required personal data is set for changing them
420 * @return Whether the required personal data is set
422 boolean isRequiredChangePersonalDataSet ();
425 * Checks whether same email addresses have been entered
427 * @return Whether same email addresses have been entered
429 boolean isSameEmailAddressEntered ();
432 * Changes logged-in user's personal data if the current password matches
433 * and TAC + privacy statement has been accepted.
435 * @return New target page
437 String doChangePersonalContactData ();