--- /dev/null
+/*
+ * 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
+ }
+
+}
*/
@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 {
* 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) {