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.addressbook.beans.contact;
19 import java.io.Serializable;
20 import java.util.Date;
21 import org.mxchange.jcontacts.contact.Contact;
22 import org.mxchange.jcontacts.contact.gender.Gender;
23 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
24 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
25 import org.mxchange.jcountry.data.Country;
26 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
27 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
28 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
31 * An interface for user beans
33 * @author Roland Haeder<roland@mxchange.org>
35 public interface AddressbookContactWebSessionController extends Serializable {
38 * Minimum password length
40 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
43 * Updates all data from bean in given contact instance
45 * @param userContact Contact instance to update
47 void updateContactDataFromController (final Contact userContact);
50 * Adds given email address to list
52 * @param contactEmailAddress Email address to add
54 void addEmailAddress (final String contactEmailAddress);
57 * Tries to lookup contact by given id number. If the user is not found a
58 * proper exceptions are thrown.
60 * @param contactId Contact id
62 * @return Contact instance
64 * @throws ContactNotFoundException If the user is not found
66 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
69 * Clears this controller
74 * Event observer for new user registrations
76 * @param event User registration event
78 void afterRegistrationEvent (final UserRegisteredEvent event);
81 * Event observer for updated contact data by admins
83 * @param event Updated contact data event
85 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
88 * Event observer for logged-in user
90 * @param event Event instance
92 void afterUserLogin (final UserLoggedInEvent event);
95 * Creates an instance from all properties
97 * @return A contact instance
99 Contact createContactInstance ();
102 * Getter for birth day
109 * Setter for birth day
111 * @param birthday Birth day
113 void setBirthday (final Date birthday);
116 * Getter for ellphone number's carrier
118 * @return Cellphone number's carrier
120 MobileProvider getCellphoneCarrier ();
123 * Setter for cellphone number's carrier prefix
125 * @param cellphoneCarrier Cellphone number's carrier prefix
127 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
130 * Getter for ellphone number
132 * @return Cellphone number
134 Long getCellphoneNumber ();
137 * Setter for ellphone number
139 * @param cellphoneNumber Cellphone number
141 void setCellphoneNumber (final Long cellphoneNumber);
153 * @param city the city to set
155 void setCity (final String city);
158 * Getter for comments
162 String getComment ();
167 * @param comment Comments
169 void setComment (final String comment);
172 * Getter for country instance
174 * @return Country instance
176 Country getCountry ();
179 * Setter for country instance
181 * @param country Country instance
183 void setCountry (final Country country);
186 * Getter for email address
188 * @return Email address
190 String getEmailAddress ();
193 * Setter for email address
195 * @param emailAddress Email address
197 void setEmailAddress (final String emailAddress);
200 * Getter for email address, repeated
202 * @return the emailAddress, repeated
204 String getEmailAddressRepeat ();
207 * Setter for email address repeated
209 * @param emailAddressRepeat the emailAddress to set
211 void setEmailAddressRepeat (final String emailAddressRepeat);
216 * @return the familyName
218 String getFamilyName ();
223 * @param familyName the familyName to set
225 void setFamilyName (final String familyName);
228 * Getter for fax number's area code
230 * @return Fax number's area code
232 Integer getFaxAreaCode ();
235 * Setter for fax number's area code
237 * @param faxAreaCode Fax number's area code
239 void setFaxAreaCode (final Integer faxAreaCode);
242 * Getter for fax's country instance
244 * @return Fax' country instance
246 Country getFaxCountry ();
249 * Setter for fax's country instance
251 * @param faxCountry Fax' country instance
253 void setFaxCountry (final Country faxCountry);
256 * Getter for fax number
260 Long getFaxNumber ();
263 * Setter for fax number
265 * @param faxNumber Fax number
267 void setFaxNumber (final Long faxNumber);
272 * @return the first name
274 String getFirstName ();
279 * @param firstName the first name to set
281 void setFirstName (final String firstName);
284 * Gender of the contact
291 * Gender of the contact
293 * @param gender the gender to set
295 void setGender (final Gender gender);
300 * @return the houseNumber
302 Short getHouseNumber ();
307 * @param houseNumber the houseNumber to set
309 void setHouseNumber (final Short houseNumber);
312 * Getter for phone number's area code
314 * @return Phone number's area code
316 Integer getPhoneAreaCode ();
319 * Setter for phone number's area code
321 * @param phoneAreaCode Phone number's area code
323 void setPhoneAreaCode (final Integer phoneAreaCode);
326 * Getter for phone number's country instance
328 * @return Phone number's country instance
330 Country getPhoneCountry ();
333 * Setter for phone number's country instance
335 * @param phoneCountry Phone number's country instance
337 void setPhoneCountry (final Country phoneCountry);
340 * Getter for phone number
342 * @return Phone number
344 Long getPhoneNumber ();
347 * Setter for phone number
349 * @param phoneNumber Phone number
351 void setPhoneNumber (final Long phoneNumber);
363 * @param street the street to set
365 void setStreet (final String street);
370 * @return the zipCode
372 Integer getZipCode ();
377 * @param zipCode the zipCode to set
379 void setZipCode (final Integer zipCode);
382 * Checks whether contact instance's email address is used
384 * @param contact Contact instance's email address to check
386 * @return Whether it is already used
388 boolean isEmailAddressRegistered (final Contact contact);
391 * Checks whether all required personal data is set
393 * @return Whether the required personal data is set
395 boolean isRequiredPersonalDataSet ();
398 * Checks whether all required personal data is set for changing them
400 * @return Whether the required personal data is set
402 boolean isRequiredChangePersonalDataSet ();
405 * Checks whether same email addresses have been entered
407 * @return Whether same email addresses have been entered
409 boolean isSameEmailAddressEntered ();
412 * Changes logged-in user's personal data if the current password matches
413 * and TAC + privacy statement has been accepted.
415 * @return New target page
417 String doChangePersonalContactData ();