2 * Copyright (C) 2016 - 2022 Free Software Foundation
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.phone;
19 import java.text.MessageFormat;
20 import java.util.Date;
22 import javax.enterprise.context.RequestScoped;
23 import javax.enterprise.event.Event;
24 import javax.enterprise.event.Observes;
25 import javax.enterprise.inject.Any;
26 import javax.faces.application.FacesMessage;
27 import javax.inject.Inject;
28 import javax.inject.Named;
29 import org.mxchange.addressbook.beans.BaseAddressbookBean;
30 import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
31 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
32 import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
33 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
34 import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
35 import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
36 import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
37 import org.mxchange.jcontacts.events.fax.unlinked.AdminUnlinkedFaxNumberEvent;
38 import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
39 import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEvent;
40 import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
41 import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumberEvent;
42 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
43 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
44 import org.mxchange.jcontacts.model.contact.Contact;
45 import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
46 import org.mxchange.jcountry.model.data.Country;
47 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
48 import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
49 import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
50 import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
51 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
52 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
53 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
54 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
55 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
58 * An administrative contact phone controller (bean)
60 * @author Roland Häder<roland@mxchange.org>
62 @Named ("adminContactPhoneController")
64 public class AddressbookAdminContactPhoneWebRequestBean extends BaseAddressbookBean implements AddressbookAdminContactPhoneWebRequestController {
67 * Call-stack instance (5 may show BeanELResolver.getValue as caller)
69 private static final short THREAD_STACK = 5;
74 private static final long serialVersionUID = 542_145_354_001L;
77 * Administrative EJB for phone number
79 @EJB (lookup = "java:global/addressbook-ejb/adminContactPhone!org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote")
80 private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
83 * Event being fired when a fax number has been linked
87 private Event<ObservableAdminLinkedFaxNumberEvent> adminLinkedFaxNumberEvent;
90 * Event being fired when a land-line number has been linked
94 private Event<ObservableAdminLinkedLandLineNumberEvent> adminLinkedLandLineNumberEvent;
97 * Administrative phone controller
100 private AddressbookAdminPhoneWebRequestController adminPhoneController;
105 private Contact contact;
108 * Area code (city dial prefix) for fax number
110 private Integer faxAreaCode;
113 * Country (for dial prefix) for fax number
115 private Country faxCountry;
120 private Long faxNumber;
123 * Event being fired when a fax number has been unlinked
127 private Event<ObservableAdminUnlinkedFaxNumberEvent> faxNumberUnlinkedEvent;
130 * Area code (city dial prefix) for land-line number
132 private Integer landLineAreaCode;
135 * Country (for dial prefix) for land-line number
137 private Country landLineCountry;
142 private Long landLineNumber;
145 * Event being fired when a land-line number has been unlinked
149 private Event<ObservableAdminUnlinkedLandLineNumberEvent> landLineNumberUnlinkedEvent;
152 * When phone number has been created
154 private Date phoneEntryCreated;
157 * When phone number has been updated
159 private Date phoneEntryUpdated;
162 * Phone id (primary key)
164 private Long phoneId;
167 * Default constructor
169 public AddressbookAdminContactPhoneWebRequestBean () {
170 // Call super constructor
173 // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
174 // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
178 * Observes events being fired when an administrator has added a new
181 * @param event Event being fired
183 public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
184 // The event must be valid
187 throw new NullPointerException("event is null"); //NOI18N
188 } else if (event.getAddedContact() == null) {
190 throw new NullPointerException("event.addedContact is null"); //NOI18N
191 } else if (event.getAddedContact().getContactId() == null) {
193 throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
194 } else if (event.getAddedContact().getContactId() < 1) {
196 throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
204 * Event observer for newly added users by administrator
206 * @param event Event being fired
208 public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
209 // Event and contained entity instance should not be null
212 throw new NullPointerException("event is null"); //NOI18N
213 } else if (event.getAddedUser() == null) {
215 throw new NullPointerException("event.addedUser is null"); //NOI18N
216 } else if (event.getAddedUser().getUserId() == null) {
218 throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
219 } else if (event.getAddedUser().getUserId() < 1) {
221 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
229 * Event observer for updated contact data by administrators
231 * @param event Updated contact data event
233 public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
234 // Event and contained entity instance should not be null
237 throw new NullPointerException("event is null"); //NOI18N
238 } else if (event.getUpdatedContact() == null) {
240 throw new NullPointerException("event.updatedContact is null"); //NOI18N
241 } else if (event.getUpdatedContact().getContactId() == null) {
243 throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
244 } else if (event.getUpdatedContact().getContactId() < 1) {
246 throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
254 * Observer for events being fired when a bean helper has successfully
255 * created a contact instance.
257 * @param event Event being fired
259 public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) {
261 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N
263 // The event instance must be valid
266 throw new NullPointerException("event is null"); //NOI18N
267 } else if (event.getCreatedContact() == null) {
269 throw new NullPointerException("event.createdContact is null"); //NOI18N
270 } else if (event.getCreatedContact().getContactId() == null) {
272 throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N
273 } else if (event.getCreatedContact().getContactId() < 1) {
275 throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
279 this.setContact(event.getCreatedContact());
283 * Observes events being fired when a bean helper has successfully created a
284 * fax number instance.
286 * @param event Event being fired
288 public void afterCreatedFaxNumberEvent (@Observes final ObservableCreatedFaxNumberEvent event) {
289 // The event instance must be valid
292 throw new NullPointerException("event is null"); //NOI18N
293 } else if (event.getFaxNumber() == null) {
295 throw new NullPointerException("event.faxNumber is null"); //NOI18N
296 } else if (event.getFaxNumber().getPhoneId() == null) {
297 // Throw NPE yet again
298 throw new NullPointerException("event.faxNumber.phoneId is null"); //NOI18N
299 } else if (event.getFaxNumber().getPhoneId() < 1) {
300 // Throw NPE yet again
301 throw new NullPointerException(MessageFormat.format("event.faxNumber.phoneId={0} is invalid", event.getFaxNumber().getPhoneId())); //NOI18N
304 // Get fax number from event
305 final DialableFaxNumber number = event.getFaxNumber();
307 // Copy all data to this bean
308 this.setPhoneId(number.getPhoneId());
309 this.setFaxCountry(number.getPhoneCountry());
310 this.setFaxAreaCode(number.getPhoneAreaCode());
311 this.setFaxNumber(number.getPhoneNumber());
312 this.setPhoneEntryCreated(number.getPhoneEntryCreated());
313 this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
317 * Observes events being fired when a bean helper has successfully created a
318 * land-line number instance.
320 * @param event Event being fired
322 public void afterCreatedLandLineNumberEvent (@Observes final ObservableCreatedLandLineNumberEvent event) {
323 // The event instance must be valid
326 throw new NullPointerException("event is null"); //NOI18N
327 } else if (event.getLandLineNumber() == null) {
329 throw new NullPointerException("event.landLineNumber is null"); //NOI18N
330 } else if (event.getLandLineNumber().getPhoneId() == null) {
331 // Throw NPE yet again
332 throw new NullPointerException("event.landLineNumber.phoneId is null"); //NOI18N
333 } else if (event.getLandLineNumber().getPhoneId() < 1) {
334 // Throw NPE yet again
335 throw new NullPointerException(MessageFormat.format("event.landLineNumber.phoneId={0} is invalid", event.getLandLineNumber().getPhoneId())); //NOI18N
338 // Get fax number from event
339 final DialableLandLineNumber number = event.getLandLineNumber();
341 // Copy all data to this bean
342 this.setPhoneId(number.getPhoneId());
343 this.setLandLineCountry(number.getPhoneCountry());
344 this.setLandLineAreaCode(number.getPhoneAreaCode());
345 this.setLandLineNumber(number.getPhoneNumber());
346 this.setPhoneEntryCreated(number.getPhoneEntryCreated());
347 this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
351 * Event observer for updated contact data by the user
353 * @param event Updated contact data event
355 public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
356 // Event and contained entity instance should not be null
359 throw new NullPointerException("event is null"); //NOI18N
360 } else if (event.getUpdatedContact() == null) {
362 throw new NullPointerException("event.updatedContact is null"); //NOI18N
363 } else if (event.getUpdatedContact().getContactId() == null) {
365 throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
366 } else if (event.getUpdatedContact().getContactId() < 1) {
368 throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
376 * Links fax number to contact from bean helper as "main fax number".
378 * @return Redirect outcome
380 public String doLinkMainFaxNumber () {
381 // Get contact from helper
382 final Contact targetContact = this.getContact();
384 // Is all data properly set?
385 if (null == targetContact) {
387 throw new NullPointerException("targetContact is null"); //NOI18N
388 } else if (targetContact.getContactId() == null) {
390 throw new NullPointerException("targetContact.contactId is null"); //NOI18N
391 } else if (targetContact.getContactId() < 1) {
393 throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
394 } else if (this.getFaxCountry() == null) {
396 throw new NullPointerException("this.faxCountry is null"); //NOI18N
397 } else if (this.getFaxCountry().getCountryId() == null) {
399 throw new NullPointerException("this.faxCountry.countryId is null"); //NOI18N
400 } else if (this.getFaxCountry().getCountryId() < 1) {
402 throw new IllegalArgumentException(MessageFormat.format("this.faxCountry.countryId={0} is not valid.", this.getFaxCountry().getCountryId())); //NOI18N
403 } else if (this.getFaxAreaCode() == null) {
405 throw new NullPointerException("this.faxAreaCode is null"); //NOI18N
406 } else if (this.getFaxAreaCode() < 1) {
408 throw new IllegalArgumentException(MessageFormat.format("this.faxAreaCode={0} is invalid", this.getFaxAreaCode())); //NOI18N
409 } else if (this.getFaxNumber() == null) {
411 throw new NullPointerException("this.faxNumber is null"); //NOI18N
412 } else if (this.getFaxNumber() < 1) {
414 throw new IllegalArgumentException(MessageFormat.format("this.faxNumber={0} is invalid", this.getFaxNumber())); //NOI18N
418 final Contact updatedContact;
419 final DialableFaxNumber number = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
424 updatedContact = this.adminContactPhoneBean.linkNewFaxNumberWithContact(targetContact, number);
425 } catch (final PhoneNumberAlreadyLinkedException | ContactNotFoundException ex) {
426 // Throw again as cause
427 this.showFacesMessage("form_add_contact_fax:faxNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
432 this.adminLinkedFaxNumberEvent.fire(new AdminLinkedFaxNumberEvent(updatedContact, number));
434 // Return to contact profile
435 return "admin_show_contact"; //NOI18N
439 * Links land-line number to contact from bean helper as "main land-line
442 * @return Redirect outcome
444 public String doLinkMainLandLineNumber () {
445 // Get contact from helper
446 final Contact targetContact = this.getContact();
448 // Is all data properly set?
449 if (null == targetContact) {
451 throw new NullPointerException("targetContact is null"); //NOI18N
452 } else if (targetContact.getContactId() == null) {
454 throw new NullPointerException("targetContact.contactId is null"); //NOI18N
455 } else if (targetContact.getContactId() < 1) {
457 throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
458 } else if (this.getLandLineCountry() == null) {
460 throw new NullPointerException("this.landLineCountry is null"); //NOI18N
461 } else if (this.getLandLineCountry().getCountryId() == null) {
463 throw new NullPointerException("this.landLineCountry.countryId is null"); //NOI18N
464 } else if (this.getLandLineCountry().getCountryId() < 1) {
466 throw new IllegalArgumentException(MessageFormat.format("this.landLineCountry.countryId={0} is not valid.", this.getLandLineCountry().getCountryId())); //NOI18N
467 } else if (this.getLandLineAreaCode() == null) {
469 throw new NullPointerException("this.landLineAreaCode is null"); //NOI18N
470 } else if (this.getLandLineAreaCode() < 1) {
472 throw new IllegalArgumentException(MessageFormat.format("this.landLineAreaCode={0} is invalid", this.getLandLineAreaCode())); //NOI18N
473 } else if (this.getLandLineNumber() == null) {
475 throw new NullPointerException("this.landLineNumber is null"); //NOI18N
476 } else if (this.getLandLineNumber() < 1) {
478 throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber={0} is invalid", this.getLandLineNumber())); //NOI18N
482 final Contact updatedContact;
483 final DialableLandLineNumber number = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
488 updatedContact = this.adminContactPhoneBean.linkNewLandLineNumberWithContact(targetContact, number);
489 } catch (final PhoneNumberAlreadyLinkedException | ContactNotFoundException ex) {
490 // Throw again as cause
491 this.showFacesMessage("form_add_contact_landLine:landLineNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
496 this.adminLinkedLandLineNumberEvent.fire(new AdminLinkedLandLineNumberEvent(updatedContact, number));
498 // Return to contact profile
499 return "admin_show_contact"; //NOI18N
503 * Getter for contact instance
505 * @return Contact instance
507 public Contact getContact () {
512 * Setter for contact instance
514 * @param contact Contact instance
516 public void setContact (final Contact contact) {
517 this.contact = contact;
521 * Getter for fax area code
523 * @return Fax area code
525 public Integer getFaxAreaCode () {
526 return this.faxAreaCode;
530 * Setter for fax area code
532 * @param faxAreaCode Fax area code
534 public void setFaxAreaCode (final Integer faxAreaCode) {
535 this.faxAreaCode = faxAreaCode;
539 * Getter for fax numbers country
541 * @return Fax numbers country
543 public Country getFaxCountry () {
544 return this.faxCountry;
548 * Setter for fax numbers country
550 * @param faxCountry Fax numbers country
552 public void setFaxCountry (final Country faxCountry) {
553 this.faxCountry = faxCountry;
557 * Getter for fax number
561 public Long getFaxNumber () {
562 return this.faxNumber;
566 * Setter for fax number
568 * @param faxNumber Fax number
570 public void setFaxNumber (final Long faxNumber) {
571 this.faxNumber = faxNumber;
575 * Getter for land-line area code
577 * @return Land-line area code
579 public Integer getLandLineAreaCode () {
580 return this.landLineAreaCode;
584 * Setter for land-line area code
586 * @param landLineAreaCode Land-line area code
588 public void setLandLineAreaCode (final Integer landLineAreaCode) {
589 this.landLineAreaCode = landLineAreaCode;
593 * Getter for land-line country
595 * @return Land-line country
597 public Country getLandLineCountry () {
598 return this.landLineCountry;
602 * Setter for land-line country
604 * @param landLineCountry Land-line country
606 public void setLandLineCountry (final Country landLineCountry) {
607 this.landLineCountry = landLineCountry;
611 * Getter for land-line number
613 * @return Land-line number
615 public Long getLandLineNumber () {
616 return this.landLineNumber;
620 * Setter for land-line number
622 * @param landLineNumber Land-line number
624 public void setLandLineNumber (final Long landLineNumber) {
625 this.landLineNumber = landLineNumber;
629 * Setter for phone id
633 public Long getPhoneId () {
638 * Getter for phone id
640 * @param phoneId Phone id
642 public void setPhoneId (final Long phoneId) {
643 this.phoneId = phoneId;
647 * Unlinks fax data with current contact
649 * @return Redirect outcome
651 public String unlinkFaxContactData () {
652 // Create fax number instance
653 final DialableFaxNumber number = this.createFaxNumber();
656 if (number == null) {
657 // Not set, throw NPE
658 throw new NullPointerException("number is null"); //NOI18N
659 } else if (number.getPhoneId() == null) {
661 throw new NullPointerException("number.phoneId is null"); //NOI18N
662 } else if (number.getPhoneId() < 1) {
664 throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
665 } else if (number.getPhoneNumber() == null) {
667 throw new NullPointerException("number.phoneNumber is null"); //NOI18N
668 } else if (number.getPhoneNumber() < 1) {
669 // Throw it again ...
670 throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
671 } else if (this.getContact() == null) {
672 // ... and throw again
673 throw new NullPointerException("this.contact is null"); //NOI18N
674 } else if (this.getContact().getContactId() == null) {
676 throw new NullPointerException("this.contact.contactId is null"); //NOI18N
677 } else if (this.getContact().getContactId() < 1) {
679 throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
682 // Init contact instance
683 final Contact updatedContact;
686 // Unlink it and return contact without fax instance
687 updatedContact = this.adminContactPhoneBean.unlinkFaxDataFromContact(this.getContact(), number);
688 } catch (final PhoneNumberNotLinkedException | ContactNotFoundException ex) {
690 this.showFacesMessage("form_unlink_contact_fax:faxNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
695 this.faxNumberUnlinkedEvent.fire(new AdminUnlinkedFaxNumberEvent(updatedContact, number));
698 return "admin_show_contact"; //NOI18N
702 * Unlinks land-line data with current contact
704 * @return Redirect outcome
706 public String unlinkLandLineContactData () {
707 // Create fax number instance
708 final DialableLandLineNumber number = this.createLandLineNumber();
711 if (number == null) {
712 // Not set, throw NPE
713 throw new NullPointerException("number is null"); //NOI18N
714 } else if (number.getPhoneId() == null) {
716 throw new NullPointerException("number.phoneId is null"); //NOI18N
717 } else if (number.getPhoneId() < 1) {
719 throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
720 } else if (number.getPhoneNumber() == null) {
722 throw new NullPointerException("number.phoneNumber is null"); //NOI18N
723 } else if (number.getPhoneNumber() < 1) {
724 // Throw it again ...
725 throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
726 } else if (this.getContact() == null) {
727 // ... and throw again
728 throw new NullPointerException("this.contact is null"); //NOI18N
729 } else if (this.getContact().getContactId() == null) {
731 throw new NullPointerException("this.contact.contactId is null"); //NOI18N
732 } else if (this.getContact().getContactId() < 1) {
734 throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
737 // Init contact instance
738 final Contact updatedContact;
741 // Unlink it and return contact without landLine instance
742 updatedContact = this.adminContactPhoneBean.unlinkLandLineDataFromContact(this.getContact(), number);
743 } catch (final PhoneNumberNotLinkedException | ContactNotFoundException ex) {
745 this.showFacesMessage("form_unlink_contact_landLine:landLineNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
750 this.landLineNumberUnlinkedEvent.fire(new AdminUnlinkedLandLineNumberEvent(updatedContact, number));
753 return "admin_show_contact"; //NOI18N
759 private void clear () {
764 * Creates an instance of a DialableFaxNumber class
766 * @return DialableFaxNumber class
768 private DialableFaxNumber createFaxNumber () {
770 final DialableFaxNumber number = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
772 // Set all other fields
773 number.setPhoneEntryCreated(this.getPhoneEntryCreated());
774 number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
775 number.setPhoneId(this.getPhoneId());
782 * Returns an instance of a DialableLandLineNumber from all fields stored in
785 * @return An instance of a DialableLandLineNumber class
787 private DialableLandLineNumber createLandLineNumber () {
789 final DialableLandLineNumber number = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
791 // Add all other data
792 number.setPhoneEntryCreated(this.getPhoneEntryCreated());
793 number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
794 number.setPhoneId(this.getPhoneId());
801 * Getter for phone entry created
803 * @return Phone entry created
805 @SuppressWarnings ("ReturnOfDateField")
806 private Date getPhoneEntryCreated () {
807 return this.phoneEntryCreated;
811 * Setter for phone entry created
813 * @param phoneEntryCreated Phone entry created
815 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
816 private void setPhoneEntryCreated (final Date phoneEntryCreated) {
817 this.phoneEntryCreated = phoneEntryCreated;
821 * Getter for phone entry updated
823 * @return Phone entry updated
825 @SuppressWarnings ("ReturnOfDateField")
826 private Date getPhoneEntryUpdated () {
827 return this.phoneEntryUpdated;
831 * Setter for phone entry updated
833 * @param phoneEntryUpdated Phone entry updated
835 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
836 private void setPhoneEntryUpdated (final Date phoneEntryUpdated) {
837 this.phoneEntryUpdated = phoneEntryUpdated;