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