]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 15 Jan 2020 10:36:08 +0000 (11:36 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 15 Jan 2020 10:36:08 +0000 (11:36 +0100)
- 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 <roland@mxchange.org>
src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java
src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/activity/JobsUserActivityLogMessageBean.java

index 87d28193aa5b7a68bd29b0edd500a1f99d2db8fb..ae7ced4d8c71253d7dc23b70d56a46e7675ed28f 100644 (file)
@@ -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;
index f935f619710d5bfa654a2cc0ef4d0faa2c92e04d..0d5a662f214ecc24c3f976709856e7a02bf2f16f 100644 (file)
@@ -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;
index eb12a67c5482eab04e58c35b108040f166a48f16..6c75dcca4db13f86f652b23752e50fa81a04b9b6 100644 (file)
@@ -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);
                }
index 15dc9bc93d8fac952879ed2527d0c31d544ba389..df7d30caab12a2563f39aed404191f4c54854f54 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.jfinancials.enterprise.BaseJobsEnterpriseBean;
+import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean;
 import org.mxchange.jusercore.model.user.User;
 
 /**