2 * Copyright (C) 2016, 2017 Roland Häder
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.addressbook.database.BaseAddressbookDatabaseBean;
25 import org.mxchange.jcontacts.contact.Contact;
26 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
27 import org.mxchange.jcontacts.contact.UserContact;
28 import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
29 import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
30 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
31 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
32 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
35 * A session EJB for administrative contact's phone number purposes
37 * @author Roland Häder<roland@mxchange.org>
39 @Stateless (name = "adminContactPhone", description = "An administrative bean handling contact's phone data")
40 public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
45 private static final long serialVersionUID = 189_217_561_460_237_108L;
51 private ContactSessionBeanRemote contactBean;
56 public AddressbookAdminContactPhoneSessionBean () {
57 // Call super constructor
62 public Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
64 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
66 // Is the contact set?
67 if (null == contact) {
69 throw new NullPointerException("contact is null"); //NOI18N
70 } else if (contact.getContactId() == null) {
71 // ... and throw again
72 throw new NullPointerException("contact.contactId is null"); //NOI18N
73 } else if (contact.getContactId() < 1) {
75 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
76 } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
77 // Not set cell phone instance
78 throw new PhoneNumberAlreadyLinkedException(faxNumber);
79 } else if (null == faxNumber) {
81 throw new NullPointerException("faxNumber is null"); //NOI18N
82 } else if (faxNumber.getPhoneId() == null) {
84 throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
85 } else if (faxNumber.getPhoneId() < 1) {
87 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid", faxNumber.getPhoneId())); //NOI18N
88 } else if (faxNumber.getPhoneCountry() == null) {
90 throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
91 } else if (faxNumber.getPhoneAreaCode() == null) {
93 throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
94 } else if (faxNumber.getPhoneAreaCode() < 1) {
96 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
97 } else if (faxNumber.getPhoneNumber() == null) {
99 throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
100 } else if (faxNumber.getPhoneNumber() < 1) {
102 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
106 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
108 // Merge phone number
109 DialableFaxNumber managedNumber = this.getEntityManager().merge(faxNumber);
111 // Set fax number in contact
112 managedContact.setContactFaxNumber(managedNumber);
115 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
118 return managedContact;
122 public Contact linkExistingLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
124 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
126 // Is the contact set?
127 if (null == contact) {
129 throw new NullPointerException("contact is null"); //NOI18N
130 } else if (contact.getContactId() == null) {
131 // ... and throw again
132 throw new NullPointerException("contact.contactId is null"); //NOI18N
133 } else if (contact.getContactId() < 1) {
135 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
136 } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
137 // Not set cell phone instance
138 throw new PhoneNumberAlreadyLinkedException(landLineNumber);
139 } else if (null == landLineNumber) {
141 throw new NullPointerException("landLineNumber is null"); //NOI18N
142 } else if (landLineNumber.getPhoneId() == null) {
144 throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
145 } else if (landLineNumber.getPhoneId() < 1) {
147 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid", landLineNumber.getPhoneId())); //NOI18N
148 } else if (landLineNumber.getPhoneCountry() == null) {
150 throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
151 } else if (landLineNumber.getPhoneAreaCode() == null) {
153 throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
154 } else if (landLineNumber.getPhoneAreaCode() < 1) {
156 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
157 } else if (landLineNumber.getPhoneNumber() == null) {
159 throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
160 } else if (landLineNumber.getPhoneNumber() < 1) {
162 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
166 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
168 // Merge phone number
169 DialableLandLineNumber managedNumber = this.getEntityManager().merge(landLineNumber);
171 // Set fax number in contact
172 managedContact.setContactLandLineNumber(managedNumber);
175 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
178 return managedContact;
182 public Contact linkExistingMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
184 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
186 // Is the contact set?
187 if (null == contact) {
189 throw new NullPointerException("contact is null"); //NOI18N
190 } else if (contact.getContactId() == null) {
191 // ... and throw again
192 throw new NullPointerException("contact.contactId is null"); //NOI18N
193 } else if (contact.getContactId() < 1) {
195 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
196 } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
197 // Not set cell phone instance
198 throw new PhoneNumberAlreadyLinkedException(mobileNumber);
199 } else if (null == mobileNumber) {
201 throw new NullPointerException("mobileNumber is null"); //NOI18N
202 } else if (mobileNumber.getPhoneId() == null) {
204 throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
205 } else if (mobileNumber.getPhoneId() < 1) {
207 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
208 } else if (mobileNumber.getMobileProvider() == null) {
210 throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
211 } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
213 throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
214 } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
216 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
220 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
222 // Merge phone number
223 DialableMobileNumber managedNumber = this.getEntityManager().merge(mobileNumber);
225 // Set fax number in contact
226 managedContact.setContactMobileNumber(managedNumber);
229 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkExistingMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
232 return managedContact;
236 public Contact linkNewFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
238 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
240 // Is the contact set?
241 if (null == contact) {
243 throw new NullPointerException("contact is null"); //NOI18N
244 } else if (contact.getContactId() == null) {
245 // ... and throw again
246 throw new NullPointerException("contact.contactId is null"); //NOI18N
247 } else if (contact.getContactId() < 1) {
249 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
250 } else if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
251 // Not set cell phone instance
252 throw new PhoneNumberAlreadyLinkedException(faxNumber);
253 } else if (null == faxNumber) {
255 throw new NullPointerException("faxNumber is null"); //NOI18N
256 } else if (faxNumber.getPhoneId() instanceof Long) {
258 throw new IllegalStateException(MessageFormat.format("faxNumber.phoneId={0} is not null", faxNumber.getPhoneId())); //NOI18N
259 } else if (faxNumber.getPhoneCountry() == null) {
261 throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18N
262 } else if (faxNumber.getPhoneAreaCode() == null) {
264 throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18N
265 } else if (faxNumber.getPhoneAreaCode() < 1) {
267 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is not valid", faxNumber.getPhoneAreaCode())); //NOI18N
268 } else if (faxNumber.getPhoneNumber() == null) {
270 throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18N
271 } else if (faxNumber.getPhoneNumber() < 1) {
273 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is not valid", faxNumber.getPhoneNumber())); //NOI18N
276 // Set created instance
277 faxNumber.setPhoneEntryCreated(new GregorianCalendar());
280 this.getEntityManager().persist(faxNumber);
283 this.getEntityManager().flush();
286 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
288 // Set fax number in contact
289 managedContact.setContactFaxNumber(faxNumber);
292 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewFaxNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
295 return managedContact;
299 public Contact linkNewLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException {
301 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
303 // Is the contact set?
304 if (null == contact) {
306 throw new NullPointerException("contact is null"); //NOI18N
307 } else if (contact.getContactId() == null) {
308 // ... and throw again
309 throw new NullPointerException("contact.contactId is null"); //NOI18N
310 } else if (contact.getContactId() < 1) {
312 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
313 } else if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
314 // Not set cell phone instance
315 throw new PhoneNumberAlreadyLinkedException(landLineNumber);
316 } else if (null == landLineNumber) {
318 throw new NullPointerException("landLineNumber is null"); //NOI18N
319 } else if (landLineNumber.getPhoneId() instanceof Long) {
321 throw new IllegalStateException(MessageFormat.format("landLineNumber.phoneId={0} is not null", landLineNumber.getPhoneId())); //NOI18N
322 } else if (landLineNumber.getPhoneCountry() == null) {
324 throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18N
325 } else if (landLineNumber.getPhoneAreaCode() == null) {
327 throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18N
328 } else if (landLineNumber.getPhoneAreaCode() < 1) {
330 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is not valid", landLineNumber.getPhoneAreaCode())); //NOI18N
331 } else if (landLineNumber.getPhoneNumber() == null) {
333 throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18N
334 } else if (landLineNumber.getPhoneNumber() < 1) {
336 throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is not valid", landLineNumber.getPhoneNumber())); //NOI18N
339 // Set created instance
340 landLineNumber.setPhoneEntryCreated(new GregorianCalendar());
343 this.getEntityManager().persist(landLineNumber);
346 this.getEntityManager().flush();
349 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
351 // Set land-line number in contact
352 managedContact.setContactLandLineNumber(landLineNumber);
355 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewLandLineNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
358 return managedContact;
362 public Contact linkNewMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException {
364 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
366 // Is the contact set?
367 if (null == contact) {
369 throw new NullPointerException("contact is null"); //NOI18N
370 } else if (contact.getContactId() == null) {
371 // ... and throw again
372 throw new NullPointerException("contact.contactId is null"); //NOI18N
373 } else if (contact.getContactId() < 1) {
375 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
376 } else if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
377 // Not set cell phone instance
378 throw new PhoneNumberAlreadyLinkedException(mobileNumber);
379 } else if (null == mobileNumber) {
381 throw new NullPointerException("mobileNumber is null"); //NOI18N
382 } else if (mobileNumber.getPhoneId() instanceof Long) {
384 throw new IllegalStateException(MessageFormat.format("mobileNumber.phoneId={0} is not null", mobileNumber.getPhoneId())); //NOI18N
385 } else if (mobileNumber.getMobileProvider() == null) {
387 throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
388 } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
390 throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
391 } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
393 throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
396 // Set created instance
397 mobileNumber.setPhoneEntryCreated(new GregorianCalendar());
400 this.getEntityManager().persist(mobileNumber);
403 this.getEntityManager().flush();
406 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
408 // Set land-line number in contact
409 managedContact.setContactMobileNumber(mobileNumber);
412 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.linkNewMobileNumberWithContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
415 return managedContact;
419 public Contact unlinkFaxDataFromContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberNotLinkedException {
421 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: contact={1},faxNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, faxNumber)); //NOI18N
423 // Is the contact set?
424 if (null == contact) {
426 throw new NullPointerException("contact is null"); //NOI18N
427 } else if (contact.getContactId() == null) {
428 // ... and throw again
429 throw new NullPointerException("contact.contactId is null"); //NOI18N
430 } else if (contact.getContactId() < 1) {
432 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
433 } else if (contact.getContactFaxNumber() == null) {
434 // Not set cell phone instance
435 throw new PhoneNumberNotLinkedException(faxNumber);
436 } else if (contact.getContactFaxNumber().getPhoneId() == null) {
438 throw new NullPointerException("contact.contactFaxNumber.phoneId is null"); //NOI18N
439 } else if (contact.getContactFaxNumber().getPhoneId() < 1) {
441 throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} is invalid.", contact.getContactFaxNumber().getPhoneId())); //NOI18N
442 } else if (!Objects.equals(faxNumber.getPhoneId(), contact.getContactFaxNumber().getPhoneId())) {
444 throw new IllegalArgumentException(MessageFormat.format("contact.contactFaxNumber.phoneId={0} and faxNumber.phoneId={1} are not the same.", contact.getContactFaxNumber().getPhoneId(), faxNumber.getPhoneId())); //NOI18N
448 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
450 // Remove it from contact
451 managedContact.setContactFaxNumber(null);
454 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkFaxDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
457 return managedContact;
461 public Contact unlinkLandLineDataFromContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberNotLinkedException {
463 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: contact={1},landLineNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, landLineNumber)); //NOI18N
465 // Is the contact set?
466 if (null == contact) {
468 throw new NullPointerException("contact is null"); //NOI18N
469 } else if (contact.getContactId() == null) {
470 // ... and throw again
471 throw new NullPointerException("contact.contactId is null"); //NOI18N
472 } else if (contact.getContactId() < 1) {
474 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
475 } else if (contact.getContactLandLineNumber() == null) {
476 // Not set cell phone instance
477 throw new PhoneNumberNotLinkedException(landLineNumber);
478 } else if (contact.getContactLandLineNumber().getPhoneId() == null) {
480 throw new NullPointerException("contact.contactLandLineNumber.phoneId is null"); //NOI18N
481 } else if (contact.getContactLandLineNumber().getPhoneId() < 1) {
483 throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} is invalid.", contact.getContactLandLineNumber().getPhoneId())); //NOI18N
484 } else if (!Objects.equals(landLineNumber.getPhoneId(), contact.getContactLandLineNumber().getPhoneId())) {
486 throw new IllegalArgumentException(MessageFormat.format("contact.contactLandLineNumber.phoneId={0} and landLineNumber.phoneId={1} are not the same.", contact.getContactLandLineNumber().getPhoneId(), landLineNumber.getPhoneId())); //NOI18N
490 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
492 // Remove it from contact
493 managedContact.setContactLandLineNumber(null);
496 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkLandLineDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
499 return managedContact;
503 public Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberNotLinkedException {
505 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: contact={1},mobileNumber={2} - CALLED!", this.getClass().getSimpleName(), contact, mobileNumber)); //NOI18N
507 // Is the contact set?
508 if (null == contact) {
510 throw new NullPointerException("contact is null"); //NOI18N
511 } else if (contact.getContactId() == null) {
512 // ... and throw again
513 throw new NullPointerException("contact.contactId is null"); //NOI18N
514 } else if (contact.getContactId() < 1) {
516 throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
517 } else if (contact.getContactMobileNumber() == null) {
518 // Not set cell phone instance
519 throw new PhoneNumberNotLinkedException(mobileNumber);
520 } else if (contact.getContactMobileNumber().getPhoneId() == null) {
522 throw new NullPointerException("contact.contactMobileNumber.phoneId is null"); //NOI18N
523 } else if (contact.getContactMobileNumber().getPhoneId() < 1) {
525 throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} is invalid.", contact.getContactMobileNumber().getPhoneId())); //NOI18N
526 } else if (!Objects.equals(mobileNumber.getPhoneId(), contact.getContactMobileNumber().getPhoneId())) {
528 throw new IllegalArgumentException(MessageFormat.format("contact.contactMobileNumber.phoneId={0} and mobileNumber.phoneId={1} are not the same.", contact.getContactMobileNumber().getPhoneId(), mobileNumber.getPhoneId())); //NOI18N
532 Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
534 // Remove it from contact
535 managedContact.setContactMobileNumber(null);
538 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.unlinkMobileDataFromContact: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
541 return managedContact;