]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 19 Aug 2017 18:33:19 +0000 (20:33 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 19 Aug 2017 18:33:19 +0000 (20:33 +0200)
- moved business (basic) data related exceptions to own package
- added exception when a company employee was not found
- some auto-formatting

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java [deleted file]
src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataNotFoundException.java [deleted file]
src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataNotFoundException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/exceptions/employee/CompanyEmployeeNotFoundException.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java

index 89015527915a7e2cb0e234d8f816f728b1d6212e..e702921c5e76ce2122d2406162645e50f1d10e1a 100644 (file)
@@ -33,6 +33,7 @@ import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.UserContact;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData;
 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
 import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
@@ -46,7 +47,6 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 
 /**
  * A POJO for company employees (including CEO)
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataAlreadyAddedException.java
deleted file mode 100644 (file)
index 50b2aaa..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.basicdata.BusinessBasicData;
-
-/**
- * Thrown if the given BusinessBasicData instance is already added
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class BusinessDataAlreadyAddedException 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 BusinessDataAlreadyAddedException (final BusinessBasicData businessContact) {
-               super(MessageFormat.format("Business contact with businessContactId={0} not found.", businessContact.getBusinessDataId())); //NOI18N
-       }
-
-       /**
-        * Default constructor, may be used if no contact instance is available
-        */
-       public BusinessDataAlreadyAddedException () {
-               super("BusinessContact already added"); //NOI18N
-       }
-
-}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/BusinessDataNotFoundException.java
deleted file mode 100644 (file)
index 918db2f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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 BusinessDataNotFoundException 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 BusinessDataNotFoundException (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 BusinessDataNotFoundException (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 BusinessDataNotFoundException (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
-       }
-
-}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java b/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataAlreadyAddedException.java
new file mode 100644 (file)
index 0000000..a60459c
--- /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.basicdata;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
+
+/**
+ * Thrown if the given BusinessBasicData instance is already added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BusinessDataAlreadyAddedException 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 BusinessDataAlreadyAddedException (final BusinessBasicData businessContact) {
+               super(MessageFormat.format("Business contact with businessContactId={0} not found.", businessContact.getBusinessDataId())); //NOI18N
+       }
+
+       /**
+        * Default constructor, may be used if no contact instance is available
+        */
+       public BusinessDataAlreadyAddedException () {
+               super("BusinessContact already added"); //NOI18N
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/basicdata/BusinessDataNotFoundException.java
new file mode 100644 (file)
index 0000000..a0f9977
--- /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.basicdata;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a contact (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class BusinessDataNotFoundException 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 BusinessDataNotFoundException (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 BusinessDataNotFoundException (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 BusinessDataNotFoundException (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
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/exceptions/employee/CompanyEmployeeNotFoundException.java b/src/org/mxchange/jcontactsbusiness/exceptions/employee/CompanyEmployeeNotFoundException.java
new file mode 100644 (file)
index 0000000..40ac5a4
--- /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.employee;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a contact (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CompanyEmployeeNotFoundException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 23_759_801_876_416_568L;
+
+       /**
+        * Constructor with company employee id
+        * <p>
+        * @param employeeId Company employee id
+        */
+       public CompanyEmployeeNotFoundException (final Long employeeId) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Company employee with id {0} was not found.", employeeId)); //NOI18N
+       }
+
+       /**
+        * Constructor with company employee id and causing exception
+        * <p>
+        * @param employeeId Company employee id
+        * @param cause      Causing exception
+        */
+       public CompanyEmployeeNotFoundException (final Long employeeId, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Company employee with id {0} was not found.", employeeId), cause); //NOI18N
+       }
+
+       /**
+        * Constructor with email address and causing exception
+        * <p>
+        * @param emailAddress Email address
+        * @param cause        Causing exception
+        */
+       public CompanyEmployeeNotFoundException (final String emailAddress, final Throwable cause) {
+               // Call super constructor with message and cause
+               super(MessageFormat.format("Company employee with email address {0} was not found.", emailAddress), cause); //NOI18N
+       }
+
+}
index ca8cc13a5e42d357bf826e4ab46f288c712d18f0..1262030c763e4c05d7d0c3e164c4865d484cc6c8 100644 (file)
@@ -52,7 +52,7 @@ public class BusinessOpeningTimes implements OpeningTimes {
         * Ending day of opening hours (if applyable)
         */
        @Column (name = "opening_times_end_day")
-       @Enumerated(EnumType.STRING)
+       @Enumerated (EnumType.STRING)
        private DayOfTheWeek endDay;
 
        /**
@@ -76,7 +76,7 @@ public class BusinessOpeningTimes implements OpeningTimes {
         */
        @Basic (optional = false)
        @Column (name = "opening_times_start_day", nullable = false)
-       @Enumerated(EnumType.STRING)
+       @Enumerated (EnumType.STRING)
        private DayOfTheWeek startDay;
 
        /**
@@ -96,10 +96,10 @@ public class BusinessOpeningTimes implements OpeningTimes {
        /**
         * Constructor with all field
         * <p>
-        * @param endDay End day
-        * @param endTime End time
-        * @param id Id number
-        * @param startDay Start day
+        * @param endDay    End day
+        * @param endTime   End time
+        * @param id        Id number
+        * @param startDay  Start day
         * @param startTime Start time
         */
        public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final Long id, final DayOfTheWeek startDay, final Calendar startTime) {
@@ -113,9 +113,9 @@ public class BusinessOpeningTimes implements OpeningTimes {
        /**
         * Constructor with all fields except id number
         * <p>
-        * @param endDay End day
-        * @param endTime End time
-        * @param startDay Start day
+        * @param endDay    End day
+        * @param endTime   End time
+        * @param startDay  Start day
         * @param startTime Start time
         */
        public BusinessOpeningTimes (final DayOfTheWeek endDay, final Calendar endTime, final DayOfTheWeek startDay, final Calendar startTime) {