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 General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (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 General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.pizzaaplication.database;
19 import java.text.MessageFormat;
20 import java.util.GregorianCalendar;
21 import java.util.Objects;
22 import java.util.Properties;
23 import javax.ejb.EJBException;
24 import javax.faces.FacesException;
25 import javax.jms.Connection;
26 import javax.jms.JMSException;
27 import javax.jms.MessageProducer;
28 import javax.jms.ObjectMessage;
29 import javax.jms.Queue;
30 import javax.jms.QueueConnectionFactory;
31 import javax.jms.Session;
32 import javax.mail.Address;
33 import javax.naming.Context;
34 import javax.naming.InitialContext;
35 import javax.naming.NamingException;
36 import org.mxchange.jcontacts.contact.Contact;
37 import org.mxchange.jcoreee.database.BaseDatabaseBean;
38 import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper;
39 import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
40 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
41 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
42 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
43 import org.mxchange.jphone.utils.PhoneUtils;
44 import org.mxchange.jusercore.model.user.User;
45 import org.mxchange.jusercore.model.user.UserUtils;
48 * A helper class for beans that access the database.
50 * @author Roland Haeder<roland@mxchange.org>
52 public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean {
57 private static final long serialVersionUID = 12_895_410_275_811_963L;
62 private Connection connection;
67 private MessageProducer messageProducer;
70 * Mailer message queue
77 private Session session;
80 * Protected constructor
82 protected BasePizzaDatabaseBean () {
83 // Call super constructor
87 // Get initial context
88 Context context = new InitialContext();
90 // Get factory from JMS resource
91 QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("jms/jlandingpage-queue-factory"); //NOI18N
94 this.queue = (Queue) context.lookup("jms/jlandingpage-email-queue"); //NOI18N
97 this.connection = connectionFactory.createConnection();
99 // Init session instance
100 this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
102 // And message producer
103 this.messageProducer = this.session.createProducer(this.queue);
104 } catch (final NamingException | JMSException e) {
105 // Continued to throw
106 throw new FacesException(e);
111 * Updates all contacts's phone entry's created timestamps
113 * @param contact Contact instance to update
115 protected void setAllContactPhoneEntriesCreated (final Contact contact) {
117 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
119 // The contact instance must be valid
120 if (null == contact) {
122 throw new NullPointerException("contact is null"); //NOI18N
125 // Get all phone instances
126 DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
127 DialableFaxNumber faxNumber = contact.getContactFaxNumber();
128 DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
131 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: landLineNumber={1},faxNumber={2},mobileNumber={3}", this.getClass().getSimpleName(), landLineNumber, faxNumber, mobileNumber)); //NOI18N
133 // Is a phone number instance set?
134 if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
136 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
138 // Set updated timestamp
139 landLineNumber.setPhoneEntryCreated(new GregorianCalendar());
142 // Is a fax number instance set?
143 if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
145 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
147 // Set updated timestamp
148 faxNumber.setPhoneEntryCreated(new GregorianCalendar());
151 // Is a mobile number instance set?
152 if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
154 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for cellphone number ...", this.getClass().getSimpleName())); //NOI18N
156 // Set updated timestamp
157 mobileNumber.setPhoneEntryCreated(new GregorianCalendar());
161 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: EXIT!", this.getClass().getSimpleName())); //NOI18N
165 * Returnes a managed instance from given mobile number
167 * @param mobileNumber Mobile number
168 * @param fetchedNumber Found mobile number in database
170 * @return Managed instance
172 protected DialableMobileNumber getManaged (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) {
174 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: mobileNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), mobileNumber, fetchedNumber)); //NOI18N
177 if (null == mobileNumber) {
179 throw new NullPointerException("mobileNumber is null"); //NOI18N
180 } else if (null == fetchedNumber) {
182 throw new NullPointerException("fetchedNumber is null"); //NOI18N
183 } else if (fetchedNumber.getPhoneId() == null) {
185 throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
189 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
192 DialableMobileNumber managedNumber = null;
194 // Is there a difference?
195 if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
197 managedNumber = this.getEntityManager().merge(fetchedNumber);
201 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
204 return managedNumber;
208 * Returnes a managed instance from given land-line number
210 * @param landLineNumber Land-line number
211 * @param fetchedNumber Found land-line number in database
213 * @return Managed instance
215 protected DialableLandLineNumber getManaged (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) {
217 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: landLineNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), landLineNumber, fetchedNumber)); //NOI18N
220 if (null == landLineNumber) {
222 throw new NullPointerException("landLineNumber is null"); //NOI18N
223 } else if (null == fetchedNumber) {
225 throw new NullPointerException("fetchedNumber is null"); //NOI18N
226 } else if (fetchedNumber.getPhoneId() == null) {
228 throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
232 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
235 DialableLandLineNumber managedNumber = null;
237 // Is there a difference?
238 if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
240 managedNumber = this.getEntityManager().merge(fetchedNumber);
244 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
247 return managedNumber;
251 * Returnes a managed instance from given fax number
253 * @param faxNumber Fax number
254 * @param fetchedNumber Found fax number in database
256 * @return Managed instance
258 protected DialableFaxNumber getManaged (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) {
260 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: faxNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), faxNumber, fetchedNumber)); //NOI18N
263 if (null == faxNumber) {
265 throw new NullPointerException("faxNumber is null"); //NOI18N
266 } else if (null == fetchedNumber) {
268 throw new NullPointerException("fetchedNumber is null"); //NOI18N
269 } else if (fetchedNumber.getPhoneId() == null) {
271 throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
275 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.getDetached: fetchedNumber.phoneId={1}", this.getClass().getSimpleName(), fetchedNumber.getPhoneId())); //NOI18N
278 DialableFaxNumber managedNumber = null;
280 // Is there a difference?
281 if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
283 managedNumber = this.getEntityManager().merge(fetchedNumber);
287 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
290 return managedNumber;
294 * Merges given (detached) contact's data
296 * @param detachedContact Contact instance to merge
298 * @return Detached contact instance
300 protected Contact mergeContactData (final Contact detachedContact) {
302 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: contact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
304 // The contact instance must be valid
305 if (null == detachedContact) {
307 throw new NullPointerException("detachedContact is null"); //NOI18N
308 } else if (detachedContact.getContactId() == null) {
310 throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
311 } else if (detachedContact.getContactId() < 1) {
313 throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
316 // Get contact from it and find it
317 Contact foundContact = this.getEntityManager().getReference(detachedContact.getClass(), detachedContact.getContactId());
320 assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", detachedContact.getContactId()); //NOI18N
323 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateUserPersonalData: foundContact.contactId={1}", this.getClass().getSimpleName(), foundContact.getContactId())); //NOI18N
325 // Merge contact instance
326 Contact managedContact = this.getEntityManager().merge(foundContact);
328 // Is a fax number set?
329 if (detachedContact.getContactFaxNumber() instanceof DialableFaxNumber) {
330 // Make fax numbers managed
331 managedContact.setContactFaxNumber(this.getManaged(detachedContact.getContactFaxNumber(), detachedContact.getContactFaxNumber()));
334 // Is a land-line number set?
335 if (detachedContact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
336 // Make land-line numbers managed
337 managedContact.setContactLandLineNumber(this.getManaged(detachedContact.getContactLandLineNumber(), detachedContact.getContactLandLineNumber()));
340 // Is a mobile number set?
341 if (detachedContact.getContactMobileNumber() instanceof DialableMobileNumber) {
342 // Make mobile numbers managed
343 managedContact.setContactMobileNumber(this.getManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber()));
346 // Set updated timestamp
347 managedContact.setContactUpdated(new GregorianCalendar());
350 managedContact.copyAll(detachedContact);
353 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
355 // Return detached contact
356 return managedContact;
360 * Merges given (detached) contact's cellphone, land-line and fax numbers
362 * @param detachedContact Detached contact instance
364 protected void mergeContactsMobileLandLineFaxNumbers (final Contact detachedContact) {
366 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactsMobileLandLineFaxNumbers: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
368 // The contact instance must be valid
369 if (null == detachedContact) {
371 throw new NullPointerException("detachedContact is null"); //NOI18N
372 } else if (detachedContact.getContactId() == null) {
374 throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
375 } else if (detachedContact.getContactId() < 1) {
377 throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
381 DialableMobileNumber cellphone = detachedContact.getContactMobileNumber();
382 DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
383 DialableFaxNumber fax = detachedContact.getContactFaxNumber();
385 // Is there a cellphone instance set?
386 if (cellphone instanceof DialableMobileNumber) {
388 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N
391 DialableMobileNumber foundMobile = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId());
394 assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
397 foundMobile.copyAll(detachedContact.getContactMobileNumber());
400 detachedContact.setContactMobileNumber(foundMobile);
403 // Is there a fax instance set?
404 if (fax instanceof DialableFaxNumber) {
406 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); //NOI18N
409 DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId());
412 foundFax.copyAll(detachedContact.getContactFaxNumber());
415 detachedContact.setContactFaxNumber(foundFax);
418 // Is there a fax instance set?
419 if (landLine instanceof DialableLandLineNumber) {
421 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); //NOI18N
424 DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId());
427 assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N
430 foundLandLine.copyAll(detachedContact.getContactLandLineNumber());
433 detachedContact.setContactLandLineNumber(foundLandLine);
437 this.getLoggerBeanLocal().logTrace("mergeContactsMobileLandLineFaxNumbers: EXIT!"); //NOI18N
441 * Sends an email with given subject line, template name to given recipient
444 * @param subjectLine Subject line
445 * @param templateName Template name
446 * @param emailAddress Recipient's email address
447 * @param user User instance
448 * @param baseUrl Base URL
450 protected void sendEmail (final String subjectLine, final String templateName, final Address emailAddress, final User user, final String baseUrl) {
452 this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendEmail: subjectLine={0},templateName={1},emailAddress={2},user={3},baseUrl={4} - CALLED!", subjectLine, templateName, emailAddress, user, baseUrl)); //NOI18N
455 if (null == subjectLine) {
457 throw new NullPointerException("subjectLine is null"); //NOI18N
458 } else if (subjectLine.isEmpty()) {
460 throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
461 } else if (null == templateName) {
463 throw new NullPointerException("templateName is null"); //NOI18N
464 } else if (templateName.isEmpty()) {
466 throw new IllegalArgumentException("templateName is empty"); //NOI18N
467 } else if (null == emailAddress) {
469 throw new NullPointerException("emailAddress is null"); //NOI18N
472 // Prepare mail wrapper
473 WrapableEmailDelivery emailWrapper = new EmailDeliveryWrapper();
476 Properties variables = UserUtils.getAllUserFields(user);
479 variables.put("baseUrl", baseUrl); //NOI18N
482 // @TODO Language from message bundle
483 emailWrapper.setRecipient(emailAddress);
484 emailWrapper.setLocale(user.getUserLocale());
485 emailWrapper.setSubjectLine(subjectLine);
486 emailWrapper.setTemplateName(templateName);
487 emailWrapper.setTemplateVariables(variables);
490 // Send out email change
491 ObjectMessage message = this.session.createObjectMessage();
492 message.setObject(emailWrapper);
495 this.sendMessage(message, this.messageProducer);
496 } catch (final JMSException ex) {
498 throw new EJBException(ex);
502 this.getLoggerBeanLocal().logTrace("sendEmail: EXIT!"); //NOI18N
506 * Updates all contact's phone instances from other contact, both contacts
507 * should be the same.
509 * @param contact Contact to set instances
510 * @param other Other contact to get instances from
512 protected void setAllContactPhoneEntries (final Contact contact, final Contact other) {
514 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1},other={2} - CALLED!", this.getClass().getSimpleName(), contact, other)); //NOI18N
516 // Both must be the same and not null
517 if (null == contact) {
519 throw new NullPointerException("contact is null"); //NOI18N
520 } else if (null == other) {
522 throw new NullPointerException("other is null"); //NOI18N
523 } else if (!Objects.equals(contact, other)) {
524 // Not same instances
525 throw new IllegalArgumentException(MessageFormat.format("contact={0} and other={1} are not equal!", contact, other)); //NOI18N
529 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactMobileNumber={0}", other.getContactMobileNumber())); //NOI18N
531 // Is other cellphone not set?
532 if ((other.getContactMobileNumber() == null) || (PhoneUtils.isSameMobileNumber(contact.getContactMobileNumber(), other.getContactMobileNumber()))) {
534 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying cellphone entry ...", this.getClass().getSimpleName())); //NOI18N
536 // Is the fax number set?
537 if (other.getContactMobileNumber() instanceof DialableMobileNumber) {
538 // Copy cellphone number
539 contact.setContactMobileNumber(this.getManaged(other.getContactMobileNumber(), contact.getContactMobileNumber()));
542 contact.setContactMobileNumber(null);
547 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactLandLineNumber={0}", other.getContactLandLineNumber())); //NOI18N
549 // Is other cellphone not set?
550 if ((other.getContactLandLineNumber() == null) || (PhoneUtils.isSameLandLineNumber(contact.getContactLandLineNumber(), other.getContactLandLineNumber()))) {
552 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying land-line entry ...", this.getClass().getSimpleName())); //NOI18N
554 // Is the land-line number set?
555 if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) {
556 // Copy land-line number
557 contact.setContactLandLineNumber(this.getManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber()));
560 contact.setContactLandLineNumber(null);
565 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactFaxNumber={1}", this.getClass().getSimpleName(), other.getContactFaxNumber())); //NOI18N
567 // Is other cellphone not set?
568 if ((other.getContactFaxNumber() == null) || (PhoneUtils.isSameFaxNumber(contact.getContactFaxNumber(), other.getContactFaxNumber()))) {
570 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying fax entry ...", this.getClass().getSimpleName())); //NOI18N
572 // Is the fax number set?
573 if (other.getContactFaxNumber() instanceof DialableFaxNumber) {
575 contact.setContactFaxNumber(this.getManaged(other.getContactFaxNumber(), contact.getContactFaxNumber()));
578 contact.setContactFaxNumber(null);
583 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: EXIT!", this.getClass().getSimpleName())); //NOI18N
587 * Updates all contacts's phone entry's updated timestamps
589 * @param contact Contact instance to update
590 * @param isMobileUnlinked Whether a cellphone entry has been unlinked in
592 * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
594 * @param isFaxUnlinked Whether a fax entry has been unlinked in contact
597 protected void setAllContactPhoneEntriesUpdated (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
599 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: contact={1},isMobileUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED", this.getClass().getSimpleName(), contact, isMobileUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
601 // The contact instance must be valid
602 if (null == contact) {
604 throw new NullPointerException("contact is null"); //NOI18N
605 } else if (contact.getContactId() == null) {
607 throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
608 } else if (contact.getContactId() < 1) {
610 throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
613 // Get all phone instances
614 DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
615 DialableFaxNumber faxNumber = contact.getContactFaxNumber();
616 DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
618 // Flags and instances must be constistent
619 if (isMobileUnlinked && mobileNumber instanceof DialableMobileNumber) {
621 throw new IllegalStateException("isCellPhoneUnlinked is TRUE, but mobileNumber is set."); //NOI18N
622 } else if (isLandlineUnlinked && landLineNumber instanceof DialableLandLineNumber) {
624 throw new IllegalStateException("isLandlineUnlinked is TRUE, but landLineNumber is set."); //NOI18N
625 } else if (isFaxUnlinked && faxNumber instanceof DialableFaxNumber) {
627 throw new IllegalStateException("isFaxUnlinked is TRUE, but faxNumber is set."); //NOI18N
630 // Is a phone number instance set?
631 if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() instanceof Long) && (landLineNumber.getPhoneId() > 0)) {
633 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
635 // Set updated timestamp
636 landLineNumber.setPhoneEntryUpdated(new GregorianCalendar());
639 // Is a fax number instance set?
640 if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() instanceof Long) && (faxNumber.getPhoneId() > 0)) {
642 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
644 // Set updated timestamp
645 faxNumber.setPhoneEntryUpdated(new GregorianCalendar());
648 // Is a mobile number instance set?
649 if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() instanceof Long) && (mobileNumber.getPhoneId() > 0)) {
651 this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for cellphone number ...", this.getClass().getSimpleName())); //NOI18N
653 // Set updated timestamp
654 mobileNumber.setPhoneEntryUpdated(new GregorianCalendar());
658 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: EXIT!", this.getClass().getSimpleName())); //NOI18N