]> 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.AddressbookWebRequestHelperController;
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 AddressbookWebRequestHelperController 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                 // Call super constructor
251                 super();
252         }
253
254         @Override
255         public String addContact () {
256                 // Are all minimum fields set?
257                 if (this.getGender() == null) {
258                         // Throw NPE
259                         throw new NullPointerException("gender is null"); //NOI18N
260                 } else if (this.getFirstName() == null) {
261                         // Throw NPE
262                         throw new NullPointerException("firstName is null"); //NOI18N
263                 } else if (this.getFirstName().isEmpty()) {
264                         // Empty string
265                         throw new IllegalStateException("firstName is empty"); //NOI18N
266                 } else if (this.getFamilyName() == null) {
267                         // Throw NPE
268                         throw new NullPointerException("familyName is null"); //NOI18N
269                 } else if (this.getFamilyName().isEmpty()) {
270                         // Empty string
271                         throw new IllegalStateException("familyName is empty"); //NOI18N
272                 }
273
274                 // Create new contact instance
275                 Contact contact = this.createContactInstance();
276
277                 // Default is not same contact
278                 if (this.isSameContactFound(contact)) {
279                         // Already registered
280                         throw new FaceletException(new ContactAlreadyAddedException(contact));
281                 }
282
283                 // Init contact
284                 Contact updatedContact;
285
286                 // Try to call EJB
287                 try {
288                         // Call EJB
289                         updatedContact = this.adminContactBean.addContact(contact);
290                 } catch (final ContactAlreadyAddedException ex) {
291                         // Throw again
292                         throw new FaceletException(ex);
293                 }
294
295                 // Fire event
296                 this.addedContactEvent.fire(new AdminAddedContactEvent(updatedContact));
297
298                 // Clear this bean
299                 this.clear();
300
301                 // Return outcome
302                 return "admin_list_contact"; //NOI18N
303         }
304
305         @Override
306         public void copyContactToController (final Contact contact) {
307                 // The contact instance must be valid
308                 if (null == contact) {
309                         // Throw NPE again
310                         throw new NullPointerException("contact is null"); //NOI18N
311                 } else if (contact.getContactId() == null) {
312                         // Throw NPE again
313                         throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
314                 } else if (contact.getContactId() < 1) {
315                         // Not valid
316                         throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
317                 }
318
319                 // Set all fields: contact
320                 this.setContactId(contact.getContactId());
321                 this.setTitle(contact.getContactTitle());
322                 this.setBirthday(contact.getContactBirthday());
323                 this.setCity(contact.getContactCity());
324                 this.setComment(contact.getContactComment());
325                 this.setCountry(contact.getContactCountry());
326                 this.setEmailAddress(contact.getContactEmailAddress());
327                 this.setFamilyName(contact.getContactFamilyName());
328                 this.setFirstName(contact.getContactFirstName());
329                 this.setGender(contact.getContactGender());
330                 this.setHouseNumber(contact.getContactHouseNumber());
331                 this.setHouseNumberExtension(contact.getContactHouseNumberExtension());
332                 this.setStreet(contact.getContactStreet());
333                 this.setZipCode(contact.getContactZipCode());
334
335                 // ... mobile data
336                 if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
337                         this.setMobileId(contact.getContactMobileNumber().getPhoneId());
338                         this.setMobileCarrier(contact.getContactMobileNumber().getMobileProvider());
339                         this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
340                 }
341
342                 // ... fax data
343                 if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
344                         this.setFaxId(contact.getContactFaxNumber().getPhoneId());
345                         this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
346                         this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
347                         this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
348                 }
349
350                 // .. land-line data
351                 if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
352                         this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
353                         this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
354                         this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
355                         this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
356                 }
357         }
358
359         @Override
360         public Contact createContactInstance () {
361                 // Generate phone number
362                 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
363                 DialableMobileNumber mobile = new MobileNumber(this.getMobileCarrier(), this.getMobileNumber());
364                 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
365
366                 // Create new instance
367                 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
368
369                 // Check if contact instance is in helper and valid
370                 if (null == contact) {
371                         // Throw NPE
372                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
373                 } else if (contact.getContactId() == null) {
374                         // Throw NPE again
375                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
376                 } else if (contact.getContactId() < 1) {
377                         // Invalid id
378                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
379                 }
380
381                 // Update all data in contact
382                 this.updateContactData(contact);
383
384                 // Call EJB for updating contact data
385                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
386
387                 // Fire event
388                 this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
389
390                 // Clear bean
391                 this.clear();
392
393                 // Return it
394                 return contact;
395         }
396
397         @Override
398         public String editContactData () {
399                 // Get contact instance
400                 Contact contact = this.beanHelper.getContact();
401
402                 // Check if contact instance is in helper and valid
403                 if (null == contact) {
404                         // Throw NPE
405                         throw new NullPointerException("beanHelper.contact is null"); //NOI18N
406                 } else if (contact.getContactId() == null) {
407                         // Throw NPE again
408                         throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
409                 } else if (contact.getContactId() < 1) {
410                         // Invalid id
411                         throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
412                 }
413
414                 // Update all data in contact
415                 this.updateContactData(contact);
416
417                 // Call EJB for updating contact data
418                 Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
419
420                 // Fire event
421                 this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
422
423                 // Clear bean
424                 this.clear();
425
426                 // Return to contact list (for now)
427                 return "admin_list_contact"; //NOI18N
428         }
429
430         @Override
431         public String generateMobileNumber (final DialableMobileNumber mobileNumber) {
432                 // Is it null?
433                 if (null == mobileNumber) {
434                         // Return null
435                         return null;
436                 }
437
438                 // Get all data
439                 String number = String.format(
440                            "%s%d%d", //NOI18N
441                            mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
442                            mobileNumber.getMobileProvider().getProviderDialPrefix(),
443                            mobileNumber.getPhoneNumber()
444            );
445
446                 // Return it
447                 return number;
448         }
449
450         @Override
451         public String generatePhoneNumber (final DialableNumber phoneNumber) {
452                 // Is it null?
453                 if (null == phoneNumber) {
454                         // Return null
455                         return null;
456                 }
457
458                 // Generate it
459                 String number = String.format(
460                            "%s%d%d", //NOI18N
461                            phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
462                            phoneNumber.getPhoneAreaCode(),
463                            phoneNumber.getPhoneNumber()
464            );
465
466                 // Return it
467                 return number;
468         }
469
470         @Override
471         @SuppressWarnings ("ReturnOfDateField")
472         public Date getBirthday () {
473                 return this.birthday;
474         }
475
476         @Override
477         @SuppressWarnings ("AssignmentToDateFieldFromParameter")
478         public void setBirthday (final Date birthday) {
479                 this.birthday = birthday;
480         }
481
482         @Override
483         public String getCity () {
484                 return this.city;
485         }
486
487         @Override
488         public void setCity (final String city) {
489                 this.city = city;
490         }
491
492         @Override
493         public String getComment () {
494                 return this.comment;
495         }
496
497         @Override
498         public void setComment (final String comment) {
499                 this.comment = comment;
500         }
501
502         @Override
503         public Long getContactId () {
504                 return this.contactId;
505         }
506
507         @Override
508         public void setContactId (final Long contactId) {
509                 this.contactId = contactId;
510         }
511
512         @Override
513         public Country getCountry () {
514                 return this.country;
515         }
516
517         @Override
518         public void setCountry (final Country country) {
519                 this.country = country;
520         }
521
522         @Override
523         public String getEmailAddress () {
524                 return this.emailAddress;
525         }
526
527         @Override
528         public void setEmailAddress (final String emailAddress) {
529                 this.emailAddress = emailAddress;
530         }
531
532         @Override
533         public String getFamilyName () {
534                 return this.familyName;
535         }
536
537         @Override
538         public void setFamilyName (final String familyName) {
539                 this.familyName = familyName;
540         }
541
542         @Override
543         public Integer getFaxAreaCode () {
544                 return this.faxAreaCode;
545         }
546
547         @Override
548         public void setFaxAreaCode (final Integer faxAreaCode) {
549                 this.faxAreaCode = faxAreaCode;
550         }
551
552         @Override
553         public Country getFaxCountry () {
554                 return this.faxCountry;
555         }
556
557         @Override
558         public void setFaxCountry (final Country faxCountry) {
559                 this.faxCountry = faxCountry;
560         }
561
562         @Override
563         public Long getFaxId () {
564                 return this.faxId;
565         }
566
567         @Override
568         public void setFaxId (final Long faxId) {
569                 this.faxId = faxId;
570         }
571
572         @Override
573         public Long getFaxNumber () {
574                 return this.faxNumber;
575         }
576
577         @Override
578         public void setFaxNumber (final Long faxNumber) {
579                 this.faxNumber = faxNumber;
580         }
581
582         @Override
583         public String getFirstName () {
584                 return this.firstName;
585         }
586
587         @Override
588         public void setFirstName (final String firstName) {
589                 this.firstName = firstName;
590         }
591
592         @Override
593         public Gender getGender () {
594                 return this.gender;
595         }
596
597         @Override
598         public void setGender (final Gender gender) {
599                 this.gender = gender;
600         }
601
602         @Override
603         public Short getHouseNumber () {
604                 return this.houseNumber;
605         }
606
607         @Override
608         public void setHouseNumber (final Short houseNumber) {
609                 this.houseNumber = houseNumber;
610         }
611
612         @Override
613         public String getHouseNumberExtension () {
614                 return this.houseNumberExtension;
615         }
616
617         @Override
618         public void setHouseNumberExtension (final String houseNumberExtension) {
619                 this.houseNumberExtension = houseNumberExtension;
620         }
621
622         @Override
623         public Long getLandLineId () {
624                 return this.landLineId;
625         }
626
627         @Override
628         public void setLandLineId (final Long landLineId) {
629                 this.landLineId = landLineId;
630         }
631
632         @Override
633         public MobileProvider getMobileCarrier () {
634                 return this.mobileCarrier;
635         }
636
637         @Override
638         public void setMobileCarrier (final MobileProvider mobileCarrier) {
639                 this.mobileCarrier = mobileCarrier;
640         }
641
642         @Override
643         public Long getMobileId () {
644                 return this.mobileId;
645         }
646
647         @Override
648         public void setMobileId (final Long mobileId) {
649                 this.mobileId = mobileId;
650         }
651
652         @Override
653         public Long getMobileNumber () {
654                 return this.mobileNumber;
655         }
656
657         @Override
658         public void setMobileNumber (Long mobileNumber) {
659                 this.mobileNumber = mobileNumber;
660         }
661
662         @Override
663         public Integer getPhoneAreaCode () {
664                 return this.phoneAreaCode;
665         }
666
667         @Override
668         public void setPhoneAreaCode (final Integer phoneAreaCode) {
669                 this.phoneAreaCode = phoneAreaCode;
670         }
671
672         @Override
673         public Country getPhoneCountry () {
674                 return this.phoneCountry;
675         }
676
677         @Override
678         public void setPhoneCountry (final Country phoneCountry) {
679                 this.phoneCountry = phoneCountry;
680         }
681
682         @Override
683         public Long getPhoneNumber () {
684                 return this.phoneNumber;
685         }
686
687         @Override
688         public void setPhoneNumber (final Long phoneNumber) {
689                 this.phoneNumber = phoneNumber;
690         }
691
692         @Override
693         public String getStreet () {
694                 return this.street;
695         }
696
697         @Override
698         public void setStreet (final String street) {
699                 this.street = street;
700         }
701
702         @Override
703         public String getTitle () {
704                 return this.title;
705         }
706
707         @Override
708         public void setTitle (final String title) {
709                 this.title = title;
710         }
711
712         @Override
713         public Integer getZipCode () {
714                 return this.zipCode;
715         }
716
717         @Override
718         public void setZipCode (final Integer zipCode) {
719                 this.zipCode = zipCode;
720         }
721
722         /**
723          * Post-initialization of this class
724          */
725         @PostConstruct
726         public void init () {
727                 // Try it
728                 try {
729                         // Get initial context
730                         Context context = new InitialContext();
731
732                         // Try to lookup
733                         this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
734                 } catch (final NamingException e) {
735                         // Throw again
736                         throw new FaceletException(e);
737                 }
738         }
739
740         @Override
741         public boolean isGenderRequired () {
742                 // Get context parameter
743                 String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
744
745                 // Is it set?
746                 boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
747
748                 // Return value
749                 return isRequired;
750         }
751
752         /**
753          * Clears this bean
754          */
755         private void clear () {
756                 // Clear all data
757                 // - personal data
758                 this.setGender(null);
759                 this.setTitle(null);
760                 this.setFirstName(null);
761                 this.setFamilyName(null);
762                 this.setStreet(null);
763                 this.setHouseNumber(null);
764                 this.setHouseNumberExtension(null);
765                 this.setZipCode(null);
766                 this.setCity(null);
767                 this.setCountry(null);
768
769                 // - contact data
770                 this.setEmailAddress(null);
771                 this.setPhoneCountry(null);
772                 this.setPhoneAreaCode(null);
773                 this.setPhoneNumber(null);
774                 this.setMobileCarrier(null);
775                 this.setMobileNumber(null);
776                 this.setFaxCountry(null);
777                 this.setFaxAreaCode(null);
778                 this.setFaxNumber(null);
779
780                 // - other data
781                 this.setBirthday(null);
782                 this.setComment(null);
783         }
784
785         /**
786          * Checks whether the given contact is found
787          * <p>
788          * @param contact Contact inastance
789          *
790          * @return Wether contact has been found
791          */
792         private boolean isSameContactFound (final Contact contact) {
793                 // Default is not found
794                 boolean IsFound = false;
795
796                 // Get iterator
797                 Iterator<Contact> iterator = this.contactController.allContacts().iterator();
798
799                 // Loop through all
800                 while (iterator.hasNext()) {
801                         // Get next contact
802                         Contact next = iterator.next();
803
804                         // Is the same?
805                         if (ContactUtils.isSameContact(contact, next)) {
806                                 // Yes, then abort loop
807                                 IsFound = false;
808                                 break;
809                         }
810                 }
811
812                 // Return status
813                 return IsFound;
814         }
815
816         /**
817          * Updates all data in contact instance.
818          * <p>
819          * @param contact Contact instance
820          */
821         private void updateContactData (final Contact contact) {
822                 // Contact instance should be valid
823                 if (null == contact) {
824                         // Throw NPE
825                         throw new NullPointerException("contact is null"); //NOI18N
826                 } else if (contact.getContactId() == null) {
827                         // Throw NPE again
828                         throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
829                 } else if (contact.getContactId() < 1) {
830                         // Invalid id
831                         throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
832                 }
833
834                 // Update all fields
835                 contact.setContactGender(this.getGender());
836                 contact.setContactTitle(this.getTitle());
837                 contact.setContactFirstName(this.getFirstName());
838                 contact.setContactFamilyName(this.getFamilyName());
839                 contact.setContactStreet(this.getStreet());
840                 contact.setContactHouseNumber(this.getHouseNumber());
841                 contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
842                 contact.setContactZipCode(this.getZipCode());
843                 contact.setContactCity(this.getCity());
844                 contact.setContactCountry(this.getCountry());
845
846                 // Update contact's mobile number
847                 this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileCarrier(), this.getMobileNumber());
848
849                 // Update contact's land-line number
850                 this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
851
852                 // Update contact's fax number
853                 this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
854         }
855
856 }