From 4fb130efb4ecb03cfece9444cf4233d162fa726c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 10 May 2020 05:53:49 +0200 Subject: [PATCH] Continued: - added exception constructor with full department instance MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../department/DepartmentNotFoundException.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/department/DepartmentNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/department/DepartmentNotFoundException.java index 0efe7bb..9be1c4f 100644 --- a/src/org/mxchange/jcontactsbusiness/exceptions/department/DepartmentNotFoundException.java +++ b/src/org/mxchange/jcontactsbusiness/exceptions/department/DepartmentNotFoundException.java @@ -17,6 +17,7 @@ package org.mxchange.jcontactsbusiness.exceptions.department; import java.text.MessageFormat; +import org.mxchange.jcontactsbusiness.model.department.Department; /** * An exception thrown when a company department (entity) has not found. @@ -44,11 +45,21 @@ public class DepartmentNotFoundException extends Exception { * Constructor with company department id and causing exception *

* @param departmentId Company department id - * @param cause Causing exception + * @param cause Causing exception */ public DepartmentNotFoundException (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 } + /** + * Constructor with full department instance + *

+ * @param department Department instance + */ + public DepartmentNotFoundException (final Department department) { + // Invoke other constructor + this(department.getDepartmentId()); + } + } -- 2.39.5