From 60dcfafd8dd2db734224c7aebe75b52affe940a0 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Wed, 20 Apr 2016 16:06:05 +0200
Subject: [PATCH] Continued: - added business methods and implemented two -
 added trace log messages

---
 .../AddressbookContactSessionBean.java        | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java
index 553660e..9e8a66a 100644
--- a/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java
+++ b/src/java/org/mxchange/jcontacts/contact/AddressbookContactSessionBean.java
@@ -17,6 +17,7 @@
 package org.mxchange.jcontacts.contact;
 
 import java.text.MessageFormat;
+import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
@@ -44,6 +45,9 @@ public class AddressbookContactSessionBean extends BaseDatabaseBean implements C
 
 	@Override
 	public Contact findContactById (final Long contactId) throws ContactNotFoundException {
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: contactId={0} - CALLED!", contactId)); //NOI18N
+
 		// The parameter must be valid
 		if (null == contactId) {
 			// Throw NPE
@@ -66,13 +70,62 @@ public class AddressbookContactSessionBean extends BaseDatabaseBean implements C
 		try {
 			// Find a single result
 			contact = (Contact) query.getSingleResult();
+
+			// Log trace message
+			this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: Found contact={0}", contact)); //NOI18N
 		} catch (final NoResultException ex) {
 			// No result found
 			throw new ContactNotFoundException(contactId, ex);
 		}
 
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("findContactById: contact={0} - EXIT!", contact)); //NOI18N
+
 		// Return found instance
 		return contact;
 	}
 
+	@Override
+	@SuppressWarnings ("unchecked")
+	public List<Contact> getAllContacts () {
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace("getAllContacts - CALLED!"); //NOI18N
+
+		// Create query instance
+		Query query = this.getEntityManager().createNamedQuery("AllContacts", List.class); //NOI18N
+
+		// Get list
+		List<Contact> contacts = query.getResultList();
+
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("getAllContacts: contacts.size()={0} - EXIT!", contacts.size())); //NOI18N
+
+		// Return it
+		return contacts;
+	}
+
+	@Override
+	@SuppressWarnings ("unchecked")
+	public List<String> getEmailAddressList () {
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace("getEmailAddressList - CALLED!"); //NOI18N
+
+		// Create query instance
+		Query query = this.getEntityManager().createNamedQuery("AllContactEmailAddresses", List.class); //NOI18N
+
+		// Get list
+		List<String> emailAddresses = query.getResultList();
+
+		// Log trace message
+		this.getLoggerBeanLocal().logTrace(MessageFormat.format("getEmailAddressList: emailAddresses.size()={0} - EXIT!", emailAddresses.size())); //NOI18N
+
+		// Return it
+		return emailAddresses;
+	}
+
+	@Override
+	public void updateContactPersonalData (final Contact contact) {
+		throw new UnsupportedOperationException("Not supported yet."); //NOI18N
+	}
+
 }
-- 
2.39.5