]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 20 Sep 2017 18:37:12 +0000 (20:37 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 20 Sep 2017 18:37:12 +0000 (20:37 +0200)
- need to have serial number unique accross project's JARs
- added named query SearchBranchOfficeById which searches for branch office
  entity by it's primary key

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BasicCompanyDataNotFoundException.java
src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeNotFoundException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/exceptions/employee/CompanyEmployeeNotFoundException.java
src/org/mxchange/jcontactsbusiness/exceptions/headquarters/CompanyHeadquartersNotFoundException.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/CompanyBranchOffice.java

index fc7df971aafee357d9c651cde657f6dd78ac9ac0..8f214c91cdcf6088bb6c61e42e42995c22bfe063 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.jcontactsbusiness.exceptions.basicdata;
 import java.text.MessageFormat;
 
 /**
- * An exception thrown when a contact (entity) has not found.
+ * An exception thrown when basic company data (entity) has not found.
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
@@ -28,7 +28,7 @@ public class BasicCompanyDataNotFoundException extends Exception {
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 23_759_801_876_416_568L;
+       private static final long serialVersionUID = 23_759_801_876_416_569L;
 
        /**
         * Constructor with business contact id
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeNotFoundException.java
new file mode 100644 (file)
index 0000000..5ee8a4a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.exceptions.branchoffice;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a branch office (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BranchOfficeNotFoundException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 23_759_801_876_416_570L;
+
+       /**
+        * Constructor with branch office id
+        * <p>
+        * @param branchOfficeId Branch office id
+        */
+       public BranchOfficeNotFoundException (final Long branchOfficeId) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Branch office with id {0} was not found.", branchOfficeId)); //NOI18N
+       }
+
+       /**
+        * Constructor with branch office id and causing exception
+        * <p>
+        * @param branchOfficeId Branch office id
+        * @param cause          Causing exception
+        */
+       public BranchOfficeNotFoundException (final Long branchOfficeId, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Branch office with id {0} was not found.", branchOfficeId), cause); //NOI18N
+       }
+
+       /**
+        * Constructor with email address and causing exception
+        * <p>
+        * @param emailAddress Email address
+        * @param cause        Causing exception
+        */
+       public BranchOfficeNotFoundException (final String emailAddress, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Branch office with email address {0} was not found.", emailAddress), cause); //NOI18N
+       }
+
+}
index 6e4495647c9ba9fe157d59a483af8ec1a681cc5c..21ee7501750b9627d3bfd24286f1baefa95565da 100644 (file)
@@ -28,7 +28,7 @@ public class CompanyEmployeeNotFoundException extends Exception {
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 23_759_801_876_416_568L;
+       private static final long serialVersionUID = 23_759_801_876_416_571L;
 
        /**
         * Constructor with company employee id
index ce1799ca38877704aebba5487cf26c49a4b3629c..738dd6ecaa7184f07d6615b138ef9f4cf46997ad 100644 (file)
@@ -28,7 +28,7 @@ public class CompanyHeadquartersNotFoundException extends Exception {
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 23_759_801_876_416_568L;
+       private static final long serialVersionUID = 23_759_801_876_416_572L;
 
        /**
         * Constructor with company headquarters id
index ee57cb5b089feffd382911c9b743ebf47b341126..4a855a8584b9a8cff170326a06270a8f86ee435b 100644 (file)
@@ -54,9 +54,12 @@ import org.mxchange.jusercore.model.user.User;
  */
 @Entity (name = "company_branch_offices")
 @Table (name = "company_branch_offices")
-@NamedQueries ({
-       @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC")
-})
+@NamedQueries (
+               {
+                       @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC"),
+                       @NamedQuery (name = "SearchBranchOfficeById", query = "SELECT bo FROM company_branch_offices AS bo WHERE bo.branchId = :branchOfficeId")
+               }
+)
 @SuppressWarnings ("PersistenceUnitPresent")
 public class CompanyBranchOffice implements BranchOffice {
 
@@ -180,11 +183,11 @@ public class CompanyBranchOffice implements BranchOffice {
         * Constructor with all required fields. This constructor may throw
         * exceptions when one parameter is not valid or NULL.
         * <p>
-        * @param branchCity         Branch office's city
-        * @param branchCompany      Branch office's assigned company
-        * @param branchCountry      Branch office's country
-        * @param branchStreet       Branch office's street
-        * @param branchZipCode      Branch office's ZIP code
+        * @param branchCity        Branch office's city
+        * @param branchCompany     Branch office's assigned company
+        * @param branchCountry     Branch office's country
+        * @param branchStreet      Branch office's street
+        * @param branchZipCode     Branch office's ZIP code
         * @param branchHouseNumber Branch office's house number
         */
        public CompanyBranchOffice (final String branchCity, final BusinessBasicData branchCompany, final Country branchCountry, final String branchStreet, final Integer branchZipCode, final Short branchHouseNumber) {