2 * Copyright (C) 2016 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.jcontacts.phone;
19 import java.text.MessageFormat;
20 import java.util.GregorianCalendar;
21 import java.util.Objects;
23 import javax.ejb.Stateless;
24 import org.mxchange.jcontacts.contact.Contact;
25 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
26 import org.mxchange.jcontacts.contact.UserContact;
27 import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
28 import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
29 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
30 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
31 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
32 import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;
35 * A session EJB for administrative contact's phone number purposes
37 * @author Roland Haeder<rhaeder@cho-time.de>
39 @Stateless (name = "adminContactPhone", description = "An administrative bean handling contact's phone (fax, land-line and mobile) data")
40 public class PizzaAdminContactPhoneSessionBean extends BasePizzaDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
45 private static final long serialVersionUID = 189_217_561_460_237_108L;
51 private ContactSessionBeanRemote contactBean;
54 public Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
56 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
58 // Is the contact set?
59 if (null == contact) {
61 throw new NullPointerException("contact is null"); //NOI18N
62 } else if (contact.getContactId() == null) {
63 // ... and throw again
64 throw new NullPointerException("contact.contactId is null"); //NOI18N
65 } else if (contact.getContactId() < 1) {
67 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
68 } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
69 // Not set cell phone instance
70 throw new PhoneNumberAlreadyLinkedException(faxNumber);
71 } else if (null == faxNumber) {
73 throw new NullPointerException("faxNumber is null"); //NOI18N
74 } else if (faxNumber.getPhoneId() == null) {
76 throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
77 } else if (faxNumber.getPhoneId() < 1) {
79 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
80 } else if (faxNumber.getPhoneCountry() == null) {
82 throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
83 } else if (faxNumber.getPhoneAreaCode() == null) {
85 throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
86 } else if (faxNumber.getPhoneAreaCode() < 1) {
88 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
89 } else if (faxNumber.getPhoneNumber() == null) {
91 throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
92 } else if (faxNumber.getPhoneNumber() < 1) {
94 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
98 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
100 // Merge phone number
101 DialableFaxNumber managedNumber = this.getEntityManager().merge(faxNumber);
103 // Set fax number in contact
104 managedContact.setContactFaxNumber(managedNumber);
107 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
110 return managedContact;
114 public Contact linkExistingLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
116 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
118 // Is the contact set?
119 if (null == contact) {
121 throw new NullPointerException("contact is null"); //NOI18N
122 } else if (contact.getContactId() == null) {
123 // ... and throw again
124 throw new NullPointerException("contact.contactId is null"); //NOI18N
125 } else if (contact.getContactId() < 1) {
127 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
128 } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
129 // Not set cell phone instance
130 throw new PhoneNumberAlreadyLinkedException(landLineNumber);
131 } else if (null == landLineNumber) {
133 throw new NullPointerException("landLineNumber is null"); //NOI18N
134 } else if (landLineNumber.getPhoneId() == null) {
136 throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
137 } else if (landLineNumber.getPhoneId() < 1) {
139 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
140 } else if (landLineNumber.getPhoneCountry() == null) {
142 throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
143 } else if (landLineNumber.getPhoneAreaCode() == null) {
145 throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
146 } else if (landLineNumber.getPhoneAreaCode() < 1) {
148 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
149 } else if (landLineNumber.getPhoneNumber() == null) {
151 throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
152 } else if (landLineNumber.getPhoneNumber() < 1) {
154 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
158 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
160 // Merge phone number
161 DialableLandLineNumber managedNumber = this.getEntityManager().merge(landLineNumber);
163 // Set fax number in contact
164 managedContact.setContactLandLineNumber(managedNumber);
167 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
170 return managedContact;
174 public Contact linkExistingMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
176 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
178 // Is the contact set?
179 if (null == contact) {
181 throw new NullPointerException("contact is null"); //NOI18N
182 } else if (contact.getContactId() == null) {
183 // ... and throw again
184 throw new NullPointerException("contact.contactId is null"); //NOI18N
185 } else if (contact.getContactId() < 1) {
187 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
188 } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
189 // Not set cell phone instance
190 throw new PhoneNumberAlreadyLinkedException(mobileNumber);
191 } else if (null == mobileNumber) {
193 throw new NullPointerException("mobileNumber is null"); //NOI18N
194 } else if (mobileNumber.getPhoneId() == null) {
196 throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
197 } else if (mobileNumber.getPhoneId() < 1) {
199 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
200 } else if (mobileNumber.getMobileProvider() == null) {
202 throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
203 } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
205 throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
206 } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
208 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
212 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
214 // Merge phone number
215 DialableMobileNumber managedNumber = this.getEntityManager().merge(mobileNumber);
217 // Set fax number in contact
218 managedContact.setContactMobileNumber(managedNumber);
221 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
224 return managedContact;
228 public Contact linkNewFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
230 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
232 // Is the contact set?
233 if (null == contact) {
235 throw new NullPointerException("contact is null"); //NOI18N
236 } else if (contact.getContactId() == null) {
237 // ... and throw again
238 throw new NullPointerException("contact.contactId is null"); //NOI18N
239 } else if (contact.getContactId() < 1) {
241 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
242 } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
243 // Not set cell phone instance
244 throw new PhoneNumberAlreadyLinkedException(faxNumber);
245 } else if (null == faxNumber) {
247 throw new NullPointerException("faxNumber is null"); //NOI18N
248 } else if (faxNumber.getPhoneId() instanceof Long) {
250 throw new IllegalStateException(MessageFormat.format("faxNumber.phoneId={0} is not null", faxNumber.getPhoneId())); //NOI18N
251 } else if (faxNumber.getPhoneCountry() == null) {
253 throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
254 } else if (faxNumber.getPhoneAreaCode() == null) {
256 throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
257 } else if (faxNumber.getPhoneAreaCode() < 1) {
259 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
260 } else if (faxNumber.getPhoneNumber() == null) {
262 throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
263 } else if (faxNumber.getPhoneNumber() < 1) {
265 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
268 // Set created instance
269 faxNumber.setPhoneEntryCreated(new GregorianCalendar());
272 this.getEntityManager().persist(faxNumber);
275 this.getEntityManager().flush();
278 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
280 // Set fax number in contact
281 managedContact.setContactFaxNumber(faxNumber);
284 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
287 return managedContact;
291 public Contact linkNewLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
293 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
295 // Is the contact set?
296 if (null == contact) {
298 throw new NullPointerException("contact is null"); //NOI18N
299 } else if (contact.getContactId() == null) {
300 // ... and throw again
301 throw new NullPointerException("contact.contactId is null"); //NOI18N
302 } else if (contact.getContactId() < 1) {
304 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
305 } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
306 // Not set cell phone instance
307 throw new PhoneNumberAlreadyLinkedException(landLineNumber);
308 } else if (null == landLineNumber) {
310 throw new NullPointerException("landLineNumber is null"); //NOI18N
311 } else if (landLineNumber.getPhoneId() instanceof Long) {
313 throw new IllegalStateException(MessageFormat.format("landLineNumber.phoneId={0} is not null", landLineNumber.getPhoneId())); //NOI18N
314 } else if (landLineNumber.getPhoneCountry() == null) {
316 throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
317 } else if (landLineNumber.getPhoneAreaCode() == null) {
319 throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
320 } else if (landLineNumber.getPhoneAreaCode() < 1) {
322 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
323 } else if (landLineNumber.getPhoneNumber() == null) {
325 throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
326 } else if (landLineNumber.getPhoneNumber() < 1) {
328 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
331 // Set created instance
332 landLineNumber.setPhoneEntryCreated(new GregorianCalendar());
335 this.getEntityManager().persist(landLineNumber);
338 this.getEntityManager().flush();
341 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
343 // Set land-line number in contact
344 managedContact.setContactLandLineNumber(landLineNumber);
347 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
350 return managedContact;
354 public Contact linkNewMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
356 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
358 // Is the contact set?
359 if (null == contact) {
361 throw new NullPointerException("contact is null"); //NOI18N
362 } else if (contact.getContactId() == null) {
363 // ... and throw again
364 throw new NullPointerException("contact.contactId is null"); //NOI18N
365 } else if (contact.getContactId() < 1) {
367 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
368 } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
369 // Not set cell phone instance
370 throw new PhoneNumberAlreadyLinkedException(mobileNumber);
371 } else if (null == mobileNumber) {
373 throw new NullPointerException("mobileNumber is null"); //NOI18N
374 } else if (mobileNumber.getPhoneId() instanceof Long) {
376 throw new IllegalStateException(MessageFormat.format("mobileNumber.phoneId={0} is not null", mobileNumber.getPhoneId())); //NOI18N
377 } else if (mobileNumber.getMobileProvider() == null) {
379 throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
380 } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
382 throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
383 } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
385 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
388 // Set created instance
389 mobileNumber.setPhoneEntryCreated(new GregorianCalendar());
392 this.getEntityManager().persist(mobileNumber);
395 this.getEntityManager().flush();
398 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
400 // Set land-line number in contact
401 managedContact.setContactMobileNumber(mobileNumber);
404 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
407 return managedContact;
411 public Contact unlinkFaxDataFromContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberNotLinkedException {
413 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
415 // Is the contact set?
416 if (null == contact) {
418 throw new NullPointerException("contact is null"); //NOI18N
419 } else if (contact.getContactId() == null) {
420 // ... and throw again
421 throw new NullPointerException("contact.contactId is null"); //NOI18N
422 } else if (contact.getContactId() < 1) {
424 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
425 } else if (contact.getContactFaxNumber() == null) {
426 // Not set cell phone instance
427 throw new PhoneNumberNotLinkedException(faxNumber);
428 } else if (contact.getContactFaxNumber().getPhoneId() == null) {
430 throw new NullPointerException("contact.contactFaxNumber.phoneId is null"); //NOI18N
431 } else if (contact.getContactFaxNumber().getPhoneId() < 1) {
433 throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} is invalid.", contact.getContactFaxNumber().getPhoneId())); //NOI18N
434 } else if (!Objects.equals(faxNumber.getPhoneId(), contact.getContactFaxNumber().getPhoneId())) {
436 throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} and faxNumber.phoneId={1} are not the same.", contact.getContactFaxNumber().getPhoneId(), faxNumber.getPhoneId())); //NOI18N
440 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
442 // Remove it from contact
443 managedContact.setContactFaxNumber(null);
446 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
449 return managedContact;
453 public Contact unlinkLandLineDataFromContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberNotLinkedException {
455 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
457 // Is the contact set?
458 if (null == contact) {
460 throw new NullPointerException("contact is null"); //NOI18N
461 } else if (contact.getContactId() == null) {
462 // ... and throw again
463 throw new NullPointerException("contact.contactId is null"); //NOI18N
464 } else if (contact.getContactId() < 1) {
466 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
467 } else if (contact.getContactLandLineNumber() == null) {
468 // Not set cell phone instance
469 throw new PhoneNumberNotLinkedException(landLineNumber);
470 } else if (contact.getContactLandLineNumber().getPhoneId() == null) {
472 throw new NullPointerException("contact.contactLandLineNumber.phoneId is null"); //NOI18N
473 } else if (contact.getContactLandLineNumber().getPhoneId() < 1) {
475 throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} is invalid.", contact.getContactLandLineNumber().getPhoneId())); //NOI18N
476 } else if (!Objects.equals(landLineNumber.getPhoneId(), contact.getContactLandLineNumber().getPhoneId())) {
478 throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} and landLineNumber.phoneId={1} are not the same.", contact.getContactLandLineNumber().getPhoneId(), landLineNumber.getPhoneId())); //NOI18N
482 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
484 // Remove it from contact
485 managedContact.setContactLandLineNumber(null);
488 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
491 return managedContact;
495 public Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberNotLinkedException {
497 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
499 // Is the contact set?
500 if (null == contact) {
502 throw new NullPointerException("contact is null"); //NOI18N
503 } else if (contact.getContactId() == null) {
504 // ... and throw again
505 throw new NullPointerException("contact.contactId is null"); //NOI18N
506 } else if (contact.getContactId() < 1) {
508 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
509 } else if (contact.getContactMobileNumber() == null) {
510 // Not set cell phone instance
511 throw new PhoneNumberNotLinkedException(mobileNumber);
512 } else if (contact.getContactMobileNumber().getPhoneId() == null) {
514 throw new NullPointerException("contact.contactMobileNumber.phoneId is null"); //NOI18N
515 } else if (contact.getContactMobileNumber().getPhoneId() < 1) {
517 throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} is invalid.", contact.getContactMobileNumber().getPhoneId())); //NOI18N
518 } else if (!Objects.equals(mobileNumber.getPhoneId(), contact.getContactMobileNumber().getPhoneId())) {
520 throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} and mobileNumber.phoneId={1} are not the same.", contact.getContactMobileNumber().getPhoneId(), mobileNumber.getPhoneId())); //NOI18N
524 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
526 // Remove it from contact
527 managedContact.setContactMobileNumber(null);
530 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
533 return managedContact;