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