]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Mon, 15 Jul 2019 04:44:57 +0000 (06:44 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 15 Jul 2019 04:44:57 +0000 (06:44 +0200)
- renamed package database -> enterprise
- renamed *DatabaseBean -> *EnterpriseBean
- renamed Financials* -> Pizza*

Signed-off-by: Roland Häder <roland@mxchange.org>
37 files changed:
src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java
src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java
src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/department/PizzaAdminDepartmentSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/department/PizzaDepartmentSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsAdminHeadquartersSessionBean.java [deleted file]
src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsHeadquartersSessionBean.java [deleted file]
src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaAdminHeadquartersSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaHeadquartersSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaAdminOpeningTimesSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaOpeningTimesSessionBean.java
src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java
src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java
src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java
src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java
src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java
src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java
src/java/org/mxchange/jusercore/model/user/password_history/PizzaUserPasswordHistorySessionBean.java
src/java/org/mxchange/juserlogincore/model/user/login/PizzaUserLoginSessionBean.java
src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java
src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java
src/java/org/mxchange/pizzaapplication/model/basket/PizzaBasketSessionBean.java
src/java/org/mxchange/pizzaapplication/model/category/PizzaAdminCategorySessionBean.java
src/java/org/mxchange/pizzaapplication/model/category/PizzaCategorySessionBean.java
src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java
src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java
src/java/org/mxchange/pizzaapplication/model/product/PizzaAdminProductSessionBean.java
src/java/org/mxchange/pizzaapplication/model/product/PizzaProductSessionBean.java

index 26cb8d301152f95c7bb8a1018c2cc134393114cc..faa9092d2280385e7766c9c22fc274ef7c02d9ca 100644 (file)
@@ -23,7 +23,7 @@ import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * An administrative contact EJB
index 34d8d38e55e04fee351b03419992709ab2733420..6eb664935ec325dd33f803aadb21ef3dfc9144a6 100644 (file)
@@ -24,7 +24,7 @@ import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 /**
  * A contact EJB
  * <p>
index dee137d52eda4ff3568ed33e32ca419fcef6cf1b..5386da4cd78a3adbc8e1706a3b52d4221dc8bc6e 100644 (file)
@@ -28,7 +28,7 @@ import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session EJB for administrative contact's phone number purposes
index 5e9d68313e98a6ba627640581361382a0a66603a..a35b11324b2494234abcc45ec7b8a05faa29e496 100644 (file)
@@ -25,7 +25,7 @@ import javax.ejb.Stateless;
 import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * An administrative stateless session bean for business data
index f83f1449b2afbb1a092aafa0dfa3cd79c16ac77e..3cae7d68ff3644bd8f720fc6cb98cc6d0ceb6e03 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless session bean for business data
index 8e1c65491f87cb6bef0fc286f063fef3ce324874..c0d50004ceb49edaab796b7c62f678b59c84aaf0 100644 (file)
@@ -25,7 +25,7 @@ import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlread
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
index d6f801e9e1adaf5e287cf5c0b8014a2f9df2953a..185f4bcbcc339a7ecff75e5696679a2461c7472c 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless session bean for general branch office purposes
index eceab73795fc55010f55d5258e762177739cfb45..d5bb9273a528e92b9d67c709dffe9baca6c30cfe 100644 (file)
@@ -23,7 +23,7 @@ import javax.ejb.EJB;
 import javax.ejb.Stateless;
 import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jfinancials.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
@@ -45,7 +45,7 @@ public class PizzaAdminDepartmentSessionBean extends BasePizzaEnterpriseBean imp
        /**
         * General department bean
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/department!org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote")
+       @EJB (lookup = "java:global/pizzaapplication-ejb/department!org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote")
        private DepartmentSessionBeanRemote departmentBean;
 
        /**
index 7966d2fbf312241896e269b54488eca7c0690b77..777e4a317b7a97ef5a51933245ebb8a779981313 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.jfinancials.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless session bean for general department purposes
index bd5dbb4af295887811dfd93eb2be21cce0eca0fb..54761b59ce3aead4ad95a96824df424ae6409a3c 100644 (file)
@@ -17,7 +17,7 @@
 package org.mxchange.jcontactsbusiness.model.employee;
 
 import javax.ejb.Stateless;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless bean for administrative purposes for company employees.
index aaf4a576d8d65558d444aaf7fa595c94fcc1ccf6..09cf26802999c328c8cb8b48b08b16ccbb3d699a 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless bean for general purposes for company employees.
@@ -38,11 +38,7 @@ public class PizzaEmployeeSessionBean extends BasePizzaEnterpriseBean implements
        /**
         * Default constructor
         */
-<<<<<<< HEAD:src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java
-       public PizzaCompanyEmployeeSessionBean () {
-=======
-       public FinancialsEmployeeSessionBean () {
->>>>>>> 0f4238c5... Please cherry-pick::src/java/org/mxchange/jcontactsbusiness/model/employee/FinancialsEmployeeSessionBean.java
+       public PizzaEmployeeSessionBean () {
                super();
        }
 
diff --git a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsAdminHeadquartersSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsAdminHeadquartersSessionBean.java
deleted file mode 100644 (file)
index a24ae7d..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.model.headquarters;
-
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import org.mxchange.jcontactsbusiness.exceptions.headquarters.HeadquartersAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A stateless session bean for administrative branch office purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "adminHeadquarter", description = "An administrative statless bean for handling branch office data (all)")
-public class FinancialsAdminHeadquartersSessionBean extends BaseFinancialsDatabaseBean implements AdminHeadquartersSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 58_467_386_571_701L;
-
-       /**
-        * General branch office bean
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.HeadquarterSessionBeanRemote")
-       private HeadquartersSessionBeanRemote headquartersBean;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsAdminHeadquartersSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public Headquarter addHeadquarters (final Headquarter headquarter) throws HeadquartersAlreadyAddedException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarters(): headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
-
-               // Validate parameter
-               if (null == headquarter) {
-                       // Throw NPE
-                       throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getHeadquartersId() instanceof Long) {
-                       // Should not happen
-                       throw new IllegalArgumentException("headquarter.branchId should not be set."); //NOI18N
-               } else if (this.isHeadquarterFound(headquarter)) {
-                       // Already added, abort here
-                       throw new HeadquartersAlreadyAddedException(headquarter);
-               }
-
-               // Add created timestamp
-               headquarter.setHeadquartersCreated(new Date());
-
-               // Is user instance set?
-               if (headquarter.getHeadquartersUserOwner() instanceof User) {
-                       // Get managed instance back
-                       final User managedUser = this.createManaged(headquarter.getHeadquartersUserOwner());
-
-                       // Set it back in branch office
-                       headquarter.setHeadquartersUserOwner(managedUser);
-               }
-
-               // Is user instance set?
-               if (headquarter.getHeadquartersCountry() instanceof Country) {
-                       // Get managed instance back
-                       final Country managedCountry = this.createManaged(headquarter.getHeadquartersCountry());
-
-                       // Set it back in branch office
-                       headquarter.setHeadquartersCountry(managedCountry);
-               }
-
-               // Set "created" timestamp on any number assigned
-               this.setAllPhoneEntriesCreated(headquarter);
-
-               // Get opening times
-               final List<OpeningTime> openingTimes = headquarter.getHeadquartersOpeningTimes();
-
-               // Debugging:
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.addHeadquarters(): headquarter.headquarterOpeningTimes={1}", this.getClass().getSimpleName(), openingTimes));
-
-               // Is opening times set and not empty?
-               if ((openingTimes instanceof List) && (!openingTimes.isEmpty())) {
-                       // Add created timestamp for all times
-                       this.setAllOpeningTimesCreated(openingTimes);
-               } else {
-                       // Set all to null
-                       headquarter.setHeadquartersOpeningTimes(null);
-               }
-
-               // Persist it
-               this.getEntityManager().persist(headquarter);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarters(): headquarter.branchId={1} - EXIT!", this.getClass().getSimpleName(), headquarter.getHeadquartersId())); //NOI18N
-
-               // Return updated instance
-               return headquarter;
-       }
-
-       /**
-        * Checks if given branch office's address is already persisted. The whole
-        * (persisted) list is being loaded and each address is being matched
-        * against the given branch office's address.
-        * <p>
-        * @param headquarter Headquarters office being checked
-        * <p>
-        * @return Whether it has been found
-        */
-       private boolean isHeadquarterFound (final Headquarter headquarter) {
-               // Get whole list
-               final List<Headquarter> headquarters = this.headquartersBean.allHeadquarters();
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all single addresses
-               for (final Headquarter hq : headquarters) {
-                       // Is the same address found?
-                       if (Headquarters.isSameAddress(hq, headquarter)) {
-                               // Found one
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
-}
diff --git a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsHeadquartersSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsHeadquartersSessionBean.java
deleted file mode 100644 (file)
index 76e671f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.model.headquarters;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.persistence.Query;
-import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
-
-/**
- * A stateless session bean for general headquarters purposes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Stateless (name = "headquarters", description = "A general statless bean for handling headquarters data (all)")
-public class FinancialsHeadquartersSessionBean extends BaseFinancialsDatabaseBean implements HeadquartersSessionBeanRemote {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 58_467_386_571_701L;
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public List<Headquarter> allHeadquarters () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Get query
-               final Query query = this.getEntityManager().createNamedQuery("AllHeadquarters"); //NOI18N
-
-               // Get list from it
-               final List<Headquarter> list = query.getResultList();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
-
-               // Return it
-               return list;
-       }
-
-}
diff --git a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaAdminHeadquartersSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaAdminHeadquartersSessionBean.java
new file mode 100644 (file)
index 0000000..0ad1cdd
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.headquarters;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.List;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import org.mxchange.jcontactsbusiness.exceptions.headquarters.HeadquartersAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jusercore.model.user.User;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
+
+/**
+ * A stateless session bean for administrative branch office purposes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "adminHeadquarter", description = "An administrative statless bean for handling branch office data (all)")
+public class PizzaAdminHeadquartersSessionBean extends BasePizzaEnterpriseBean implements AdminHeadquartersSessionBeanRemote {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 58_467_386_571_701L;
+
+       /**
+        * General branch office bean
+        */
+       @EJB (lookup = "java:global/pizzaapplication-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.HeadquarterSessionBeanRemote")
+       private HeadquartersSessionBeanRemote headquartersBean;
+
+       /**
+        * Default constructor
+        */
+       public PizzaAdminHeadquartersSessionBean () {
+               // Call super constructor
+               super();
+       }
+
+       @Override
+       public Headquarter addHeadquarters (final Headquarter headquarter) throws HeadquartersAlreadyAddedException {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarters(): headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
+
+               // Validate parameter
+               if (null == headquarter) {
+                       // Throw NPE
+                       throw new NullPointerException("headquarter is null"); //NOI18N
+               } else if (headquarter.getHeadquartersId() instanceof Long) {
+                       // Should not happen
+                       throw new IllegalArgumentException("headquarter.branchId should not be set."); //NOI18N
+               } else if (this.isHeadquarterFound(headquarter)) {
+                       // Already added, abort here
+                       throw new HeadquartersAlreadyAddedException(headquarter);
+               }
+
+               // Add created timestamp
+               headquarter.setHeadquartersCreated(new Date());
+
+               // Is user instance set?
+               if (headquarter.getHeadquartersUserOwner() instanceof User) {
+                       // Get managed instance back
+                       final User managedUser = this.createManaged(headquarter.getHeadquartersUserOwner());
+
+                       // Set it back in branch office
+                       headquarter.setHeadquartersUserOwner(managedUser);
+               }
+
+               // Is user instance set?
+               if (headquarter.getHeadquartersCountry() instanceof Country) {
+                       // Get managed instance back
+                       final Country managedCountry = this.createManaged(headquarter.getHeadquartersCountry());
+
+                       // Set it back in branch office
+                       headquarter.setHeadquartersCountry(managedCountry);
+               }
+
+               // Set "created" timestamp on any number assigned
+               this.setAllPhoneEntriesCreated(headquarter);
+
+               // Get opening times
+               final List<OpeningTime> openingTimes = headquarter.getHeadquartersOpeningTimes();
+
+               // Debugging:
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.addHeadquarters(): headquarter.headquarterOpeningTimes={1}", this.getClass().getSimpleName(), openingTimes));
+
+               // Is opening times set and not empty?
+               if ((openingTimes instanceof List) && (!openingTimes.isEmpty())) {
+                       // Add created timestamp for all times
+                       this.setAllOpeningTimesCreated(openingTimes);
+               } else {
+                       // Set all to null
+                       headquarter.setHeadquartersOpeningTimes(null);
+               }
+
+               // Persist it
+               this.getEntityManager().persist(headquarter);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addHeadquarters(): headquarter.branchId={1} - EXIT!", this.getClass().getSimpleName(), headquarter.getHeadquartersId())); //NOI18N
+
+               // Return updated instance
+               return headquarter;
+       }
+
+       /**
+        * Checks if given branch office's address is already persisted. The whole
+        * (persisted) list is being loaded and each address is being matched
+        * against the given branch office's address.
+        * <p>
+        * @param headquarter Headquarters office being checked
+        * <p>
+        * @return Whether it has been found
+        */
+       private boolean isHeadquarterFound (final Headquarter headquarter) {
+               // Get whole list
+               final List<Headquarter> headquarters = this.headquartersBean.allHeadquarters();
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Check all single addresses
+               for (final Headquarter hq : headquarters) {
+                       // Is the same address found?
+                       if (Headquarters.isSameAddress(hq, headquarter)) {
+                               // Found one
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaHeadquartersSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaHeadquartersSessionBean.java
new file mode 100644 (file)
index 0000000..2f0e6bb
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.headquarters;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.Query;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
+
+/**
+ * A stateless session bean for general headquarters purposes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "headquarters", description = "A general statless bean for handling headquarters data (all)")
+public class PizzaHeadquartersSessionBean extends BasePizzaEnterpriseBean implements HeadquartersSessionBeanRemote {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 58_467_386_571_701L;
+
+       @Override
+       @SuppressWarnings ("unchecked")
+       public List<Headquarter> allHeadquarters () {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+               // Get query
+               final Query query = this.getEntityManager().createNamedQuery("AllHeadquarters"); //NOI18N
+
+               // Get list from it
+               final List<Headquarter> list = query.getResultList();
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
+
+               // Return it
+               return list;
+       }
+
+}
index a916645705c6a5207ad87d2564a73cd23755613c..1418e16749fccbd063fa2cda5f895b1656da312b 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.jcontactsbusiness.model.opening_time;
 import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.Stateless;
-import org.mxchange.jfinancials.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless session bean for administrative opening times purposes
index 3bf50726b554594308d19c5b8b5a7ac381a2d18e..bca9a6f7d6670458a4fdb641ef0d7da8d855160b 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.jfinancials.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaapplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless session bean for general opening times purposes
index 2536b80ec4144064d0277589a079fe0c704128cb..b27f35671bf984c457cc70cf5e205cb2beea5de9 100644 (file)
@@ -21,7 +21,7 @@ import java.util.List;
 import javax.ejb.Singleton;
 import javax.ejb.Startup;
 import javax.persistence.Query;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A singleton EJB for country informations
index 722df902d6b21896dc5a12095ac8f01dbb421706..73754cc2a1c1f0bb8ce4ce0fa5ebd4a9fc41d194 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.Stateless;
 import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * Administrative singleton EJB for mobile provider informations
index 3ae2b4cc09615a91e6f775dc80b88c16f1dc105f..eddf8ee96ba825da7179534088367750fc93e98a 100644 (file)
@@ -21,7 +21,7 @@ import java.util.List;
 import javax.ejb.Singleton;
 import javax.ejb.Startup;
 import javax.persistence.Query;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A singleton EJB for mobile provider informations
index 4e9d24fb35ae5085b68dd8d565aa2b62260f5980..45d0264f8216be8083aafacfc12ace5763871bd7 100644 (file)
@@ -25,7 +25,7 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumbers;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * An EJB for administrative phone purposes
index 3a1ec0d41c385d5ea441f0e1f1e4bb561d7da3ff..a99267c46019d849ba841ee3029a24466e031cd6 100644 (file)
@@ -27,7 +27,7 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A general phone EJB
index 6cb4c06a7e7c9d322265910ca7f5b1c342f54e57..e91b35d85762c217c09c82d02dda88e88c7dbfab 100644 (file)
@@ -29,7 +29,7 @@ import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * An administrative user EJB
index 7ffbbb9940e4a43378a2e84c7b72c209190098d5..d62171c0adca13a71089629cf60a635cc186fd74 100644 (file)
@@ -42,7 +42,7 @@ import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A user EJB
index 21a8a7ecbff59b2b497564d5396fdc069f48b522..b12a5c4cb99ea46f3758ef19cd27256e8d43d1e3 100644 (file)
@@ -25,7 +25,7 @@ import javax.jms.Message;
 import javax.jms.MessageListener;
 import javax.jms.ObjectMessage;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A message-driven bean for adding user activity log
index 663674b707cdc8f05f4121e3400bd1afa5d8a0d0..03810b767949aee3140a5ea70fc3625de0c814ff 100644 (file)
@@ -28,7 +28,7 @@ import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
 import org.mxchange.jusercore.model.email_address.EmailAddressChange;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session-scoped bean for changing email addresses
index 3a3b475800b1ee385cc8499e74169185f2fed294..0d309b7d8143a28794ced90dfc92d42480bf0564 100644 (file)
@@ -21,7 +21,7 @@ import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A user password history EJB
index 0d2c387a6515af36a274930c33a04ffffe69ed62..9c3b67c0d97a8342e8443f52020aaa964a685fc4 100644 (file)
@@ -29,7 +29,7 @@ import org.mxchange.juserlogincore.container.login.LoginContainer;
 import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
 import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session EJB for user logins
index 692f9a53da7a4deee12323bffa4b0e4f9bcf642c..35257cc22a273c0d4eab93948b4121f3038e8e39 100644 (file)
@@ -30,7 +30,7 @@ import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session-scoped bean for user registration
index d4caca713d1f0f3f705b98c1696ce25d393fc3c5..37a665108c24a080cafc8bc99d94d21afce45332 100644 (file)
@@ -28,7 +28,7 @@ import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session-based EJB for resending confirmation links
index 561ad4f0710b8da6e637996c96de7726988322ee..4daede242d4db98a11ed93641c5c19e94252021f 100644 (file)
@@ -29,7 +29,7 @@ import org.mxchange.jshopcore.model.basket.ShopBasket;
 import org.mxchange.jshopcore.model.customer.ShopCustomerUtils;
 import org.mxchange.jshopcore.model.order.Orderable;
 import org.mxchange.jshopcore.model.order.ShopOrder;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A basket for orderable items
index e535c328d14262d54e20a7d70296ac88f1fbb027..c65ddd937a74b243a913acffa0178c20f6554fc9 100644 (file)
@@ -26,7 +26,7 @@ import org.mxchange.jproduct.exceptions.CategoryTitleAlreadyUsedException;
 import org.mxchange.jproduct.model.category.Category;
 import org.mxchange.jproduct.model.category.ProductCategory;
 import org.mxchange.jshopcore.model.category.AdminCategorySessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * An EJB for administrative access on categories
index 5abb42e5a8c9e5090958aac2cb7931598208cec4..6462ec026e21d0c6f7e0dc7748c1c2fd7ab3bb2e 100644 (file)
@@ -23,7 +23,7 @@ import javax.persistence.Query;
 import org.mxchange.jproduct.model.category.Category;
 import org.mxchange.jproduct.model.category.ProductCategory;
 import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * Main shop class
index 219f44714c333fee3aa8cd8af0e40a998c0f3bb8..48bccc4c5bef6292bd5c96c911f84c251fcdd191 100644 (file)
@@ -29,7 +29,7 @@ import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
 import org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException;
 import org.mxchange.jcustomercore.model.customer.Customer;
 import org.mxchange.jcustomercore.utils.CustomerUtils;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless administrative customer session-scoped bean (EJB)
index f864c07f54b9b4ed11ff90eee448b06a7d3d948e..78fe234a1f0bdc5d69b8e46ced5193e7470c2994 100644 (file)
@@ -23,7 +23,7 @@ import javax.persistence.Query;
 import org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException;
 import org.mxchange.jcustomercore.exceptions.CustomerNotFoundException;
 import org.mxchange.jcustomercore.model.customer.Customer;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A stateless customer session-scoped bean (EJB)
index 34bf1cc90f77898889eec2df2e29366fa024b4da..4a8a02e06888b9b84ce243436cadab68bce13f43 100644 (file)
@@ -28,7 +28,7 @@ import org.mxchange.jproduct.exceptions.ProductTitleAlreadyUsedException;
 import org.mxchange.jproduct.model.product.GenericProduct;
 import org.mxchange.jproduct.model.product.Product;
 import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session-scoped bean for non-administrative roles for products
index b5c3e470b5fbe7a1942d68f675ee764c20cd1db1..136dd7f3b53d8f5363c18e8938148e4d2505ea71 100644 (file)
@@ -25,7 +25,7 @@ import javax.ejb.Stateless;
 import org.mxchange.jproduct.model.product.Product;
 import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote;
 import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
-import org.mxchange.pizzaaplication.database.BasePizzaEnterpriseBean;
+import org.mxchange.pizzaaplication.enterpriseBasePizzaEnterpriseBean;
 
 /**
  * A session-scoped bean for non-administrative roles for products