From 63146d310df05848bab07a0b0b43a892101c1a3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 9 Sep 2017 14:18:10 +0200 Subject: [PATCH] Please cherry-pick: - introduced isSameCompanyNameAdded() which encapsulates checking for if a company name has already been used. This is, together with the thrown checked exception a last effort to prevent bad bad SqlException or any other "low-level" exception as they are more severage than this. - thumb of a rule: always pre-validate if all conditions are met (return "okay") prior doing risky things where uncontrolled exceptions may be thrown. - make company-owner (User), founder (Employee) and contact person (dito) managed before persisting the whole BasicData instance as this makes sure that no duplicates will end up in database MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../contact/PizzaAdminContactSessionBean.java | 2 +- .../contact/PizzaContactSessionBean.java | 2 +- .../PizzaAdminContactPhoneSessionBean.java | 12 +- .../PizzaAdminBusinessDataSessionBean.java | 76 +++++++++--- .../PizzaBusinessDataSessionBean.java | 3 +- .../PizzaAdminBranchOfficeSessionBean.java | 16 ++- .../PizzaBranchOfficeSessionBean.java | 3 +- .../PizzaAdminCompanyEmployeeSessionBean.java | 3 +- .../PizzaCompanyEmployeeSessionBean.java | 3 +- .../data/PizzaCountrySingletonBean.java | 2 +- .../PizzaAdminMobileProviderSessionBean.java | 2 +- .../PizzaMobileProviderSingletonBean.java | 2 +- .../phone/PizzaAdminPhoneSessionBean.java | 15 +-- .../phone/PizzaPhoneSessionBean.java | 14 +-- .../model/user/PizzaAdminUserSessionBean.java | 4 +- .../model/user/PizzaUserSessionBean.java | 18 +-- .../PizzaUserActivityLogMessageBean.java | 2 +- .../PizzaUserEmailChangeSessionBean.java | 2 +- .../PizzaUserRegistrationSessionBean.java | 2 +- .../database/BasePizzaDatabaseBean.java | 112 ++++++++++++------ .../PizzaAdminCustomerSessionBean.java | 4 +- 21 files changed, 196 insertions(+), 103 deletions(-) rename src/java/org/mxchange/jcontacts/{ => model}/contact/PizzaAdminContactSessionBean.java (99%) rename src/java/org/mxchange/jcontacts/{ => model}/contact/PizzaContactSessionBean.java (99%) rename src/java/org/mxchange/jcontacts/{ => model}/phone/PizzaAdminContactPhoneSessionBean.java (98%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/basicdata/PizzaAdminBusinessDataSessionBean.java (61%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/basicdata/PizzaBusinessDataSessionBean.java (97%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/branchoffice/PizzaAdminBranchOfficeSessionBean.java (85%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/branchoffice/PizzaBranchOfficeSessionBean.java (93%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/employee/PizzaAdminCompanyEmployeeSessionBean.java (90%) rename src/java/org/mxchange/jcontactsbusiness/{ => model}/employee/PizzaCompanyEmployeeSessionBean.java (96%) rename src/java/org/mxchange/jcountry/{ => model}/data/PizzaCountrySingletonBean.java (99%) rename src/java/org/mxchange/jphone/{ => model}/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java (98%) rename src/java/org/mxchange/jphone/{ => model}/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java (97%) rename src/java/org/mxchange/jphone/{ => model}/phonenumbers/phone/PizzaAdminPhoneSessionBean.java (96%) rename src/java/org/mxchange/jphone/{ => model}/phonenumbers/phone/PizzaPhoneSessionBean.java (94%) diff --git a/src/java/org/mxchange/jcontacts/contact/PizzaAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java similarity index 99% rename from src/java/org/mxchange/jcontacts/contact/PizzaAdminContactSessionBean.java rename to src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java index fe254f5..1ec9392 100644 --- a/src/java/org/mxchange/jcontacts/contact/PizzaAdminContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/contact/PizzaAdminContactSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontacts.contact; +package org.mxchange.jcontacts.model.contact; import java.text.MessageFormat; import java.util.GregorianCalendar; diff --git a/src/java/org/mxchange/jcontacts/contact/PizzaContactSessionBean.java b/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java similarity index 99% rename from src/java/org/mxchange/jcontacts/contact/PizzaContactSessionBean.java rename to src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java index f149355..854f43a 100644 --- a/src/java/org/mxchange/jcontacts/contact/PizzaContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/contact/PizzaContactSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontacts.contact; +package org.mxchange.jcontacts.model.contact; import java.text.MessageFormat; import java.util.Iterator; diff --git a/src/java/org/mxchange/jcontacts/phone/PizzaAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java similarity index 98% rename from src/java/org/mxchange/jcontacts/phone/PizzaAdminContactPhoneSessionBean.java rename to src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java index 0aa00fe..bff8e8f 100644 --- a/src/java/org/mxchange/jcontacts/phone/PizzaAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/phone/PizzaAdminContactPhoneSessionBean.java @@ -14,20 +14,20 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontacts.phone; +package org.mxchange.jcontacts.model.phone; import java.text.MessageFormat; import java.util.GregorianCalendar; import java.util.Objects; import javax.ejb.EJB; import javax.ejb.Stateless; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; +import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote; import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException; import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +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.BasePizzaDatabaseBean; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java similarity index 61% rename from src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java index 5ad2589..e73eff3 100644 --- a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaAdminBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaAdminBusinessDataSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.basicdata; +package org.mxchange.jcontactsbusiness.model.basicdata; import java.text.MessageFormat; import java.util.GregorianCalendar; @@ -22,7 +22,11 @@ import java.util.List; import java.util.Objects; import javax.ejb.EJB; import javax.ejb.Stateless; +import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote; +import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataAlreadyAddedException; +import org.mxchange.jcontactsbusiness.model.employee.Employee; +import org.mxchange.jusercore.model.user.User; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; /** @@ -64,25 +68,40 @@ public class PizzaAdminBusinessDataSessionBean extends BasePizzaDatabaseBean imp } else if (basicData.getBasicDataId() != null) { // Should be null throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} - is not null", basicData.getBasicDataId())); //NOI18N + } else if (this.isSameCompanyNameAdded(basicData)) { + // Throw exception + throw new BusinessDataAlreadyAddedException(basicData); } - // Get all available entries - final List list = this.businessDataBean.allCompanyBasicData(); + // Now add current date + basicData.setCompanyCreated(new GregorianCalendar()); - // Is the list filled? - if (!list.isEmpty()) { - // Then check each entry - for (final BusinessBasicData entry : list) { - // Is the company name matching? - if (Objects.equals(entry.getCompanyName(), basicData.getCompanyName())) { - // Found match - throw new BusinessDataAlreadyAddedException(basicData); - } - } + // Is there a owner set? + if (basicData.getCompanyUserOwner() instanceof User) { + // Get managed instance + final User managedUser = this.createManaged(basicData.getCompanyUserOwner()); + + // Set it back + basicData.setCompanyUserOwner(managedUser); } - // Now add current date - basicData.setCompanyCreated(new GregorianCalendar()); + // Is a founder set? + if (basicData.getCompanyFounder() instanceof Employee) { + // Get managed instance + final Employee managedEmployee = this.createManaged(basicData.getCompanyFounder()); + + // Set it back + basicData.setCompanyFounder(managedEmployee); + } + + // Is a contact person set? + if (basicData.getCompanyContactEmployee() instanceof Employee) { + // Get managed instance + final Employee managedEmployee = this.createManaged(basicData.getCompanyContactEmployee()); + + // Set it back + basicData.setCompanyContactEmployee(managedEmployee); + } // Persist it this.getEntityManager().persist(basicData); @@ -94,4 +113,31 @@ public class PizzaAdminBusinessDataSessionBean extends BasePizzaDatabaseBean imp return basicData; } + /** + * Checks if given basic data is already added by it's company name + *

+ * @param basicData Basic data to be checked + * + * @return Whether same company name has been used + */ + private boolean isSameCompanyNameAdded (final BusinessBasicData basicData) { + // Get all available entries + final List list = this.businessDataBean.allCompanyBasicData(); + + // Default is not found + boolean isFound = false; + + // Then check each entry + for (final BusinessBasicData entry : list) { + // Is the company name matching? + if (Objects.equals(entry.getCompanyName(), basicData.getCompanyName())) { + // Found match + isFound = true; + } + } + + // Return flag + return isFound; + } + } diff --git a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java similarity index 97% rename from src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java index 2e1be00..4633530 100644 --- a/src/java/org/mxchange/jcontactsbusiness/basicdata/PizzaBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/PizzaBusinessDataSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.basicdata; +package org.mxchange.jcontactsbusiness.model.basicdata; import java.text.MessageFormat; import java.util.List; @@ -22,6 +22,7 @@ import java.util.Objects; import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; +import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; import org.mxchange.jcontactsbusiness.exceptions.basicdata.BusinessDataNotFoundException; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; diff --git a/src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaAdminBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java similarity index 85% rename from src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaAdminBranchOfficeSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java index 7b328cf..1bd1cac 100644 --- a/src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaAdminBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaAdminBranchOfficeSessionBean.java @@ -14,16 +14,20 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.branchoffice; +package org.mxchange.jcontactsbusiness.model.branchoffice; import java.text.MessageFormat; import java.util.GregorianCalendar; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.branchoffice.AdminBranchOfficeSessionBeanRemote; +import org.mxchange.jcontactsbusiness.branchoffice.BranchOfficeSessionBeanRemote; import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException; -import org.mxchange.jcountry.data.Country; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; +import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeUtils; +import org.mxchange.jcountry.model.data.Country; import org.mxchange.jusercore.model.user.User; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; @@ -77,7 +81,7 @@ public class PizzaAdminBranchOfficeSessionBean extends BasePizzaDatabaseBean imp // Is user instance set? if (branchOffice.getBranchCompany() instanceof BusinessBasicData) { // Get managed instance back - final BusinessBasicData managedBasicData = this.getManaged(branchOffice.getBranchCompany()); + final BusinessBasicData managedBasicData = this.createManaged(branchOffice.getBranchCompany()); // Set it back in branch office branchOffice.setBranchCompany(managedBasicData); @@ -86,7 +90,7 @@ public class PizzaAdminBranchOfficeSessionBean extends BasePizzaDatabaseBean imp // Is user instance set? if (branchOffice.getBranchUserOwner() instanceof User) { // Get managed instance back - final User managedUser = this.getManaged(branchOffice.getBranchUserOwner()); + final User managedUser = this.createManaged(branchOffice.getBranchUserOwner()); // Set it back in branch office branchOffice.setBranchUserOwner(managedUser); @@ -95,7 +99,7 @@ public class PizzaAdminBranchOfficeSessionBean extends BasePizzaDatabaseBean imp // Is user instance set? if (branchOffice.getBranchCountry() instanceof Country) { // Get managed instance back - final Country managedCountry = this.getManaged(branchOffice.getBranchCountry()); + final Country managedCountry = this.createManaged(branchOffice.getBranchCountry()); // Set it back in branch office branchOffice.setBranchCountry(managedCountry); diff --git a/src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java similarity index 93% rename from src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaBranchOfficeSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java index bc251df..ec75390 100644 --- a/src/java/org/mxchange/jcontactsbusiness/branchoffice/PizzaBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/PizzaBranchOfficeSessionBean.java @@ -14,12 +14,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.branchoffice; +package org.mxchange.jcontactsbusiness.model.branchoffice; import java.text.MessageFormat; import java.util.List; import javax.ejb.Stateless; import javax.persistence.Query; +import org.mxchange.jcontactsbusiness.branchoffice.BranchOfficeSessionBeanRemote; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/employee/PizzaAdminCompanyEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java similarity index 90% rename from src/java/org/mxchange/jcontactsbusiness/employee/PizzaAdminCompanyEmployeeSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java index aa4a95c..03f071c 100644 --- a/src/java/org/mxchange/jcontactsbusiness/employee/PizzaAdminCompanyEmployeeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaAdminCompanyEmployeeSessionBean.java @@ -14,9 +14,10 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.employee; +package org.mxchange.jcontactsbusiness.model.employee; import javax.ejb.Stateless; +import org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; /** diff --git a/src/java/org/mxchange/jcontactsbusiness/employee/PizzaCompanyEmployeeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java similarity index 96% rename from src/java/org/mxchange/jcontactsbusiness/employee/PizzaCompanyEmployeeSessionBean.java rename to src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java index 3efaf89..ac7c8c0 100644 --- a/src/java/org/mxchange/jcontactsbusiness/employee/PizzaCompanyEmployeeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/employee/PizzaCompanyEmployeeSessionBean.java @@ -14,13 +14,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.employee; +package org.mxchange.jcontactsbusiness.model.employee; import java.text.MessageFormat; import java.util.List; import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; +import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote; import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; diff --git a/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java b/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java similarity index 99% rename from src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java rename to src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java index eb2b2b2..7f3b2bc 100644 --- a/src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java +++ b/src/java/org/mxchange/jcountry/model/data/PizzaCountrySingletonBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jcountry.data; +package org.mxchange.jcountry.model.data; import java.text.MessageFormat; import java.util.GregorianCalendar; diff --git a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java similarity index 98% rename from src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java rename to src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java index 7217458..4d9adf2 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaAdminMobileProviderSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jphone.phonenumbers.mobileprovider; +package org.mxchange.jphone.model.phonenumbers.mobileprovider; import java.text.MessageFormat; import java.util.GregorianCalendar; diff --git a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java similarity index 97% rename from src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java rename to src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java index 222842c..194f439 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/PizzaMobileProviderSingletonBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jphone.phonenumbers.mobileprovider; +package org.mxchange.jphone.model.phonenumbers.mobileprovider; import java.text.MessageFormat; import java.util.List; diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java similarity index 96% rename from src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java rename to src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java index f1a9f39..360720c 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaAdminPhoneSessionBean.java @@ -14,17 +14,18 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jphone.phonenumbers.phone; +package org.mxchange.jphone.model.phonenumbers.phone; import java.text.MessageFormat; import java.util.GregorianCalendar; import javax.ejb.Stateless; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumbers; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers; +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.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; /** diff --git a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java similarity index 94% rename from src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java rename to src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java index cb89a77..c3260d8 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/PizzaPhoneSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jphone.phonenumbers.phone; +package org.mxchange.jphone.model.phonenumbers.phone; import java.text.MessageFormat; import java.util.List; @@ -22,12 +22,12 @@ import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.mobile.MobileNumber; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber; +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.BasePizzaDatabaseBean; /** diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java index 1b1a159..e451aef 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java @@ -20,7 +20,7 @@ import java.text.MessageFormat; import java.util.GregorianCalendar; import javax.ejb.EJB; import javax.ejb.Stateless; -import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNotFoundException; @@ -137,7 +137,7 @@ public class PizzaAdminUserSessionBean extends BasePizzaDatabaseBean implements } // Get a managed instance - final User managedUser = this.getManaged(user); + final User managedUser = this.createManaged(user); // Should be found! assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java index 15cc277..9653c09 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java @@ -25,14 +25,14 @@ import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.PersistenceException; import javax.persistence.Query; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.ContactUtils; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumbers; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers; +import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jcontacts.model.contact.ContactUtils; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers; +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.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; @@ -764,7 +764,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS MobileNumbers.copyAll(managedUser.getUserContact().getContactMobileNumber(), managedMobile); // Set it back - managedContact.setContactMobileNumber(this.getManaged(mobileNumber, mobileNumber)); + managedContact.setContactMobileNumber(this.createManaged(mobileNumber, mobileNumber)); } // Get mobile instance 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 3d64e9c..6637169 100644 --- a/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java +++ b/src/java/org/mxchange/jusercore/model/user/activity/PizzaUserActivityLogMessageBean.java @@ -136,7 +136,7 @@ public class PizzaUserActivityLogMessageBean extends BasePizzaDatabaseBean imple } // Make user instance managed - final User managedUser = this.getManaged(userActivity.getActivityUser()); + final User managedUser = this.createManaged(userActivity.getActivityUser()); // Set it back userActivity.setActivityUser(managedUser); 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 e8c3a59..6383c7d 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 @@ -110,7 +110,7 @@ public class PizzaUserEmailChangeSessionBean extends BasePizzaDatabaseBean imple this.generateSecureHash(emailChange); // Make user managed - emailChange.setEmailChangeUser(this.getManaged(emailChange.getEmailChangeUser())); + emailChange.setEmailChangeUser(this.createManaged(emailChange.getEmailChangeUser())); // Persist it //@TODO Fix email delivery then allow this: this.getEntityManager().persist(emailChange); 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 1d7d30a..de9fdca 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java @@ -22,7 +22,7 @@ import javax.ejb.EJB; import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; -import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote; diff --git a/src/java/org/mxchange/pizzaaplication/database/BasePizzaDatabaseBean.java b/src/java/org/mxchange/pizzaaplication/database/BasePizzaDatabaseBean.java index 7776ddf..b45b7bf 100644 --- a/src/java/org/mxchange/pizzaaplication/database/BasePizzaDatabaseBean.java +++ b/src/java/org/mxchange/pizzaaplication/database/BasePizzaDatabaseBean.java @@ -26,22 +26,24 @@ import javax.jms.ObjectMessage; import javax.mail.Address; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.ContactUtils; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; -import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; +import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jcontacts.model.contact.ContactUtils; +import org.mxchange.jcontacts.model.contact.UserContact; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData; +import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee; +import org.mxchange.jcontactsbusiness.model.employee.Employee; import org.mxchange.jcoreee.database.BaseDatabaseBean; -import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; +import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcountry.model.data.CountryData; import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper; import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumbers; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumbers; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.mobile.MobileNumbers; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers; +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.jphone.utils.PhoneUtils; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; @@ -140,7 +142,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed instance */ - protected DialableMobileNumber getManaged (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) { + protected DialableMobileNumber createManaged (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) { // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: mobileNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), mobileNumber, fetchedNumber)); //NOI18N @@ -191,7 +193,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed instance */ - protected DialableLandLineNumber getManaged (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) { + protected DialableLandLineNumber createManaged (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) { // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: landLineNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), landLineNumber, fetchedNumber)); //NOI18N @@ -242,7 +244,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed instance */ - protected DialableFaxNumber getManaged (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) { + protected DialableFaxNumber createManaged (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) { // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: faxNumber={1},fetchedNumber={2} - CALLED!", this.getClass().getSimpleName(), faxNumber, fetchedNumber)); //NOI18N @@ -292,9 +294,9 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed contact instance */ - protected Contact getManaged (final Contact contact) { + protected Contact createManaged (final Contact contact) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N // user should not be null if (null == contact) { @@ -315,7 +317,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N // Return it return managedContact; @@ -328,9 +330,9 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed country instance */ - protected Country getManaged (final Country country) { + protected Country createManaged (final Country country) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N // user should not be null if (null == country) { @@ -351,22 +353,22 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: managedCountry={1} - EXIT!", this.getClass().getSimpleName(), managedCountry)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedCountry={1} - EXIT!", this.getClass().getSimpleName(), managedCountry)); //NOI18N // Return it return managedCountry; } /** - * Get back a managed instance from given contact + * Get back a managed instance from given basic data *

- * @param basicData Unmanaged/detached contact instance + * @param basicData Unmanaged/detached basic data instance *

- * @return Managed contact instance + * @return Managed basic data instance */ - protected BusinessBasicData getManaged (final BusinessBasicData basicData) { + protected BusinessBasicData createManaged (final BusinessBasicData basicData) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N // user should not be null if (null == basicData) { @@ -387,12 +389,48 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { assert (managedBasicData instanceof BusinessBasicData) : "managedBasicData is null"; //NOI18N // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: managedBasicData={1} - EXIT!", this.getClass().getSimpleName(), managedBasicData)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBasicData={1} - EXIT!", this.getClass().getSimpleName(), managedBasicData)); //NOI18N // Return it return managedBasicData; } + /** + * Get back a managed instance from given employee + *

+ * @param employee Unmanaged/detached employee instance + *

+ * @return Managed employee instance + */ + protected Employee createManaged (final Employee employee) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: employee={1} - CALLED!", this.getClass().getSimpleName(), employee)); //NOI18N + + // user should not be null + if (null == employee) { + // Abort here + throw new NullPointerException("employee is null"); //NOI18N + } else if (employee.getEmployeeId() == null) { + // Id is set + throw new NullPointerException("employee.employeeId is null"); //NOI18N + } else if (employee.getEmployeeId() < 1) { + // Id is set + throw new IllegalArgumentException(MessageFormat.format("employee.employeeId={0} is null", employee.getEmployeeId())); //NOI18N + } + + // Try to find it (should be there) + final Employee managedEmployee = this.getEntityManager().find(CompanyEmployee.class, employee.getEmployeeId()); + + // Should be there + assert (managedEmployee instanceof Employee) : "managedEmployee is null"; //NOI18N + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedEmployee={1} - EXIT!", this.getClass().getSimpleName(), managedEmployee)); //NOI18N + + // Return it + return managedEmployee; + } + /** * Get back a managed instance from given user *

@@ -400,9 +438,9 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { *

* @return Managed user instance */ - protected User getManaged (final User user) { + protected User createManaged (final User user) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N // user should not be null if (null == user) { @@ -432,7 +470,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { assert (managedUser instanceof User) : "managedUser is null"; //NOI18N // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N // Return it return managedUser; @@ -473,19 +511,19 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { // Is a fax number set? if (detachedContact.getContactFaxNumber() instanceof DialableFaxNumber) { // Make fax numbers managed - foundContact.setContactFaxNumber(this.getManaged(detachedContact.getContactFaxNumber(), detachedContact.getContactFaxNumber())); + foundContact.setContactFaxNumber(this.createManaged(detachedContact.getContactFaxNumber(), detachedContact.getContactFaxNumber())); } // Is a land-line number set? if (detachedContact.getContactLandLineNumber() instanceof DialableLandLineNumber) { // Make land-line numbers managed - foundContact.setContactLandLineNumber(this.getManaged(detachedContact.getContactLandLineNumber(), detachedContact.getContactLandLineNumber())); + foundContact.setContactLandLineNumber(this.createManaged(detachedContact.getContactLandLineNumber(), detachedContact.getContactLandLineNumber())); } // Is a mobile number set? if (detachedContact.getContactMobileNumber() instanceof DialableMobileNumber) { // Make mobile numbers managed - foundContact.setContactMobileNumber(this.getManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber())); + foundContact.setContactMobileNumber(this.createManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber())); } // Merge contact instance @@ -746,7 +784,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { // Is the fax number set? if (other.getContactMobileNumber() instanceof DialableMobileNumber) { // Copy mobile number - contact.setContactMobileNumber(this.getManaged(other.getContactMobileNumber(), contact.getContactMobileNumber())); + contact.setContactMobileNumber(this.createManaged(other.getContactMobileNumber(), contact.getContactMobileNumber())); } else { // Null it contact.setContactMobileNumber(null); @@ -764,7 +802,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { // Is the land-line number set? if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) { // Copy land-line number - contact.setContactLandLineNumber(this.getManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber())); + contact.setContactLandLineNumber(this.createManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber())); } else { // Null it contact.setContactLandLineNumber(null); @@ -782,7 +820,7 @@ public abstract class BasePizzaDatabaseBean extends BaseDatabaseBean { // Is the fax number set? if (other.getContactFaxNumber() instanceof DialableFaxNumber) { // Copy fax number - contact.setContactFaxNumber(this.getManaged(other.getContactFaxNumber(), contact.getContactFaxNumber())); + contact.setContactFaxNumber(this.createManaged(other.getContactFaxNumber(), contact.getContactFaxNumber())); } else { // Null it contact.setContactFaxNumber(null); diff --git a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java index 964c9c1..a6c19ea 100644 --- a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java @@ -23,9 +23,9 @@ import javax.ejb.EJB; import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; +import org.mxchange.jcontacts.model.contact.Contact; +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; -- 2.39.5