]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/contact/AddressbookAdminContactWebRequestBean.java
Please cherry-pick:
[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.ObservableAdminAddedContactEvent;
43 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
44 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
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<ObservableAdminAddedContactEvent> 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 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<ObservableAdminUpdatedContactEvent> updatedContactEvent;
240
241         /**
242          * ZIP code
243          */
244         private Integer zipCode;
245
246         /**
247          * Default constructor
248          */
249         public AddressbookAdminContactWebRequestBean () {
250         }
251
252         @Override
253         public String addContact () {
254                 // Are all minimum fields set?
255                 if (this.getGender() == null) {
256                         // Throw NPE
257                         throw new NullPointerException("gender is null"); //NOI18N
258                 } else if (this.getFirstName() == null) {
259                         // Throw NPE
260                         throw new NullPointerException("firstName is null"); //NOI18N
261                 } else if (this.getFirstName().isEmpty()) {
262                         // Empty string
263                         throw new IllegalStateException("firstName is empty"); //NOI18N
264                 } else if (this.getFamilyName() == null) {
265                         // Throw NPE
266                         throw new NullPointerException("familyName is null"); //NOI18N
267                 } else if (this.getFamilyName().isEmpty()) {
268                         // Empty string
269                         throw new IllegalStateException("familyName is empty"); //NOI18N
270                 }
271
272                 // Create new contact instance
273                 Contact contact = this.createContactInstance();
274
275                 // Default is not same contact
276                 if (this.isSameContactFound(contact)) {
277                         // Already registered
278                         throw new FaceletException(new ContactAlreadyAddedException(contact));
279                 }
280
281                 // Init contact
282                 Contact updatedContact;
283
284                 // Try to call EJB
285                 try {
286                         // Call EJB
287                         updatedContact = this.adminContactBean.addContact(contact);
288                 } catch (final ContactAlreadyAddedException ex) {
289                         // Throw again
290                         throw new FaceletException(ex);
291                 }
292
293                 // Fire event
294                 this.addedContactEvent.fire(new AdminAddedContactEvent(updatedContact));
295
296                 // Clear this bean
297                 this.clear();
298
299                 // Return outcome
300                 return "admin_list_contact"; //NOI18N
301         }
302
303         @Override
304         public void copyContactToController (final Contact contact) {
305                 // The contact instance must be valid
306                 if (null == contact) {
307                         // Throw NPE again
308                         throw new NullPointerException("contact is null"); //NOI18N
309                 } else if (contact.getContactId() == null) {
310                         // Throw NPE again
311                         throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
312                 } else if (contact.getContactId() < 1) {
313                         // Not valid
314                         throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
315                 }
316
317                 // Set all fields: contact
318                 this.setContactId(contact.getContactId());
319                 this.setTitle(contact.getContactTitle());
320                 this.setBirthday(contact.getContactBirthday());
321                 this.setCity(contact.getContactCity());
322                 this.setComment(contact.getContactComment());
323                 this.setCountry(contact.getContactCountry());
324                 this.setEmailAddress(contact.getContactEmailAddress());
325                 this.setFamilyName(contact.getContactFamilyName());
326                 this.setFirstName(contact.getContactFirstName());
327                 this.setGender(contact.getContactGender());
328                 this.setHouseNumber(contact.getContactHouseNumber());
329                 this.setHouseNumberExtension(contact.getContactHouseNumberExtension());
330                 this.setStreet(contact.getContactStreet());
331                 this.setZipCode(contact.getContactZipCode());
332
333                 // ... mobile data
334                 if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
335                         this.setMobileId(contact.getContactMobileNumber().getPhoneId());
336                         this.setMobileCarrier(contact.getContactMobileNumber().getMobileProvider());
337                         this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
338                 }
339
340                 // ... fax data
341                 if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
342                         this.setFaxId(contact.getContactFaxNumber().getPhoneId());
343                         this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
344                         this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
345                         this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
346                 }
347
348                 // .. land-line data
349                 if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
350                         this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
351                         this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
352                         this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
353                         this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
354                 }
355         }
356
357         @Override
358         public Contact createContactInstance () {
359                 // Generate phone number
360                 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
361                 DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber());
362                 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
363
364                 // Create new instance
365                 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
366
367                 // Check if contact instance is in helper and valid
368                 if (null == contact) {
369                         // Throw NPE
370                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
371                 } else if (contact.getContactId() == null) {
372                         // Throw NPE again
373                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
374                 } else if (contact.getContactId() < 1) {
375                         // Invalid id
376                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
377                 }
378
379                 // Update all data in contact
380                 this.updateContactData(contact);
381
382                 // Call EJB for updating contact data
383                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
384
385                 // Fire event
386                 this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
387
388                 // Clear bean
389                 this.clear();
390
391                 // Return it
392                 return contact;
393         }
394
395         @Override
396         public String editContactData () {
397                 // Get contact instance
398                 Contact contact = this.beanHelper.getContact();
399
400                 // Check if contact instance is in helper and valid
401                 if (null == contact) {
402                         // Throw NPE
403                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
404                 } else if (contact.getContactId() == null) {
405                         // Throw NPE again
406                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
407                 } else if (contact.getContactId() < 1) {
408                         // Invalid id
409                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
410                 }
411
412                 // Update all data in contact
413                 this.updateContactData(contact);
414
415                 // Call EJB for updating contact data
416                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
417
418                 // Fire event
419                 this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
420
421                 // Clear bean
422                 this.clear();
423
424                 // Return to contact list (for now)
425                 return "admin_list_contact"; //NOI18N
426         }
427
428         @Override
429         public String generateMobileNumber (final DialableMobileNumber mobileNumber) {
430                 // Is it null?
431                 if (null == mobileNumber) {
432                         // Return null
433                         return null;
434                 }
435
436                 // Get all data
437                 String number = String.format(
438                            "%s%d%d", //NOI18N
439                            mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
440                            mobileNumber.getMobileProvider().getProviderDialPrefix(),
441                            mobileNumber.getPhoneNumber()
442            );
443
444                 // Return it
445                 return number;
446         }
447
448         @Override
449         public String generatePhoneNumber (final DialableNumber phoneNumber) {
450                 // Is it null?
451                 if (null == phoneNumber) {
452                         // Return null
453                         return null;
454                 }
455
456                 // Generate it
457                 String number = String.format(
458                            "%s%d%d", //NOI18N
459                            phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
460                            phoneNumber.getPhoneAreaCode(),
461                            phoneNumber.getPhoneNumber()
462            );
463
464                 // Return it
465                 return number;
466         }
467
468         @Override
469         @SuppressWarnings ("ReturnOfDateField")
470         public Date getBirthday () {
471                 return this.birthday;
472         }
473
474         @Override
475         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
476         public void setBirthday (final Date birthday) {
477                 this.birthday = birthday;
478         }
479
480         @Override
481         public String getCity () {
482                 return this.city;
483         }
484
485         @Override
486         public void setCity (final String city) {
487                 this.city = city;
488         }
489
490         @Override
491         public String getComment () {
492                 return this.comment;
493         }
494
495         @Override
496         public void setComment (final String comment) {
497                 this.comment = comment;
498         }
499
500         @Override
501         public Long getContactId () {
502                 return this.contactId;
503         }
504
505         @Override
506         public void setContactId (final Long contactId) {
507                 this.contactId = contactId;
508         }
509
510         @Override
511         public Country getCountry () {
512                 return this.country;
513         }
514
515         @Override
516         public void setCountry (final Country country) {
517                 this.country = country;
518         }
519
520         @Override
521         public String getEmailAddress () {
522                 return this.emailAddress;
523         }
524
525         @Override
526         public void setEmailAddress (final String emailAddress) {
527                 this.emailAddress = emailAddress;
528         }
529
530         @Override
531         public String getFamilyName () {
532                 return this.familyName;
533         }
534
535         @Override
536         public void setFamilyName (final String familyName) {
537                 this.familyName = familyName;
538         }
539
540         @Override
541         public Integer getFaxAreaCode () {
542                 return this.faxAreaCode;
543         }
544
545         @Override
546         public void setFaxAreaCode (final Integer faxAreaCode) {
547                 this.faxAreaCode = faxAreaCode;
548         }
549
550         @Override
551         public Country getFaxCountry () {
552                 return this.faxCountry;
553         }
554
555         @Override
556         public void setFaxCountry (final Country faxCountry) {
557                 this.faxCountry = faxCountry;
558         }
559
560         @Override
561         public Long getFaxId () {
562                 return this.faxId;
563         }
564
565         @Override
566         public void setFaxId (final Long faxId) {
567                 this.faxId = faxId;
568         }
569
570         @Override
571         public Long getFaxNumber () {
572                 return this.faxNumber;
573         }
574
575         @Override
576         public void setFaxNumber (final Long faxNumber) {
577                 this.faxNumber = faxNumber;
578         }
579
580         @Override
581         public String getFirstName () {
582                 return this.firstName;
583         }
584
585         @Override
586         public void setFirstName (final String firstName) {
587                 this.firstName = firstName;
588         }
589
590         @Override
591         public Gender getGender () {
592                 return this.gender;
593         }
594
595         @Override
596         public void setGender (final Gender gender) {
597                 this.gender = gender;
598         }
599
600         @Override
601         public Short getHouseNumber () {
602                 return this.houseNumber;
603         }
604
605         @Override
606         public void setHouseNumber (final Short houseNumber) {
607                 this.houseNumber = houseNumber;
608         }
609
610         @Override
611         public String getHouseNumberExtension () {
612                 return this.houseNumberExtension;
613         }
614
615         @Override
616         public void setHouseNumberExtension (final String houseNumberExtension) {
617                 this.houseNumberExtension = houseNumberExtension;
618         }
619
620         @Override
621         public Long getLandLineId () {
622                 return this.landLineId;
623         }
624
625         @Override
626         public void setLandLineId (final Long landLineId) {
627                 this.landLineId = landLineId;
628         }
629
630         @Override
631         public MobileProvider getMobileCarrier () {
632                 return this.mobileCarrier;
633         }
634
635         @Override
636         public void setMobileCarrier (final MobileProvider mobileCarrier) {
637                 this.mobileCarrier = mobileCarrier;
638         }
639
640         @Override
641         public Long getMobileId () {
642                 return this.mobileId;
643         }
644
645         @Override
646         public void setMobileId (final Long mobileId) {
647                 this.mobileId = mobileId;
648         }
649
650         @Override
651         public Long getMobileNumber () {
652                 return this.mobileNumber;
653         }
654
655         @Override
656         public void setMobileNumber (Long mobileNumber) {
657                 this.mobileNumber = mobileNumber;
658         }
659
660         @Override
661         public Integer getPhoneAreaCode () {
662                 return this.phoneAreaCode;
663         }
664
665         @Override
666         public void setPhoneAreaCode (final Integer phoneAreaCode) {
667                 this.phoneAreaCode = phoneAreaCode;
668         }
669
670         @Override
671         public Country getPhoneCountry () {
672                 return this.phoneCountry;
673         }
674
675         @Override
676         public void setPhoneCountry (final Country phoneCountry) {
677                 this.phoneCountry = phoneCountry;
678         }
679
680         @Override
681         public Long getPhoneNumber () {
682                 return this.phoneNumber;
683         }
684
685         @Override
686         public void setPhoneNumber (final Long phoneNumber) {
687                 this.phoneNumber = phoneNumber;
688         }
689
690         @Override
691         public String getStreet () {
692                 return this.street;
693         }
694
695         @Override
696         public void setStreet (final String street) {
697                 this.street = street;
698         }
699
700         @Override
701         public String getTitle () {
702                 return this.title;
703         }
704
705         @Override
706         public void setTitle (final String title) {
707                 this.title = title;
708         }
709
710         @Override
711         public Integer getZipCode () {
712                 return this.zipCode;
713         }
714
715         @Override
716         public void setZipCode (final Integer zipCode) {
717                 this.zipCode = zipCode;
718         }
719
720         /**
721          * Post-initialization of this class
722          */
723         @PostConstruct
724         public void init () {
725                 // Try it
726                 try {
727                         // Get initial context
728                         Context context = new InitialContext();
729
730                         // Try to lookup
731                         this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
732                 } catch (final NamingException e) {
733                         // Throw again
734                         throw new FaceletException(e);
735                 }
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.updateMobileNumber(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 }