]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 24 Sep 2017 20:58:15 +0000 (22:58 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 24 Sep 2017 20:59:26 +0000 (22:59 +0200)
- added checked exceptions for already/not found company departments

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/exceptions/branchoffice/BranchOfficeAlreadyAddedException.java
src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentAlreadyAddedException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentNotFoundException.java [new file with mode: 0644]

index fcbd471f2f29b9a60b010d8f221a7fe4fa20c6c2..0ca35e8fccecb383c22d5c915685f9401adaa596 100644 (file)
@@ -29,7 +29,7 @@ public class BranchOfficeAlreadyAddedException extends Exception {
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 75_844_851_467L;
+       private static final long serialVersionUID = 129_075_844_851_467L;
 
        /**
         * Constructor with a branch office instance
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentAlreadyAddedException.java
new file mode 100644 (file)
index 0000000..4ac6bd9
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.department;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.model.department.Department;
+
+/**
+ * Thrown if the given BusinessBasicData instance is already added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CompanyDepartmentAlreadyAddedException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 129_075_844_851_468L;
+
+       /**
+        * Constructor with a company department instance
+        * <p>
+        * @param department Company department that is already found
+        */
+       public CompanyDepartmentAlreadyAddedException (final Department department) {
+               super(MessageFormat.format("Company department with name {0} already created.", department.getDepartmentName()));
+       }
+
+       /**
+        * Default constructor, may be used if no contact instance is available
+        */
+       public CompanyDepartmentAlreadyAddedException () {
+               super("Company department already added"); //NOI18N
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/department/CompanyDepartmentNotFoundException.java
new file mode 100644 (file)
index 0000000..68e568e
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.department;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a company department (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CompanyDepartmentNotFoundException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 23_759_801_876_416_573L;
+
+       /**
+        * Constructor with company department id
+        * <p>
+        * @param departmentId Company department id
+        */
+       public CompanyDepartmentNotFoundException (final Long departmentId) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Company department with id {0} was not found.", departmentId)); //NOI18N
+       }
+
+       /**
+        * Constructor with company department id and causing exception
+        * <p>
+        * @param departmentId Company department id
+        * @param cause          Causing exception
+        */
+       public CompanyDepartmentNotFoundException (final Long departmentId, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Company department with id {0} was not found.", departmentId), cause); //NOI18N
+       }
+
+}