]> git.mxchange.org Git - juser-activity-core.git/commitdiff
added event for confirmed user accounts
authorRoland Häder <roland@mxchange.org>
Thu, 19 May 2016 15:53:09 +0000 (17:53 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 19 May 2016 15:53:09 +0000 (17:53 +0200)
src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java [new file with mode: 0644]

diff --git a/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java b/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java
new file mode 100644 (file)
index 0000000..0481159
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * 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.jusercore.events.confirmation;
+
+import java.text.MessageFormat;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An event, fireed if a new confirmedUser has confirmed
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public class ConfirmedUserAccountEvent implements UserConfirmedAccountEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 575_412_375_267_190L;
+
+       /**
+        * Newly confirmed user
+        */
+       private final User confirmedUser;
+
+       /**
+        * Constructor with newly confirmed confirmedUser
+        * <p>
+        * @param confirmedUser Newly confirmed confirmedUser
+        */
+       public ConfirmedUserAccountEvent (final User confirmedUser) {
+               // Is the confirmed user instance valid?
+               if (null == confirmedUser) {
+                       // Throw NPE
+                       throw new NullPointerException("confirmedUser is null"); //NOI18N
+               } else if (confirmedUser.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("confirmedUser.userId is null"); //NOI18N
+               } else if (confirmedUser.getUserId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("confirmedUser.userId={0} is invalid.", confirmedUser.getUserId())); //NOI18N
+               }
+
+               // Set it here
+               this.confirmedUser = confirmedUser;
+       }
+
+       /**
+        * Getter for confirmedUser instance
+        * <p>
+        * @return User instance
+        */
+       @Override
+       public User getConfirmedUser () {
+               return this.confirmedUser;
+       }
+
+}
diff --git a/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java b/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java
new file mode 100644 (file)
index 0000000..1bbea50
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * 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.jusercore.events.confirmation;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An event interface, fireed if a new user has registered
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface UserConfirmedAccountEvent extends Serializable {
+
+       /**
+        * Getter for user instance
+        * <p>
+        * @return User instance
+        */
+       User getConfirmedUser ();
+
+}