]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java
Closed internal TODO: (please cherry-pick this)
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / contact / AddressbookAdminContactWebRequestBean.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.addressbook.beans.contact;
18
19 import java.text.MessageFormat;
20 import java.util.Date;
21 import java.util.Iterator;
22 import javax.annotation.PostConstruct;
23 import javax.enterprise.context.RequestScoped;
24 import javax.enterprise.event.Event;
25 import javax.enterprise.inject.Any;
26 import javax.faces.context.FacesContext;
27 import javax.faces.view.facelets.FaceletException;
28 import javax.inject.Inject;
29 import javax.inject.Named;
30 import javax.naming.Context;
31 import javax.naming.InitialContext;
32 import javax.naming.NamingException;
33 import org.mxchange.addressbook.beans.BaseAddressbookController;
34 import org.mxchange.addressbook.beans.helper.AddressbookWebRequestController;
35 import org.mxchange.jcontacts.contact.Contact;
36 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
37 import org.mxchange.jcontacts.contact.UserContact;
38 import org.mxchange.jcontacts.contact.gender.Gender;
39 import org.mxchange.jcontacts.contact.utils.ContactUtils;
40 import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
41 import org.mxchange.jcontacts.events.contact.add.AdminContactAddedEvent;
42 import org.mxchange.jcontacts.events.contact.update.AdminContactUpdatedEvent;
43 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
44 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
45 import org.mxchange.jcountry.data.Country;
46 import org.mxchange.jphone.phonenumbers.DialableNumber;
47 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
48 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
49 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
50 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
51 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
52 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
53 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
54
55 /**
56  * An administrative user bean (controller)
57  * <p>
58  * @author Roland Haeder<roland@mxchange.org>
59  */
60 @Named ("adminContactController")
61 @RequestScoped
62 public class AddressbookAdminContactWebRequestBean extends BaseAddressbookController implements AddressbookAdminContactWebRequestController {
63
64         /**
65          * Serial number
66          */
67         private static final long serialVersionUID = 542_145_347_916L;
68
69         /**
70          * An event fired when the administrator has added a new contact
71          */
72         @Inject
73         @Any
74         private Event<AdminAddedContactEvent> addedContactEvent;
75
76         /**
77          * Admin helper instance
78          */
79         @Inject
80         private AddressbookWebRequestController beanHelper;
81
82         /**
83          * Birth day
84          */
85         private Date birthday;
86
87         /**
88          * Cellphone number's carrier
89          */
90         private MobileProvider cellphoneCarrier;
91
92         /**
93          * Cellphone id number
94          */
95         private Long cellphoneId;
96
97         /**
98          * Cellphone number
99          */
100         private Long cellphoneNumber;
101
102         /**
103          * City
104          */
105         private String city;
106
107         /**
108          * Optional comments
109          */
110         private String comment;
111
112         /**
113          * Remote contact bean
114          */
115         private final ContactSessionBeanRemote contactBean;
116
117         /**
118          * General contact controller
119          */
120         @Inject
121         private AddressbookContactWebSessionController contactController;
122
123         /**
124          * Contact id
125          */
126         private Long contactId;
127
128         /**
129          * Country instance
130          */
131         private Country country;
132
133         /**
134          * Email address
135          */
136         private String emailAddress;
137
138         /**
139          * Family name
140          */
141         private String familyName;
142
143         /**
144          * Fax number's area code
145          */
146         private Integer faxAreaCode;
147
148         /**
149          * Country instance for fax number
150          */
151         private Country faxCountry;
152
153         /**
154          * Fax id number
155          */
156         private Long faxId;
157
158         /**
159          * Fax number
160          */
161         private Long faxNumber;
162
163         /**
164          * First name
165          */
166         private String firstName;
167
168         /**
169          * Gender instance
170          */
171         private Gender gender;
172
173         /**
174          * House number
175          */
176         private Short houseNumber;
177
178         /**
179          * House number extension
180          */
181         private String houseNumberExtension;
182
183         /**
184          * Whether a cellphone entry has been unlinked
185          */
186         private boolean isCellphoneUnlinked;
187
188         /**
189          * Whether a fax entry has been unlinked
190          */
191         private boolean isFaxUnlinked;
192
193         /**
194          * Whether a land-line number has been unlinked
195          */
196         private boolean isLandLineUnlinked;
197
198         /**
199          * Land-line id number
200          */
201         private Long landLineId;
202
203         /**
204          * Phone number area code
205          */
206         private Integer phoneAreaCode;
207
208         /**
209          * Country instance for phone number
210          */
211         private Country phoneCountry;
212
213         /**
214          * Phone number
215          */
216         private Long phoneNumber;
217
218         /**
219          * Street
220          */
221         private String street;
222
223         /**
224          * Title
225          */
226         private String title;
227
228         /**
229          * An event fired when the administrator has updated contact data
230          */
231         @Inject
232         @Any
233         private Event<AdminUpdatedContactEvent> updatedContactEvent;
234
235         /**
236          * ZIP code
237          */
238         private Integer zipCode;
239
240         /**
241          * Default constructor
242          */
243         public AddressbookAdminContactWebRequestBean () {
244                 // Try it
245                 try {
246                         // Get initial context
247                         Context context = new InitialContext();
248
249                         // Try to lookup
250                         this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
251                 } catch (final NamingException e) {
252                         // Throw again
253                         throw new FaceletException(e);
254                 }
255         }
256
257         @Override
258         public String addContact () {
259                 // Are all minimum fields set?
260                 if (this.getGender() == null) {
261                         // Throw NPE
262                         throw new NullPointerException("gender is null"); //NOI18N
263                 } else if (this.getFirstName() == null) {
264                         // Throw NPE
265                         throw new NullPointerException("firstName is null"); //NOI18N
266                 } else if (this.getFirstName().isEmpty()) {
267                         // Empty string
268                         throw new IllegalStateException("firstName is empty"); //NOI18N
269                 } else if (this.getFamilyName() == null) {
270                         // Throw NPE
271                         throw new NullPointerException("familyName is null"); //NOI18N
272                 } else if (this.getFamilyName().isEmpty()) {
273                         // Empty string
274                         throw new IllegalStateException("familyName is empty"); //NOI18N
275                 }
276
277                 // Create new contact instance
278                 Contact contact = this.createContactInstance();
279
280                 // Default is not same contact
281                 if (this.isSameContactFound(contact)) {
282                         // Already registered
283                         throw new FaceletException(new ContactAlreadyAddedException(contact));
284                 }
285
286                 // Init contact
287                 Contact updatedContact;
288
289                 // Try to call EJB
290                 try {
291                         // Call EJB
292                         updatedContact = this.contactBean.addContact(contact);
293                 } catch (final ContactAlreadyAddedException ex) {
294                         // Throw again
295                         throw new FaceletException(ex);
296                 }
297
298                 // Fire event
299                 this.addedContactEvent.fire(new AdminContactAddedEvent(updatedContact));
300
301                 // Clear this bean
302                 this.clear();
303
304                 // Return outcome
305                 return "admin_list_contact"; //NOI18N
306         }
307
308         @Override
309         public void copyContactToController (final Contact contact) {
310                 // The contact instance must be valid
311                 if (null == contact) {
312                         // Throw NPE again
313                         throw new NullPointerException("contact is null"); //NOI18N
314                 } else if (contact.getContactId() == null) {
315                         // Throw NPE again
316                         throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
317                 } else if (contact.getContactId() < 1) {
318                         // Not valid
319                         throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
320                 }
321
322                 // Set all fields: contact
323                 this.setContactId(contact.getContactId());
324                 this.setTitle(contact.getContactTitle());
325                 this.setBirthday(contact.getContactBirthday());
326                 this.setCity(contact.getContactCity());
327                 this.setComment(contact.getContactComment());
328                 this.setCountry(contact.getContactCountry());
329                 this.setEmailAddress(contact.getContactEmailAddress());
330                 this.setFamilyName(contact.getContactFamilyName());
331                 this.setFirstName(contact.getContactFirstName());
332                 this.setGender(contact.getContactGender());
333                 this.setHouseNumber(contact.getContactHouseNumber());
334                 this.setStreet(contact.getContactStreet());
335                 this.setZipCode(contact.getContactZipCode());
336
337                 // ... cellphone data
338                 if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
339                         this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
340                         this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
341                         this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
342                 }
343
344                 // ... fax data
345                 if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
346                         this.setFaxId(contact.getContactFaxNumber().getPhoneId());
347                         this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
348                         this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
349                         this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
350                 }
351
352                 // .. land-line data
353                 if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
354                         this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
355                         this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
356                         this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
357                         this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
358                 }
359         }
360
361         @Override
362         public Contact createContactInstance () {
363                 // Generate phone number
364                 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
365                 DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
366                 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
367
368                 // Create new instance
369                 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
370
371                 // Check if contact instance is in helper and valid
372                 if (null == contact) {
373                         // Throw NPE
374                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
375                 } else if (contact.getContactId() == null) {
376                         // Throw NPE again
377                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
378                 } else if (contact.getContactId() < 1) {
379                         // Invalid id
380                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
381                 }
382
383                 // Update all data in contact
384                 this.updateContactData(contact);
385
386                 // Call EJB for updating contact data
387                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
388
389                 // Fire event
390                 this.updatedContactEvent.fire(new AdminContactUpdatedEvent(updatedContact));
391
392                 // Clear bean
393                 this.clear();
394
395                 // Return it
396                 return contact;
397         }
398
399         @Override
400         public String editContactData () {
401                 // Get contact instance
402                 Contact contact = this.beanHelper.getContact();
403
404                 // Check if contact instance is in helper and valid
405                 if (null == contact) {
406                         // Throw NPE
407                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
408                 } else if (contact.getContactId() == null) {
409                         // Throw NPE again
410                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
411                 } else if (contact.getContactId() < 1) {
412                         // Invalid id
413                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
414                 }
415
416                 // Update all data in contact
417                 this.updateContactData(contact);
418
419                 // Call EJB for updating contact data
420                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
421
422                 // Fire event
423                 this.updatedContactEvent.fire(new AdminContactUpdatedEvent(updatedContact));
424
425                 // Clear bean
426                 this.clear();
427
428                 // Return to contact list (for now)
429                 return "admin_list_contact"; //NOI18N
430         }
431
432         @Override
433         public String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
434                 // Is it null?
435                 if (null == cellphoneNumber) {
436                         // Return null
437                         return null;
438                 }
439
440                 // Get all data
441                 String number = String.format(
442                            "%s%d%d", //NOI18N
443                            cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(),
444                            cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(),
445                            cellphoneNumber.getPhoneNumber()
446            );
447
448                 // Return it
449                 return number;
450         }
451
452         @Override
453         public String generatePhoneNumber (final DialableNumber phoneNumber) {
454                 // Is it null?
455                 if (null == phoneNumber) {
456                         // Return null
457                         return null;
458                 }
459
460                 // Generate it
461                 String number = String.format(
462                            "%s%d%d", //NOI18N
463                            phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
464                            phoneNumber.getPhoneAreaCode(),
465                            phoneNumber.getPhoneNumber()
466            );
467
468                 // Return it
469                 return number;
470         }
471
472         @Override
473         @SuppressWarnings ("ReturnOfDateField")
474         public Date getBirthday () {
475                 return this.birthday;
476         }
477
478         @Override
479         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
480         public void setBirthday (final Date birthday) {
481                 this.birthday = birthday;
482         }
483
484         @Override
485         public MobileProvider getCellphoneCarrier () {
486                 return this.cellphoneCarrier;
487         }
488
489         @Override
490         public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
491                 this.cellphoneCarrier = cellphoneCarrier;
492         }
493
494         @Override
495         public Long getCellphoneId () {
496                 return this.cellphoneId;
497         }
498
499         @Override
500         public void setCellphoneId (final Long cellphoneId) {
501                 this.cellphoneId = cellphoneId;
502         }
503
504         @Override
505         public Long getCellphoneNumber () {
506                 return this.cellphoneNumber;
507         }
508
509         @Override
510         public void setCellphoneNumber (Long cellphoneNumber) {
511                 this.cellphoneNumber = cellphoneNumber;
512         }
513
514         @Override
515         public String getCity () {
516                 return this.city;
517         }
518
519         @Override
520         public void setCity (final String city) {
521                 this.city = city;
522         }
523
524         @Override
525         public String getComment () {
526                 return this.comment;
527         }
528
529         @Override
530         public void setComment (final String comment) {
531                 this.comment = comment;
532         }
533
534         @Override
535         public Long getContactId () {
536                 return this.contactId;
537         }
538
539         @Override
540         public void setContactId (final Long contactId) {
541                 this.contactId = contactId;
542         }
543
544         @Override
545         public Country getCountry () {
546                 return this.country;
547         }
548
549         @Override
550         public void setCountry (final Country country) {
551                 this.country = country;
552         }
553
554         @Override
555         public String getEmailAddress () {
556                 return this.emailAddress;
557         }
558
559         @Override
560         public void setEmailAddress (final String emailAddress) {
561                 this.emailAddress = emailAddress;
562         }
563
564         @Override
565         public String getFamilyName () {
566                 return this.familyName;
567         }
568
569         @Override
570         public void setFamilyName (final String familyName) {
571                 this.familyName = familyName;
572         }
573
574         @Override
575         public Integer getFaxAreaCode () {
576                 return this.faxAreaCode;
577         }
578
579         @Override
580         public void setFaxAreaCode (final Integer faxAreaCode) {
581                 this.faxAreaCode = faxAreaCode;
582         }
583
584         @Override
585         public Country getFaxCountry () {
586                 return this.faxCountry;
587         }
588
589         @Override
590         public void setFaxCountry (final Country faxCountry) {
591                 this.faxCountry = faxCountry;
592         }
593
594         @Override
595         public Long getFaxId () {
596                 return this.faxId;
597         }
598
599         @Override
600         public void setFaxId (final Long faxId) {
601                 this.faxId = faxId;
602         }
603
604         @Override
605         public Long getFaxNumber () {
606                 return this.faxNumber;
607         }
608
609         @Override
610         public void setFaxNumber (final Long faxNumber) {
611                 this.faxNumber = faxNumber;
612         }
613
614         @Override
615         public String getFirstName () {
616                 return this.firstName;
617         }
618
619         @Override
620         public void setFirstName (final String firstName) {
621                 this.firstName = firstName;
622         }
623
624         @Override
625         public Gender getGender () {
626                 return this.gender;
627         }
628
629         @Override
630         public void setGender (final Gender gender) {
631                 this.gender = gender;
632         }
633
634         @Override
635         public Short getHouseNumber () {
636                 return this.houseNumber;
637         }
638
639         @Override
640         public void setHouseNumber (final Short houseNumber) {
641                 this.houseNumber = houseNumber;
642         }
643
644         @Override
645         public String getHouseNumberExtension () {
646                 return this.houseNumberExtension;
647         }
648
649         @Override
650         public void setHouseNumberExtension (final String houseNumberExtension) {
651                 this.houseNumberExtension = houseNumberExtension;
652         }
653
654         @Override
655         public Long getLandLineId () {
656                 return this.landLineId;
657         }
658
659         @Override
660         public void setLandLineId (final Long landLineId) {
661                 this.landLineId = landLineId;
662         }
663
664         @Override
665         public Integer getPhoneAreaCode () {
666                 return this.phoneAreaCode;
667         }
668
669         @Override
670         public void setPhoneAreaCode (final Integer phoneAreaCode) {
671                 this.phoneAreaCode = phoneAreaCode;
672         }
673
674         @Override
675         public Country getPhoneCountry () {
676                 return this.phoneCountry;
677         }
678
679         @Override
680         public void setPhoneCountry (final Country phoneCountry) {
681                 this.phoneCountry = phoneCountry;
682         }
683
684         @Override
685         public Long getPhoneNumber () {
686                 return this.phoneNumber;
687         }
688
689         @Override
690         public void setPhoneNumber (final Long phoneNumber) {
691                 this.phoneNumber = phoneNumber;
692         }
693
694         @Override
695         public String getStreet () {
696                 return this.street;
697         }
698
699         @Override
700         public void setStreet (final String street) {
701                 this.street = street;
702         }
703
704         @Override
705         public String getTitle () {
706                 return this.title;
707         }
708
709         @Override
710         public void setTitle (final String title) {
711                 this.title = title;
712         }
713
714         @Override
715         public Integer getZipCode () {
716                 return this.zipCode;
717         }
718
719         @Override
720         public void setZipCode (final Integer zipCode) {
721                 this.zipCode = zipCode;
722         }
723
724         /**
725          * Post-initialization of this class
726          */
727         @PostConstruct
728         public void init () {
729         }
730
731         @Override
732         public boolean isGenderRequired () {
733                 // Get context parameter
734                 String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
735
736                 // Is it set?
737                 boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
738
739                 // Return value
740                 return isRequired;
741         }
742
743         /**
744          * Clears this bean
745          */
746         private void clear () {
747                 // Clear all data
748                 // - personal data
749                 this.setGender(null);
750                 this.setTitle(null);
751                 this.setFirstName(null);
752                 this.setFamilyName(null);
753                 this.setStreet(null);
754                 this.setHouseNumber(null);
755                 this.setZipCode(null);
756                 this.setCity(null);
757                 this.setCountry(null);
758
759                 // - contact data
760                 this.setEmailAddress(null);
761                 this.setPhoneCountry(null);
762                 this.setPhoneAreaCode(null);
763                 this.setPhoneNumber(null);
764                 this.setCellphoneCarrier(null);
765                 this.setCellphoneNumber(null);
766                 this.setFaxCountry(null);
767                 this.setFaxAreaCode(null);
768                 this.setFaxNumber(null);
769
770                 // - other data
771                 this.setBirthday(null);
772                 this.setComment(null);
773         }
774
775         /**
776          * Checks whether the given contact is found
777          * <p>
778          * @param contact Contact inastance
779          *
780          * @return Wether contact has been found
781          */
782         private boolean isSameContactFound (final Contact contact) {
783                 // Default is not found
784                 boolean IsFound = false;
785
786                 // Get iterator
787                 Iterator<Contact> iterator = this.contactController.allContacts().iterator();
788
789                 // Loop through all
790                 while (iterator.hasNext()) {
791                         // Get next contact
792                         Contact next = iterator.next();
793
794                         // Is the same?
795                         if (ContactUtils.isSameContact(contact, next)) {
796                                 // Yes, then abort loop
797                                 IsFound = false;
798                                 break;
799                         }
800                 }
801
802                 // Return status
803                 return IsFound;
804         }
805
806         /**
807          * Updates all data in contact instance.
808          * <p>
809          * @param contact Contact instance
810          */
811         private void updateContactData (final Contact contact) {
812                 // Contact instance should be valid
813                 if (null == contact) {
814                         // Throw NPE
815                         throw new NullPointerException("contact is null"); //NOI18N
816                 } else if (contact.getContactId() == null) {
817                         // Throw NPE again
818                         throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
819                 } else if (contact.getContactId() < 1) {
820                         // Invalid id
821                         throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
822                 }
823
824                 // Update all fields
825                 contact.setContactGender(this.getGender());
826                 contact.setContactTitle(this.getTitle());
827                 contact.setContactFirstName(this.getFirstName());
828                 contact.setContactFamilyName(this.getFamilyName());
829                 contact.setContactStreet(this.getStreet());
830                 contact.setContactHouseNumber(this.getHouseNumber());
831                 contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
832                 contact.setContactZipCode(this.getZipCode());
833                 contact.setContactCity(this.getCity());
834                 contact.setContactCountry(this.getCountry());
835
836                 // Update contact's cellphone number
837                 this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
838
839                 // Update contact's land-line number
840                 this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
841
842                 // Update contact's fax number
843                 this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
844         }
845
846 }