]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionController.java
Continued with rewrite: (please cherry-pick)
[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 javax.ejb.Local;
23 import org.mxchange.jcontacts.contact.Contact;
24 import org.mxchange.jcontacts.contact.gender.Gender;
25 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
26 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
27 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
28 import org.mxchange.jcountry.data.Country;
29 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
30 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
31 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
32 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
33 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
34 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
35
36 /**
37  * An interface for user beans
38  * <p>
39  * @author Roland Haeder<roland@mxchange.org>
40  */
41 @Local
42 public interface JobsContactWebSessionController extends Serializable {
43
44         /**
45          * Minimum password length
46          */
47         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
48
49         /**
50          * Returns a list of all found contacts
51          * <p>
52          * @return A list of all contacts.
53          */
54         List<Contact> allContacts ();
55
56         /**
57          * Getter for all contacts having current cellphone instance linked
58          * <p>
59          * @return List of all linked contacts
60          */
61         List<Contact> allCellphoneContacts ();
62
63         /**
64          * Checks whether there are contacts.
65          * <p>
66          * @return Whether contacts are there
67          */
68         boolean hasContacts ();
69
70         /**
71          * Event observer for newly added users by adminstrator
72          * <p>
73          * @param event Event being fired
74          */
75         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
76
77         /**
78          * Event observer when user confirmed account.
79          * <p>
80          * @param event Event being fired
81          */
82         void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
83
84         /**
85          * Updates all data from bean in given contact instance
86          * <p>
87          * @param userContact Contact instance to update
88          */
89         void updateContactDataFromController (final Contact userContact);
90
91         /**
92          * Tries to lookup contact by given id number. If the user is not found a
93          * proper exceptions are thrown.
94          * <p>
95          * @param contactId Contact id
96          * <p>
97          * @return Contact instance
98          * <p>
99          * @throws ContactNotFoundException If the user is not found
100          */
101         Contact lookupContactById (final Long contactId) throws ContactNotFoundException;
102
103         /**
104          * Event observer for new user registrations
105          * <p>
106          * @param event User registration event
107          */
108         void afterRegistrationEvent (final UserRegisteredEvent event);
109
110         /**
111          * Observes events being fired when an administrator has added a new
112          * contact.
113          * <p>
114          * @param event Event being fired
115          */
116         void afterAdminAddedContact (final AdminAddedContactEvent event);
117
118         /**
119          * Observes events being fired when an administrator has linked a new user
120          * with existing contact data.
121          * <p>
122          * @param event Event being fired
123          */
124         void afterAdminLinkedUser (final AdminLinkedUserEvent event);
125
126         /**
127          * Event observer for updated contact data by administrators
128          * <p>
129          * @param event Updated contact data event
130          */
131         void afterAdminUpdatedContactDataEvent (final AdminUpdatedContactEvent event);
132
133         /**
134          * Event observer for logged-in user
135          * <p>
136          * @param event Event instance
137          */
138         void afterUserLogin (final UserLoggedInEvent event);
139
140         /**
141          * Creates an instance from all properties
142          * <p>
143          * @return A contact instance
144          */
145         Contact createContactInstance ();
146
147         /**
148          * Getter for birth day
149          * <p>
150          * @return Birth day
151          */
152         Date getBirthday ();
153
154         /**
155          * Setter for birth day
156          * <p>
157          * @param birthday Birth day
158          */
159         void setBirthday (final Date birthday);
160
161         /**
162          * Getter for ellphone number's carrier
163          * <p>
164          * @return Cellphone number's carrier
165          */
166         MobileProvider getCellphoneCarrier ();
167
168         /**
169          * Setter for cellphone number's carrier prefix
170          * <p>
171          * @param cellphoneCarrier Cellphone number's carrier prefix
172          */
173         void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
174
175         /**
176          * Getter for ellphone number
177          * <p>
178          * @return Cellphone number
179          */
180         Long getCellphoneNumber ();
181
182         /**
183          * Setter for ellphone number
184          * <p>
185          * @param cellphoneNumber Cellphone number
186          */
187         void setCellphoneNumber (final Long cellphoneNumber);
188
189         /**
190          * City
191          * <p>
192          * @return the city
193          */
194         String getCity ();
195
196         /**
197          * City
198          * <p>
199          * @param city the city to set
200          */
201         void setCity (final String city);
202
203         /**
204          * Getter for comments
205          * <p>
206          * @return Comments
207          */
208         String getComment ();
209
210         /**
211          * Setter for comment
212          * <p>
213          * @param comment Comments
214          */
215         void setComment (final String comment);
216
217         /**
218          * Getter for country instance
219          * <p>
220          * @return Country instance
221          */
222         Country getCountry ();
223
224         /**
225          * Setter for country instance
226          * <p>
227          * @param country Country instance
228          */
229         void setCountry (final Country country);
230
231         /**
232          * Getter for email address
233          * <p>
234          * @return Email address
235          */
236         String getEmailAddress ();
237
238         /**
239          * Setter for email address
240          * <p>
241          * @param emailAddress Email address
242          */
243         void setEmailAddress (final String emailAddress);
244
245         /**
246          * Getter for email address, repeated
247          * <p>
248          * @return the emailAddress, repeated
249          */
250         String getEmailAddressRepeat ();
251
252         /**
253          * Setter for email address repeated
254          * <p>
255          * @param emailAddressRepeat the emailAddress to set
256          */
257         void setEmailAddressRepeat (final String emailAddressRepeat);
258
259         /**
260          * Family name
261          * <p>
262          * @return the familyName
263          */
264         String getFamilyName ();
265
266         /**
267          * Family name
268          * <p>
269          * @param familyName the familyName to set
270          */
271         void setFamilyName (final String familyName);
272
273         /**
274          * Getter for fax number's area code
275          * <p>
276          * @return Fax number's area code
277          */
278         Integer getFaxAreaCode ();
279
280         /**
281          * Setter for fax number's area code
282          * <p>
283          * @param faxAreaCode Fax number's area code
284          */
285         void setFaxAreaCode (final Integer faxAreaCode);
286
287         /**
288          * Getter for fax's country instance
289          * <p>
290          * @return Fax' country instance
291          */
292         Country getFaxCountry ();
293
294         /**
295          * Setter for fax's country instance
296          * <p>
297          * @param faxCountry Fax' country instance
298          */
299         void setFaxCountry (final Country faxCountry);
300
301         /**
302          * Getter for fax number
303          * <p>
304          * @return Fax number
305          */
306         Long getFaxNumber ();
307
308         /**
309          * Setter for fax number
310          * <p>
311          * @param faxNumber Fax number
312          */
313         void setFaxNumber (final Long faxNumber);
314
315         /**
316          * First name
317          * <p>
318          * @return the first name
319          */
320         String getFirstName ();
321
322         /**
323          * First name
324          * <p>
325          * @param firstName the first name to set
326          */
327         void setFirstName (final String firstName);
328
329         /**
330          * Gender of the contact
331          * <p>
332          * @return the gender
333          */
334         Gender getGender ();
335
336         /**
337          * Gender of the contact
338          * <p>
339          * @param gender the gender to set
340          */
341         void setGender (final Gender gender);
342
343         /**
344          * House number
345          * <p>
346          * @return the houseNumber
347          */
348         Short getHouseNumber ();
349
350         /**
351          * House number
352          * <p>
353          * @param houseNumber the houseNumber to set
354          */
355         void setHouseNumber (final Short houseNumber);
356
357         /**
358          * Getter for house number extension, example: 123a 'a' is then the
359          * extension and 123 is the house number.
360          * <p>
361          * @return House number extension
362          */
363         String getHouseNumberExtension ();
364
365         /**
366          * Setter for house number extension
367          * <p>
368          * @param houseNumberExtension House number extension
369          */
370         void setHouseNumberExtension (final String houseNumberExtension);
371
372         /**
373          * Getter for phone number's area code
374          * <p>
375          * @return Phone number's area code
376          */
377         Integer getPhoneAreaCode ();
378
379         /**
380          * Setter for phone number's area code
381          * <p>
382          * @param phoneAreaCode Phone number's area code
383          */
384         void setPhoneAreaCode (final Integer phoneAreaCode);
385
386         /**
387          * Getter for phone number's country instance
388          * <p>
389          * @return Phone number's country instance
390          */
391         Country getPhoneCountry ();
392
393         /**
394          * Setter for phone number's country instance
395          * <p>
396          * @param phoneCountry Phone number's country instance
397          */
398         void setPhoneCountry (final Country phoneCountry);
399
400         /**
401          * Getter for phone number
402          * <p>
403          * @return Phone number
404          */
405         Long getPhoneNumber ();
406
407         /**
408          * Setter for phone number
409          * <p>
410          * @param phoneNumber Phone number
411          */
412         void setPhoneNumber (final Long phoneNumber);
413
414         /**
415          * Street
416          * <p>
417          * @return the street
418          */
419         String getStreet ();
420
421         /**
422          * Street
423          * <p>
424          * @param street the street to set
425          */
426         void setStreet (final String street);
427
428         /**
429          * Titöe
430          * <p>
431          * @return the title
432          */
433         String getTitle ();
434
435         /**
436          * Title
437          * <p>
438          * @param title the title to set
439          */
440         void setTitle (final String title);
441
442         /**
443          * ZIP code
444          * <p>
445          * @return the zipCode
446          */
447         Integer getZipCode ();
448
449         /**
450          * ZIP code
451          * <p>
452          * @param zipCode the zipCode to set
453          */
454         void setZipCode (final Integer zipCode);
455
456         /**
457          * Getter for controller type
458          * <p>
459          * @return controller type
460          */
461         String getControllerType ();
462
463         /**
464          * Setter for controller type
465          * <p>
466          * @param controllerType Controller type
467          * @deprecated Don't use this method.
468          */
469         @Deprecated
470         void setControllerType (final String controllerType);
471
472         /**
473          * Checks whether contact instance's email address is used
474          * <p>
475          * @param contact Contact instance's email address to check
476          * <p>
477          * @return Whether it is already used
478          */
479         boolean isEmailAddressRegistered (final Contact contact);
480
481         /**
482          * Checks whether all required personal data is set
483          * <p>
484          * @return Whether the required personal data is set
485          */
486         boolean isRequiredPersonalDataSet ();
487
488         /**
489          * Checks whether all required personal data is set for changing them
490          * <p>
491          * @return Whether the required personal data is set
492          */
493         boolean isRequiredChangePersonalDataSet ();
494
495         /**
496          * Checks whether same email addresses have been entered
497          * <p>
498          * @return Whether same email addresses have been entered
499          */
500         boolean isSameEmailAddressEntered ();
501
502         /**
503          * Changes logged-in user's personal data if the current password matches
504          * and TAC + privacy statement has been accepted.
505          * <p>
506          * @return New target page
507          */
508         String doChangePersonalContactData ();
509
510         /**
511          * Returns a list of all selectable contacts for user creation. Contacts
512          * from already existing users are excluded in this list.
513          * <p>
514          * @return A list of all selectable contacts
515          */
516         List<Contact> selectableContacts ();
517
518 }