]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionController.java
garr, again localContact was returned empty because of confusion ... :-( Please cherr...
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / contact / JobsContactWebSessionController.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.jjobs.beans.contact;
18
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;
32
33 /**
34  * An interface for user beans
35  * <p>
36  * @author Roland Haeder<roland@mxchange.org>
37  */
38 public interface JobsContactWebSessionController extends Serializable {
39
40         /**
41          * Minimum password length
42          */
43         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
44
45         /**
46          * Returns a list of all found contacts
47          * <p>
48          * @return A list of all contacts.
49          */
50         List<Contact> allContacts();
51
52         /**
53          * Checks whether there are contacts.
54          * <p>
55          * @return Whether contacts are there
56          */
57         boolean hasContacts ();
58
59         /**
60          * Event observer for newly added users by adminstrator
61          * <p>
62          * @param event Event being fired
63          */
64         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
65
66         /**
67          * Updates all data from bean in given contact instance
68          * <p>
69          * @param userContact Contact instance to update
70          */
71         void updateContactDataFromController (final Contact userContact);
72
73         /**
74          * Tries to lookup contact by given id number. If the user is not found a
75          * proper exceptions are thrown.
76          * <p>
77          * @param contactId Contact id
78          * <p>
79          * @return Contact instance
80          * <p>
81          * @throws ContactNotFoundException If the user is not found
82          */
83         Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
84
85         /**
86          * Event observer for new user registrations
87          * <p>
88          * @param event User registration event
89          */
90         void afterRegistrationEvent (final UserRegisteredEvent event);
91
92         /**
93          * Observes events being fired when an administrator has added a new
94          * contact.
95          * <p>
96          * @param event Event being fired
97          */
98         void afterAdminAddedContact (final AdminAddedContactEvent event);
99
100         /**
101          * Event observer for updated contact data by admins
102          * <p>
103          * @param event Updated contact data event
104          */
105         void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
106
107         /**
108          * Event observer for logged-in user
109          * <p>
110          * @param event Event instance
111          */
112         void afterUserLogin (final UserLoggedInEvent event);
113
114         /**
115          * Creates an instance from all properties
116          * <p>
117          * @return A contact instance
118          */
119         Contact createContactInstance ();
120
121         /**
122          * Getter for birth day
123          * <p>
124          * @return Birth day
125          */
126         Date getBirthday ();
127
128         /**
129          * Setter for birth day
130          * <p>
131          * @param birthday Birth day
132          */
133         void setBirthday (final Date birthday);
134
135         /**
136          * Getter for ellphone number's carrier
137          * <p>
138          * @return Cellphone number's carrier
139          */
140         MobileProvider getCellphoneCarrier ();
141
142         /**
143          * Setter for cellphone number's carrier prefix
144          * <p>
145          * @param cellphoneCarrier Cellphone number's carrier prefix
146          */
147         void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
148
149         /**
150          * Getter for ellphone number
151          * <p>
152          * @return Cellphone number
153          */
154         Long getCellphoneNumber ();
155
156         /**
157          * Setter for ellphone number
158          * <p>
159          * @param cellphoneNumber Cellphone number
160          */
161         void setCellphoneNumber (final Long cellphoneNumber);
162
163         /**
164          * City
165          * <p>
166          * @return the city
167          */
168         String getCity ();
169
170         /**
171          * City
172          * <p>
173          * @param city the city to set
174          */
175         void setCity (final String city);
176
177         /**
178          * Getter for comments
179          * <p>
180          * @return Comments
181          */
182         String getComment ();
183
184         /**
185          * Setter for comment
186          * <p>
187          * @param comment Comments
188          */
189         void setComment (final String comment);
190
191         /**
192          * Getter for country instance
193          * <p>
194          * @return Country instance
195          */
196         Country getCountry ();
197
198         /**
199          * Setter for country instance
200          * <p>
201          * @param country Country instance
202          */
203         void setCountry (final Country country);
204
205         /**
206          * Getter for email address
207          * <p>
208          * @return Email address
209          */
210         String getEmailAddress ();
211
212         /**
213          * Setter for email address
214          * <p>
215          * @param emailAddress Email address
216          */
217         void setEmailAddress (final String emailAddress);
218
219         /**
220          * Getter for email address, repeated
221          * <p>
222          * @return the emailAddress, repeated
223          */
224         String getEmailAddressRepeat ();
225
226         /**
227          * Setter for email address repeated
228          * <p>
229          * @param emailAddressRepeat the emailAddress to set
230          */
231         void setEmailAddressRepeat (final String emailAddressRepeat);
232
233         /**
234          * Family name
235          * <p>
236          * @return the familyName
237          */
238         String getFamilyName ();
239
240         /**
241          * Family name
242          * <p>
243          * @param familyName the familyName to set
244          */
245         void setFamilyName (final String familyName);
246
247         /**
248          * Getter for fax number's area code
249          * <p>
250          * @return Fax number's area code
251          */
252         Integer getFaxAreaCode ();
253
254         /**
255          * Setter for fax number's area code
256          * <p>
257          * @param faxAreaCode Fax number's area code
258          */
259         void setFaxAreaCode (final Integer faxAreaCode);
260
261         /**
262          * Getter for fax's country instance
263          * <p>
264          * @return Fax' country instance
265          */
266         Country getFaxCountry ();
267
268         /**
269          * Setter for fax's country instance
270          * <p>
271          * @param faxCountry Fax' country instance
272          */
273         void setFaxCountry (final Country faxCountry);
274
275         /**
276          * Getter for fax number
277          * <p>
278          * @return Fax number
279          */
280         Long getFaxNumber ();
281
282         /**
283          * Setter for fax number
284          * <p>
285          * @param faxNumber Fax number
286          */
287         void setFaxNumber (final Long faxNumber);
288
289         /**
290          * First name
291          * <p>
292          * @return the first name
293          */
294         String getFirstName ();
295
296         /**
297          * First name
298          * <p>
299          * @param firstName the first name to set
300          */
301         void setFirstName (final String firstName);
302
303         /**
304          * Gender of the contact
305          * <p>
306          * @return the gender
307          */
308         Gender getGender ();
309
310         /**
311          * Gender of the contact
312          * <p>
313          * @param gender the gender to set
314          */
315         void setGender (final Gender gender);
316
317         /**
318          * House number
319          * <p>
320          * @return the houseNumber
321          */
322         Short getHouseNumber ();
323
324         /**
325          * House number
326          * <p>
327          * @param houseNumber the houseNumber to set
328          */
329         void setHouseNumber (final Short houseNumber);
330
331         /**
332          * Getter for phone number's area code
333          * <p>
334          * @return Phone number's area code
335          */
336         Integer getPhoneAreaCode ();
337
338         /**
339          * Setter for phone number's area code
340          * <p>
341          * @param phoneAreaCode Phone number's area code
342          */
343         void setPhoneAreaCode (final Integer phoneAreaCode);
344
345         /**
346          * Getter for phone number's country instance
347          * <p>
348          * @return Phone number's country instance
349          */
350         Country getPhoneCountry ();
351
352         /**
353          * Setter for phone number's country instance
354          * <p>
355          * @param phoneCountry Phone number's country instance
356          */
357         void setPhoneCountry (final Country phoneCountry);
358
359         /**
360          * Getter for phone number
361          * <p>
362          * @return Phone number
363          */
364         Long getPhoneNumber ();
365
366         /**
367          * Setter for phone number
368          * <p>
369          * @param phoneNumber Phone number
370          */
371         void setPhoneNumber (final Long phoneNumber);
372
373         /**
374          * Street
375          * <p>
376          * @return the street
377          */
378         String getStreet ();
379
380         /**
381          * Street
382          * <p>
383          * @param street the street to set
384          */
385         void setStreet (final String street);
386
387         /**
388          * ZIP code
389          * <p>
390          * @return the zipCode
391          */
392         Integer getZipCode ();
393
394         /**
395          * ZIP code
396          * <p>
397          * @param zipCode the zipCode to set
398          */
399         void setZipCode (final Integer zipCode);
400
401         /**
402          * Checks whether contact instance's email address is used
403          * <p>
404          * @param contact Contact instance's email address to check
405          * <p>
406          * @return Whether it is already used
407          */
408         boolean isEmailAddressRegistered (final Contact contact);
409
410         /**
411          * Checks whether all required personal data is set
412          * <p>
413          * @return Whether the required personal data is set
414          */
415         boolean isRequiredPersonalDataSet ();
416
417         /**
418          * Checks whether all required personal data is set for changing them
419          * <p>
420          * @return Whether the required personal data is set
421          */
422         boolean isRequiredChangePersonalDataSet ();
423
424         /**
425          * Checks whether same email addresses have been entered
426          * <p>
427          * @return Whether same email addresses have been entered
428          */
429         boolean isSameEmailAddressEntered ();
430
431         /**
432          * Changes logged-in user's personal data if the current password matches
433          * and TAC + privacy statement has been accepted.
434          * <p>
435          * @return New target page
436          */
437         String doChangePersonalContactData ();
438
439 }