From: Roland Häder Date: Mon, 15 Jul 2019 04:44:57 +0000 (+0200) Subject: Don't cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e72796eec34ea68ae1ecbdfc02988c16afd341dd;p=pizzaservice-ejb.git Don't cherry-pick: - renamed package database -> enterprise - renamed *DatabaseBean -> *EnterpriseBean - renamed Financials* -> Pizza* Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java index 26cb8d3..faa9092 100644 --- a/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java b/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java index 34d8d38..6eb6649 100644 --- a/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java @@ -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 *

diff --git a/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java index dee137d..5386da4 100644 --- a/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java index 5e9d683..a35b113 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java index f83f144..3cae7d6 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java index 8e1c654..c0d5000 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java @@ -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; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java index d6f801e..185f4bc 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaAdminDepartmentSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaAdminDepartmentSessionBean.java index eceab73..d5bb927 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaAdminDepartmentSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaAdminDepartmentSessionBean.java @@ -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; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaDepartmentSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaDepartmentSessionBean.java index 7966d2f..777e4a3 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaDepartmentSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/department/PizzaDepartmentSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java index bd5dbb4..54761b5 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminEmployeeSessionBean.java @@ -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. diff --git a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java index aaf4a57..09cf268 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaEmployeeSessionBean.java @@ -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 index a24ae7d..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsAdminHeadquartersSessionBean.java +++ /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 . - */ -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 - *

- * @author Roland Häder - */ -@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 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. - *

- * @param headquarter Headquarters office being checked - *

- * @return Whether it has been found - */ - private boolean isHeadquarterFound (final Headquarter headquarter) { - // Get whole list - final List 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 index 76e671f..0000000 --- a/src/java/org/mxchange/jcontactsbusiness/model/headquarters/FinancialsHeadquartersSessionBean.java +++ /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 . - */ -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 - *

- * @author Roland Häder - */ -@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 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 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 index 0000000..0ad1cdd --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaAdminHeadquartersSessionBean.java @@ -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 . + */ +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 + *

+ * @author Roland Häder + */ +@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 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. + *

+ * @param headquarter Headquarters office being checked + *

+ * @return Whether it has been found + */ + private boolean isHeadquarterFound (final Headquarter headquarter) { + // Get whole list + final List 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 index 0000000..2f0e6bb --- /dev/null +++ b/src/java/org/mxchange/jcontactsbusiness/model/headquarters/PizzaHeadquartersSessionBean.java @@ -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 . + */ +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 + *

+ * @author Roland Häder + */ +@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 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 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/opening_time/PizzaAdminOpeningTimesSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaAdminOpeningTimesSessionBean.java index a916645..1418e16 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaAdminOpeningTimesSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaAdminOpeningTimesSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaOpeningTimesSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaOpeningTimesSessionBean.java index 3bf5072..bca9a6f 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaOpeningTimesSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/opening_time/PizzaOpeningTimesSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java b/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java index 2536b80..b27f356 100644 --- a/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java +++ b/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java @@ -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 diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java index 722df90..73754cc 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java index 3ae2b4c..eddf8ee 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java @@ -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 diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java index 4e9d24f..45d0264 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java index 3a1ec0d..a99267c 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java index 6cb4c06..e91b35d 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java index 7ffbbb9..d62171c 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java b/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java index 21a8a7e..b12a5c4 100644 --- a/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java +++ b/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java @@ -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 diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java index 663674b..03810b7 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/jusercore/model/user/password_history/PizzaUserPasswordHistorySessionBean.java b/src/java/org/mxchange/jusercore/model/user/password_history/PizzaUserPasswordHistorySessionBean.java index 3a3b475..0d309b7 100644 --- a/src/java/org/mxchange/jusercore/model/user/password_history/PizzaUserPasswordHistorySessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/password_history/PizzaUserPasswordHistorySessionBean.java @@ -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 diff --git a/src/java/org/mxchange/juserlogincore/model/user/login/PizzaUserLoginSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/login/PizzaUserLoginSessionBean.java index 0d2c387..9c3b67c 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/login/PizzaUserLoginSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/login/PizzaUserLoginSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java index 692f9a5..35257cc 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java index d4caca7..37a6651 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/pizzaapplication/model/basket/PizzaBasketSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/basket/PizzaBasketSessionBean.java index 561ad4f..4daede2 100644 --- a/src/java/org/mxchange/pizzaapplication/model/basket/PizzaBasketSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/basket/PizzaBasketSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/pizzaapplication/model/category/PizzaAdminCategorySessionBean.java b/src/java/org/mxchange/pizzaapplication/model/category/PizzaAdminCategorySessionBean.java index e535c32..c65ddd9 100644 --- a/src/java/org/mxchange/pizzaapplication/model/category/PizzaAdminCategorySessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/category/PizzaAdminCategorySessionBean.java @@ -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 diff --git a/src/java/org/mxchange/pizzaapplication/model/category/PizzaCategorySessionBean.java b/src/java/org/mxchange/pizzaapplication/model/category/PizzaCategorySessionBean.java index 5abb42e..6462ec0 100644 --- a/src/java/org/mxchange/pizzaapplication/model/category/PizzaCategorySessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/category/PizzaCategorySessionBean.java @@ -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 diff --git a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java index 219f447..48bccc4 100644 --- a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java @@ -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) diff --git a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java index f864c07..78fe234 100644 --- a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java @@ -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) diff --git a/src/java/org/mxchange/pizzaapplication/model/product/PizzaAdminProductSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/product/PizzaAdminProductSessionBean.java index 34bf1cc..4a8a02e 100644 --- a/src/java/org/mxchange/pizzaapplication/model/product/PizzaAdminProductSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/product/PizzaAdminProductSessionBean.java @@ -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 diff --git a/src/java/org/mxchange/pizzaapplication/model/product/PizzaProductSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/product/PizzaProductSessionBean.java index b5c3e47..136dd7f 100644 --- a/src/java/org/mxchange/pizzaapplication/model/product/PizzaProductSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/product/PizzaProductSessionBean.java @@ -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