]> git.mxchange.org Git - jjobs-ejb.git/blobdiff - src/java/org/mxchange/jcontactsbusiness/model/branchoffice/JobsBranchOfficeSessionBean.java
Please cherry-pick:
[jjobs-ejb.git] / src / java / org / mxchange / jcontactsbusiness / model / branchoffice / JobsBranchOfficeSessionBean.java
index ac6683f05696a7a8e184e255ab6df9b8d9c47fa2..76b81c09c6ee77caca8a36385beb2b10f73b47c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Häder
+ * Copyright (C) 2017 - 2020 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -19,10 +19,8 @@ package org.mxchange.jcontactsbusiness.model.branchoffice;
 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.branchoffice.BranchOfficeNotFoundException;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean;
 
 /**
  * A stateless session bean for general branch office purposes
@@ -30,7 +28,7 @@ import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "branchOffice", description = "A general statless bean for handling branch office data (all)")
-public class JobsBranchOfficeSessionBean extends BaseJobsDatabaseBean implements BranchOfficeSessionBeanRemote {
+public class JobsBranchOfficeSessionBean extends BaseJobsEnterpriseBean implements BranchOfficeSessionBeanRemote {
 
        /**
         * Serial number
@@ -39,7 +37,7 @@ public class JobsBranchOfficeSessionBean extends BaseJobsDatabaseBean implements
 
        @Override
        @SuppressWarnings ("unchecked")
-       public List<BranchOffice> allBranchOffices () {
+       public List<BranchOffice> fetchAllBranchOffices () {
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allBranchOffices: CALLED!", this.getClass().getSimpleName())); //NOI18N
 
@@ -56,37 +54,4 @@ public class JobsBranchOfficeSessionBean extends BaseJobsDatabaseBean implements
                return list;
        }
 
-       @Override
-       public BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               final Query query = this.getEntityManager().createNamedQuery("SearchBranchOfficeById", CompanyBranchOffice.class); //NOI18N
-
-               // Set parameter
-               query.setParameter("branchOfficeId", branchOfficeId); //NOI18N
-
-               // Get single instance
-               final BranchOffice branchOffice;
-
-               // Try to find a result
-               try {
-                       // Find a single result
-                       branchOffice = (BranchOffice) query.getSingleResult();
-
-                       // Log trace message
-                       this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: Found branchOffice={1}", this.getClass().getSimpleName(), branchOffice)); //NOI18N
-               } catch (final NoResultException ex) {
-                       // No result found
-                       throw new BranchOfficeNotFoundException(branchOfficeId, ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: branchOffice={1} - EXIT!", this.getClass().getSimpleName(), branchOffice)); //NOI18N
-
-               // Return it
-               return branchOffice;
-       }
-
 }