--- /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.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
+ }
+
+}
--- /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.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
+ }
+
+}