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.cellphone.DialableCellphoneNumber;
41 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
42 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
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("setAllContactPhoneEntriesCreated: contact={0} - CALLED!", 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 DialableCellphoneNumber cellphoneNumber = contact.getContactCellphoneNumber();
131 this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllContactPhoneEntriesCreated: landLineNumber={0},faxNumber={1},cellphoneNumber={2}", landLineNumber, faxNumber, cellphoneNumber)); //NOI18N
133 // Is a phone number instance set?
134 if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
136 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //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("setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
147 // Set updated timestamp
148 faxNumber.setPhoneEntryCreated(new GregorianCalendar());
151 // Is a mobile number instance set?
152 if ((cellphoneNumber instanceof DialableCellphoneNumber) && (cellphoneNumber.getPhoneId() == null)) {
154 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntriesCreated: Setting created timestamp for cellphone number ..."); //NOI18N
156 // Set updated timestamp
157 cellphoneNumber.setPhoneEntryCreated(new GregorianCalendar());
161 this.getLoggerBeanLocal().logTrace("setAllContactPhoneEntriesCreated: EXIT!"); //NOI18N
165 * Returnes a detached instance from given cellphone instance
167 * @param cellphoneNumber Cellphone instance
168 * @param fetchedNumber Found cellphone number in database
170 * @return Detached instance
172 protected DialableCellphoneNumber getDetached (final DialableCellphoneNumber cellphoneNumber, final DialableCellphoneNumber fetchedNumber) {
174 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: cellphoneNumber={0},fetchedNumber={1} - CALLED!", cellphoneNumber, fetchedNumber)); //NOI18N
177 if (null == cellphoneNumber) {
179 throw new NullPointerException("cellphoneNumber is null"); //NOI18N
180 } else if (fetchedNumber.getPhoneId() == null) {
182 throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
186 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
188 // Init query instance
189 DialableCellphoneNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
192 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
195 DialableCellphoneNumber detachedNumber = null;
197 // Is there a difference?
198 if (!PhoneUtils.isSameCellphoneNumber(cellphoneNumber, fetchedNumber)) {
200 detachedNumber = this.getEntityManager().merge(foundNumber);
206 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
209 return detachedNumber;
213 * Returnes a detached instance from given land-line instance
215 * @param landLineNumber Land-line instance
216 * @param fetchedNumber Found land-line number in database
218 * @return Detached instance
220 protected DialableLandLineNumber getDetached (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) {
222 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: landLineNumber={0},fetchedNumber={1} - CALLED!", landLineNumber, fetchedNumber)); //NOI18N
225 if (null == landLineNumber) {
227 throw new NullPointerException("landLineNumber is null"); //NOI18N
228 } else if (fetchedNumber.getPhoneId() == null) {
230 throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
234 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
236 // Init query instance
237 DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
240 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
243 DialableLandLineNumber detachedNumber = null;
245 // Is there a difference?
246 if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
248 detachedNumber = this.getEntityManager().merge(foundNumber);
252 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
255 return detachedNumber;
259 * Returnes a detached instance from given fax instance
261 * @param faxNumber Fax instance
262 * @param fetchedNumber Found fax number in database
264 * @return Detached instance
266 protected DialableFaxNumber getDetached (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) {
268 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: faxNumber={0},fetchedNumber={1} - CALLED!", faxNumber, fetchedNumber)); //NOI18N
271 if (null == faxNumber) {
273 throw new NullPointerException("faxNumber is null"); //NOI18N
274 } else if (fetchedNumber.getPhoneId() == null) {
276 throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
280 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
282 // Init query instance
283 DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
286 this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
289 DialableFaxNumber detachedNumber = null;
291 // Is there a difference?
292 if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
294 detachedNumber = this.getEntityManager().merge(foundNumber);
298 this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
301 return detachedNumber;
305 * Merges given contact's data
307 * @param contact Contact instance to merge
309 * @return Detached contact instance
311 protected Contact mergeContactData (final Contact contact) {
313 this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: contact={0} - CALLED!", contact)); //NOI18N
315 // The contact instance must be valid
316 if (null == contact) {
318 throw new NullPointerException("contact is null"); //NOI18N
319 } else if (contact.getContactId() == null) {
321 throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
322 } else if (contact.getContactId() < 1) {
324 throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
327 // Set updated timestamp
328 contact.setContactUpdated(new GregorianCalendar());
330 // Get contact from it and find it
331 Contact foundContact = this.getEntityManager().find(contact.getClass(), contact.getContactId());
334 assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", contact.getContactId()); //NOI18N
337 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: contact.contactId={0}", foundContact.getContactId())); //NOI18N
339 // Merge contact instance
340 Contact detachedContact = this.getEntityManager().merge(foundContact);
343 detachedContact.copyAll(contact);
346 this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: detachedContact={0} - EXIT!", detachedContact)); //NOI18N
348 // Return detached contact
349 return detachedContact;
353 * Merges given (detached) contact's cellphone, land-line and fax numbers
355 * @param detachedContact Detached contact instance
357 protected void mergeContactsCellphoneLandLineFaxNumbers (final Contact detachedContact) {
359 this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactsCellphoneLandLineFaxNumbers: detachedContact={0} - CALLED!", detachedContact)); //NOI18N
361 // The contact instance must be valid
362 if (null == detachedContact) {
364 throw new NullPointerException("detachedContact is null"); //NOI18N
365 } else if (detachedContact.getContactId() == null) {
367 throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
368 } else if (detachedContact.getContactId() < 1) {
370 throw new IllegalStateException(MessageFormat.format("detachedContact.contactId={0} is not valid.", detachedContact.getContactId())); //NOI18N
374 DialableCellphoneNumber cellphone = detachedContact.getContactCellphoneNumber();
375 DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
376 DialableFaxNumber fax = detachedContact.getContactFaxNumber();
378 // Is there a cellphone instance set?
379 if (cellphone instanceof DialableCellphoneNumber) {
381 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N
384 DialableCellphoneNumber foundCellphone = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId());
387 assert (foundCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", foundCellphone.getPhoneId()); //NOI18N
389 // Then merge it, too
390 DialableCellphoneNumber detachedCellphone = this.getEntityManager().merge(foundCellphone);
393 assert (detachedCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", detachedCellphone.getPhoneId()); //NOI18N
396 detachedCellphone.copyAll(detachedContact.getContactCellphoneNumber());
399 detachedContact.setContactCellphoneNumber(detachedCellphone);
402 // Is there a fax instance set?
403 if (fax instanceof DialableFaxNumber) {
405 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); //NOI18N
408 DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId());
411 assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N
413 // Then merge it, too
414 DialableFaxNumber detachedFax = this.getEntityManager().merge(foundFax);
417 assert (detachedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", detachedFax.getPhoneId()); //NOI18N
420 detachedFax.copyAll(detachedContact.getContactFaxNumber());
423 detachedContact.setContactFaxNumber(detachedFax);
426 // Is there a fax instance set?
427 if (landLine instanceof DialableLandLineNumber) {
429 this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); //NOI18N
432 DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId());
435 assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N
437 // Then merge it, too
438 DialableLandLineNumber detachedLandLine = this.getEntityManager().merge(foundLandLine);
441 assert (detachedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", detachedLandLine.getPhoneId()); //NOI18N
444 detachedLandLine.copyAll(detachedContact.getContactLandLineNumber());
447 detachedContact.setContactLandLineNumber(detachedLandLine);
451 this.getLoggerBeanLocal().logTrace("mergeContactsCellphoneLandLineFaxNumbers: EXIT!"); //NOI18N
455 * Sends an email with given subject line, template name to given recipient
458 * @param subjectLine Subject line
459 * @param templateName Template name
460 * @param emailAddress Recipient's email address
461 * @param user User instance
462 * @param baseUrl Base URL
464 protected void sendEmail (final String subjectLine, final String templateName, final Address emailAddress, final User user, final String baseUrl) {
466 this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendEmail: subjectLine={0},templateName={1},emailAddress={2},user={3},baseUrl={4} - CALLED!", subjectLine, templateName, emailAddress, user, baseUrl)); //NOI18N
469 if (null == subjectLine) {
471 throw new NullPointerException("subjectLine is null"); //NOI18N
472 } else if (subjectLine.isEmpty()) {
474 throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
475 } else if (null == templateName) {
477 throw new NullPointerException("templateName is null"); //NOI18N
478 } else if (templateName.isEmpty()) {
480 throw new IllegalArgumentException("templateName is empty"); //NOI18N
481 } else if (null == emailAddress) {
483 throw new NullPointerException("emailAddress is null"); //NOI18N
486 // Prepare mail wrapper
487 WrapableEmailDelivery emailWrapper = new EmailDeliveryWrapper();
490 Properties variables = UserUtils.getAllUserFields(user);
493 variables.put("baseUrl", baseUrl); //NOI18N
496 // @TODO Language from message bundle
497 emailWrapper.setRecipient(emailAddress);
498 emailWrapper.setLocale(user.getUserLocale());
499 emailWrapper.setSubjectLine(subjectLine);
500 emailWrapper.setTemplateName(templateName);
501 emailWrapper.setTemplateVariables(variables);
504 // Send out email change
505 ObjectMessage message = this.session.createObjectMessage();
506 message.setObject(emailWrapper);
509 this.sendMessage(message, this.messageProducer);
510 } catch (final JMSException ex) {
512 throw new EJBException(ex);
516 this.getLoggerBeanLocal().logTrace("sendEmail: EXIT!"); //NOI18N
520 * Updates all contact's phone instances from other contact, both contacts
521 * should be the same.
523 * @param contact Contact to set instances
524 * @param other Other contact to get instances from
526 protected void setAllContactPhoneEntries (final Contact contact, final Contact other) {
528 this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllContactPhoneEntries: contact={0},other={1} - CALLED!", contact, other)); //NOI18N
530 // Both must be the same and not null
531 if (null == contact) {
533 throw new NullPointerException("contact is null"); //NOI18N
534 } else if (null == other) {
536 throw new NullPointerException("other is null"); //NOI18N
537 } else if (!Objects.equals(contact, other)) {
538 // Not same instances
539 throw new IllegalArgumentException(MessageFormat.format("contact={0} and other={1} are not equal!", contact, other)); //NOI18N
543 this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllContactPhoneEntries: other.contactCellphoneNumber={0}", other.getContactCellphoneNumber())); //NOI18N
545 // Is other cellphone not set?
546 if ((other.getContactCellphoneNumber() == null) || (PhoneUtils.isSameCellphoneNumber(contact.getContactCellphoneNumber(), other.getContactCellphoneNumber()))) {
548 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntries: Copying cellphone entry ..."); //NOI18N
550 // Is the fax number set?
551 if (other.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
552 // Copy cellphone number
553 contact.setContactCellphoneNumber(this.getDetached(other.getContactCellphoneNumber(), contact.getContactCellphoneNumber()));
556 contact.setContactCellphoneNumber(null);
561 this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllContactPhoneEntries: other.contactLandLineNumber={0}", other.getContactLandLineNumber())); //NOI18N
563 // Is other cellphone not set?
564 if ((other.getContactLandLineNumber() == null) || (PhoneUtils.isSameLandLineNumber(contact.getContactLandLineNumber(), other.getContactLandLineNumber()))) {
566 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntries: Copying land-line entry ..."); //NOI18N
568 // Is the land-line number set?
569 if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) {
570 // Copy land-line number
571 contact.setContactLandLineNumber(this.getDetached(other.getContactLandLineNumber(), contact.getContactLandLineNumber()));
574 contact.setContactLandLineNumber(null);
579 this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllContactPhoneEntries: other.contactFaxNumber={0}", other.getContactFaxNumber())); //NOI18N
581 // Is other cellphone not set?
582 if ((other.getContactFaxNumber() == null) || (PhoneUtils.isSameFaxNumber(contact.getContactFaxNumber(), other.getContactFaxNumber()))) {
584 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntries: Copying fax entry ..."); //NOI18N
586 // Is the fax number set?
587 if (other.getContactFaxNumber() instanceof DialableFaxNumber) {
589 contact.setContactFaxNumber(this.getDetached(other.getContactFaxNumber(), contact.getContactFaxNumber()));
592 contact.setContactFaxNumber(null);
597 this.getLoggerBeanLocal().logTrace("setAllContactPhoneEntries: EXIT!"); //NOI18N
601 * Updates all contacts's phone entry's updated timestamps
603 * @param contact Contact instance to update
604 * @param isCellphoneUnlinked Whether a cellphone entry has been unlinked in
606 * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
608 * @param isFaxUnlinked Whether a fax entry has been unlinked in contact
611 protected void setAllContactPhoneEntriesUpdated (final Contact contact, final boolean isCellphoneUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
613 this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllContactPhoneEntriesUpdated: contact={0},isCellphoneUnlinked={1},isLandlineUnlinked={2},isFaxUnlinked={3} - CALLED", contact, isCellphoneUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
615 // The contact instance must be valid
616 if (null == contact) {
618 throw new NullPointerException("contact is null"); //NOI18N
619 } else if (contact.getContactId() == null) {
621 throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
622 } else if (contact.getContactId() < 1) {
624 throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
627 // Get all phone instances
628 DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
629 DialableFaxNumber faxNumber = contact.getContactFaxNumber();
630 DialableCellphoneNumber cellphoneNumber = contact.getContactCellphoneNumber();
632 // Flags and instances must be constistent
633 if (isCellphoneUnlinked && cellphoneNumber instanceof DialableCellphoneNumber) {
635 throw new IllegalStateException("isCellPhoneUnlinked is TRUE, but cellphoneNumber is set."); //NOI18N
636 } else if (isLandlineUnlinked && landLineNumber instanceof DialableLandLineNumber) {
638 throw new IllegalStateException("isLandlineUnlinked is TRUE, but landLineNumber is set."); //NOI18N
639 } else if (isFaxUnlinked && faxNumber instanceof DialableFaxNumber) {
641 throw new IllegalStateException("isFaxUnlinked is TRUE, but faxNumber is set."); //NOI18N
644 // Is a phone number instance set?
645 if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() instanceof Long) && (landLineNumber.getPhoneId() > 0)) {
647 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ..."); //NOI18N
649 // Set updated timestamp
650 landLineNumber.setPhoneEntryUpdated(new GregorianCalendar());
653 // Is a fax number instance set?
654 if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() instanceof Long) && (faxNumber.getPhoneId() > 0)) {
656 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ..."); //NOI18N
658 // Set updated timestamp
659 faxNumber.setPhoneEntryUpdated(new GregorianCalendar());
662 // Is a mobile number instance set?
663 if ((cellphoneNumber instanceof DialableCellphoneNumber) && (cellphoneNumber.getPhoneId() instanceof Long) && (cellphoneNumber.getPhoneId() > 0)) {
665 this.getLoggerBeanLocal().logDebug("setAllContactPhoneEntriesUpdated: Setting updated timestamp for cellphone number ..."); //NOI18N
667 // Set updated timestamp
668 cellphoneNumber.setPhoneEntryUpdated(new GregorianCalendar());
672 this.getLoggerBeanLocal().logTrace("setAllContactPhoneEntriesUpdated: EXIT!"); //NOI18N