From: Roland Häder Date: Wed, 15 Jan 2020 10:36:08 +0000 (+0100) Subject: Don't cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=40edbf12853a830980910aecd58ac559d7977568;p=jjobs-ejb.git Don't cherry-pick: - fixed imports - updated updateUserPersonalData() method - still there are A LOT invocations on deprecated methods, this mess needs to be cleared up. Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java index 87d2819..ae7ced4 100644 --- a/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java @@ -21,6 +21,7 @@ import java.util.Date; import java.util.Objects; import javax.ejb.EJB; import javax.ejb.Stateless; +import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote; import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean; import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException; diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java index f935f61..0d5a662 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java @@ -20,7 +20,6 @@ import java.text.MessageFormat; import java.util.Date; import javax.ejb.Stateless; import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean; -import org.mxchange.jfinancials.enterprise.BaseFinancialsEnterpriseBean; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers; import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; diff --git a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java index eb12a67..6c75dcc 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java @@ -26,7 +26,6 @@ import javax.persistence.NoResultException; import javax.persistence.PersistenceException; import javax.persistence.Query; import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcontacts.model.contact.Contacts; import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers; @@ -573,28 +572,15 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Set as updated managedUser.setUserUpdated(new Date()); - managedUser.getUserContact().setContactUpdated(new Date()); - // Get contact from it and find it - final Contact foundContact = this.getEntityManager().find(managedUser.getUserContact().getClass(), managedUser.getUserContact().getContactId()); - - // Should be found - assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", user.getUserContact().getContactId()); //NOI18N - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: contact.contactId={0}", foundContact.getContactId())); //NOI18N - - // Merge contact instance - final Contact managedContact = this.getEntityManager().merge(foundContact); - - // Copy all - Contacts.copyAll(managedUser.getUserContact(), managedContact); + // Update user data + final Contact managedContact = this.mergeContactData(managedUser.getUserContact()); // Set it back in user - user.setUserContact(managedContact); + managedUser.setUserContact(managedContact); // Should be found! - assert (managedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N + assert (managedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", managedUser.getUserContact().getContactId()); //NOI18N // Get mobile instance final DialableMobileNumber mobileNumber = managedContact.getContactMobileNumber(); @@ -610,17 +596,17 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Should be there assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N + // Copy all + MobileNumbers.copyAll(managedUser.getUserContact().getContactMobileNumber(), foundMobile); + // 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(managedUser.getUserContact().getContactMobileNumber(), managedMobile); - // Set it back - managedContact.setContactMobileNumber(this.getManaged(mobileNumber, mobileNumber)); + managedContact.setContactMobileNumber(managedMobile); } // Get mobile instance @@ -629,7 +615,7 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Is there a fax instance set? if (faxNumber instanceof DialableFaxNumber) { // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: faxNumber.phoneId={0} is being updated ...", faxNumber.getPhoneId())); //NOI18N + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", faxNumber.getPhoneId())); //NOI18N // Then find it, too final DialableFaxNumber foundFax = this.getEntityManager().find(faxNumber.getClass(), faxNumber.getPhoneId()); @@ -637,15 +623,15 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Should be there assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N + // Copy all + FaxNumbers.copyAll(managedUser.getUserContact().getContactFaxNumber(), foundFax); + // 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(managedUser.getUserContact().getContactFaxNumber(), managedFax); - // Set it back managedContact.setContactFaxNumber(managedFax); } @@ -656,7 +642,7 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Is there a fax instance set? if (landLineNumber instanceof DialableLandLineNumber) { // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLineNumber.phoneId={0} is being updated ...", landLineNumber.getPhoneId())); //NOI18N + this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLineNumber.getPhoneId())); //NOI18N // Then find it, too final DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLineNumber.getClass(), landLineNumber.getPhoneId()); @@ -664,15 +650,15 @@ public class JobsUserSessionBean extends BaseJobsEnterpriseBean implements UserS // Should be there assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N + // Copy all + LandLineNumbers.copyAll(managedUser.getUserContact().getContactLandLineNumber(), foundLandLine); + // 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(managedUser.getUserContact().getContactLandLineNumber(), managedLandLine); - // Set it back managedContact.setContactLandLineNumber(managedLandLine); } diff --git a/src/java/org/mxchange/jusercore/model/user/activity/JobsUserActivityLogMessageBean.java b/src/java/org/mxchange/jusercore/model/user/activity/JobsUserActivityLogMessageBean.java index 15dc9bc..df7d30c 100644 --- a/src/java/org/mxchange/jusercore/model/user/activity/JobsUserActivityLogMessageBean.java +++ b/src/java/org/mxchange/jusercore/model/user/activity/JobsUserActivityLogMessageBean.java @@ -24,7 +24,7 @@ import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.ObjectMessage; -import org.mxchange.jfinancials.enterprise.BaseJobsEnterpriseBean; +import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean; import org.mxchange.jusercore.model.user.User; /**