* <p>
* @return User instance
*/
- User getUser ();
+ User getLoggedInUser ();
+
}
*/
package org.mxchange.jusercore.events.login;
+import java.text.MessageFormat;
import org.mxchange.jusercore.model.user.User;
/**
- * This event is fired when the user has logged in
+ * This event is fired when the loggedInUser has logged in
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
/**
* User instance
*/
- private final User user;
+ private final User loggedInUser;
/**
- * Constructor with updated user instance
+ * Constructor with updated loggedInUser instance
* <p>
- * @param user Updated user instance
+ * @param loggedInUser Updated loggedInUser instance
*/
- public UserLoginEvent (final User user) {
- // Set user
- this.user = user;
+ public UserLoginEvent (final User loggedInUser) {
+ // Is the logged-in user instance valid?
+ if (null == loggedInUser) {
+ // Throw NPE
+ throw new NullPointerException("loggedInUser is null"); //NOI18N
+ } else if (loggedInUser.getUserId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("loggedInUser.userId is null"); //NOI18N
+ } else if (loggedInUser.getUserId() < 1) {
+ // Invalid id number
+ throw new IllegalArgumentException(MessageFormat.format("loggedInUser.userId={0} is invalid.", loggedInUser.getUserId())); //NOI18N
+ }
+
+ // Set loggedInUser
+ this.loggedInUser = loggedInUser;
}
@Override
- public User getUser () {
- return this.user;
+ public User getLoggedInUser () {
+ return this.loggedInUser;
}
+
}
*/
package org.mxchange.jusercore.events.registration;
+import java.text.MessageFormat;
import org.mxchange.jusercore.model.user.User;
/**
- * An event, fireed if a new user has registered
+ * An event, fireed if a new registeredUser has registered
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
private static final long serialVersionUID = 186_956_974_127_691L;
/**
- * Newly registered user;
+ * Newly registered registeredUser;
*/
- private final User user;
+ private final User registeredUser;
/**
- * Constructor with newly registered user
+ * Constructor with newly registered registeredUser
* <p>
- * @param user Newly registered user
+ * @param registeredUser Newly registered registeredUser
*/
- public RegisteredUserEvent (final User user) {
- this.user = user;
+ public RegisteredUserEvent (final User registeredUser) {
+ // Is the registered user instance valid?
+ if (null == registeredUser) {
+ // Throw NPE
+ throw new NullPointerException("registeredUser is null"); //NOI18N
+ } else if (registeredUser.getUserId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("registeredUser.userId is null"); //NOI18N
+ } else if (registeredUser.getUserId() < 1) {
+ // Invalid id number
+ throw new IllegalArgumentException(MessageFormat.format("registeredUser.userId={0} is invalid.", registeredUser.getUserId())); //NOI18N
+ }
+
+ // Set it here
+ this.registeredUser = registeredUser;
}
/**
- * Getter for user instance
+ * Getter for registeredUser instance
* <p>
* @return User instance
*/
@Override
- public User getUser () {
- return this.user;
+ public User getRegisteredUser () {
+ return this.registeredUser;
}
+
}
* <p>
* @return User instance
*/
- User getUser ();
+ User getRegisteredUser ();
+
}
--- /dev/null
+/*\r
+ * Copyright (C) 2016 Roland Haeder\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package org.mxchange.jusercore.events.user;\r
+\r
+import java.io.Serializable;\r
+import org.mxchange.jusercore.model.user.User;\r
+\r
+/**\r
+ * An interface for events being fired when an administrator added a new user\r
+ * account.\r
+ * <p>\r
+ * @author Roland Haeder<roland@mxchange.org>\r
+ */\r
+public interface AdminAddedUserEvent extends Serializable {\r
+\r
+ /**\r
+ * Getter for added user instance\r
+ * <p>\r
+ * @return Added user instance\r
+ */\r
+ User getAddedUser ();\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (C) 2016 Roland Haeder\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package org.mxchange.jusercore.events.user;\r
+\r
+import java.text.MessageFormat;\r
+import org.mxchange.jusercore.model.user.User;\r
+\r
+/**\r
+ * An event being fired when the administrator has added a new user account\r
+ * <p>\r
+ * @author Roland Haeder<roland@mxchange.org>\r
+ */\r
+public class AdminUserAddedEvent implements AdminAddedUserEvent {\r
+\r
+ /**\r
+ * Serial number\r
+ */\r
+ private static final long serialVersionUID = 14_785_787_174_676_290L;\r
+\r
+ /**\r
+ * Added user instance\r
+ */\r
+ private final User addedUser;\r
+\r
+ /**\r
+ * Constructor with added user instance\r
+ * @param addedUser Added user instance\r
+ */\r
+ public AdminUserAddedEvent (final User addedUser) {\r
+ // Is the user instance valid?\r
+ if (null == addedUser) {\r
+ // Throw NPE\r
+ throw new NullPointerException("addedUser is null"); //NOI18N\r
+ } else if (addedUser.getUserId() == null) {\r
+ // Throw NPE again\r
+ throw new NullPointerException("addedUser.userId is null"); //NOI18N\r
+ } else if (addedUser.getUserId() < 1) {\r
+ // Invalid id number\r
+ throw new IllegalArgumentException(MessageFormat.format("addedUser.userId={0} is invalid.", addedUser.getUserId())); //NOI18N\r
+ }\r
+\r
+ // Set it here\r
+ this.addedUser = addedUser;\r
+ }\r
+\r
+ @Override\r
+ public User getAddedUser () {\r
+ return this.addedUser;\r
+ }\r
+\r
+}\r