]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 10 Jun 2017 21:23:48 +0000 (23:23 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 10 Jun 2017 21:33:21 +0000 (23:33 +0200)
- really have to call super(), else anything there, like logger bean, will not
  be initialized

Signed-off-by: Roland Häder <roland@mxchange.org>
17 files changed:
src/java/org/mxchange/jcontacts/contact/FinancialsAdminContactSessionBean.java
src/java/org/mxchange/jcontacts/contact/FinancialsContactSessionBean.java
src/java/org/mxchange/jcontacts/phone/FinancialsAdminContactPhoneSessionBean.java
src/java/org/mxchange/jcountry/data/FinancialsCountrySingletonBean.java
src/java/org/mxchange/jfinancials/beans/resendlink/FinancialsResendLinkSessionBean.java
src/java/org/mxchange/jfinancials/mailer/model/delivery/FinancialsEmailDeliveryMessageBean.java
src/java/org/mxchange/jphone/phonenumbers/mobileprovider/FinancialsAdminMobileProviderSessionBean.java
src/java/org/mxchange/jphone/phonenumbers/mobileprovider/FinancialsMobileProviderSingletonBean.java
src/java/org/mxchange/jphone/phonenumbers/phone/FinancialsAdminPhoneSessionBean.java
src/java/org/mxchange/jphone/phonenumbers/phone/FinancialsPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/email_address/FinancialsUserEmailChangeSessionBean.java
src/java/org/mxchange/jusercore/model/login/FinancialsUserLoginSessionBean.java
src/java/org/mxchange/jusercore/model/register/FinancialsUserRegistrationSessionBean.java
src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/activity/FinancialsUserActivityLogMessageBean.java [new file with mode: 0644]
src/java/org/mxchange/jusercore/model/user/password_history/FinancialsUserPasswordHistorySessionBean.java

index 71f2303b3f9e9d17e707032b2c83255902369bf1..849b8601da38038c86e9e2c23fed46ad604183a3 100644 (file)
@@ -39,6 +39,8 @@ public class FinancialsAdminContactSessionBean extends BaseFinancialsDatabaseBea
         * Default constructor
         */
        public FinancialsAdminContactSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override
index 48ef52f5013fb60582215f302a8032d6142f5d56..a0975b5cd4219552b59e0742c9a3f4d6a2972ebc 100644 (file)
@@ -44,6 +44,8 @@ public class FinancialsContactSessionBean extends BaseFinancialsDatabaseBean imp
         * Default constructor
         */
        public FinancialsContactSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override
index 0d8590961e14296be8a2a2b2597fcb64d25c1b12..bab50edd4e49a368fdd52df1e706bae3ad60cf34 100644 (file)
@@ -21,9 +21,9 @@ import java.util.GregorianCalendar;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
+import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
 import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
 import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
@@ -49,6 +49,14 @@ public class FinancialsAdminContactPhoneSessionBean extends BaseFinancialsDataba
        @EJB
        private ContactSessionBeanRemote contactBean;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminContactPhoneSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException {
                // Trace message
index 11810ce62867d1625fff5a2e7f16c1cff6479501..f18462ad617654c85b346eba5154b4732ae5be02 100644 (file)
@@ -40,6 +40,14 @@ public class FinancialsCountrySingletonBean extends BaseDatabaseBean implements
         */
        private static final long serialVersionUID = 15_846_983_298_691_207L;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsCountrySingletonBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public Country addCountry (final Country country) throws CountryAlreadyAddedException {
                // Trace message
index 1e88731eaedd0e2e7f70b31c7410bbaf7eab3052..4c94bc3a221196163fa6766af1acfe337adecec5 100644 (file)
@@ -60,6 +60,14 @@ public class FinancialsResendLinkSessionBean extends BaseFinancialsDatabaseBean
        @EJB
        private UserSessionBeanRemote userBean;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsResendLinkSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public void resendConfirmationLink (final User user, final Locale locale, final String baseUrl) throws UserNotFoundException, UserStatusLockedException, UserStatusConfirmedException {
                // Log trace message
index a562f4f6b5b7a4f800f572fb16b29f72e070451c..6d69344a5bc0e465dcc17f6fe527190c8096c0b4 100644 (file)
@@ -61,6 +61,9 @@ public class FinancialsEmailDeliveryMessageBean extends BaseFinancialsDatabaseBe
         * Default constructor
         */
        public FinancialsEmailDeliveryMessageBean () {
+               // Call super constructor
+               super();
+
                // Init mailer instance
                this.mailer = new FinancialsMailer();
        }
index a6b0014187303078c0e01bb5c7c545605b320c02..3e93d0a0470935710bfde29fdad07f944228d183 100644 (file)
@@ -35,6 +35,14 @@ public class FinancialsAdminMobileProviderSessionBean extends BaseDatabaseBean i
         */
        private static final long serialVersionUID = 15_846_983_298_691_207L;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminMobileProviderSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public MobileProvider addMobileProvider (final MobileProvider mobileProvider) throws MobileProviderAlreadyAddedException {
                // Log trace message
index c800c75599f9875dfcf6d9f02c787a1311680f31..14277fd3a10f1b053c6a43496c78928992ffa34f 100644 (file)
@@ -37,6 +37,14 @@ public class FinancialsMobileProviderSingletonBean extends BaseDatabaseBean impl
         */
        private static final long serialVersionUID = 15_846_983_298_691_207L;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsMobileProviderSingletonBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        @SuppressWarnings ("unchecked")
        public List<MobileProvider> allMobileProvider () {
index 7936651af3e3ac4d072f2750d96b0354fd35a903..ffb28014e044a2e255d3b142279c1449c8f1e6d8 100644 (file)
@@ -37,6 +37,14 @@ public class FinancialsAdminPhoneSessionBean extends BaseFinancialsDatabaseBean
         */
        private static final long serialVersionUID = 18_597_165_817_401_853L;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminPhoneSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public void deleteFaxData (final DialableFaxNumber faxNumber) {
                // Trace message
index cab2cc2b8678da945931e42ec66547dd6657c331..2d695d96ff60daad6d6683b7eb8bb8a5bb123257 100644 (file)
@@ -47,6 +47,8 @@ public class FinancialsPhoneSessionBean extends BaseDatabaseBean implements Phon
         * Default constructor
         */
        public FinancialsPhoneSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @SuppressWarnings ("unchecked")
index 87a0e487a0ad7d762928a5f304d09936635d6d84..002509cb66bab62368c89702e55b9fdeab941c33 100644 (file)
@@ -54,6 +54,8 @@ public class FinancialsUserEmailChangeSessionBean extends BaseFinancialsDatabase
         * Default constructor
         */
        public FinancialsUserEmailChangeSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override
index d56e318974e976c41aa3b61dce5caf8f161c35cb..ab182897b94ed2d38ba08156c8d902c2d31e76f7 100644 (file)
@@ -36,7 +36,7 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus;
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@Stateless (name = "login", description = "A bean handling the user login for Addressbook project")
+@Stateless (name = "login", description = "A bean handling the user login for Financials project")
 public class FinancialsUserLoginSessionBean extends BaseDatabaseBean implements UserLoginSessionBeanRemote {
 
        /**
@@ -56,6 +56,14 @@ public class FinancialsUserLoginSessionBean extends BaseDatabaseBean implements
        @EJB
        private UserSessionBeanRemote userBean;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsUserLoginSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException {
                // Trace message
index ac57a4e50a9ce81bee486f774f28deb911e6448a..32cf506c4ade3995c6d6654474c03c1f49bf4678 100644 (file)
@@ -60,6 +60,14 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas
        @EJB
        private UserSessionBeanRemote userBean;
 
+       /**
+        * Default constructor
+        */
+       public FinancialsUserRegistrationSessionBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public String generateConfirmationKey (final User user) {
                // Trace message
index 6771ae31124056991990bb91c9817f177ca5ed7f..f20b64c0e1692bea02c3d53ab365e6c891e934a1 100644 (file)
@@ -64,6 +64,8 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsDatabaseBean i
         * Default constructor
         */
        public FinancialsAdminUserSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override
index b0aec65376e1d25df6bcdf3eecb03af97ebba878..d4c7c350a7a29bcf448e45cff12de7f33165140f 100644 (file)
@@ -66,6 +66,8 @@ public class FinancialsUserSessionBean extends BaseFinancialsDatabaseBean implem
         * Default constructor
         */
        public FinancialsUserSessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override
diff --git a/src/java/org/mxchange/jusercore/model/user/activity/FinancialsUserActivityLogMessageBean.java b/src/java/org/mxchange/jusercore/model/user/activity/FinancialsUserActivityLogMessageBean.java
new file mode 100644 (file)
index 0000000..cb5d46e
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jusercore.model.user.activity;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A message-driven bean for adding user activity log
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@MessageDriven (
+               name = "userActivityLog",
+               description = "A message-driven bean for adding user activity log",
+               activationConfig = {
+                       @ActivationConfigProperty (
+                                       propertyName = "destinationLookup",
+                                       propertyValue = "jms/addressbook-user-activity-log"
+                       ),
+                       @ActivationConfigProperty (
+                                       propertyName = "destinationType",
+                                       propertyValue = "javax.jms.Queue"
+                       )
+               }
+)
+public class FinancialsUserActivityLogMessageBean extends BaseFinancialsDatabaseBean implements MessageListener {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 14_920_686_785_732_054L;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsUserActivityLogMessageBean () {
+               // Call super constructor
+               super();
+       }
+
+       @Override
+       public void onMessage (final Message message) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: message={1} - CALLED!", this.getClass().getSimpleName(), message)); //NOI18N
+
+               // The parameter should be valid
+               if (null == message) {
+                       // Throw NPE
+                       throw new NullPointerException("message is null"); //NOI18N
+               } else if (!(message instanceof ObjectMessage)) {
+                       // Not implementing right interface
+                       throw new IllegalArgumentException(MessageFormat.format("message={0} does not implemented ObjectMessage", message)); //NOI18N
+               }
+
+               // Securely cast it
+               ObjectMessage objectMessage = (ObjectMessage) message;
+
+               // Init variable
+               Serializable serializable;
+
+               try {
+                       // Get object from message
+                       serializable = objectMessage.getObject();
+               } catch (final JMSException ex) {
+                       // Log it and don't continue any further
+                       this.getLoggerBeanLocal().logException(ex);
+                       return;
+               }
+
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.onMessage: serializable={1}", this.getClass().getSimpleName(), serializable)); //NOI18N
+
+               // Okay, is it the right interface?
+               if (null == serializable) {
+                       // Throw NPE
+                       throw new NullPointerException("serializable is null"); //NOI18N
+               } else if (!(serializable instanceof LogableUserActivity)) {
+                       // Not correct object send
+                       throw new IllegalArgumentException(MessageFormat.format("serializable={0} does not implement LogableUserActivity", serializable)); //NOI18N
+               }
+
+               // Securely cast it
+               LogableUserActivity userActivity = (LogableUserActivity) serializable;
+
+               // Should be valid
+               if (null == userActivity) {
+                       // Throw NPE
+                       throw new NullPointerException("userActivity is null"); //NOI18N
+               } else if (userActivity.getActivityId() instanceof Long) {
+                       // Id number should not be set
+                       throw new IllegalArgumentException(MessageFormat.format("userActivity.activityId={0} should be null", userActivity.getActivityId())); //NOI18N
+               } else if (userActivity.getActivityUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("userActivity.activityUser is null"); //NOI18N
+               } else if (userActivity.getActivityUser().getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("userActivity.activityUser.userId is null"); //NOI18N
+               } else if (userActivity.getActivityUser().getUserId() < 1) {
+                       // Throw NPE again
+                       throw new IllegalArgumentException(MessageFormat.format("userActivity.activityUser.userId={0}  is not valid", userActivity.getActivityUser().getUserId())); //NOI18N
+               } else if (userActivity.getActivityType() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("userActivity.activityType is null"); //NOI18N
+               } else if (userActivity.getActivityType().isEmpty()) {
+                       // Empty type
+                       throw new IllegalArgumentException("userActivity.activityType is empty"); //NOI18N
+               } else if ((userActivity.getActivityMessage() instanceof String) && (userActivity.getActivityMessage().isEmpty())) {
+                       // Set but empty message
+                       throw new IllegalArgumentException("userActivity.activityMessage is empty"); //NOI18N
+               } else if (userActivity.getActivityTimestamp() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("userActivity.activityTimestamp is null"); //NOI18N
+               }
+
+               // Make user instance managed
+               User managedUser = this.getManagedUser(userActivity.getActivityUser());
+
+               // Set it back
+               userActivity.setActivityUser(managedUser);
+
+               // All fine, persist it
+               this.getEntityManager().persist(userActivity);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: EXIT!", this.getClass().getSimpleName())); //NOI18N
+       }
+
+}
index 9cda8e589f19884ebb2f54f16824d3bdc76da5a3..531efc3405e48ce39532ab242e9e607292a32317 100644 (file)
@@ -40,6 +40,8 @@ public class FinancialsUserPasswordHistorySessionBean extends BaseFinancialsData
         * Default constructor
         */
        public FinancialsUserPasswordHistorySessionBean () {
+               // Call super constructor
+               super();
        }
 
        @Override