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;
32 * An interface for user beans
34 * @author Roland Haeder<roland@mxchange.org>
36 public interface JobsContactWebSessionController extends Serializable {
39 * Minimum password length
41 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
44 * Returns a list of all found contacts
46 * @return A list of all contacts.
48 List<Contact> allContacts();
51 * Updates all data from bean in given contact instance
53 * @param userContact Contact instance to update
55 void updateContactDataFromController (final Contact userContact);
58 * Adds given email address to list
60 * @param contactEmailAddress Email address to add
62 void addEmailAddress (final String contactEmailAddress);
65 * Tries to lookup contact by given id number. If the user is not found a
66 * proper exceptions are thrown.
68 * @param contactId Contact id
70 * @return Contact instance
72 * @throws ContactNotFoundException If the user is not found
74 Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
77 * Clears this controller
82 * Event observer for new user registrations
84 * @param event User registration event
86 void afterRegistrationEvent (final UserRegisteredEvent event);
89 * Event observer for updated contact data by admins
91 * @param event Updated contact data event
93 void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
96 * Event observer for logged-in user
98 * @param event Event instance
100 void afterUserLogin (final UserLoggedInEvent event);
103 * Creates an instance from all properties
105 * @return A contact instance
107 Contact createContactInstance ();
110 * Getter for birth day
117 * Setter for birth day
119 * @param birthday Birth day
121 void setBirthday (final Date birthday);
124 * Getter for ellphone number's carrier
126 * @return Cellphone number's carrier
128 MobileProvider getCellphoneCarrier ();
131 * Setter for cellphone number's carrier prefix
133 * @param cellphoneCarrier Cellphone number's carrier prefix
135 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
138 * Getter for ellphone number
140 * @return Cellphone number
142 Long getCellphoneNumber ();
145 * Setter for ellphone number
147 * @param cellphoneNumber Cellphone number
149 void setCellphoneNumber (final Long cellphoneNumber);
161 * @param city the city to set
163 void setCity (final String city);
166 * Getter for comments
170 String getComment ();
175 * @param comment Comments
177 void setComment (final String comment);
180 * Getter for country instance
182 * @return Country instance
184 Country getCountry ();
187 * Setter for country instance
189 * @param country Country instance
191 void setCountry (final Country country);
194 * Getter for email address
196 * @return Email address
198 String getEmailAddress ();
201 * Setter for email address
203 * @param emailAddress Email address
205 void setEmailAddress (final String emailAddress);
208 * Getter for email address, repeated
210 * @return the emailAddress, repeated
212 String getEmailAddressRepeat ();
215 * Setter for email address repeated
217 * @param emailAddressRepeat the emailAddress to set
219 void setEmailAddressRepeat (final String emailAddressRepeat);
224 * @return the familyName
226 String getFamilyName ();
231 * @param familyName the familyName to set
233 void setFamilyName (final String familyName);
236 * Getter for fax number's area code
238 * @return Fax number's area code
240 Integer getFaxAreaCode ();
243 * Setter for fax number's area code
245 * @param faxAreaCode Fax number's area code
247 void setFaxAreaCode (final Integer faxAreaCode);
250 * Getter for fax's country instance
252 * @return Fax' country instance
254 Country getFaxCountry ();
257 * Setter for fax's country instance
259 * @param faxCountry Fax' country instance
261 void setFaxCountry (final Country faxCountry);
264 * Getter for fax number
268 Long getFaxNumber ();
271 * Setter for fax number
273 * @param faxNumber Fax number
275 void setFaxNumber (final Long faxNumber);
280 * @return the first name
282 String getFirstName ();
287 * @param firstName the first name to set
289 void setFirstName (final String firstName);
292 * Gender of the contact
299 * Gender of the contact
301 * @param gender the gender to set
303 void setGender (final Gender gender);
308 * @return the houseNumber
310 Short getHouseNumber ();
315 * @param houseNumber the houseNumber to set
317 void setHouseNumber (final Short houseNumber);
320 * Getter for phone number's area code
322 * @return Phone number's area code
324 Integer getPhoneAreaCode ();
327 * Setter for phone number's area code
329 * @param phoneAreaCode Phone number's area code
331 void setPhoneAreaCode (final Integer phoneAreaCode);
334 * Getter for phone number's country instance
336 * @return Phone number's country instance
338 Country getPhoneCountry ();
341 * Setter for phone number's country instance
343 * @param phoneCountry Phone number's country instance
345 void setPhoneCountry (final Country phoneCountry);
348 * Getter for phone number
350 * @return Phone number
352 Long getPhoneNumber ();
355 * Setter for phone number
357 * @param phoneNumber Phone number
359 void setPhoneNumber (final Long phoneNumber);
371 * @param street the street to set
373 void setStreet (final String street);
378 * @return the zipCode
380 Integer getZipCode ();
385 * @param zipCode the zipCode to set
387 void setZipCode (final Integer zipCode);
390 * Checks whether contact instance's email address is used
392 * @param contact Contact instance's email address to check
394 * @return Whether it is already used
396 boolean isEmailAddressRegistered (final Contact contact);
399 * Checks whether all required personal data is set
401 * @return Whether the required personal data is set
403 boolean isRequiredPersonalDataSet ();
406 * Checks whether all required personal data is set for changing them
408 * @return Whether the required personal data is set
410 boolean isRequiredChangePersonalDataSet ();
413 * Checks whether same email addresses have been entered
415 * @return Whether same email addresses have been entered
417 boolean isSameEmailAddressEntered ();
420 * Changes logged-in user's personal data if the current password matches
421 * and TAC + privacy statement has been accepted.
423 * @return New target page
425 String doChangePersonalContactData ();