]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 20:33:22 +0000 (22:33 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 20:33:22 +0000 (22:33 +0200)
- removed find*ById() method + fixed interface name(s)

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jcontactsbusiness/model/employee/FinancialsAdminEmployeeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/employee/FinancialsEmployeeSessionBean.java

index 6ec5629be1a94c876e3090ca366239e7c9f30194..ecfb22a7c3f3f9a4ad2452c6e550959418c0ebd2 100644 (file)
@@ -25,7 +25,7 @@ import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminEmployee", description = "An administrative statless bean for handling company employees")
-public class FinancialsAdminCompanyEmployeeSessionBean extends BaseFinancialsDatabaseBean implements AdminCompanyEmployeeSessionBeanRemote {
+public class FinancialsAdminEmployeeSessionBean extends BaseFinancialsDatabaseBean implements AdminEmployeeSessionBeanRemote {
 
        /**
         * Serial number
@@ -35,7 +35,7 @@ public class FinancialsAdminCompanyEmployeeSessionBean extends BaseFinancialsDat
        /**
         * Default constructor
         */
-       public FinancialsAdminCompanyEmployeeSessionBean () {
+       public FinancialsAdminEmployeeSessionBean () {
                super();
        }
 
index 3919d0a3f234dcc7b1bd1caf9020994c8ce933e9..94df3ae54471863789f58bf55b93c67ee968cbc9 100644 (file)
@@ -19,9 +19,7 @@ package org.mxchange.jcontactsbusiness.model.employee;
 import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
-import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException;
 import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
 
 /**
@@ -30,7 +28,7 @@ import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "employee", description = "A general statless bean for handling company employees")
-public class FinancialsCompanyEmployeeSessionBean extends BaseFinancialsDatabaseBean implements CompanyEmployeeSessionBeanRemote {
+public class FinancialsEmployeeSessionBean extends BaseFinancialsDatabaseBean implements EmployeeSessionBeanRemote {
 
        /**
         * Serial number
@@ -40,69 +38,27 @@ public class FinancialsCompanyEmployeeSessionBean extends BaseFinancialsDatabase
        /**
         * Default constructor
         */
-       public FinancialsCompanyEmployeeSessionBean () {
+       public FinancialsEmployeeSessionBean () {
                super();
        }
 
        @Override
        @SuppressWarnings ("unchecked")
-       public List<Employee> allCompanyEmployees () {
+       public List<Employable> allEmployees () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCompanyEmployees(): CALLED!", this.getClass().getSimpleName())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allEmployees(): CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Get named query
                final Query query = this.getEntityManager().createNamedQuery("AllCompanyEmployees"); //NOI18N
 
                // Get list form it
-               final List<Employee> employees = query.getResultList();
+               final List<Employable> employees = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allCompanyEmployees(): employees.size()={1} - EXIT!", this.getClass().getSimpleName(), employees.size())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allEmployees(): employees.size()={1} - EXIT!", this.getClass().getSimpleName(), employees.size())); //NOI18N
 
                // Return it
                return employees;
        }
 
-       @Override
-       public Employee findCompanyEmployeeById (final Long employeeId) throws CompanyEmployeeNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById(): employeeId={1} - CALLED!", this.getClass().getSimpleName(), employeeId)); //NOI18N
-
-               // Is the employee id valid?
-               if (null == employeeId) {
-                       // Throw NPE
-                       throw new NullPointerException("employeeId is null"); //NOI18N
-               } else if (employeeId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is not valid", employeeId)); //NOI18N
-               }
-
-               // Now get named query
-               final Query query = this.getEntityManager().createNamedQuery("SearchCompanyEmployeeById"); //NOI18N
-
-               // Set parameter
-               query.setParameter("employeeId", employeeId); //NOI18N
-
-               // Declare instance
-               final Employee employee;
-
-               // Try to find a result
-               try {
-                       // Find a single result
-                       employee = (Employee) query.getSingleResult();
-
-                       // Log trace message
-                       this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById: Found employee={1}", this.getClass().getSimpleName(), employee)); //NOI18N
-               } catch (final NoResultException ex) {
-                       // No result found
-                       throw new CompanyEmployeeNotFoundException(employeeId, ex);
-               }
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findCompanyEmployeeById: employee={1} - EXIT!", this.getClass().getSimpleName(), employee)); //NOI18N
-
-               // Return found instance
-               return employee;
-       }
-
 }