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 org.mxchange.jcontacts.contact.Contact;
22 import org.mxchange.jcontacts.contact.gender.Gender;
23 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
24 import org.mxchange.jcountry.data.Country;
25 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
26 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
27 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
30 * An interface for user beans
32 * @author Roland Haeder<roland@mxchange.org>
34 public interface JobsContactWebSessionController extends Serializable {
37 * Minimum password length
39 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
42 * Updates all data from bean in given contact instance
44 * @param userContact Contact instance to update
46 void updateContactDataFromController (final Contact userContact);
49 * Adds given email address to list
51 * @param contactEmailAddress Email address to add
53 void addEmailAddress (final String contactEmailAddress);
56 * Tries to lookup contact by given id number. If the user is not found a
57 * proper exceptions are thrown.
59 * @param contactId Contact id
61 * @return Contact instance
63 * @throws ContactNotFoundException If the user is not found
65 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
68 * Clears this controller
73 * Event observer for new user registrations
75 * @param event User registration event
77 void afterRegistrationEvent (final UserRegisteredEvent event);
80 * Event observer for logged-in user
82 * @param event Event instance
84 void afterUserLogin (final UserLoggedInEvent event);
87 * Creates an instance from all properties
89 * @return A contact instance
91 Contact createContactInstance ();
94 * Getter for birth day
101 * Setter for birth day
103 * @param birthday Birth day
105 void setBirthday (final Date birthday);
108 * Getter for ellphone number's carrier
110 * @return Cellphone number's carrier
112 MobileProvider getCellphoneCarrier ();
115 * Setter for cellphone number's carrier prefix
117 * @param cellphoneCarrier Cellphone number's carrier prefix
119 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
122 * Getter for ellphone number
124 * @return Cellphone number
126 Long getCellphoneNumber ();
129 * Setter for ellphone number
131 * @param cellphoneNumber Cellphone number
133 void setCellphoneNumber (final Long cellphoneNumber);
145 * @param city the city to set
147 void setCity (final String city);
150 * Getter for comments
154 String getComment ();
159 * @param comment Comments
161 void setComment (final String comment);
164 * Getter for country instance
166 * @return Country instance
168 Country getCountry ();
171 * Setter for country instance
173 * @param country Country instance
175 void setCountry (final Country country);
178 * Getter for email address
180 * @return Email address
182 String getEmailAddress ();
185 * Setter for email address
187 * @param emailAddress Email address
189 void setEmailAddress (final String emailAddress);
192 * Getter for email address, repeated
194 * @return the emailAddress, repeated
196 String getEmailAddressRepeat ();
199 * Setter for email address repeated
201 * @param emailAddressRepeat the emailAddress to set
203 void setEmailAddressRepeat (final String emailAddressRepeat);
208 * @return the familyName
210 String getFamilyName ();
215 * @param familyName the familyName to set
217 void setFamilyName (final String familyName);
220 * Getter for fax number's area code
222 * @return Fax number's area code
224 Integer getFaxAreaCode ();
227 * Setter for fax number's area code
229 * @param faxAreaCode Fax number's area code
231 void setFaxAreaCode (final Integer faxAreaCode);
234 * Getter for fax's country instance
236 * @return Fax' country instance
238 Country getFaxCountry ();
241 * Setter for fax's country instance
243 * @param faxCountry Fax' country instance
245 void setFaxCountry (final Country faxCountry);
248 * Getter for fax number
252 Long getFaxNumber ();
255 * Setter for fax number
257 * @param faxNumber Fax number
259 void setFaxNumber (final Long faxNumber);
264 * @return the first name
266 String getFirstName ();
271 * @param firstName the first name to set
273 void setFirstName (final String firstName);
276 * Gender of the contact
283 * Gender of the contact
285 * @param gender the gender to set
287 void setGender (final Gender gender);
292 * @return the houseNumber
294 Short getHouseNumber ();
299 * @param houseNumber the houseNumber to set
301 void setHouseNumber (final Short houseNumber);
304 * Getter for phone number's area code
306 * @return Phone number's area code
308 Integer getPhoneAreaCode ();
311 * Setter for phone number's area code
313 * @param phoneAreaCode Phone number's area code
315 void setPhoneAreaCode (final Integer phoneAreaCode);
318 * Getter for phone number's country instance
320 * @return Phone number's country instance
322 Country getPhoneCountry ();
325 * Setter for phone number's country instance
327 * @param phoneCountry Phone number's country instance
329 void setPhoneCountry (final Country phoneCountry);
332 * Getter for phone number
334 * @return Phone number
336 Long getPhoneNumber ();
339 * Setter for phone number
341 * @param phoneNumber Phone number
343 void setPhoneNumber (final Long phoneNumber);
355 * @param street the street to set
357 void setStreet (final String street);
362 * @return the zipCode
364 Integer getZipCode ();
369 * @param zipCode the zipCode to set
371 void setZipCode (final Integer zipCode);
374 * Checks whether contact instance's email address is used
376 * @param contact Contact instance's email address to check
378 * @return Whether it is already used
380 boolean isEmailAddressRegistered (final Contact contact);
383 * Checks whether all required personal data is set
385 * @return Whether the required personal data is set
387 boolean isRequiredPersonalDataSet ();
390 * Checks whether all required personal data is set for changing them
392 * @return Whether the required personal data is set
394 boolean isRequiredChangePersonalDataSet ();
397 * Checks whether same email addresses have been entered
399 * @return Whether same email addresses have been entered
401 boolean isSameEmailAddressEntered ();
404 * Changes logged-in user's personal data if the current password matches
405 * and TAC + privacy statement has been accepted.
407 * @return New target page
409 String doChangePersonalContactData ();