]> git.mxchange.org Git - juser-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 22:01:03 +0000 (00:01 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 22:01:03 +0000 (00:01 +0200)
- moved post events in own package
- created first pre event
- removed clear events
- removed no longer used constructor
- "validate" all parameter in constructor

Signed-off-by: Roland Häder <roland@mxchange.org>
17 files changed:
src/org/mxchange/jusercore/events/user/clear/password/ClearUserPasswordEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/clear/password/ObservableClearUserPasswordEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/clear/username/ClearUserNameEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/clear/username/ObservableClearUserNameEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java [deleted file]
src/org/mxchange/jusercore/events/user/update/post/AdminPostUserDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/user/update/post/ObservableAdminPostUserDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/user/update/post/ObservablePostUserPersonalDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/user/update/post/PostUserPersonalDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/user/update/pre/ObservablePreUserPersonalDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/events/user/update/pre/PreUserPersonalDataUpdatedEvent.java [new file with mode: 0644]
src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java
src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java
src/org/mxchange/jusercore/model/user/Users.java

diff --git a/src/org/mxchange/jusercore/events/user/clear/password/ClearUserPasswordEvent.java b/src/org/mxchange/jusercore/events/user/clear/password/ClearUserPasswordEvent.java
deleted file mode 100644 (file)
index fdb153c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.clear.password;
-
-/**
- * An event being fired when a user password should be cleared
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ClearUserPasswordEvent implements ObservableClearUserPasswordEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_785_787_174_676_291L;
-
-       /**
-        * Default constructor
-        */
-       public ClearUserPasswordEvent () {
-       }
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/clear/password/ObservableClearUserPasswordEvent.java b/src/org/mxchange/jusercore/events/user/clear/password/ObservableClearUserPasswordEvent.java
deleted file mode 100644 (file)
index 1ff084e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.clear.password;
-
-import java.io.Serializable;
-
-/**
- * An interface for events being fired when user password should be cleared.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface ObservableClearUserPasswordEvent extends Serializable {
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/clear/username/ClearUserNameEvent.java b/src/org/mxchange/jusercore/events/user/clear/username/ClearUserNameEvent.java
deleted file mode 100644 (file)
index a3573c5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.clear.username;
-
-/**
- * An event being fired when a user name should be cleared.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ClearUserNameEvent implements ObservableClearUserNameEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_785_787_174_676_291L;
-
-       /**
-        * Default constructor
-        */
-       public ClearUserNameEvent () {
-       }
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/clear/username/ObservableClearUserNameEvent.java b/src/org/mxchange/jusercore/events/user/clear/username/ObservableClearUserNameEvent.java
deleted file mode 100644 (file)
index 00f9273..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.clear.username;
-
-import java.io.Serializable;
-
-/**
- * An interface for events being fired when a user name should be cleared.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface ObservableClearUserNameEvent extends Serializable {
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java b/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java
deleted file mode 100644 (file)
index 51187b6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.update;
-
-import java.text.MessageFormat;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An event being fired when the administrator has updated user data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class AdminUpdatedUserDataEvent implements ObservableAdminUpdatedUserDataEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_785_787_174_676_290L;
-
-       /**
-        * Updated user instance
-        */
-       private final User updatedUser;
-
-       /**
-        * Constructor with updated user instance
-        * <p>
-        * @param updatedUser Updated user instance
-        */
-       public AdminUpdatedUserDataEvent (final User updatedUser) {
-               // Is the user instance valid?
-               if (null == updatedUser) {
-                       // Throw NPE
-                       throw new NullPointerException("updatedUser is null"); //NOI18N
-               } else if (updatedUser.getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("updatedUser.userId is null"); //NOI18N
-               } else if (updatedUser.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N
-               }
-
-               // Set it here
-               this.updatedUser = updatedUser;
-       }
-
-       @Override
-       public User getUpdatedUser () {
-               return this.updatedUser;
-       }
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java b/src/org/mxchange/jusercore/events/user/update/ObservableAdminUpdatedUserDataEvent.java
deleted file mode 100644 (file)
index 0c88735..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.update;
-
-import java.io.Serializable;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An interface for events being fired when an administrator updated user data.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface ObservableAdminUpdatedUserDataEvent extends Serializable {
-
-       /**
-        * Getter for updated user instance
-        * <p>
-        * @return Added user instance
-        */
-       User getUpdatedUser ();
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/ObservableUpdatedUserPersonalDataEvent.java
deleted file mode 100644 (file)
index f473729..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.update;
-
-import java.io.Serializable;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An interface for events being fired when a user updates personal data.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface ObservableUpdatedUserPersonalDataEvent extends Serializable {
-
-       /**
-        * Getter for updated user instance
-        * <p>
-        * @return Updated user instance
-        */
-       User getUpdatedUser ();
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java
deleted file mode 100644 (file)
index 4e12633..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * 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.user.update;
-
-import java.text.MessageFormat;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An event being fired when the user has updated personal data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class UpdatedUserPersonalDataEvent implements ObservableUpdatedUserPersonalDataEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_785_787_174_676_290L;
-
-       /**
-        * Updated user instance
-        */
-       private final User updatedUser;
-
-       /**
-        * Constructor with updated user instance
-        * <p>
-        * @param updatedUser Updated user instance
-        */
-       public UpdatedUserPersonalDataEvent (final User updatedUser) {
-               // Is the user instance valid?
-               if (null == updatedUser) {
-                       // Throw NPE
-                       throw new NullPointerException("updatedUser is null"); //NOI18N
-               } else if (updatedUser.getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("updatedUser.userId is null"); //NOI18N
-               } else if (updatedUser.getUserId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N
-               }
-
-               // Set it here
-               this.updatedUser = updatedUser;
-       }
-
-       @Override
-       public User getUpdatedUser () {
-               return this.updatedUser;
-       }
-
-}
diff --git a/src/org/mxchange/jusercore/events/user/update/post/AdminPostUserDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/post/AdminPostUserDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..9d8bc18
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.post;
+
+import java.text.MessageFormat;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An event being fired after the administrator has updated user data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class AdminPostUserDataUpdatedEvent implements ObservableAdminPostUserDataUpdatedEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 14_785_787_174_676_290L;
+
+       /**
+        * Updated user instance
+        */
+       private final User updatedUser;
+
+       /**
+        * Constructor with updated user instance
+        * <p>
+        * @param updatedUser Updated user instance
+        */
+       public AdminPostUserDataUpdatedEvent (final User updatedUser) {
+               // Is the user instance valid?
+               if (null == updatedUser) {
+                       // Throw NPE
+                       throw new NullPointerException("updatedUser is null"); //NOI18N
+               } else if (updatedUser.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("updatedUser.userId is null"); //NOI18N
+               } else if (updatedUser.getUserId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N
+               }
+
+               // Set it here
+               this.updatedUser = updatedUser;
+       }
+
+       @Override
+       public User getUpdatedUser () {
+               return this.updatedUser;
+       }
+
+}
diff --git a/src/org/mxchange/jusercore/events/user/update/post/ObservableAdminPostUserDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/post/ObservableAdminPostUserDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..99e1668
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.post;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An interface for events being fired after an administrator updated user data.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableAdminPostUserDataUpdatedEvent extends Serializable {
+
+       /**
+        * Getter for updated user instance
+        * <p>
+        * @return Added user instance
+        */
+       User getUpdatedUser ();
+
+}
diff --git a/src/org/mxchange/jusercore/events/user/update/post/ObservablePostUserPersonalDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/post/ObservablePostUserPersonalDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..c882ed5
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.post;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An interface for events being fired after a user updates personal data.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservablePostUserPersonalDataUpdatedEvent extends Serializable {
+
+       /**
+        * Getter for updated user instance
+        * <p>
+        * @return Updated user instance
+        */
+       User getUpdatedUser ();
+
+}
diff --git a/src/org/mxchange/jusercore/events/user/update/post/PostUserPersonalDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/post/PostUserPersonalDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..bfb3b53
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.post;
+
+import java.text.MessageFormat;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An event being fired after the user has updated personal data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class PostUserPersonalDataUpdatedEvent implements ObservablePostUserPersonalDataUpdatedEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 14_785_787_174_676_290L;
+
+       /**
+        * Updated user instance
+        */
+       private final User updatedUser;
+
+       /**
+        * Constructor with updated user instance
+        * <p>
+        * @param updatedUser Updated user instance
+        */
+       public PostUserPersonalDataUpdatedEvent (final User updatedUser) {
+               // Is the user instance valid?
+               if (null == updatedUser) {
+                       // Throw NPE
+                       throw new NullPointerException("updatedUser is null"); //NOI18N
+               } else if (updatedUser.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("updatedUser.userId is null"); //NOI18N
+               } else if (updatedUser.getUserId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N
+               }
+
+               // Set it here
+               this.updatedUser = updatedUser;
+       }
+
+       @Override
+       public User getUpdatedUser () {
+               return this.updatedUser;
+       }
+
+}
diff --git a/src/org/mxchange/jusercore/events/user/update/pre/ObservablePreUserPersonalDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/pre/ObservablePreUserPersonalDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..990d697
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.pre;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An interface for events being fired before a user updates personal data.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservablePreUserPersonalDataUpdatedEvent extends Serializable {
+
+       /**
+        * Getter for updated user instance
+        * <p>
+        * @return Updated user instance
+        */
+       User getUpdatedUser ();
+
+}
diff --git a/src/org/mxchange/jusercore/events/user/update/pre/PreUserPersonalDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/pre/PreUserPersonalDataUpdatedEvent.java
new file mode 100644 (file)
index 0000000..3273a78
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * 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.user.update.pre;
+
+import java.text.MessageFormat;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An event being fired after the user has updated personal data
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class PreUserPersonalDataUpdatedEvent implements ObservablePreUserPersonalDataUpdatedEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 14_785_787_174_676_291L;
+
+       /**
+        * Updated user instance
+        */
+       private final User updatedUser;
+
+       /**
+        * Constructor with updated user instance
+        * <p>
+        * @param updatedUser Updated user instance
+        */
+       public PreUserPersonalDataUpdatedEvent (final User updatedUser) {
+               // Is the user instance valid?
+               if (null == updatedUser) {
+                       // Throw NPE
+                       throw new NullPointerException("updatedUser is null"); //NOI18N
+               } else if (updatedUser.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("updatedUser.userId is null"); //NOI18N
+               } else if (updatedUser.getUserId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("updatedUser.userId={0} is invalid.", updatedUser.getUserId())); //NOI18N
+               }
+
+               // Set it here
+               this.updatedUser = updatedUser;
+       }
+
+       @Override
+       public User getUpdatedUser () {
+               return this.updatedUser;
+       }
+
+}
index eaf5be036d9dee4028617e2a87f60ec512aa9fd3..8f9c6f2942596cb3e7e336dce30a605028d35913 100644 (file)
@@ -132,4 +132,5 @@ public interface ChangeableEmailAddress extends Serializable {
 
        @Override
        int hashCode ();
+
 }
index abc15625ba1d43d53354e5408e1256d54a2ed5be..58c1cfb1fdf03d7a7886f1b65227390ed9ea08f1 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jusercore.model.email_address;
 
+import java.text.MessageFormat;
 import java.util.Date;
 import java.util.Objects;
 import javax.persistence.Basic;
@@ -48,9 +49,7 @@ import org.mxchange.jusercore.model.user.User;
 @Table (name = "email_changes")
 @NamedQueries (
                value = {
-                       @NamedQuery (name = "SearchEmailChangeByEmail", query = "SELECT e FROM email_changes AS e WHERE LOWER(e.emailAddress) LIKE LOWER(:email)"),
-                       @NamedQuery (name = "AllEmailAddressChanges", query = "SELECT e.emailAddress FROM email_changes AS e ORDER BY e.emailChangeId ASC"),
-                       @NamedQuery (name = "SearchEmailChangeByHash", query = "SELECT e FROM email_changes AS e WHERE e.emailChangeHash = :hash")
+                       @NamedQuery (name = "AllEmailAddressChanges", query = "SELECT e FROM email_changes AS e ORDER BY e.emailChangeId ASC")
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
@@ -123,39 +122,34 @@ public class EmailAddressChange implements ChangeableEmailAddress {
                this.emailChangeStatus = EmailChangeStatus.NEW;
        }
 
-       /**
-        * Constructor with all fields to set
-        * <p>
-        * @param emailChangeId Email change id
-        * @param user User instance
-        * @param emailAddress Email address
-        * @param emailChangeCreated Timestamp for creation
-        * @param emailChangeStatus Email change status
-        * @param emailChangeDone When this entry has been done
-        * @param emailChangeHash Email change hash
-        */
-       public EmailAddressChange (final Long emailChangeId, final User user, final String emailAddress, final Date emailChangeCreated, final EmailChangeStatus emailChangeStatus, final Date emailChangeDone, final String emailChangeHash) {
-               // Call other constructor
-               this(user, emailAddress);
-
-               // Set remaining
-               this.emailChangeId = emailChangeId;
-               this.emailChangeCreated = emailChangeCreated;
-               this.emailChangeStatus = emailChangeStatus;
-               this.emailChangeDone = emailChangeDone;
-               this.emailChangeHash = emailChangeHash;
-       }
-
        /**
         * Constructor with user and email address
         * <p>
-        * @param user User instance
+        * @param user         User instance
         * @param emailAddress Email address
         */
        public EmailAddressChange (final User user, final String emailAddress) {
                // Call other constructor
                this();
 
+               // Validate parameter
+               if (null == user) {
+                       // Throw NPE
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
+               } else if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
+               }
+
                // Set all
                this.emailChangeUser = user;
                this.emailAddress = emailAddress;
index 79cdc30bdd42bbb6fee3aa7f808ec86dbaa134fe..97ede17f9578f65bce5b99b694b1f84580f48f2c 100644 (file)
@@ -262,9 +262,9 @@ public class Users implements Serializable {
                if (user.getUserContact().getContactEmailAddress() != null) {
                        properties.setProperty("contactEmailAddress", user.getUserContact().getContactEmailAddress()); //NOI18N
                }
-               properties.setProperty("contactCreated", user.getUserContact().getContactCreated().toString()); //NOI18N
-               if (user.getUserContact().getContactUpdated() != null) {
-                       properties.setProperty("contactUpdated", user.getUserContact().getContactUpdated().toString()); //NOI18N
+               properties.setProperty("contactCreated", user.getUserContact().getContactEntryCreated().toString()); //NOI18N
+               if (user.getUserContact().getContactEntryUpdated() != null) {
+                       properties.setProperty("contactUpdated", user.getUserContact().getContactEntryUpdated().toString()); //NOI18N
                }
 
                // Return it