]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
added exceptions which origins from jcontacts-core
authorRoland Häder <roland@mxchange.org>
Thu, 8 Jun 2017 19:08:25 +0000 (21:08 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 8 Jun 2017 19:08:25 +0000 (21:08 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactAlreadyAddedException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactNotFoundException.java [new file with mode: 0644]

diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactAlreadyAddedException.java
new file mode 100644 (file)
index 0000000..82937c7
--- /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;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.BusinessContact;
+
+/**
+ * Thrown if the given BusinessContact instance is already added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BusinessContactAlreadyAddedException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 75_844_851_467L;
+
+       /**
+        * Constructor with a Contact instance
+        * <p>
+        * @param businessContact Business contact that is already added
+        */
+       public BusinessContactAlreadyAddedException (final BusinessContact businessContact) {
+               super(MessageFormat.format("Business contact with businessContactId={0} not found.", businessContact.getBusinessContactId())); //NOI18N
+       }
+
+       /**
+        * Default constructor, may be used if no contact instance is available
+        */
+       public BusinessContactAlreadyAddedException () {
+               super("BusinessContact already added"); //NOI18N
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessContactNotFoundException.java
new file mode 100644 (file)
index 0000000..6368041
--- /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;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a contact (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BusinessContactNotFoundException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 23_759_801_876_416_568L;
+
+       /**
+        * Constructor with business contact id
+        * <p>
+        * @param businessContactId Business contact id
+        */
+       public BusinessContactNotFoundException (final Long businessContactId) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Business contact with id {0} was not found.", businessContactId)); //NOI18N
+       }
+
+       /**
+        * Constructor with business contact id and causing exception
+        * <p>
+        * @param businessContactId Business contact id
+        * @param cause Causing exception
+        */
+       public BusinessContactNotFoundException (final Long businessContactId, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Business contact with id {0} was not found.", businessContactId), cause); //NOI18N
+       }
+
+       /**
+        * Constructor with email address and causing exception
+        * <p>
+        * @param emailAddress Email address
+        * @param cause Causing exception
+        */
+       public BusinessContactNotFoundException (final String emailAddress, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Business contact with email address {0} was not found.", emailAddress), cause); //NOI18N
+       }
+
+}