]> git.mxchange.org Git - addressbook-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sun, 24 Nov 2019 04:29:41 +0000 (05:29 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 1 Feb 2020 03:40:41 +0000 (04:40 +0100)
- renamed BaseFinancialsDatabaseBean to BaseFinancialsEnterpriseBean
- also moved it to proper "enterprise" package

Signed-off-by: Roland Häder <roland@mxchange.org>
34 files changed:
src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java [deleted file]
src/java/org/mxchange/addressbook/enterprise/BaseAddressbookEnterpriseBean.java [new file with mode: 0644]
src/java/org/mxchange/jaddressbook/model/addressbook/AddressbookSessionBean.java
src/java/org/mxchange/jaddressbookshare/model/addressbook/shared/SharedAddressbooksSessionBean.java
src/java/org/mxchange/jcontacts/model/contact/AddressbookAdminContactSessionBean.java
src/java/org/mxchange/jcontacts/model/contact/AddressbookContactSessionBean.java
src/java/org/mxchange/jcontacts/model/phone/AddressbookAdminContactPhoneSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/basicdata/AddressbookAdminBusinessDataSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/basicdata/AddressbookBusinessDataSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/branchoffice/AddressbookAdminBranchOfficeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/branchoffice/AddressbookBranchOfficeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/department/AddressbookAdminDepartmentSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/department/AddressbookDepartmentSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/employee/AddressbookAdminEmployeeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/employee/AddressbookEmployeeSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/headquarter/AddressbookAdminHeadquartersSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/headquarter/AddressbookHeadquartersSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/opening_time/AddressbookAdminOpeningTimesSessionBean.java
src/java/org/mxchange/jcontactsbusiness/model/opening_time/AddressbookOpeningTimesSessionBean.java
src/java/org/mxchange/jcountry/model/data/AddressbookAdminCountrySingletonBean.java
src/java/org/mxchange/jcountry/model/data/AddressbookCountrySingletonBean.java
src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/AddressbookAdminMobileProviderSessionBean.java
src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/AddressbookMobileProviderSingletonBean.java
src/java/org/mxchange/jphone/model/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
src/java/org/mxchange/jphone/model/phonenumbers/phone/AddressbookPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivityLogMessageBean.java
src/java/org/mxchange/jusercore/model/user/activity/AddressbookUserActivitySessionBean.java
src/java/org/mxchange/jusercore/model/user/email_address/AddressbookUserEmailChangeSessionBean.java
src/java/org/mxchange/jusercore/model/user/password_history/AddressbookUserPasswordHistorySessionBean.java
src/java/org/mxchange/juserlogincore/model/user/login/AddressbookUserLoginSessionBean.java
src/java/org/mxchange/juserlogincore/model/user/register/AddressbookUserRegistrationSessionBean.java
src/java/org/mxchange/juserlogincore/model/user/resendlink/AddressbookResendLinkSessionBean.java

diff --git a/src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java b/src/java/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java
deleted file mode 100644 (file)
index 2ba523e..0000000
+++ /dev/null
@@ -1,1441 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.database;
-
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.Properties;
-import javax.ejb.EJBException;
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-import javax.mail.Address;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jcontacts.model.contact.Contacts;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters;
-import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
-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.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;
-import org.mxchange.jusercore.model.user.Users;
-
-/**
- * A helper class for beans that access the database.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 12_895_410_275_811_963L;
-
-       /**
-        * Protected constructor
-        */
-       protected BaseAddressbookDatabaseBean () {
-               // Call super constructor
-               super();
-       }
-
-       /**
-        * Constructor with queue factory JNDI and queue JNDI names
-        * <p>
-        * @param factoryJndi JNDI name for queue factory
-        * @param queueJndi   JNDI name for email queue
-        */
-       protected BaseAddressbookDatabaseBean (final String factoryJndi, final String queueJndi) {
-               // Call super constructor
-               super(factoryJndi, queueJndi);
-       }
-
-       /**
-        * Updates all contact's phone entry's created timestamps
-        * <p>
-        * @param contact Contact instance to update
-        */
-       protected void setAllContactPhoneEntriesCreated (final Contact contact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
-               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
-               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: landLineNumber={1},faxNumber={2},mobileNumber={3}", this.getClass().getSimpleName(), landLineNumber, faxNumber, mobileNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a mobile number instance set?
-               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       mobileNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       /**
-        * Returns a managed instance from given mobile number
-        * <p>
-        * @param mobileNumber  Mobile instance
-        * @param fetchedNumber Found mobile number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableMobileNumber getManaged (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
-
-               // Should be valid
-               if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableMobileNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Returns a managed instance from given land-line number
-        * <p>
-        * @param landLineNumber Land-line instance
-        * @param fetchedNumber  Found land-line number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableLandLineNumber getManaged (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
-
-               // Should be valid
-               if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableLandLineNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Returns a managed instance from given fax number
-        * <p>
-        * @param faxNumber     Fax instance
-        * @param fetchedNumber Found fax number in database
-        * <p>
-        * @return Managed instance
-        */
-       protected DialableFaxNumber getManaged (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
-
-               // Should be valid
-               if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (null == fetchedNumber) {
-                       // Throw NPE again
-                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableFaxNumber managedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
-                       // Merge this entry
-                       managedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
-
-               // Return it
-               return managedNumber;
-       }
-
-       /**
-        * Get back a managed instance from given contact
-        * <p>
-        * @param contact Unmanaged/detached contact instance
-        * <p>
-        * @return Managed contact instance
-        */
-       protected Contact createManaged (final Contact contact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
-
-               // user should not be null
-               if (null == contact) {
-                       // Abort here
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Id is set
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
-
-               // Should be there
-               assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return it
-               return managedContact;
-       }
-
-       /**
-        * Get back a managed instance from given country
-        * <p>
-        * @param country Unmanaged/detached country instance
-        * <p>
-        * @return Managed country instance
-        */
-       protected Country createManaged (final Country country) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N
-
-               // user should not be null
-               if (null == country) {
-                       // Abort here
-                       throw new NullPointerException("country is null"); //NOI18N
-               } else if (country.getCountryId() == null) {
-                       // Id is set
-                       throw new NullPointerException("country.countryId is null"); //NOI18N
-               } else if (country.getCountryId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("country.countryId={0} is invalid", country.getCountryId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId());
-
-               // Should be there
-               assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N
-
-               // Trace message
-               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 basic data
-        * <p>
-        * @param basicData Unmanaged/detached basic data instance
-        * <p>
-        * @return Managed basic data instance
-        */
-       protected BasicData createManaged (final BasicData basicData) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N
-
-               // user should not be null
-               if (null == basicData) {
-                       // Abort here
-                       throw new NullPointerException("basicData is null"); //NOI18N
-               } else if (basicData.getBasicDataId() == null) {
-                       // Id is set
-                       throw new NullPointerException("basicData.basicDataId is null"); //NOI18N
-               } else if (basicData.getBasicDataId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is invalid", basicData.getBasicDataId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final BasicData managedBasicData = this.getEntityManager().find(BusinessBasicData.class, basicData.getBasicDataId());
-
-               // Should be there
-               assert (managedBasicData instanceof BasicData) : "managedBasicData is null"; //NOI18N
-
-               // Trace message
-               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 branch office
-        * <p>
-        * @param headquarter Unmanaged/detached branch office instance
-        * <p>
-        * @return Managed basic data instance
-        */
-       protected BranchOffice createManaged (final BranchOffice headquarter) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
-
-               // user should not be null
-               if (null == headquarter) {
-                       // Abort here
-                       throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getBranchId() == null) {
-                       // Id is set
-                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
-               } else if (headquarter.getBranchId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getBranchId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final BranchOffice managedBranchOffice = this.getEntityManager().find(BusinessBranchOffice.class, headquarter.getBranchId());
-
-               // Should be there
-               assert (managedBranchOffice instanceof BasicData) : "managedBranchOffice is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBranchOffice={1} - EXIT!", this.getClass().getSimpleName(), managedBranchOffice)); //NOI18N
-
-               // Return it
-               return managedBranchOffice;
-       }
-
-       /**
-        * Get back a managed instance from given employee
-        * <p>
-        * @param employee Unmanaged/detached employee instance
-        * <p>
-        * @return Managed employee instance
-        */
-       protected Employable createManaged (final Employable 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 invalid", employee.getEmployeeId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final Employable managedEmployee = this.getEntityManager().find(BusinessEmployee.class, employee.getEmployeeId());
-
-               // Should be there
-               assert (managedEmployee instanceof Employable) : "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 headquarters
-        * <p>
-        * @param headquarters Unmanaged/detached headquarters instance
-        * <p>
-        * @return Managed basic data instance
-        */
-       protected Headquarter createManaged (final Headquarter headquarters) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarters)); //NOI18N
-
-               // user should not be null
-               if (null == headquarters) {
-                       // Abort here
-                       throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getHeadquarterId() == null) {
-                       // Id is set
-                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
-               } else if (headquarter.getHeadquarterId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getHeadquarterId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final Headquarter managedHeadquarter = this.getEntityManager().find(headquarter.getClass(), headquarter.getHeadquarterId());
-
-               // Should be there
-               assert (managedHeadquarter instanceof Headquarter) : "managedHeadquarter is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarter={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarter)); //NOI18N
-
-               // Return it
-               return managedHeadquarter;
-       }
-
-       /**
-        * Get back a managed instance from given job position
-        * <p>
-        * @param jobPosition Unmanaged/detached job position instance
-        * <p>
-        * @return Managed job position instance
-        */
-       protected JobPosition createManaged (final JobPosition jobPosition) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: jobPosition={1} - CALLED!", this.getClass().getSimpleName(), jobPosition)); //NOI18N
-
-               // user should not be null
-               if (null == jobPosition) {
-                       // Abort here
-                       throw new NullPointerException("jobPosition is null"); //NOI18N
-               } else if (jobPosition.getJobPositionId() == null) {
-                       // Id is set
-                       throw new NullPointerException("jobPosition.jobPositionId is null"); //NOI18N
-               } else if (jobPosition.getJobPositionId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("jobPosition.jobPositionId={0} is invalid", jobPosition.getJobPositionId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final JobPosition managedJobPosition = this.getEntityManager().find(jobPosition.getClass(), jobPosition.getJobPositionId());
-
-               // Should be there
-               assert (managedJobPosition instanceof JobPosition) : "managedJobPosition is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedJobPosition={1} - EXIT!", this.getClass().getSimpleName(), managedJobPosition)); //NOI18N
-
-               // Return it
-               return managedJobPosition;
-       }
-
-       /**
-        * Get back a managed instance from given mobile provider
-        * <p>
-        * @param mobileProvider Unmanaged/detached mobile provider instance
-        * <p>
-        * @return Managed mobile provider instance
-        */
-       protected MobileProvider createManaged (final MobileProvider mobileProvider) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
-
-               // user should not be null
-               if (null == mobileProvider) {
-                       // Abort here
-                       throw new NullPointerException("mobileProvider is null"); //NOI18N
-               } else if (mobileProvider.getProviderId() == null) {
-                       // Id is set
-                       throw new NullPointerException("headquarter.headquartersId is null"); //NOI18N
-               } else if (headquarters.getHeadquartersId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquartersId={0} is invalid", headquarters.getHeadquartersId())); //NOI18N
-               }
-
-               // Try to find it (should be there)
-               final Headquarter managedHeadquarters = this.getEntityManager().find(BusinessHeadquarters.class, headquarters.getHeadquartersId());
-
-               // Should be there
-               assert (managedHeadquarters instanceof BasicData) : "managedHeadquarters is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarters={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarters)); //NOI18N
-
-               // Return it
-               return managedHeadquarters;
-       }
-
-       /**
-        * Get back a managed instance from given user
-        * <p>
-        * @param user Unmanaged/detached user instance
-        * <p>
-        * @return Managed user instance
-        */
-       protected User createManaged (final User user) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Id is set
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N#
-               }
-
-               // Try to find it (should be there)
-               final User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
-
-               // Should be there
-               assert (managedUser instanceof User) : "managedUser is null"; //NOI18N
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
-
-               // Return it
-               return managedUser;
-       }
-
-       /**
-        * Sets created timestamp on all opening times.
-        * <p>
-        * @param openingTimes Opening times list
-        * <p>
-        * @throws NullPointerException If given list is null
-        * @throws IllegalArgumentException If given list is empty
-        * @throws IllegalStateException If openingId is not null
-        */
-       protected void setAllOpeningTimesCreated (final List<OpeningTime> openingTimes) {
-               // Validate parameter
-               if (null == openingTimes) {
-                       // Throw NPE
-                       throw new NullPointerException("openingTimes is null");
-               } else if (openingTimes.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("openingTimes is empty");
-               }
-
-               // Walk through whole list
-               for (final OpeningTime openingTime : openingTimes) {
-                       // Id should not be set
-                       if (openingTime.getOpeningId() != null) {
-                               // Abort here
-                               throw new IllegalStateException("openingTime.openingId is not null");
-                       }
-
-                       // Set created timestamp
-                       openingTime.setOpeningCreated(new Date());
-               }
-       }
-
-       /**
-        * Updates all contact's phone entry's created timestamps
-        * <p>
-        * @param contact Contact instance to update
-        */
-       protected void setAllPhoneEntriesCreated (final Contact contact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: contact={0} - CALLED!", contact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() != null) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is unexpected.", contact.getContactId()));
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
-               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
-               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1},mobileNumber={2}", landLineNumber, faxNumber, mobileNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a mobile number instance set?
-               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for mobile number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       mobileNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Updates all branch office's phone entry's created timestamps
-        * <p>
-        * @param branchOffice Branch office instance to update
-        */
-       protected void setAllPhoneEntriesCreated (final BranchOffice branchOffice) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: branchOffice={0} - CALLED!", branchOffice)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == branchOffice) {
-                       // Throw NPE again
-                       throw new NullPointerException("branchOffice is null"); //NOI18N
-               } else if (branchOffice.getBranchId() != null) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is unexpected.", branchOffice.getBranchId()));
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = branchOffice.getBranchLandLineNumber();
-               final DialableFaxNumber faxNumber = branchOffice.getBranchFaxNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Updates all branch office's phone entry's created timestamps
-        * <p>
-        * @param headquarter Headquarters instance to update
-        */
-       protected void setAllPhoneEntriesCreated (final Headquarter headquarter) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: headquarter={0} - CALLED!", headquarter)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == headquarter) {
-                       // Throw NPE again
-                       throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getHeadquartersId() != null) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.branchId={0} is unexpected.", headquarter.getHeadquartersId()));
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = headquarter.getHeadquartersLandLineNumber();
-               final DialableFaxNumber faxNumber = headquarter.getHeadquartersFaxNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new Date());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Updates all company's phone entry's created timestamps
-        * <p>
-        * @param basicData Company basic data instance to update
-        */
-       protected void setAllPhoneEntriesCreated (final BasicData basicData) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: basicData={0} - CALLED!", basicData)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == basicData) {
-                       // Throw NPE again
-                       throw new NullPointerException("basicData is null"); //NOI18N
-               } else if (basicData.getBasicDataId() != null) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is unexpected.", basicData.getBasicDataId()));
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = basicData.getCompanyLandLineNumber();
-               final DialableFaxNumber faxNumber = basicData.getCompanyFaxNumber();
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryCreated(new Date());
-
-                       // Set it back in basic data
-                       basicData.setCompanyLandLineNumber(landLineNumber);
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryCreated(new Date());
-
-                       // Set it back in basic data
-                       basicData.setCompanyFaxNumber(faxNumber);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Returns a detached instance from given mobile instance
-        * <p>
-        * @param mobileNumber  Mobile instance
-        * @param fetchedNumber Found mobile number in database
-        * <p>
-        * @return Detached instance
-        */
-       protected DialableMobileNumber getDetached (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: mobileNumber={0},fetchedNumber={1} - CALLED!", mobileNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableMobileNumber detachedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
-                       // Merge this entry
-                       detachedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
-
-               // Return it
-               return detachedNumber;
-       }
-
-       /**
-        * Returns a detached instance from given land-line instance
-        * <p>
-        * @param landLineNumber Land-line instance
-        * @param fetchedNumber  Found land-line number in database
-        * <p>
-        * @return Detached instance
-        */
-       protected DialableLandLineNumber getDetached (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: landLineNumber={0},fetchedNumber={1} - CALLED!", landLineNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableLandLineNumber detachedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
-                       // Merge this entry
-                       detachedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
-
-               // Return it
-               return detachedNumber;
-       }
-
-       /**
-        * Returns a detached instance from given fax instance
-        * <p>
-        * @param faxNumber     Fax instance
-        * @param fetchedNumber Found fax number in database
-        * <p>
-        * @return Detached instance
-        */
-       protected DialableFaxNumber getDetached (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: faxNumber={0},fetchedNumber={1} - CALLED!", faxNumber, fetchedNumber)); //NOI18N
-
-               // Should be valid
-               if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (fetchedNumber.getPhoneId() == null) {
-                       // ..and again
-                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
-
-               // Init query instance
-               final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableFaxNumber detachedNumber = null;
-
-               // Is there a difference?
-               if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
-                       // Merge this entry
-                       detachedNumber = this.getEntityManager().merge(foundNumber);
-
-                       // @TODO Copy all
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
-
-               // Return it
-               return detachedNumber;
-       }
-
-       /**
-        * Merges given contact's data
-        * <p>
-        * @param detachedContact Contact instance to merge
-        * <p>
-        * @return Detached contact instance
-        */
-       protected Contact mergeContactData (final Contact detachedContact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == detachedContact) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact is null"); //NOI18N
-               } else if (detachedContact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
-               } else if (detachedContact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
-               }
-
-               // Set updated timestamp
-               detachedContact.setContactUpdated(new Date());
-
-               // Get contact from it and find it
-               final Contact foundContact = this.getEntityManager().find(detachedContact.getClass(), detachedContact.getContactId());
-
-               // Should be found
-               assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", detachedContact.getContactId()); //NOI18N
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateUserPersonalData: foundContact.contactId={1}", this.getClass().getSimpleName(), foundContact.getContactId())); //NOI18N
-
-               // Is a fax number set?
-               if (detachedContact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Make fax numbers managed
-                       foundContact.setContactFaxNumber(this.getManaged(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()));
-               }
-
-               // Is a mobile number set?
-               if (detachedContact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Make mobile numbers managed
-                       foundContact.setContactMobileNumber(this.getManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber()));
-               }
-
-               // Merge contact instance
-               final Contact managedContact = this.getEntityManager().merge(foundContact);
-
-               // Copy all
-               Contacts.copyAll(detachedContact, managedContact);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
-
-               // Return detached contact
-               return managedContact;
-       }
-
-       /**
-        * Merges given (detached) contact's mobile, land-line and fax numbers
-        * <p>
-        * @param detachedContact Detached contact instance
-        */
-       protected void mergeContactsMobileLandLineFaxNumbers (final Contact detachedContact) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactsMobileLandLineFaxNumbers: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == detachedContact) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact is null"); //NOI18N
-               } else if (detachedContact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
-               } else if (detachedContact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
-               }
-
-               // Get all instances
-               final DialableMobileNumber mobile = detachedContact.getContactMobileNumber();
-               final DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
-               final DialableFaxNumber fax = detachedContact.getContactFaxNumber();
-
-               // Is there a  mobile instance set?
-               if (mobile instanceof DialableMobileNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobile.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       final DialableMobileNumber foundMobile = this.getEntityManager().find(mobile.getClass(), mobile.getPhoneId());
-
-                       // Should be there
-                       assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       final DialableMobileNumber managedMobile = this.getEntityManager().merge(foundMobile);
-
-                       // Should be there
-                       assert (managedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", managedMobile.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       MobileNumbers.copyAll(detachedContact.getContactMobileNumber(), managedMobile);
-
-                       // Set it back
-                       detachedContact.setContactMobileNumber(managedMobile);
-               }
-
-               // Is there a  fax instance set?
-               if (fax instanceof DialableFaxNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       final DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId());
-
-                       // Should be there
-                       assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       final DialableFaxNumber managedFax = this.getEntityManager().merge(foundFax);
-
-                       // Should be there
-                       assert (managedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", managedFax.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       FaxNumbers.copyAll(detachedContact.getContactFaxNumber(), managedFax);
-
-                       // Set it back
-                       detachedContact.setContactFaxNumber(managedFax);
-               }
-
-               // Is there a  fax instance set?
-               if (landLine instanceof DialableLandLineNumber) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); //NOI18N
-
-                       // Then find it, too
-                       final DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId());
-
-                       // Should be there
-                       assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N
-
-                       // Then merge it, too
-                       final DialableLandLineNumber managedLandLine = this.getEntityManager().merge(foundLandLine);
-
-                       // Should be there
-                       assert (managedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", managedLandLine.getPhoneId()); //NOI18N
-
-                       // Copy all
-                       LandLineNumbers.copyAll(detachedContact.getContactLandLineNumber(), managedLandLine);
-
-                       // Set it back
-                       detachedContact.setContactLandLineNumber(managedLandLine);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("mergeContactsMobileLandLineFaxNumbers: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Sends an email with given subject line, template name to given recipient
-        * and user data
-        * <p>
-        * @param subjectLine    Subject line
-        * @param templateName   Template name
-        * @param user           User instance
-        * @param baseUrl        Base URL
-        * @param randomPassword A randomly-generated password or NULL if user had
-        *                       to enter it.
-        */
-       protected void sendEmail (final String subjectLine, final String templateName, final User user, final String baseUrl, final String randomPassword) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendEmail: subjectLine={0},templateName={1},user={2},baseUrl={3} - CALLED!", subjectLine, templateName, user, baseUrl)); //NOI18N
-
-               // All should be set
-               if (null == subjectLine) {
-                       // Throw NPE
-                       throw new NullPointerException("subjectLine is null"); //NOI18N
-               } else if (subjectLine.isEmpty()) {
-                       // No subject line
-                       throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
-               } else if (null == templateName) {
-                       // Throw NPE
-                       throw new NullPointerException("templateName is null"); //NOI18N
-               } else if (templateName.isEmpty()) {
-                       // No template name
-                       throw new IllegalArgumentException("templateName is empty"); //NOI18N
-               } else if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Not valid number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N
-               } else if (user.getUserName() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userName is null"); //NOI18N
-               } else if (user.getUserName().isEmpty()) {
-                       // Empty string
-                       throw new IllegalArgumentException("user.userName is empty"); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw it again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // .. and again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is invalid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserContact().getContactPersonalTitle() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactPersonalTitle is null"); //NOI18N
-               } else if (user.getUserLocale() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userLocale is null"); //NOI18N
-               } else if (this.getSession() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.session is not set. Have you forgotten to call super(String, String) and called only super() ?"); //NOI18N
-               }
-
-               // Set all values
-               final Properties variables = Users.getAllUserFields(user);
-
-               // Set base URL and random password
-               variables.put("baseUrl", baseUrl); //NOI18N
-               variables.put("randomPassword", ""); //NOI18N
-
-               // Is the random password set?
-               if ((randomPassword instanceof String) && (!randomPassword.isEmpty())) {
-                       variables.put("randomPassword", randomPassword); //NOI18N
-               }
-
-               // Init addresss
-               final Address recipientAddress;
-
-               try {
-                       // Create email address and set
-                       recipientAddress = new InternetAddress(user.getUserContact().getContactEmailAddress());
-               } catch (final AddressException ex) {
-                       // Throw again
-                       throw new EJBException(ex);
-               }
-
-               // Prepare mail wrapper
-               // @TODO Language from message bundle
-               final WrapableEmailDelivery emailWrapper = new EmailDeliveryWrapper(recipientAddress, subjectLine, templateName, variables, user.getUserLocale());
-
-               try {
-                       // Send out email change
-                       final ObjectMessage message = this.getSession().createObjectMessage();
-                       message.setObject(emailWrapper);
-
-                       // Send message
-                       this.sendMessage(message);
-               } catch (final JMSException ex) {
-                       // Throw again
-                       throw new EJBException(ex);
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace("sendEmail: EXIT!"); //NOI18N
-       }
-
-       /**
-        * Updates all contact's phone instances from other contact, both contacts
-        * should be the same.
-        * <p>
-        * @param contact Contact to set instances
-        * @param other   Other contact to get instances from
-        */
-       protected void setAllContactPhoneEntries (final Contact contact, final Contact other) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1},other={2} - CALLED!", this.getClass().getSimpleName(), contact, other)); //NOI18N
-
-               // Both must be the same and not null
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (null == other) {
-                       // Throw NPE
-                       throw new NullPointerException("other is null"); //NOI18N
-               } else if (!Objects.equals(contact, other)) {
-                       // Not same instances
-                       throw new IllegalArgumentException(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1} and other={2} are not equal!", this.getClass().getSimpleName(), contact, other)); //NOI18N
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactMobileNumber={0}", other.getContactMobileNumber())); //NOI18N
-
-               // Is other mobile not set?
-               if ((other.getContactMobileNumber() == null) || (PhoneUtils.isSameMobileNumber(contact.getContactMobileNumber(), other.getContactMobileNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying mobile entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the fax number set?
-                       if (other.getContactMobileNumber() instanceof DialableMobileNumber) {
-                               // Copy mobile number
-                               contact.setContactMobileNumber(this.getManaged(other.getContactMobileNumber(), contact.getContactMobileNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactMobileNumber(null);
-                       }
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactLandLineNumber={0}", other.getContactLandLineNumber())); //NOI18N
-
-               // Is other mobile not set?
-               if ((other.getContactLandLineNumber() == null) || (PhoneUtils.isSameLandLineNumber(contact.getContactLandLineNumber(), other.getContactLandLineNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying land-line entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the land-line number set?
-                       if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                               // Copy land-line number
-                               contact.setContactLandLineNumber(this.getManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactLandLineNumber(null);
-                       }
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactFaxNumber={1}", this.getClass().getSimpleName(), other.getContactFaxNumber())); //NOI18N
-
-               // Is other mobile not set?
-               if ((other.getContactFaxNumber() == null) || (PhoneUtils.isSameFaxNumber(contact.getContactFaxNumber(), other.getContactFaxNumber()))) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying fax entry ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Is the fax number set?
-                       if (other.getContactFaxNumber() instanceof DialableFaxNumber) {
-                               // Copy fax number
-                               contact.setContactFaxNumber(this.getManaged(other.getContactFaxNumber(), contact.getContactFaxNumber()));
-                       } else {
-                               // Null it
-                               contact.setContactFaxNumber(null);
-                       }
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       /**
-        * Updates all contact's phone entry's updated timestamps
-        * <p>
-        * @param contact            Contact instance to update
-        * @param isMobileUnlinked   Whether a mobile entry has been unlinked in
-        *                           contact instance
-        * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
-        *                           contact instance
-        * @param isFaxUnlinked      Whether a fax entry has been unlinked in
-        *                           contact instance
-        */
-       protected void setAllContactPhoneEntriesUpdated (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: contact={1},isMobileUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED", this.getClass().getSimpleName(), contact, isMobileUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
-
-               // The contact instance must be valid
-               if (null == contact) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               }
-
-               // Get all phone instances
-               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
-               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
-               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
-
-               // Flags and instances must be constistent
-               if (isMobileUnlinked && mobileNumber instanceof DialableMobileNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isCellPhoneUnlinked is TRUE, but mobileNumber is set."); //NOI18N
-               } else if (isLandlineUnlinked && landLineNumber instanceof DialableLandLineNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isLandlineUnlinked is TRUE, but landLineNumber is set."); //NOI18N
-               } else if (isFaxUnlinked && faxNumber instanceof DialableFaxNumber) {
-                       // Bad state
-                       throw new IllegalStateException("isFaxUnlinked is TRUE, but faxNumber is set."); //NOI18N
-               }
-
-               // Is a phone number instance set?
-               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() instanceof Long) && (landLineNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       landLineNumber.setPhoneEntryUpdated(new Date());
-               }
-
-               // Is a fax number instance set?
-               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() instanceof Long) && (faxNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       faxNumber.setPhoneEntryUpdated(new Date());
-               }
-
-               // Is a mobile number instance set?
-               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() instanceof Long) && (mobileNumber.getPhoneId() > 0)) {
-                       // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N
-
-                       // Set updated timestamp
-                       mobileNumber.setPhoneEntryUpdated(new Date());
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/addressbook/enterprise/BaseAddressbookEnterpriseBean.java b/src/java/org/mxchange/addressbook/enterprise/BaseAddressbookEnterpriseBean.java
new file mode 100644 (file)
index 0000000..95a1c17
--- /dev/null
@@ -0,0 +1,1441 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.database;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.Properties;
+import javax.ejb.EJBException;
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.mail.Address;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.contact.Contacts;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
+import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters;
+import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcoreee.database.BaseDatabaseBean;
+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.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;
+import org.mxchange.jusercore.model.user.Users;
+
+/**
+ * A helper class for beans that access the database.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public abstract class BaseAddressbookEnterpriseBean extends BaseDatabaseBean {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 12_895_410_275_811_963L;
+
+       /**
+        * Protected constructor
+        */
+       protected BaseAddressbookEnterpriseBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Constructor with queue factory JNDI and queue JNDI names
+        * <p>
+        * @param factoryJndi JNDI name for queue factory
+        * @param queueJndi   JNDI name for email queue
+        */
+       protected BaseAddressbookEnterpriseBean (final String factoryJndi, final String queueJndi) {
+               // Call super constructor
+               super(factoryJndi, queueJndi);
+       }
+
+       /**
+        * Updates all contact's phone entry's created timestamps
+        * <p>
+        * @param contact Contact instance to update
+        */
+       protected void setAllContactPhoneEntriesCreated (final Contact contact) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == contact) {
+                       // Throw NPE again
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
+               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
+               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: landLineNumber={1},faxNumber={2},mobileNumber={3}", this.getClass().getSimpleName(), landLineNumber, faxNumber, mobileNumber)); //NOI18N
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a mobile number instance set?
+               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       mobileNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: EXIT!", this.getClass().getSimpleName())); //NOI18N
+       }
+
+       /**
+        * Returns a managed instance from given mobile number
+        * <p>
+        * @param mobileNumber  Mobile instance
+        * @param fetchedNumber Found mobile number in database
+        * <p>
+        * @return Managed instance
+        */
+       protected DialableMobileNumber getManaged (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
+
+               // Should be valid
+               if (null == mobileNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (null == fetchedNumber) {
+                       // Throw NPE again
+                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableMobileNumber managedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
+                       // Merge this entry
+                       managedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
+
+               // Return it
+               return managedNumber;
+       }
+
+       /**
+        * Returns a managed instance from given land-line number
+        * <p>
+        * @param landLineNumber Land-line instance
+        * @param fetchedNumber  Found land-line number in database
+        * <p>
+        * @return Managed instance
+        */
+       protected DialableLandLineNumber getManaged (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
+
+               // Should be valid
+               if (null == landLineNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("landLineNumber is null"); //NOI18N
+               } else if (null == fetchedNumber) {
+                       // Throw NPE again
+                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableLandLineNumber managedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
+                       // Merge this entry
+                       managedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
+
+               // Return it
+               return managedNumber;
+       }
+
+       /**
+        * Returns a managed instance from given fax number
+        * <p>
+        * @param faxNumber     Fax instance
+        * @param fetchedNumber Found fax number in database
+        * <p>
+        * @return Managed instance
+        */
+       protected DialableFaxNumber getManaged (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
+
+               // Should be valid
+               if (null == faxNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("faxNumber is null"); //NOI18N
+               } else if (null == fetchedNumber) {
+                       // Throw NPE again
+                       throw new NullPointerException("fetchedNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableFaxNumber managedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
+                       // Merge this entry
+                       managedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getDetached: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N
+
+               // Return it
+               return managedNumber;
+       }
+
+       /**
+        * Get back a managed instance from given contact
+        * <p>
+        * @param contact Unmanaged/detached contact instance
+        * <p>
+        * @return Managed contact instance
+        */
+       protected Contact createManaged (final Contact contact) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: contact={1} - CALLED!", this.getClass().getSimpleName(), contact)); //NOI18N
+
+               // user should not be null
+               if (null == contact) {
+                       // Abort here
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Id is set
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
+
+               // Should be there
+               assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
+
+               // Return it
+               return managedContact;
+       }
+
+       /**
+        * Get back a managed instance from given country
+        * <p>
+        * @param country Unmanaged/detached country instance
+        * <p>
+        * @return Managed country instance
+        */
+       protected Country createManaged (final Country country) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: country={1} - CALLED!", this.getClass().getSimpleName(), country)); //NOI18N
+
+               // user should not be null
+               if (null == country) {
+                       // Abort here
+                       throw new NullPointerException("country is null"); //NOI18N
+               } else if (country.getCountryId() == null) {
+                       // Id is set
+                       throw new NullPointerException("country.countryId is null"); //NOI18N
+               } else if (country.getCountryId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("country.countryId={0} is invalid", country.getCountryId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId());
+
+               // Should be there
+               assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N
+
+               // Trace message
+               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 basic data
+        * <p>
+        * @param basicData Unmanaged/detached basic data instance
+        * <p>
+        * @return Managed basic data instance
+        */
+       protected BasicData createManaged (final BasicData basicData) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: basicData={1} - CALLED!", this.getClass().getSimpleName(), basicData)); //NOI18N
+
+               // user should not be null
+               if (null == basicData) {
+                       // Abort here
+                       throw new NullPointerException("basicData is null"); //NOI18N
+               } else if (basicData.getBasicDataId() == null) {
+                       // Id is set
+                       throw new NullPointerException("basicData.basicDataId is null"); //NOI18N
+               } else if (basicData.getBasicDataId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is invalid", basicData.getBasicDataId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final BasicData managedBasicData = this.getEntityManager().find(BusinessBasicData.class, basicData.getBasicDataId());
+
+               // Should be there
+               assert (managedBasicData instanceof BasicData) : "managedBasicData is null"; //NOI18N
+
+               // Trace message
+               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 branch office
+        * <p>
+        * @param headquarter Unmanaged/detached branch office instance
+        * <p>
+        * @return Managed basic data instance
+        */
+       protected BranchOffice createManaged (final BranchOffice headquarter) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
+
+               // user should not be null
+               if (null == headquarter) {
+                       // Abort here
+                       throw new NullPointerException("headquarter is null"); //NOI18N
+               } else if (headquarter.getBranchId() == null) {
+                       // Id is set
+                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
+               } else if (headquarter.getBranchId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getBranchId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final BranchOffice managedBranchOffice = this.getEntityManager().find(BusinessBranchOffice.class, headquarter.getBranchId());
+
+               // Should be there
+               assert (managedBranchOffice instanceof BasicData) : "managedBranchOffice is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBranchOffice={1} - EXIT!", this.getClass().getSimpleName(), managedBranchOffice)); //NOI18N
+
+               // Return it
+               return managedBranchOffice;
+       }
+
+       /**
+        * Get back a managed instance from given employee
+        * <p>
+        * @param employee Unmanaged/detached employee instance
+        * <p>
+        * @return Managed employee instance
+        */
+       protected Employable createManaged (final Employable 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 invalid", employee.getEmployeeId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Employable managedEmployee = this.getEntityManager().find(BusinessEmployee.class, employee.getEmployeeId());
+
+               // Should be there
+               assert (managedEmployee instanceof Employable) : "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 headquarters
+        * <p>
+        * @param headquarters Unmanaged/detached headquarters instance
+        * <p>
+        * @return Managed basic data instance
+        */
+       protected Headquarter createManaged (final Headquarter headquarters) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarters)); //NOI18N
+
+               // user should not be null
+               if (null == headquarters) {
+                       // Abort here
+                       throw new NullPointerException("headquarter is null"); //NOI18N
+               } else if (headquarter.getHeadquarterId() == null) {
+                       // Id is set
+                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
+               } else if (headquarter.getHeadquarterId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getHeadquarterId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Headquarter managedHeadquarter = this.getEntityManager().find(headquarter.getClass(), headquarter.getHeadquarterId());
+
+               // Should be there
+               assert (managedHeadquarter instanceof Headquarter) : "managedHeadquarter is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarter={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarter)); //NOI18N
+
+               // Return it
+               return managedHeadquarter;
+       }
+
+       /**
+        * Get back a managed instance from given job position
+        * <p>
+        * @param jobPosition Unmanaged/detached job position instance
+        * <p>
+        * @return Managed job position instance
+        */
+       protected JobPosition createManaged (final JobPosition jobPosition) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: jobPosition={1} - CALLED!", this.getClass().getSimpleName(), jobPosition)); //NOI18N
+
+               // user should not be null
+               if (null == jobPosition) {
+                       // Abort here
+                       throw new NullPointerException("jobPosition is null"); //NOI18N
+               } else if (jobPosition.getJobPositionId() == null) {
+                       // Id is set
+                       throw new NullPointerException("jobPosition.jobPositionId is null"); //NOI18N
+               } else if (jobPosition.getJobPositionId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("jobPosition.jobPositionId={0} is invalid", jobPosition.getJobPositionId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final JobPosition managedJobPosition = this.getEntityManager().find(jobPosition.getClass(), jobPosition.getJobPositionId());
+
+               // Should be there
+               assert (managedJobPosition instanceof JobPosition) : "managedJobPosition is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedJobPosition={1} - EXIT!", this.getClass().getSimpleName(), managedJobPosition)); //NOI18N
+
+               // Return it
+               return managedJobPosition;
+       }
+
+       /**
+        * Get back a managed instance from given mobile provider
+        * <p>
+        * @param mobileProvider Unmanaged/detached mobile provider instance
+        * <p>
+        * @return Managed mobile provider instance
+        */
+       protected MobileProvider createManaged (final MobileProvider mobileProvider) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
+
+               // user should not be null
+               if (null == mobileProvider) {
+                       // Abort here
+                       throw new NullPointerException("mobileProvider is null"); //NOI18N
+               } else if (mobileProvider.getProviderId() == null) {
+                       // Id is set
+                       throw new NullPointerException("headquarter.headquartersId is null"); //NOI18N
+               } else if (headquarters.getHeadquartersId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquartersId={0} is invalid", headquarters.getHeadquartersId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Headquarter managedHeadquarters = this.getEntityManager().find(BusinessHeadquarters.class, headquarters.getHeadquartersId());
+
+               // Should be there
+               assert (managedHeadquarters instanceof BasicData) : "managedHeadquarters is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarters={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarters)); //NOI18N
+
+               // Return it
+               return managedHeadquarters;
+       }
+
+       /**
+        * Get back a managed instance from given user
+        * <p>
+        * @param user Unmanaged/detached user instance
+        * <p>
+        * @return Managed user instance
+        */
+       protected User createManaged (final User user) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
+
+               // user should not be null
+               if (null == user) {
+                       // Abort here
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserId() == null) {
+                       // Id is set
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
+               } else if (user.getUserContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userContact is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() < 1) {
+                       // Not valid id number
+                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N#
+               }
+
+               // Try to find it (should be there)
+               final User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
+
+               // Should be there
+               assert (managedUser instanceof User) : "managedUser is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
+
+               // Return it
+               return managedUser;
+       }
+
+       /**
+        * Sets created timestamp on all opening times.
+        * <p>
+        * @param openingTimes Opening times list
+        * <p>
+        * @throws NullPointerException If given list is null
+        * @throws IllegalArgumentException If given list is empty
+        * @throws IllegalStateException If openingId is not null
+        */
+       protected void setAllOpeningTimesCreated (final List<OpeningTime> openingTimes) {
+               // Validate parameter
+               if (null == openingTimes) {
+                       // Throw NPE
+                       throw new NullPointerException("openingTimes is null");
+               } else if (openingTimes.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("openingTimes is empty");
+               }
+
+               // Walk through whole list
+               for (final OpeningTime openingTime : openingTimes) {
+                       // Id should not be set
+                       if (openingTime.getOpeningId() != null) {
+                               // Abort here
+                               throw new IllegalStateException("openingTime.openingId is not null");
+                       }
+
+                       // Set created timestamp
+                       openingTime.setOpeningCreated(new Date());
+               }
+       }
+
+       /**
+        * Updates all contact's phone entry's created timestamps
+        * <p>
+        * @param contact Contact instance to update
+        */
+       protected void setAllPhoneEntriesCreated (final Contact contact) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: contact={0} - CALLED!", contact)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() != null) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is unexpected.", contact.getContactId()));
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
+               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
+               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1},mobileNumber={2}", landLineNumber, faxNumber, mobileNumber)); //NOI18N
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a mobile number instance set?
+               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for mobile number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       mobileNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Updates all branch office's phone entry's created timestamps
+        * <p>
+        * @param branchOffice Branch office instance to update
+        */
+       protected void setAllPhoneEntriesCreated (final BranchOffice branchOffice) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: branchOffice={0} - CALLED!", branchOffice)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == branchOffice) {
+                       // Throw NPE again
+                       throw new NullPointerException("branchOffice is null"); //NOI18N
+               } else if (branchOffice.getBranchId() != null) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is unexpected.", branchOffice.getBranchId()));
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = branchOffice.getBranchLandLineNumber();
+               final DialableFaxNumber faxNumber = branchOffice.getBranchFaxNumber();
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Updates all branch office's phone entry's created timestamps
+        * <p>
+        * @param headquarter Headquarters instance to update
+        */
+       protected void setAllPhoneEntriesCreated (final Headquarter headquarter) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: headquarter={0} - CALLED!", headquarter)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == headquarter) {
+                       // Throw NPE again
+                       throw new NullPointerException("headquarter is null"); //NOI18N
+               } else if (headquarter.getHeadquartersId() != null) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.branchId={0} is unexpected.", headquarter.getHeadquartersId()));
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = headquarter.getHeadquartersLandLineNumber();
+               final DialableFaxNumber faxNumber = headquarter.getHeadquartersFaxNumber();
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryCreated(new Date());
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Updates all company's phone entry's created timestamps
+        * <p>
+        * @param basicData Company basic data instance to update
+        */
+       protected void setAllPhoneEntriesCreated (final BasicData basicData) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("setAllPhoneEntriesCreated: basicData={0} - CALLED!", basicData)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == basicData) {
+                       // Throw NPE again
+                       throw new NullPointerException("basicData is null"); //NOI18N
+               } else if (basicData.getBasicDataId() != null) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is unexpected.", basicData.getBasicDataId()));
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = basicData.getCompanyLandLineNumber();
+               final DialableFaxNumber faxNumber = basicData.getCompanyFaxNumber();
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for land-line number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryCreated(new Date());
+
+                       // Set it back in basic data
+                       basicData.setCompanyLandLineNumber(landLineNumber);
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() == null)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug("setAllPhoneEntriesCreated: Setting created timestamp for fax number ..."); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryCreated(new Date());
+
+                       // Set it back in basic data
+                       basicData.setCompanyFaxNumber(faxNumber);
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Returns a detached instance from given mobile instance
+        * <p>
+        * @param mobileNumber  Mobile instance
+        * @param fetchedNumber Found mobile number in database
+        * <p>
+        * @return Detached instance
+        */
+       protected DialableMobileNumber getDetached (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: mobileNumber={0},fetchedNumber={1} - CALLED!", mobileNumber, fetchedNumber)); //NOI18N
+
+               // Should be valid
+               if (null == mobileNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableMobileNumber detachedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameMobileNumber(mobileNumber, fetchedNumber)) {
+                       // Merge this entry
+                       detachedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
+
+               // Return it
+               return detachedNumber;
+       }
+
+       /**
+        * Returns a detached instance from given land-line instance
+        * <p>
+        * @param landLineNumber Land-line instance
+        * @param fetchedNumber  Found land-line number in database
+        * <p>
+        * @return Detached instance
+        */
+       protected DialableLandLineNumber getDetached (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: landLineNumber={0},fetchedNumber={1} - CALLED!", landLineNumber, fetchedNumber)); //NOI18N
+
+               // Should be valid
+               if (null == landLineNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("landLineNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableLandLineNumber detachedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameLandLineNumber(landLineNumber, fetchedNumber)) {
+                       // Merge this entry
+                       detachedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
+
+               // Return it
+               return detachedNumber;
+       }
+
+       /**
+        * Returns a detached instance from given fax instance
+        * <p>
+        * @param faxNumber     Fax instance
+        * @param fetchedNumber Found fax number in database
+        * <p>
+        * @return Detached instance
+        */
+       protected DialableFaxNumber getDetached (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: faxNumber={0},fetchedNumber={1} - CALLED!", faxNumber, fetchedNumber)); //NOI18N
+
+               // Should be valid
+               if (null == faxNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("faxNumber is null"); //NOI18N
+               } else if (fetchedNumber.getPhoneId() == null) {
+                       // ..and again
+                       throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
+
+               // Init query instance
+               final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
+
+               // Default is null
+               DialableFaxNumber detachedNumber = null;
+
+               // Is there a difference?
+               if (!PhoneUtils.isSameFaxNumber(faxNumber, fetchedNumber)) {
+                       // Merge this entry
+                       detachedNumber = this.getEntityManager().merge(foundNumber);
+
+                       // @TODO Copy all
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
+
+               // Return it
+               return detachedNumber;
+       }
+
+       /**
+        * Merges given contact's data
+        * <p>
+        * @param detachedContact Contact instance to merge
+        * <p>
+        * @return Detached contact instance
+        */
+       protected Contact mergeContactData (final Contact detachedContact) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == detachedContact) {
+                       // Throw NPE again
+                       throw new NullPointerException("detachedContact is null"); //NOI18N
+               } else if (detachedContact.getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
+               } else if (detachedContact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
+               }
+
+               // Set updated timestamp
+               detachedContact.setContactUpdated(new Date());
+
+               // Get contact from it and find it
+               final Contact foundContact = this.getEntityManager().find(detachedContact.getClass(), detachedContact.getContactId());
+
+               // Should be found
+               assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", detachedContact.getContactId()); //NOI18N
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateUserPersonalData: foundContact.contactId={1}", this.getClass().getSimpleName(), foundContact.getContactId())); //NOI18N
+
+               // Is a fax number set?
+               if (detachedContact.getContactFaxNumber() instanceof DialableFaxNumber) {
+                       // Make fax numbers managed
+                       foundContact.setContactFaxNumber(this.getManaged(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()));
+               }
+
+               // Is a mobile number set?
+               if (detachedContact.getContactMobileNumber() instanceof DialableMobileNumber) {
+                       // Make mobile numbers managed
+                       foundContact.setContactMobileNumber(this.getManaged(detachedContact.getContactMobileNumber(), detachedContact.getContactMobileNumber()));
+               }
+
+               // Merge contact instance
+               final Contact managedContact = this.getEntityManager().merge(foundContact);
+
+               // Copy all
+               Contacts.copyAll(detachedContact, managedContact);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactData: managedContact={1} - EXIT!", this.getClass().getSimpleName(), managedContact)); //NOI18N
+
+               // Return detached contact
+               return managedContact;
+       }
+
+       /**
+        * Merges given (detached) contact's mobile, land-line and fax numbers
+        * <p>
+        * @param detachedContact Detached contact instance
+        */
+       protected void mergeContactsMobileLandLineFaxNumbers (final Contact detachedContact) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.mergeContactsMobileLandLineFaxNumbers: detachedContact={1} - CALLED!", this.getClass().getSimpleName(), detachedContact)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == detachedContact) {
+                       // Throw NPE again
+                       throw new NullPointerException("detachedContact is null"); //NOI18N
+               } else if (detachedContact.getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
+               } else if (detachedContact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N
+               }
+
+               // Get all instances
+               final DialableMobileNumber mobile = detachedContact.getContactMobileNumber();
+               final DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
+               final DialableFaxNumber fax = detachedContact.getContactFaxNumber();
+
+               // Is there a  mobile instance set?
+               if (mobile instanceof DialableMobileNumber) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobile.getPhoneId())); //NOI18N
+
+                       // Then find it, too
+                       final DialableMobileNumber foundMobile = this.getEntityManager().find(mobile.getClass(), mobile.getPhoneId());
+
+                       // Should be there
+                       assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
+
+                       // Then merge it, too
+                       final DialableMobileNumber managedMobile = this.getEntityManager().merge(foundMobile);
+
+                       // Should be there
+                       assert (managedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", managedMobile.getPhoneId()); //NOI18N
+
+                       // Copy all
+                       MobileNumbers.copyAll(detachedContact.getContactMobileNumber(), managedMobile);
+
+                       // Set it back
+                       detachedContact.setContactMobileNumber(managedMobile);
+               }
+
+               // Is there a  fax instance set?
+               if (fax instanceof DialableFaxNumber) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); //NOI18N
+
+                       // Then find it, too
+                       final DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId());
+
+                       // Should be there
+                       assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N
+
+                       // Then merge it, too
+                       final DialableFaxNumber managedFax = this.getEntityManager().merge(foundFax);
+
+                       // Should be there
+                       assert (managedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", managedFax.getPhoneId()); //NOI18N
+
+                       // Copy all
+                       FaxNumbers.copyAll(detachedContact.getContactFaxNumber(), managedFax);
+
+                       // Set it back
+                       detachedContact.setContactFaxNumber(managedFax);
+               }
+
+               // Is there a  fax instance set?
+               if (landLine instanceof DialableLandLineNumber) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); //NOI18N
+
+                       // Then find it, too
+                       final DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId());
+
+                       // Should be there
+                       assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N
+
+                       // Then merge it, too
+                       final DialableLandLineNumber managedLandLine = this.getEntityManager().merge(foundLandLine);
+
+                       // Should be there
+                       assert (managedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", managedLandLine.getPhoneId()); //NOI18N
+
+                       // Copy all
+                       LandLineNumbers.copyAll(detachedContact.getContactLandLineNumber(), managedLandLine);
+
+                       // Set it back
+                       detachedContact.setContactLandLineNumber(managedLandLine);
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("mergeContactsMobileLandLineFaxNumbers: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Sends an email with given subject line, template name to given recipient
+        * and user data
+        * <p>
+        * @param subjectLine    Subject line
+        * @param templateName   Template name
+        * @param user           User instance
+        * @param baseUrl        Base URL
+        * @param randomPassword A randomly-generated password or NULL if user had
+        *                       to enter it.
+        */
+       protected void sendEmail (final String subjectLine, final String templateName, final User user, final String baseUrl, final String randomPassword) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendEmail: subjectLine={0},templateName={1},user={2},baseUrl={3} - CALLED!", subjectLine, templateName, user, baseUrl)); //NOI18N
+
+               // All should be set
+               if (null == subjectLine) {
+                       // Throw NPE
+                       throw new NullPointerException("subjectLine is null"); //NOI18N
+               } else if (subjectLine.isEmpty()) {
+                       // No subject line
+                       throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
+               } else if (null == templateName) {
+                       // Throw NPE
+                       throw new NullPointerException("templateName is null"); //NOI18N
+               } else if (templateName.isEmpty()) {
+                       // No template name
+                       throw new IllegalArgumentException("templateName is empty"); //NOI18N
+               } else if (null == user) {
+                       // Throw NPE
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Not valid number
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N
+               } else if (user.getUserName() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userName is null"); //NOI18N
+               } else if (user.getUserName().isEmpty()) {
+                       // Empty string
+                       throw new IllegalArgumentException("user.userName is empty"); //NOI18N
+               } else if (user.getUserAccountStatus() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
+               } else if (user.getUserContact() == null) {
+                       // Throw it again
+                       throw new NullPointerException("user.userContact is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() == null) {
+                       // .. and again
+                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is invalid", user.getUserContact().getContactId())); //NOI18N
+               } else if (user.getUserContact().getContactPersonalTitle() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userContact.contactPersonalTitle is null"); //NOI18N
+               } else if (user.getUserLocale() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userLocale is null"); //NOI18N
+               } else if (this.getSession() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.session is not set. Have you forgotten to call super(String, String) and called only super() ?"); //NOI18N
+               }
+
+               // Set all values
+               final Properties variables = Users.getAllUserFields(user);
+
+               // Set base URL and random password
+               variables.put("baseUrl", baseUrl); //NOI18N
+               variables.put("randomPassword", ""); //NOI18N
+
+               // Is the random password set?
+               if ((randomPassword instanceof String) && (!randomPassword.isEmpty())) {
+                       variables.put("randomPassword", randomPassword); //NOI18N
+               }
+
+               // Init addresss
+               final Address recipientAddress;
+
+               try {
+                       // Create email address and set
+                       recipientAddress = new InternetAddress(user.getUserContact().getContactEmailAddress());
+               } catch (final AddressException ex) {
+                       // Throw again
+                       throw new EJBException(ex);
+               }
+
+               // Prepare mail wrapper
+               // @TODO Language from message bundle
+               final WrapableEmailDelivery emailWrapper = new EmailDeliveryWrapper(recipientAddress, subjectLine, templateName, variables, user.getUserLocale());
+
+               try {
+                       // Send out email change
+                       final ObjectMessage message = this.getSession().createObjectMessage();
+                       message.setObject(emailWrapper);
+
+                       // Send message
+                       this.sendMessage(message);
+               } catch (final JMSException ex) {
+                       // Throw again
+                       throw new EJBException(ex);
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace("sendEmail: EXIT!"); //NOI18N
+       }
+
+       /**
+        * Updates all contact's phone instances from other contact, both contacts
+        * should be the same.
+        * <p>
+        * @param contact Contact to set instances
+        * @param other   Other contact to get instances from
+        */
+       protected void setAllContactPhoneEntries (final Contact contact, final Contact other) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1},other={2} - CALLED!", this.getClass().getSimpleName(), contact, other)); //NOI18N
+
+               // Both must be the same and not null
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (null == other) {
+                       // Throw NPE
+                       throw new NullPointerException("other is null"); //NOI18N
+               } else if (!Objects.equals(contact, other)) {
+                       // Not same instances
+                       throw new IllegalArgumentException(MessageFormat.format("{0}.setAllContactPhoneEntries: contact={1} and other={2} are not equal!", this.getClass().getSimpleName(), contact, other)); //NOI18N
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactMobileNumber={0}", other.getContactMobileNumber())); //NOI18N
+
+               // Is other mobile not set?
+               if ((other.getContactMobileNumber() == null) || (PhoneUtils.isSameMobileNumber(contact.getContactMobileNumber(), other.getContactMobileNumber()))) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying mobile entry ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Is the fax number set?
+                       if (other.getContactMobileNumber() instanceof DialableMobileNumber) {
+                               // Copy mobile number
+                               contact.setContactMobileNumber(this.getManaged(other.getContactMobileNumber(), contact.getContactMobileNumber()));
+                       } else {
+                               // Null it
+                               contact.setContactMobileNumber(null);
+                       }
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactLandLineNumber={0}", other.getContactLandLineNumber())); //NOI18N
+
+               // Is other mobile not set?
+               if ((other.getContactLandLineNumber() == null) || (PhoneUtils.isSameLandLineNumber(contact.getContactLandLineNumber(), other.getContactLandLineNumber()))) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying land-line entry ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Is the land-line number set?
+                       if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                               // Copy land-line number
+                               contact.setContactLandLineNumber(this.getManaged(other.getContactLandLineNumber(), contact.getContactLandLineNumber()));
+                       } else {
+                               // Null it
+                               contact.setContactLandLineNumber(null);
+                       }
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: other.contactFaxNumber={1}", this.getClass().getSimpleName(), other.getContactFaxNumber())); //NOI18N
+
+               // Is other mobile not set?
+               if ((other.getContactFaxNumber() == null) || (PhoneUtils.isSameFaxNumber(contact.getContactFaxNumber(), other.getContactFaxNumber()))) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntries: Copying fax entry ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Is the fax number set?
+                       if (other.getContactFaxNumber() instanceof DialableFaxNumber) {
+                               // Copy fax number
+                               contact.setContactFaxNumber(this.getManaged(other.getContactFaxNumber(), contact.getContactFaxNumber()));
+                       } else {
+                               // Null it
+                               contact.setContactFaxNumber(null);
+                       }
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntries: EXIT!", this.getClass().getSimpleName())); //NOI18N
+       }
+
+       /**
+        * Updates all contact's phone entry's updated timestamps
+        * <p>
+        * @param contact            Contact instance to update
+        * @param isMobileUnlinked   Whether a mobile entry has been unlinked in
+        *                           contact instance
+        * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
+        *                           contact instance
+        * @param isFaxUnlinked      Whether a fax entry has been unlinked in
+        *                           contact instance
+        */
+       protected void setAllContactPhoneEntriesUpdated (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: contact={1},isMobileUnlinked={2},isLandlineUnlinked={3},isFaxUnlinked={4} - CALLED", this.getClass().getSimpleName(), contact, isMobileUnlinked, isLandlineUnlinked, isFaxUnlinked)); //NOI18N
+
+               // The contact instance must be valid
+               if (null == contact) {
+                       // Throw NPE again
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
+               }
+
+               // Get all phone instances
+               final DialableLandLineNumber landLineNumber = contact.getContactLandLineNumber();
+               final DialableFaxNumber faxNumber = contact.getContactFaxNumber();
+               final DialableMobileNumber mobileNumber = contact.getContactMobileNumber();
+
+               // Flags and instances must be constistent
+               if (isMobileUnlinked && mobileNumber instanceof DialableMobileNumber) {
+                       // Bad state
+                       throw new IllegalStateException("isCellPhoneUnlinked is TRUE, but mobileNumber is set."); //NOI18N
+               } else if (isLandlineUnlinked && landLineNumber instanceof DialableLandLineNumber) {
+                       // Bad state
+                       throw new IllegalStateException("isLandlineUnlinked is TRUE, but landLineNumber is set."); //NOI18N
+               } else if (isFaxUnlinked && faxNumber instanceof DialableFaxNumber) {
+                       // Bad state
+                       throw new IllegalStateException("isFaxUnlinked is TRUE, but faxNumber is set."); //NOI18N
+               }
+
+               // Is a phone number instance set?
+               if ((landLineNumber instanceof DialableLandLineNumber) && (landLineNumber.getPhoneId() instanceof Long) && (landLineNumber.getPhoneId() > 0)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       landLineNumber.setPhoneEntryUpdated(new Date());
+               }
+
+               // Is a fax number instance set?
+               if ((faxNumber instanceof DialableFaxNumber) && (faxNumber.getPhoneId() instanceof Long) && (faxNumber.getPhoneId() > 0)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       faxNumber.setPhoneEntryUpdated(new Date());
+               }
+
+               // Is a mobile number instance set?
+               if ((mobileNumber instanceof DialableMobileNumber) && (mobileNumber.getPhoneId() instanceof Long) && (mobileNumber.getPhoneId() > 0)) {
+                       // Debug message
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N
+
+                       // Set updated timestamp
+                       mobileNumber.setPhoneEntryUpdated(new Date());
+               }
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: EXIT!", this.getClass().getSimpleName())); //NOI18N
+       }
+
+}
index 285a65bfbe3eeb5b2e6b3f6fb389b77cfa3043b5..e8975ccf9166e575ca91e7fc063e5e2f395727a4 100644 (file)
@@ -22,7 +22,7 @@ import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
 import org.mxchange.jaddressbook.exceptions.AddressbookNameAlreadyUsedException;
 import org.mxchange.jaddressbook.exceptions.AddressbookNotFoundException;
@@ -35,7 +35,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "addressbook", description = "A stateless bean for handling Addressbook addressbooks")
-public class AddressbookSessionBean extends BaseAddressbookDatabaseBean implements AddressbookSessionBeanRemote {
+public class AddressbookSessionBean extends BaseAddressbookEnterpriseBean implements AddressbookSessionBeanRemote {
 
        /**
         * Serial number
index 89a42905da14c302cdf30500712867f34411136e..3043e7e818bd479abb611d05888c0a2d6bcf6ef8 100644 (file)
@@ -24,7 +24,7 @@ import java.util.Objects;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.addressbook.model.shared.AddressbookShareSessionBeanRemote;
 import org.mxchange.jaddressbook.model.addressbook.Addressbook;
 import org.mxchange.jaddressbookshare.exceptions.UserAlreadySharingAddressbookException;
@@ -36,7 +36,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "share", description = "A stateless bean for handling shared addressbooks")
-public class SharedAddressbooksSessionBean extends BaseAddressbookDatabaseBean implements AddressbookShareSessionBeanRemote {
+public class SharedAddressbooksSessionBean extends BaseAddressbookEnterpriseBean implements AddressbookShareSessionBeanRemote {
 
        /**
         * Serial number
index 27a86a7c8ad37cf7c175afab09cd7f77ff965a7f..5ffa6225529d17ae8243bb9fc71d824b50d5362f 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Date;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 
@@ -31,7 +31,7 @@ import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminContact", description = "An administrative contact EJB")
-public class AddressbookAdminContactSessionBean extends BaseAddressbookDatabaseBean implements AdminContactSessionBeanRemote {
+public class AddressbookAdminContactSessionBean extends BaseAddressbookEnterpriseBean implements AdminContactSessionBeanRemote {
 
        /**
         * Serial number
index 583b1fce676717fcd57566456aed8cc4eeb86067..628bd9164b8d51834b2f826517bb332abf51f5da 100644 (file)
@@ -23,7 +23,7 @@ import java.util.Objects;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 
 /**
@@ -32,7 +32,7 @@ import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "contact", description = "A bean handling contact data")
-public class AddressbookContactSessionBean extends BaseAddressbookDatabaseBean implements ContactSessionBeanRemote {
+public class AddressbookContactSessionBean extends BaseAddressbookEnterpriseBean implements ContactSessionBeanRemote {
 
        /**
         * Serial number
index b93841eb86da1d3f783eec135f181d3d92b50b71..d59d5a693c89a6c8a6a5ed67562b03435bcc1b34 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Date;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
 import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
@@ -36,7 +36,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminContactPhone", description = "An administrative bean handling contact's phone data")
-public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminContactsPhoneSessionBeanRemote {
+public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookEnterpriseBean implements AdminContactsPhoneSessionBeanRemote {
 
        /**
         * Serial number
index 5570b478266e7c72e2ac43b547949659c178f7e6..05d7adb13ab44992da0cbc8dcdd5b4da193bc810 100644 (file)
@@ -22,7 +22,7 @@ import java.util.List;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
@@ -34,7 +34,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminBasicCompanyData", description = "An administrative statless bean for handling business data (all)")
-public class AddressbookAdminBusinessDataSessionBean extends BaseAddressbookDatabaseBean implements AdminBasicCompanyDataSessionBeanRemote {
+public class AddressbookAdminBusinessDataSessionBean extends BaseAddressbookEnterpriseBean implements AdminBasicCompanyDataSessionBeanRemote {
 
        /**
         * Serial number
index 2be6f91f41f4ef56f351bae697cbf5a7885453b1..1ca10a2caffceb5dd0a034d180ebf9a3bf6da2ea 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless session bean for business data
@@ -28,7 +28,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "basicCompanyData", description = "A general statless bean for handling business data (all)")
-public class AddressbookBusinessDataSessionBean extends BaseAddressbookDatabaseBean implements BasicCompanyDataSessionBeanRemote {
+public class AddressbookBusinessDataSessionBean extends BaseAddressbookEnterpriseBean implements BasicCompanyDataSessionBeanRemote {
 
        /**
         * Serial number
index 5597caf12149c8ef57490cf09daaaa1d0ce72214..3fc9ba613e00db2b172eebf1488ab95901616bfe 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Date;
 import java.util.List;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
@@ -34,7 +34,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminBranchOffice", description = "An administrative statless bean for handling branch office data (all)")
-public class AddressbookAdminBranchOfficeSessionBean extends BaseAddressbookDatabaseBean implements AdminBranchOfficeSessionBeanRemote {
+public class AddressbookAdminBranchOfficeSessionBean extends BaseAddressbookEnterpriseBean implements AdminBranchOfficeSessionBeanRemote {
 
        /**
         * Serial number
index c09b8be2d69c1b8a356dd02f61c5932dc2527289..4209f1357a01083331c77b4a89427070079079a7 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless session bean for general branch office purposes
@@ -28,7 +28,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "branchOffice", description = "A general statless bean for handling branch office data (all)")
-public class AddressbookBranchOfficeSessionBean extends BaseAddressbookDatabaseBean implements BranchOfficeSessionBeanRemote {
+public class AddressbookBranchOfficeSessionBean extends BaseAddressbookEnterpriseBean implements BranchOfficeSessionBeanRemote {
 
        /**
         * Serial number
index b95556dcfe4368e9e307c105d70c2760f7cdeb93..55bc8bd18f34a01d5cc1d05a3e27dbe5f7b642b2 100644 (file)
@@ -24,7 +24,7 @@ import javax.ejb.Stateless;
 import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 import org.mxchange.jusercore.model.user.User;
@@ -35,7 +35,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminDepartment", description = "An administrative statless bean for handling department data (all)")
-public class AddressbookAdminDepartmentSessionBean extends BaseAddressbookDatabaseBean implements AdminDepartmentSessionBeanRemote {
+public class AddressbookAdminDepartmentSessionBean extends BaseAddressbookEnterpriseBean implements AdminDepartmentSessionBeanRemote {
 
        /**
         * Serial number
index e8dea68477ebbed22823acccbcbe75bc7eb29746..d86f4dfe9591ce88aeafb15987b4ae9d029ab187 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless session bean for general department purposes
@@ -28,7 +28,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "department", description = "A general statless bean for handling branch office data (all)")
-public class AddressbookDepartmentSessionBean extends BaseAddressbookDatabaseBean implements DepartmentSessionBeanRemote {
+public class AddressbookDepartmentSessionBean extends BaseAddressbookEnterpriseBean implements DepartmentSessionBeanRemote {
 
        /**
         * Serial number
index 15ab7362c66452b2401a48bf3a952cf786e533db..a61e25f1ad5271f3c5111f7082889bbd55c0b3e1 100644 (file)
@@ -20,13 +20,13 @@ import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.Department;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.model.user.User;
@@ -37,7 +37,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminEmployee", description = "An administrative statless bean for handling company employees")
-public class AddressbookAdminEmployeeSessionBean extends BaseAddressbookDatabaseBean implements AdminEmployeeSessionBeanRemote {
+public class AddressbookAdminEmployeeSessionBean extends BaseAddressbookEnterpriseBean implements AdminEmployeeSessionBeanRemote {
 
        /**
         * Serial number
@@ -177,9 +177,9 @@ public class AddressbookAdminEmployeeSessionBean extends BaseAddressbookDatabase
                }
 
                // Is headquarter set?
-               if (employee.getEmployeeJobPosition() instanceof JobPosition) {
+               if (employee.getEmployeeJobPosition() instanceof HireableJobPosition) {
                        // Then make it managed
-                       final JobPosition jobPosition = this.createManaged(employee.getEmployeeJobPosition());
+                       final HireableJobPosition jobPosition = this.createManaged(employee.getEmployeeJobPosition());
 
                        // Set it back
                        employee.setEmployeeJobPosition(jobPosition);
index 56b25f1c4dde373c2088f5e3b3a486e72cff9279..89fdadb0ac587d48462c408fa6f8b4f45edc1ea7 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless bean for general purposes for company employees.
@@ -28,7 +28,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "employee", description = "A general statless bean for handling company employees")
-public class AddressbookEmployeeSessionBean extends BaseAddressbookDatabaseBean implements EmployeeSessionBeanRemote {
+public class AddressbookEmployeeSessionBean extends BaseAddressbookEnterpriseBean implements EmployeeSessionBeanRemote {
 
        /**
         * Serial number
index a90afda93e763406fdef697c8a2808fead44a3de..88261acf83bf04ec5157d67cfa5e029a6ee06bc3 100644 (file)
@@ -24,7 +24,7 @@ import javax.ejb.Stateless;
 import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -33,7 +33,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminHeadquarter", description = "An administrative statless bean for handling branch office data (all)")
-public class AddressbookAdminHeadquarterSessionBean extends BaseAddressbookDatabaseBean implements AdminHeadquarterSessionBeanRemote {
+public class AddressbookAdminHeadquarterSessionBean extends BaseAddressbookEnterpriseBean implements AdminHeadquarterSessionBeanRemote {
 
        /**
         * Serial number
index 25655571458f73115d8b0b5d40505e93954c7541..a309bd0b5f68a40a686598a1900f0ca6c571f2ce 100644 (file)
@@ -21,7 +21,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote;
 
 /**
@@ -30,7 +30,7 @@ import org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRe
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "headquarter", description = "A general statless bean for handling headquarter data (all)")
-public class AddressbookHeadquarterSessionBean extends BaseAddressbookDatabaseBean implements HeadquarterSessionBeanRemote {
+public class AddressbookHeadquarterSessionBean extends BaseAddressbookEnterpriseBean implements HeadquarterSessionBeanRemote {
 
        /**
         * Serial number
index 0935f56ff2bc3043b7709b7a0054428689605e54..24de2875f85c1114ede0b925a6ab7caa0dc3177b 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless session bean for administrative opening times purposes
@@ -27,7 +27,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminOpeningTimes", description = "An administrative statless bean for handling opening times")
-public class AddressbookAdminOpeningTimesSessionBean extends BaseAddressbookDatabaseBean implements AdminOpeningTimeSessionBeanRemote {
+public class AddressbookAdminOpeningTimesSessionBean extends BaseAddressbookEnterpriseBean implements AdminOpeningTimeSessionBeanRemote {
 
        /**
         * Serial number
index 5546004526fbb14149632814fd42b701dc3b2c16..44cf87797ba4db1f5d4e17eda438b62ef7fa4cff 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless session bean for general opening times purposes
@@ -28,7 +28,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "openingTimes", description = "A general statless bean for handling branch office data (all)")
-public class AddressbookOpeningTimesSessionBean extends BaseAddressbookDatabaseBean implements OpeningTimeSessionBeanRemote {
+public class AddressbookOpeningTimesSessionBean extends BaseAddressbookEnterpriseBean implements OpeningTimeSessionBeanRemote {
 
        /**
         * Serial number
index ab5be18452dbfe0d689f821ce9e8b69233e123a9..484605ed2cb90a387679f2b3350d90ac22f3a94d 100644 (file)
@@ -22,7 +22,7 @@ import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A stateless EJB for administrative country purposes
@@ -30,7 +30,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminCountry", description = "A stateless session-scoped bean for administrative country purposes")
-public class AddressbookAdminCountrySingletonBean extends BaseAddressbookDatabaseBean implements AdminCountrySessionBeanRemote {
+public class AddressbookAdminCountrySingletonBean extends BaseAddressbookEnterpriseBean implements AdminCountrySessionBeanRemote {
 
        /**
         * Serial number
index 148f82858c2b1f458fe9de122362bff3d63e92d5..99ff1d69da4c5a263ad753a21b9348fc38c84614 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A singleton EJB for country informations
@@ -30,7 +30,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  */
 @Startup
 @Singleton (name = "country", description = "A singleton session-scoped bean for country informations")
-public class AddressbookCountrySingletonBean extends BaseAddressbookDatabaseBean implements CountrySingletonBeanRemote {
+public class AddressbookCountrySingletonBean extends BaseAddressbookEnterpriseBean implements CountrySingletonBeanRemote {
 
        /**
         * Serial number
index 316f80f0c284d8b2231e348d75480e4ebca84c49..59d1f2ff14e14162274e9716d09f4b08e49de6e5 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.jphone.model.phonenumbers.mobileprovider;
 import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
 
 /**
@@ -28,7 +28,7 @@ import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedE
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminMobileProvider", description = "A singleton session-scoped bean for mobile provider informations, admin-edition")
-public class AddressbookAdminMobileProviderSessionBean extends BaseAddressbookDatabaseBean implements AdminMobileProviderSessionBeanRemote {
+public class AddressbookAdminMobileProviderSessionBean extends BaseAddressbookEnterpriseBean implements AdminMobileProviderSessionBeanRemote {
 
        /**
         * Serial number
index 145c9277b64cccdedf377fe9dbc69f6374358535..d377b4a6340969ca046280075e4de0d8b67f0ee4 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 
 /**
  * A singleton EJB for mobile provider informations
@@ -30,7 +30,7 @@ import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
  */
 @Startup
 @Singleton (name = "mobileProvider", description = "A singleton session-scoped bean for SMS provider informations")
-public class AddressbookMobileProviderSingletonBean extends BaseAddressbookDatabaseBean implements MobileProviderSingletonBeanRemote {
+public class AddressbookMobileProviderSingletonBean extends BaseAddressbookEnterpriseBean implements MobileProviderSingletonBeanRemote {
 
        /**
         * Serial number
index d8c33acb5b9c6a0a34fc6ccc02ec5b173d18f726..2d8ac9f9f58c990c711ecf77908aa1c3cc1fcda8 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.jphone.model.phonenumbers.phone;
 import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -33,7 +33,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminPhone", description = "An administrative bean handling phone data")
-public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBean implements AdminPhoneSessionBeanRemote {
+public class AddressbookAdminPhoneSessionBean extends BaseAddressbookEnterpriseBean implements AdminPhoneSessionBeanRemote {
 
        /**
         * Serial number
index 94f5d68754a02c68ec2cf179b64a897820052af0..a937bdec65cb3f3cb5df628d2b887c44ee4e3a37 100644 (file)
@@ -20,8 +20,7 @@ import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -35,7 +34,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "phone", description = "A bean handling phone data")
-public class AddressbookPhoneSessionBean extends BaseAddressbookDatabaseBean implements PhoneSessionBeanRemote {
+public class AddressbookPhoneSessionBean extends BaseAddressbookEnterpriseBean implements PhoneSessionBeanRemote {
 
        /**
         * Serial number
index dc1d482978bb7893250949dcc11b1b6e8bfc866c..cbf7dbd1cfc9a941063a058a2d7315a4d8eeecd5 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.Date;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
@@ -37,7 +37,7 @@ import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBe
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminUser", description = "A bean handling the user data")
-public class AddressbookAdminUserSessionBean extends BaseAddressbookDatabaseBean implements AdminUserSessionBeanRemote {
+public class AddressbookAdminUserSessionBean extends BaseAddressbookEnterpriseBean implements AdminUserSessionBeanRemote {
 
        /**
         * Serial number
index c3e5822f05f780deb25b80b06e3a55a329ac520b..3de16e24f79282ee4c19d1eb932091450b02e35e 100644 (file)
@@ -25,7 +25,7 @@ import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.PersistenceException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.Contacts;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -49,7 +49,7 @@ import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBe
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "user", description = "A bean handling the user data")
-public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean implements UserSessionBeanRemote {
+public class AddressbookUserSessionBean extends BaseAddressbookEnterpriseBean implements UserSessionBeanRemote {
 
        /**
         * Serial number
index 333a907032d83f8bf470ba6507fcdf32ac810c8a..68bd4a458c2afe470d46f7a19b99ccce869d77bd 100644 (file)
@@ -24,7 +24,7 @@ import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
 import javax.jms.ObjectMessage;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -46,7 +46,7 @@ import org.mxchange.jusercore.model.user.User;
                        )
                }
 )
-public class AddressbookUserActivityLogMessageBean extends BaseAddressbookDatabaseBean implements MessageListener {
+public class AddressbookUserActivityLogMessageBean extends BaseAddressbookEnterpriseBean implements MessageListener {
 
        /**
         * Serial number
index c6baf941679b0699d392a2ea628f83350bc11ef0..cf54b96f4ab5b8f8e56f488ab858739c1368ed09 100644 (file)
@@ -23,7 +23,7 @@ import javax.ejb.Stateless;
 import javax.jms.JMSException;
 import javax.jms.ObjectMessage;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -32,7 +32,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userActivity", description = "A stateless, session-scored user-activity bean.")
-public class AddressbookUserActivitySessionBean extends BaseAddressbookDatabaseBean implements UserActivityLogSessionBeanRemote {
+public class AddressbookUserActivitySessionBean extends BaseAddressbookEnterpriseBean implements UserActivityLogSessionBeanRemote {
 
        /**
         * Serial number
index 391737f44a61e825ecefa841d9d8875f83427360..0b3bec75195490aad8686d65c3e7dbde3fe43c0c 100644 (file)
@@ -24,7 +24,7 @@ import javax.ejb.EJBException;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
 import org.mxchange.jusercore.model.email_address.EmailAddressChange;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
@@ -36,7 +36,7 @@ import org.mxchange.juserlogincore.login.UserLoginUtils;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userEmailChange", description = "A bean handling user email changes")
-public class AddressbookUserEmailChangeSessionBean extends BaseAddressbookDatabaseBean implements UserEmailChangeSessionBeanRemote {
+public class AddressbookUserEmailChangeSessionBean extends BaseAddressbookEnterpriseBean implements UserEmailChangeSessionBeanRemote {
 
        /**
         * Serial number
index cbfa84c47dd7363f8c6644d0ae18d0b7357bbecf..7734e09b49c777ad577531760065c02342ba3a21 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.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -29,7 +29,7 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userPasswordHistory", description = "A stateless EJB for user's password history. This bean does return the full user's password history and not limited. The application then needs to limit it to it's purpose.")
-public class AddressbookUserPasswordHistorySessionBean extends BaseAddressbookDatabaseBean implements UserPasswordHistorySessionBeanRemote {
+public class AddressbookUserPasswordHistorySessionBean extends BaseAddressbookEnterpriseBean implements UserPasswordHistorySessionBeanRemote {
 
        /**
         * Serial number
index 8db7dcdb54ae38bcef427e98c42bcfdf23fd99a1..4c239d5dd9be0a4784e3a15fbf96717c83193bea 100644 (file)
@@ -19,7 +19,7 @@ package org.mxchange.juserlogincore.model.user.login;
 import java.text.MessageFormat;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
@@ -37,7 +37,7 @@ import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBe
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userLogin", description = "A bean handling the user login for Addressbook project")
-public class AddressbookUserLoginSessionBean extends BaseAddressbookDatabaseBean implements UserLoginSessionBeanRemote {
+public class AddressbookUserLoginSessionBean extends BaseAddressbookEnterpriseBean implements UserLoginSessionBeanRemote {
 
        /**
         * Serial number
index 3d96a742407ed3a2b204482102fe877927814ba6..e0a01aae1496fbfe31fc6d7c30e36e1609db65c7 100644 (file)
@@ -22,7 +22,7 @@ import javax.ejb.EJB;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
@@ -38,7 +38,7 @@ import org.mxchange.juserlogincore.login.UserLoginUtils;
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userRegistration", description = "A bean handling the user registration")
-public class AddressbookUserRegistrationSessionBean extends BaseAddressbookDatabaseBean implements UserRegistrationSessionBeanRemote {
+public class AddressbookUserRegistrationSessionBean extends BaseAddressbookEnterpriseBean implements UserRegistrationSessionBeanRemote {
 
        /**
         * Serial number
index 9e34760d8e48f86f57de551b210dd4db2b6a16dc..e8bbba6cad99ab57e4cfad6c516502a181baf36b 100644 (file)
@@ -20,7 +20,7 @@ import java.text.MessageFormat;
 import java.util.Locale;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
+import org.mxchange.addressbook.enterprise.BaseAddressbookEnterpriseBean;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
@@ -36,7 +36,7 @@ import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBe
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "userResendConfirmationLink", description = "A bean resending confirmation links")
-public class AddressbookResendLinkSessionBean extends BaseAddressbookDatabaseBean implements ResendLinkSessionBeanRemote {
+public class AddressbookResendLinkSessionBean extends BaseAddressbookEnterpriseBean implements ResendLinkSessionBeanRemote {
 
        /**
         * Serial number