From: Roland Häder Date: Wed, 24 Aug 2016 14:31:27 +0000 (+0200) Subject: JUser-Activity-core has derived from juser-core. This library logs user's activity... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=73d3fbb5d2d34604904771f32db378f9a42cdd5e;p=juser-activity-core.git JUser-Activity-core has derived from juser-core. This library logs user's activity of any kind (type) and may include a message (e.g. lock reason) in it as well. Ideas to expand: - IP address - user agent - referer URL - data that has been changed (old-new values) - ??? --- diff --git a/build.xml b/build.xml index 8726c4d..d3b2757 100644 --- a/build.xml +++ b/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project juser-core. + + Builds, tests, and runs the project juser-activity. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties index 8ebcafb..a0aad23 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,101 +1,99 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=true -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=juser-core -application.vendor=Roland Haeder -auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/juser-core.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar -file.reference.jcontacts-core.jar=lib/jcontacts-core.jar -file.reference.jcoreee.jar=lib/jcoreee.jar -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=false -jar.index=${jnlp.enabled} -javac.classpath=\ - ${file.reference.jcoreee.jar}:\ - ${file.reference.jcontacts-core.jar}:\ - ${file.reference.commons-codec-1.10.jar}:\ - ${libs.javaee-api-7.0.classpath} -# Space-separated list of extra javac options -javac.compilerargs=-Xlint:unchecked -Xlint:deprecation -javac.deprecation=true -javac.external.vm=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=true -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=true -javadoc.reference.commons-codec-1.10.jar=https://commons.apache.org/proper/commons-codec/archives/1.10/apidocs/ -javadoc.splitindex=true -javadoc.use=true -javadoc.version=true -javadoc.windowtitle=User Library -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed -manifest.custom.codebase= -# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) -manifest.custom.permissions= -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=true -platform.active=default_platform -project.license=gpl30 -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -source.reference.jcontacts-core.jar=../jcontacts-core/src/ -source.reference.jcoreee.jar=../jcoreee/src/ -src.dir=src -test.src.dir=test +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=juser-activity-core +application.vendor=Roland Haeder +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/juser-activity-core.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.juser-core.jar=lib/juser-core.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.juser-core.jar}:\ + ${libs.javaee-api-7.0.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.deprecation=true +javac.external.vm=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=true +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=User Activity Log Library +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. +manifest.custom.application.library.allowable.codebase= +# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. +manifest.custom.caller.allowable.codebase= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +project.license=gpl30 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +source.reference.juser-core.jar=../juser-core/src/ +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index 1643b78..6206458 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -1,18 +1,18 @@ - - - org.netbeans.modules.java.j2seproject - - - juser-core - - - - - - - - - ./lib/nblibraries.properties - - - + + + org.netbeans.modules.java.j2seproject + + + juser-activity-core + + + + + + + + + ./lib/nblibraries.properties + + + diff --git a/src/org/mxchange/jusercore/container/login/LoginContainer.java b/src/org/mxchange/jusercore/container/login/LoginContainer.java deleted file mode 100644 index 87014e9..0000000 --- a/src/org/mxchange/jusercore/container/login/LoginContainer.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.container.login; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * A container for login data - *

- * @author Roland Haeder - */ -public interface LoginContainer extends Serializable { - - /** - * Getter for user instance - *

- * @return User instance - */ - User getUser (); - - /** - * Setter for user instance - *

- * @param user User instance - */ - void setUser (final User user); - - /** - * Getter for user password - *

- * @return User password - */ - String getUserPassword (); - - /** - * Setter for user password - *

- * @param userPassword User password - */ - void setUserPassword (final String userPassword); - -} diff --git a/src/org/mxchange/jusercore/container/login/UserLoginContainer.java b/src/org/mxchange/jusercore/container/login/UserLoginContainer.java deleted file mode 100644 index f54a3ba..0000000 --- a/src/org/mxchange/jusercore/container/login/UserLoginContainer.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.container.login; - -import org.mxchange.jusercore.model.user.User; - -/** - * A user login container - *

- * @author Roland Haeder - */ -public class UserLoginContainer implements LoginContainer { - - /** - * Serial number - */ - private static final long serialVersionUID = 158_768_718_689_760_186L; - - /** - * User instance - */ - private User user; - - /** - * Unencrypted password - */ - private String userPassword; - - /** - * Constructor with user instance and unencrypted password - *

- * @param user User instance - * @param userPassword Unencrypted password - */ - public UserLoginContainer (final User user, final String userPassword) { - // Is both set? - if (null == user) { - // Throw NPE - throw new NullPointerException("user is null"); //NOI18N - } else if (null == userPassword) { - // Throw NPE again - throw new NullPointerException("userPassword is null"); //NOI18N - } else if (userPassword.isEmpty()) { - // Empty password - throw new IllegalArgumentException("user password is empty."); //NOI18N - } - - // Set both - this.user = user; - this.userPassword = userPassword; - } - - @Override - public User getUser () { - return this.user; - } - - @Override - public void setUser (final User user) { - this.user = user; - } - - @Override - public String getUserPassword () { - return this.userPassword; - } - - @Override - public void setUserPassword (final String userPassword) { - this.userPassword = userPassword; - } - -} diff --git a/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java b/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java deleted file mode 100644 index 0481159..0000000 --- a/src/org/mxchange/jusercore/events/confirmation/ConfirmedUserAccountEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -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 - *

- * @author Roland Haeder - */ -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 - *

- * @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 - *

- * @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 deleted file mode 100644 index 1bbea50..0000000 --- a/src/org/mxchange/jusercore/events/confirmation/UserConfirmedAccountEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 . - */ -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 - *

- * @author Roland Haeder - */ -public interface UserConfirmedAccountEvent extends Serializable { - - /** - * Getter for user instance - *

- * @return User instance - */ - User getConfirmedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/login/UserLoggedInEvent.java b/src/org/mxchange/jusercore/events/login/UserLoggedInEvent.java deleted file mode 100644 index 1846490..0000000 --- a/src/org/mxchange/jusercore/events/login/UserLoggedInEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.login; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events after the user has logged in - *

- * @author Roland Haeder - */ -public interface UserLoggedInEvent extends Serializable { - - /** - * Getter for user instance - *

- * @return User instance - */ - User getLoggedInUser (); - -} diff --git a/src/org/mxchange/jusercore/events/login/UserLoginEvent.java b/src/org/mxchange/jusercore/events/login/UserLoginEvent.java deleted file mode 100644 index bfc25a6..0000000 --- a/src/org/mxchange/jusercore/events/login/UserLoginEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.login; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * This event is fired when the loggedInUser has logged in - *

- * @author Roland Haeder - */ -public class UserLoginEvent implements UserLoggedInEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 163_294_958_817_560L; - - /** - * User instance - */ - private final User loggedInUser; - - /** - * Constructor with updated user instance - *

- * @param loggedInUser Updated user instance - */ - 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 getLoggedInUser () { - return this.loggedInUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/logout/ObserveableUserLogoutEvent.java b/src/org/mxchange/jusercore/events/logout/ObserveableUserLogoutEvent.java deleted file mode 100644 index e9d430b..0000000 --- a/src/org/mxchange/jusercore/events/logout/ObserveableUserLogoutEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.logout; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events after the user has logged in - *

- * @author Roland Haeder - */ -public interface ObserveableUserLogoutEvent extends Serializable { - - /** - * Getter for user instance - *

- * @return User instance - */ - User getLoggedOutUser (); - -} diff --git a/src/org/mxchange/jusercore/events/logout/UserLogoutEvent.java b/src/org/mxchange/jusercore/events/logout/UserLogoutEvent.java deleted file mode 100644 index 3ee0555..0000000 --- a/src/org/mxchange/jusercore/events/logout/UserLogoutEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.logout; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * This event is fired when the loggedOutUser has logged in - *

- * @author Roland Haeder - */ -public class UserLogoutEvent implements ObserveableUserLogoutEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 58_617_641_290_620L; - - /** - * User instance - */ - private final User loggedOutUser; - - /** - * Constructor with updated loggedOutUser instance - *

- * @param loggedOutUser Updated loggedOutUser instance - */ - public UserLogoutEvent (final User loggedOutUser) { - // Is the logged-in user instance valid? - if (null == loggedOutUser) { - // Throw NPE - throw new NullPointerException("loggedOutUser is null"); //NOI18N - } else if (loggedOutUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("loggedOutUser.userId is null"); //NOI18N - } else if (loggedOutUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("loggedOutUser.userId={0} is invalid.", loggedOutUser.getUserId())); //NOI18N - } - - // Set loggedOutUser - this.loggedOutUser = loggedOutUser; - } - - @Override - public User getLoggedOutUser () { - return this.loggedOutUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/registration/RegisteredUserEvent.java b/src/org/mxchange/jusercore/events/registration/RegisteredUserEvent.java deleted file mode 100644 index 85ae473..0000000 --- a/src/org/mxchange/jusercore/events/registration/RegisteredUserEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.registration; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event, fireed if a new registeredUser has registered - *

- * @author Roland Haeder - */ -public class RegisteredUserEvent implements UserRegisteredEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 186_956_974_127_691L; - - /** - * Newly registered registeredUser; - */ - private final User registeredUser; - - /** - * Constructor with newly registered registeredUser - *

- * @param registeredUser Newly registered registeredUser - */ - 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 registeredUser instance - *

- * @return User instance - */ - @Override - public User getRegisteredUser () { - return this.registeredUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/registration/UserRegisteredEvent.java b/src/org/mxchange/jusercore/events/registration/UserRegisteredEvent.java deleted file mode 100644 index ee1ecbe..0000000 --- a/src/org/mxchange/jusercore/events/registration/UserRegisteredEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.registration; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An event interface, fireed if a new user has registered - *

- * @author Roland Haeder - */ -public interface UserRegisteredEvent extends Serializable { - - /** - * Getter for user instance - *

- * @return User instance - */ - User getRegisteredUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java b/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java deleted file mode 100644 index f1b8173..0000000 --- a/src/org/mxchange/jusercore/events/user/add/AdminAddedUserEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.add; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when an administrator added a new user - * account. - *

- * @author Roland Haeder - */ -public interface AdminAddedUserEvent extends Serializable { - - /** - * Getter for added user instance - *

- * @return Added user instance - */ - User getAddedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.java b/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.java deleted file mode 100644 index 8889084..0000000 --- a/src/org/mxchange/jusercore/events/user/add/AdminUserAddedEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.add; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has added a new user account - *

- * @author Roland Haeder - */ -public class AdminUserAddedEvent implements AdminAddedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Added user instance - */ - private final User addedUser; - - /** - * Constructor with added user instance - *

- * @param addedUser Added user instance - */ - public AdminUserAddedEvent (final User addedUser) { - // Is the user instance valid? - if (null == addedUser) { - // Throw NPE - throw new NullPointerException("addedUser is null"); //NOI18N - } else if (addedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("addedUser.userId is null"); //NOI18N - } else if (addedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("addedUser.userId={0} is invalid.", addedUser.getUserId())); //NOI18N - } - - // Set it here - this.addedUser = addedUser; - } - - @Override - public User getAddedUser () { - return this.addedUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/user/linked/AdminLinkedUserEvent.java b/src/org/mxchange/jusercore/events/user/linked/AdminLinkedUserEvent.java deleted file mode 100644 index c34ce80..0000000 --- a/src/org/mxchange/jusercore/events/user/linked/AdminLinkedUserEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.linked; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when an administrator linked a new user - * account with existing contact data. - *

- * @author Roland Haeder - */ -public interface AdminLinkedUserEvent extends Serializable { - - /** - * Getter for linked user instance - *

- * @return linked user instance - */ - User getLinkedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/linked/AdminUserLinkedEvent.java b/src/org/mxchange/jusercore/events/user/linked/AdminUserLinkedEvent.java deleted file mode 100644 index f35cc70..0000000 --- a/src/org/mxchange/jusercore/events/user/linked/AdminUserLinkedEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.linked; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has linked a new user account - * with existing contact data. - *

- * @author Roland Haeder - */ -public class AdminUserLinkedEvent implements AdminLinkedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Linked user instance - */ - private final User linkedUser; - - /** - * Constructor with linked user instance - *

- * @param linkedUser Linked user instance - */ - public AdminUserLinkedEvent (final User linkedUser) { - // Is the user instance valid? - if (null == linkedUser) { - // Throw NPE - throw new NullPointerException("linkedUser is null"); //NOI18N - } else if (linkedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("linkedUser.userId is null"); //NOI18N - } else if (linkedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("linkedUser.userId={0} is invalid.", linkedUser.getUserId())); //NOI18N - } - - // Set it here - this.linkedUser = linkedUser; - } - - @Override - public User getLinkedUser () { - return this.linkedUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/user/locked/AdminLockedUserEvent.java b/src/org/mxchange/jusercore/events/user/locked/AdminLockedUserEvent.java deleted file mode 100644 index cd3196d..0000000 --- a/src/org/mxchange/jusercore/events/user/locked/AdminLockedUserEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.locked; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when an administrator locked a user - * account. - *

- * @author Roland Haeder - */ -public interface AdminLockedUserEvent extends Serializable { - - /** - * Getter for locked user instance - *

- * @return locked user instance - */ - User getLockedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/locked/AdminUserLockedEvent.java b/src/org/mxchange/jusercore/events/user/locked/AdminUserLockedEvent.java deleted file mode 100644 index a2df3f9..0000000 --- a/src/org/mxchange/jusercore/events/user/locked/AdminUserLockedEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.locked; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has locked a user account. - *

- * @author Roland Haeder - */ -public class AdminUserLockedEvent implements AdminLockedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Locked user instance - */ - private final User lockedUser; - - /** - * Constructor with linked user instance - *

- * @param lockedUser Locked user instance - */ - public AdminUserLockedEvent (final User lockedUser) { - // Is the user instance valid? - if (null == lockedUser) { - // Throw NPE - throw new NullPointerException("lockedUser is null"); //NOI18N - } else if (lockedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("lockedUser.userId is null"); //NOI18N - } else if (lockedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("lockedUser.userId={0} is invalid.", lockedUser.getUserId())); //NOI18N - } - - // Set it here - this.lockedUser = lockedUser; - } - - @Override - public User getLockedUser () { - return this.lockedUser; - } - -} diff --git a/src/org/mxchange/jusercore/events/user/password_change/UpdatedUserPasswordEvent.java b/src/org/mxchange/jusercore/events/user/password_change/UpdatedUserPasswordEvent.java deleted file mode 100644 index 600e749..0000000 --- a/src/org/mxchange/jusercore/events/user/password_change/UpdatedUserPasswordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.password_change; - -import org.mxchange.jusercore.model.user.password_history.PasswordHistory; - -/** - * An interface for events being fired when a user updates personal data. - *

- * @author Roland Haeder - */ -public interface UpdatedUserPasswordEvent { - - /** - * Getter for password history entry - *

- * @return Password history entry - */ - PasswordHistory getPasswordHistory (); - -} diff --git a/src/org/mxchange/jusercore/events/user/password_change/UserUpdatedPasswordEvent.java b/src/org/mxchange/jusercore/events/user/password_change/UserUpdatedPasswordEvent.java deleted file mode 100644 index 629f195..0000000 --- a/src/org/mxchange/jusercore/events/user/password_change/UserUpdatedPasswordEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.password_change; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.password_history.PasswordHistory; - -/** - * An event being fired when the user has updated personal data - *

- * @author Roland Haeder - */ -public class UserUpdatedPasswordEvent implements UpdatedUserPasswordEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Updated user instance - */ - private final PasswordHistory passwordHistory; - - /** - * Constructor with updated user instance - *

- * @param passwordHistory Updated user instance - */ - public UserUpdatedPasswordEvent (final PasswordHistory passwordHistory) { - // Is the user instance valid? - if (null == passwordHistory) { - // Throw NPE - throw new NullPointerException("passwordHistory is null"); //NOI18N - } else if (passwordHistory.getUserPasswordHistoryUser() == null) { - // Throw NPE again - throw new NullPointerException("passwordHistory.userPasswordHistoryUser is null"); //NOI18N - } else if (passwordHistory.getUserPasswordHistoryUser().getUserId() == null) { - // Throw NPE again - throw new NullPointerException("passwordHistory.userPasswordHistoryUser.userId is null"); //NOI18N - } else if (passwordHistory.getUserPasswordHistoryUser().getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("passwordHistory.userPasswordHistoryUser.userId={0} is invalid.", passwordHistory.getUserPasswordHistoryUser().getUserId())); //NOI18N - } - - // Set it here - this.passwordHistory = passwordHistory; - } - - @Override - public PasswordHistory getPasswordHistory () { - return this.passwordHistory; - } - -} diff --git a/src/org/mxchange/jusercore/events/user/unlocked/AdminUnlockedUserEvent.java b/src/org/mxchange/jusercore/events/user/unlocked/AdminUnlockedUserEvent.java deleted file mode 100644 index bc0c422..0000000 --- a/src/org/mxchange/jusercore/events/user/unlocked/AdminUnlockedUserEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.unlocked; - -import java.io.Serializable; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when an administrator unlocked a user - * account. - *

- * @author Roland Haeder - */ -public interface AdminUnlockedUserEvent extends Serializable { - - /** - * Getter for unlocked user instance - *

- * @return Unlocked user instance - */ - User getUnlockedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/unlocked/AdminUserUnlockedEvent.java b/src/org/mxchange/jusercore/events/user/unlocked/AdminUserUnlockedEvent.java deleted file mode 100644 index 145314b..0000000 --- a/src/org/mxchange/jusercore/events/user/unlocked/AdminUserUnlockedEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.unlocked; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An event being fired when the administrator has unlocked a user account. - *

- * @author Roland Haeder - */ -public class AdminUserUnlockedEvent implements AdminUnlockedUserEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_785_787_174_676_290L; - - /** - * Unlocked user instance - */ - private final User unlockedUser; - - /** - * Constructor with linked user instance - *

- * @param unlockedUser Unlocked user instance - */ - public AdminUserUnlockedEvent (final User unlockedUser) { - // Is the user instance valid? - if (null == unlockedUser) { - // Throw NPE - throw new NullPointerException("unlockedUser is null"); //NOI18N - } else if (unlockedUser.getUserId() == null) { - // Throw NPE again - throw new NullPointerException("unlockedUser.userId is null"); //NOI18N - } else if (unlockedUser.getUserId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("unlockedUser.userId={0} is invalid.", unlockedUser.getUserId())); //NOI18N - } - - // Set it here - this.unlockedUser = unlockedUser; - } - - @Override - public User getUnlockedUser () { - return this.unlockedUser; - } - -} 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 index 5b32266..0000000 --- a/src/org/mxchange/jusercore/events/user/update/AdminUpdatedUserDataEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 . - */ -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. - *

- * @author Roland Haeder - */ -public interface AdminUpdatedUserDataEvent extends Serializable { - - /** - * Getter for updated user instance - *

- * @return Added user instance - */ - User getUpdatedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.java b/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.java deleted file mode 100644 index 4a9fda3..0000000 --- a/src/org/mxchange/jusercore/events/user/update/AdminUserDataUpdatedEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -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 - *

- * @author Roland Haeder - */ -public class AdminUserDataUpdatedEvent implements AdminUpdatedUserDataEvent { - - /** - * 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 - *

- * @param updatedUser Updated user instance - */ - public AdminUserDataUpdatedEvent (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/UpdatedUserPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java deleted file mode 100644 index 6499521..0000000 --- a/src/org/mxchange/jusercore/events/user/update/UpdatedUserPersonalDataEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.events.user.update; - -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for events being fired when a user updates personal data. - *

- * @author Roland Haeder - */ -public interface UpdatedUserPersonalDataEvent { - - /** - * Getter for updated user instance - *

- * @return Added user instance - */ - User getUpdatedUser (); - -} diff --git a/src/org/mxchange/jusercore/events/user/update/UserUpdatedPersonalDataEvent.java b/src/org/mxchange/jusercore/events/user/update/UserUpdatedPersonalDataEvent.java deleted file mode 100644 index 9e65dae..0000000 --- a/src/org/mxchange/jusercore/events/user/update/UserUpdatedPersonalDataEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 . - */ -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 - *

- * @author Roland Haeder - */ -public class UserUpdatedPersonalDataEvent implements UpdatedUserPersonalDataEvent { - - /** - * 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 - *

- * @param updatedUser Updated user instance - */ - public UserUpdatedPersonalDataEvent (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/exceptions/DataRepeatMismatchException.java b/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java deleted file mode 100644 index 7606d6e..0000000 --- a/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -/** - * An exception thrown when the user has not entered same email addresses - *

- * @author Roland Haeder - */ -public class DataRepeatMismatchException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 12_857_813_986_248_156L; - - /** - * Constructor with message - *

- * @param message Message to show - */ - public DataRepeatMismatchException (final String message) { - super(message); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java b/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java deleted file mode 100644 index c0e1ddf..0000000 --- a/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user's email address is already registered. - *

- * @author Roland Haeder - */ -public class EmailAddressAlreadyRegisteredException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 16_435_892_878_271L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public EmailAddressAlreadyRegisteredException (final User user) { - // Call super contructor - super(MessageFormat.format("Email address {0} already registered.", user.getUserContact().getContactEmailAddress())); //NOI18N - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserEmailAddressNotFoundException.java b/src/org/mxchange/jusercore/exceptions/UserEmailAddressNotFoundException.java deleted file mode 100644 index 8a1591f..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserEmailAddressNotFoundException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; - -/** - * An exception thrown when an user email address was not found. - *

- * @author Roland Haeder - */ -public class UserEmailAddressNotFoundException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 50_375_271_856_714_906L; - - /** - * Constructor with email address - *

- * @param emailAddress Email address - */ - public UserEmailAddressNotFoundException (final String emailAddress) { - super(MessageFormat.format("User email address {0} not found.", emailAddress)); //NOI18N - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserNameAlreadyRegisteredException.java b/src/org/mxchange/jusercore/exceptions/UserNameAlreadyRegisteredException.java deleted file mode 100644 index f32fbb1..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserNameAlreadyRegisteredException.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user name is already registered - *

- * @author Roland Haeder - */ -public class UserNameAlreadyRegisteredException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 16_435_892_878_271L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public UserNameAlreadyRegisteredException (final User user) { - // Call super contructor - super(MessageFormat.format("User name {0} already registered at record id {1}. Maybe forgot to call isRegistered(user) ?", user.getUserName(), user.getUserId())); - } - - /** - * Constructor with already registered user name - *

- * @param userName User name - */ - public UserNameAlreadyRegisteredException (final String userName) { - // Call super contructor - super(MessageFormat.format("User name {0} already used. Maybe forgot to call isRegistered(user) ?", userName)); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java b/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java deleted file mode 100644 index c8710f7..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user's account was not found - *

- * @author Roland Haeder - */ -public class UserNotFoundException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 42_895_928_956_718_956L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public UserNotFoundException (final User user) { - // Call super contructor - super(MessageFormat.format("User name {0} not found.", user.getUserName())); //NOI18N - } - - /** - * Constructor with user id - *

- * @param userId User id - */ - public UserNotFoundException (final Long userId) { - super(MessageFormat.format("User id {0} not found.", userId)); //NOI18N - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java b/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java deleted file mode 100644 index 55db22b..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the entered password did not match the stored - * password. - *

- * @author Roland Haeder - */ -public class UserPasswordMismatchException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 97_283_567_871_569_401L; - - /** - * Creates an exception with given user instance - *

- * @param user User instance - */ - public UserPasswordMismatchException (final User user) { - super(MessageFormat.format("Password for user {0} does not match stored password.", user)); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java b/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java deleted file mode 100644 index 8a28369..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the entered password did not match the stored - * password. - *

- * @author Roland Haeder - */ -public class UserPasswordRepeatMismatchException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 51_782_450_671_256_594L; - - /** - * Creates an exception with given user instance - *

- * @param user User instance - */ - public UserPasswordRepeatMismatchException (final User user) { - super(MessageFormat.format("Passwords don't match, userId={0}", user.getUserId())); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserStatusConfirmedException.java b/src/org/mxchange/jusercore/exceptions/UserStatusConfirmedException.java deleted file mode 100644 index 28cfdb7..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserStatusConfirmedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user account is unconfirmed - *

- * @author Roland Haeder - */ -public class UserStatusConfirmedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 541_378_578_296_710L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public UserStatusConfirmedException (final User user) { - // Call super contructor - super(MessageFormat.format("User account with user name {0} is confirmed.", user.getUserName())); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java b/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java deleted file mode 100644 index bb96e7f..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user account is locked - *

- * @author Roland Haeder - */ -public class UserStatusLockedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 438_395_891_288_681L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public UserStatusLockedException (final User user) { - // Call super contructor - super(MessageFormat.format("User account with user name {0} is locked.", user.getUserName())); - } - -} diff --git a/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java b/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java deleted file mode 100644 index 543cb80..0000000 --- a/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jusercore.model.user.User; - -/** - * An exception thrown when the user account is unconfirmed - *

- * @author Roland Haeder - */ -public class UserStatusUnconfirmedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 438_395_891_288_681L; - - /** - * Constructor with already registered user instance - *

- * @param user User instance - */ - public UserStatusUnconfirmedException (final User user) { - // Call super contructor - super(MessageFormat.format("User account with user name {0} is unconfirmed.", user.getUserName())); - } - -} diff --git a/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java b/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java deleted file mode 100644 index 5d2d726..0000000 --- a/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.email_address; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jusercore.model.email_address.status.EmailChangeStatus; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for email address changes. This is required to have the user confirm - * the change (avoids abuse a bit). - *

- * @author Roland Haeder - */ -public interface ChangeableEmailAddress extends Serializable { - - /** - * Getter for email change id - *

- * @return Email change id - */ - Long getEmailChangeId (); - - /** - * Setter for email change id - *

- * @param emailChangeId Email change id - */ - void setEmailChangeId (final Long emailChangeId); - - /** - * Getter for email address to change to - *

- * @return Email address to change to - */ - String getEmailAddress (); - - /** - * Setter for email address to change to - *

- * @param emailAddress Email address to change to - */ - void setEmailAddress (final String emailAddress); - - /** - * Getter for created "email change" timestamp - *

- * @return Created "email change" timestamp - */ - Calendar getEmailChangeCreated (); - - /** - * Setter for created "email change" timestamp - *

- * @param emailChangeCreated Created "email change" timestamp - */ - void setEmailChangeCreated (final Calendar emailChangeCreated); - - /** - * Getter for user initiating the email change - *

- * @return User initiating the email change - */ - User getEmailChangeUser (); - - /** - * Setter for user initiating the email change - *

- * @param emailChangeUser User initiating the email change - */ - void setEmailChangeUser (final User emailChangeUser); - - /** - * Getter for email change done/undone - *

- * @return Email change done/undone - */ - Calendar getEmailChangeDone (); - - /** - * Setter for email change done/undone - *

- * @param emailChangeDone Email change done/undone - */ - void setEmailChangeDone (final Calendar emailChangeDone); - - /** - * Getter for email change status - *

- * @return Email change status - */ - EmailChangeStatus getEmailChangeStatus (); - - /** - * Setter for email change status - *

- * @param emailChangeStatus Email change status - */ - void setEmailChangeStatus (final EmailChangeStatus emailChangeStatus); - - /** - * Getter for email change hash - *

- * @return Email change hash - */ - String getEmailChangeHash (); - - /** - * Getter for email change hash - *

- * @param emailChangeHash Email change hash - */ - void setEmailChangeHash (final String emailChangeHash); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java b/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java deleted file mode 100644 index 718c4c5..0000000 --- a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.email_address; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jusercore.model.email_address.status.EmailChangeStatus; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for changing email addresses. - *

- * @author Roland Haeder - */ -@Entity (name = "email_changes") -@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") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class EmailAddressChange implements ChangeableEmailAddress { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 398_459_287_176_139L; - - /** - * Email address to change to - */ - @Basic (optional = false) - @Column (name = "email_address", length = 100, nullable = false, updatable = false) - private String emailAddress; - - /** - * Timestamp when this change has been added - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "email_change_created", nullable = false, updatable = false) - private Calendar emailChangeCreated; - - /** - * Timestamp when this change has been done or undone - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "email_change_done", nullable = false, updatable = false) - private Calendar emailChangeDone; - - /** - * Email change hash the user has to click - */ - @Basic (optional = false) - @Column (name = "email_change_hash", unique = true) - private String emailChangeHash; - - /** - * Email change id - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "email_change_id", nullable = false, updatable = false) - private Long emailChangeId; - - /** - * Email change status - */ - @Basic (optional = false) - @Column (name = "email_change_status", nullable = false, updatable = false) - @Enumerated (EnumType.STRING) - private EmailChangeStatus emailChangeStatus; - - /** - * User initiating the email change - */ - @JoinColumn (name = "email_change_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User emailChangeUser; - - /** - * Default constructor - */ - public EmailAddressChange () { - // Set default email change status - this.emailChangeStatus = EmailChangeStatus.NEW; - } - - /** - * Constructor with all fields to set - *

- * @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 Calendar emailChangeCreated, final EmailChangeStatus emailChangeStatus, final Calendar 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 - *

- * @param user User instance - * @param emailAddress Email address - */ - public EmailAddressChange (final User user, final String emailAddress) { - // Call other constructor - this(); - - // Set all - this.emailChangeUser = user; - this.emailAddress = emailAddress; - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final ChangeableEmailAddress otherEmail = (ChangeableEmailAddress) object; - - if (!Objects.equals(this.getEmailChangeId(), otherEmail.getEmailChangeId())) { - return false; - } else if (!Objects.equals(this.getEmailAddress(), otherEmail.getEmailAddress())) { - return false; - } else if (!Objects.equals(this.getEmailChangeUser(), otherEmail.getEmailChangeUser())) { - return false; - } - - return true; - } - - @Override - public String getEmailAddress () { - return this.emailAddress; - } - - @Override - public void setEmailAddress (final String emailAddress) { - this.emailAddress = emailAddress; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getEmailChangeCreated () { - return this.emailChangeCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEmailChangeCreated (final Calendar emailChangeCreated) { - this.emailChangeCreated = emailChangeCreated; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getEmailChangeDone () { - return this.emailChangeDone; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEmailChangeDone (final Calendar emailChangeDone) { - this.emailChangeDone = emailChangeDone; - } - - @Override - public String getEmailChangeHash () { - return this.emailChangeHash; - } - - @Override - public void setEmailChangeHash (final String emailChangeHash) { - this.emailChangeHash = emailChangeHash; - } - - @Override - public Long getEmailChangeId () { - return this.emailChangeId; - } - - @Override - public void setEmailChangeId (final Long emailChangeId) { - this.emailChangeId = emailChangeId; - } - - @Override - public EmailChangeStatus getEmailChangeStatus () { - return this.emailChangeStatus; - } - - @Override - public void setEmailChangeStatus (final EmailChangeStatus emailChangeStatus) { - this.emailChangeStatus = emailChangeStatus; - } - - @Override - public User getEmailChangeUser () { - return this.emailChangeUser; - } - - @Override - public void setEmailChangeUser (final User emailChangeUser) { - this.emailChangeUser = emailChangeUser; - } - - @Override - public int hashCode () { - int hash = 5; - - hash = 71 * hash + Objects.hashCode(this.getEmailChangeId()); - hash = 71 * hash + Objects.hashCode(this.getEmailAddress()); - hash = 71 * hash + Objects.hashCode(this.getEmailChangeUser()); - - return hash; - } - -} diff --git a/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java b/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java deleted file mode 100644 index c472e80..0000000 --- a/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.email_address.status; - -import java.io.Serializable; - -/** - * An enumeration for email changing - *

- * @author Roland Haeder - */ -public enum EmailChangeStatus implements Serializable { - - /** - * Newly added email address (default) - */ - NEW("EMAIL_CHANGE_STATUS_NEW"), //NOI18N - - /** - * User changed to this address - */ - CHANGED("EMAIL_CHANGE_STATUS_CHANGED"), //NOI18N - - /** - * Has withdrawn the action - */ - WITHDRAWN("EMAIL_CHANGE_STATUS_WITHDRAWN"), //NOI18N - - /** - * User has "deleted" the entry. This is not done to keep a history of email changes. - */ - DELETED("EMAIL_CHANGE_STATUS_DELETED"); //NOI18N - - /** - * Message key - */ - private final String messageKey; - - /** - * Constructor with i18n translation key - *

- * @param messageKey Message key (i18n) - */ - private EmailChangeStatus (final String messageKey) { - // Set it here - this.messageKey = messageKey; - } - - /** - * Output value (for messages) - *

- * @return the messageKey - */ - public String getMessageKey () { - return this.messageKey; - } - -} diff --git a/src/org/mxchange/jusercore/model/user/LoginUser.java b/src/org/mxchange/jusercore/model/user/LoginUser.java deleted file mode 100644 index 7de804a..0000000 --- a/src/org/mxchange/jusercore/model/user/LoginUser.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user; - -import java.util.Calendar; -import java.util.Locale; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; -import org.mxchange.jusercore.model.user.status.UserAccountStatus; - -/** - * A generic user entity class - *

- * @author Roland Haeder - */ -@Entity (name = "users") -@Table ( - name = "users" -) -@NamedQueries ( - { - @NamedQuery (name = "AllUserNames", query = "SELECT DISTINCT u.userName FROM users AS u ORDER BY u.userId ASC"), - @NamedQuery (name = "AllEmailAddresses", query = "SELECT DISTINCT c.contactEmailAddress FROM contacts AS c INNER JOIN users AS u ON u.userContact = c ORDER BY c.contactId ASC"), - @NamedQuery (name = "SearchUserByName", query = "SELECT u FROM users AS u WHERE LOWER(u.userName) LIKE LOWER(:userName)"), - @NamedQuery (name = "SearchUserById", query = "SELECT u FROM users AS u WHERE u.userId = :id"), - @NamedQuery (name = "SearchUserByEmailAddress", query = "SELECT u FROM users AS u INNER JOIN contacts AS c ON u.userContact = c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:emailAddress)"), - @NamedQuery (name = "SearchUserByConfirmKey", query = "SELECT u FROM users AS u WHERE u.userConfirmKey = :confirmKey"), - @NamedQuery (name = "SearchAllUsersExcept", query = "SELECT u FROM users AS u WHERE u != :user ORDER BY u.userId ASC"), - @NamedQuery (name = "AllUsers", query = "SELECT u FROM users AS u ORDER BY u.userId ASC"), - @NamedQuery (name = "AllPublicUsers", query = "SELECT u FROM users AS u WHERE u.userAccountStatus = :status AND u.userProfileMode = :mode ORDER BY u.userId ASC"), - @NamedQuery (name = "AllMemberPublicUsers", query = "SELECT u FROM users AS u WHERE u.userAccountStatus = :status AND u.userProfileMode IN (:public, :members) ORDER BY u.userId ASC") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class LoginUser implements User { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 4_328_454_581_751L; - - /** - * Account status - */ - @Basic (optional = false) - @Column (name = "user_account_status", nullable = false) - @Enumerated (value = EnumType.STRING) - private UserAccountStatus userAccountStatus; - - /** - * Confirmation key - */ - @Column (name = "user_confirm_key", unique = true) - private String userConfirmKey; - - /** - * Id number from "contacts" table - */ - @JoinColumn (name = "user_contact_id", referencedColumnName = "contact_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) - private Contact userContact; - - /** - * "created" timestamp - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "user_created", nullable = false) - private Calendar userCreated; - - /** - * Encrypted password - */ - @Basic (optional = false) - @Column (name = "user_encrypted_password", nullable = false) - private String userEncryptedPassword; - - /** - * User id - */ - @Id - @Column (name = "user_id", nullable = false, length = 20, updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long userId; - - /** - * Last "locked" timestamp - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "user_last_locked_timestamp") - private Calendar userLastLocked; - - /** - * Last locked reason - */ - @Lob - @Column (name = "user_last_locked_reason") - private String userLastLockedReason; - - /** - * User locale - */ - @Column (name = "user_locale") - private Locale userLocale; - - /** - * Whether the user must change password after login - */ - @Column (name = "user_must_change_password") - private Boolean userMustChangePassword; - - /** - * User name - */ - @Basic (optional = false) - @Column (name = "user_name", nullable = false, length = 30, unique = true) - private String userName; - - /** - * Profile mode of this user - */ - @Basic (optional = false) - @Enumerated (EnumType.STRING) - @Column (name = "user_profile_mode", nullable = false) - private ProfileMode userProfileMode; - - /** - * When this user has been updated - */ - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "user_updated") - private Calendar userUpdated; - - /** - * Default constructor - */ - public LoginUser () { - // Default is invisible - this.userProfileMode = ProfileMode.INVISIBLE; - } - - @Override - public void copyAll (final User user) { - // Is contact set? - if (user.getUserContact() instanceof Contact) { - // Copy also contact data - this.getUserContact().copyAll(user.getUserContact()); - } - - // Copy other data - this.setUserConfirmKey(user.getUserConfirmKey()); - this.setUserName(user.getUserName()); - this.setUserEncryptedPassword(user.getUserEncryptedPassword()); - this.setUserAccountStatus(user.getUserAccountStatus()); - this.setUserCreated(user.getUserCreated()); - this.setUserLastLocked(user.getUserLastLocked()); - this.setUserLastLockedReason(user.getUserLastLockedReason()); - this.setUserUpdated(user.getUserUpdated()); - this.setUserProfileMode(user.getUserProfileMode()); - this.setUserLocale(user.getUserLocale()); - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final User other = (User) object; - - return ((Objects.equals(this.getUserName(), other.getUserName())) && - (Objects.equals(this.getUserId(), other.getUserId()))); - } - - @Override - public UserAccountStatus getUserAccountStatus () { - return this.userAccountStatus; - } - - @Override - public void setUserAccountStatus (final UserAccountStatus userAccountStatus) { - this.userAccountStatus = userAccountStatus; - } - - @Override - public String getUserConfirmKey () { - return this.userConfirmKey; - } - - @Override - public void setUserConfirmKey (final String userConfirmKey) { - this.userConfirmKey = userConfirmKey; - } - - @Override - public Contact getUserContact () { - return this.userContact; - } - - @Override - public void setUserContact (final Contact userContact) { - this.userContact = userContact; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserCreated () { - return this.userCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserCreated (final Calendar userCreated) { - this.userCreated = userCreated; - } - - @Override - public String getUserEncryptedPassword () { - return this.userEncryptedPassword; - } - - @Override - public void setUserEncryptedPassword (final String userEncryptedPassword) { - this.userEncryptedPassword = userEncryptedPassword; - } - - @Override - public Long getUserId () { - return this.userId; - } - - @Override - public void setUserId (final Long userId) { - this.userId = userId; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserLastLocked () { - return this.userLastLocked; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserLastLocked (final Calendar userLastLocked) { - this.userLastLocked = userLastLocked; - } - - @Override - public String getUserLastLockedReason () { - return this.userLastLockedReason; - } - - @Override - public void setUserLastLockedReason (final String userLastLockedReason) { - this.userLastLockedReason = userLastLockedReason; - } - - @Override - public Locale getUserLocale () { - return this.userLocale; - } - - @Override - public void setUserLocale (final Locale userLocale) { - this.userLocale = userLocale; - } - - @Override - public Boolean getUserMustChangePassword () { - return this.userMustChangePassword; - } - - @Override - public void setUserMustChangePassword (final Boolean userMustChangePassword) { - this.userMustChangePassword = userMustChangePassword; - } - - @Override - public String getUserName () { - return this.userName; - } - - @Override - public void setUserName (final String userName) { - this.userName = userName; - } - - @Override - public ProfileMode getUserProfileMode () { - return this.userProfileMode; - } - - @Override - public void setUserProfileMode (final ProfileMode userProfileMode) { - this.userProfileMode = userProfileMode; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserUpdated () { - return this.userUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserUpdated (final Calendar userUpdated) { - this.userUpdated = userUpdated; - } - - @Override - public int hashCode () { - int hash = 5; - hash = 83 * hash + Objects.hashCode(this.getUserName()); - hash = 83 * hash + Objects.hashCode(this.getUserId()); - return hash; - } - -} diff --git a/src/org/mxchange/jusercore/model/user/User.java b/src/org/mxchange/jusercore/model/user/User.java deleted file mode 100644 index 4bb0f05..0000000 --- a/src/org/mxchange/jusercore/model/user/User.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.Locale; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; -import org.mxchange.jusercore.model.user.status.UserAccountStatus; - -/** - * A user POPJI - *

- * @author Roland Haeder - */ -public interface User extends Serializable { - - /** - * Copies all attributes from other user object to this - *

- * @param userSource Source instance - */ - void copyAll (final User userSource); - - /** - * Getter for account status - *

- * @return Account status - */ - UserAccountStatus getUserAccountStatus (); - - /** - * Setter for account status - *

- * @param userStatus Account status - */ - void setUserAccountStatus (final UserAccountStatus userStatus); - - /** - * Getter for confirmation key - *

- * @return Confirmation key - */ - String getUserConfirmKey (); - - /** - * Setter for confirmation key - *

- * @param userConfirmKey Confirmation key - */ - void setUserConfirmKey (final String userConfirmKey); - - /** - * Getter for contact instance - *

- * @return Contact id number - */ - Contact getUserContact (); - - /** - * Setter for contact instance - *

- * @param contact Contact instance - */ - void setUserContact (final Contact contact); - - /** - * Getter for "created" timestamp - *

- * @return "created" timestamp - */ - Calendar getUserCreated (); - - /** - * Setter for "created" timestamp - *

- * @param userCreated "created" timestamp - */ - void setUserCreated (final Calendar userCreated); - - /** - * Getter for encrypted password - *

- * @return Encrypted password - */ - String getUserEncryptedPassword (); - - /** - * Setter for password hash - *

- * @param userEncryptedPassword Encrypted password - */ - void setUserEncryptedPassword (final String userEncryptedPassword); - - /** - * Getter for customer id number - *

- * @return User id number - */ - Long getUserId (); - - /** - * Settte for customer id number - *

- * @param customerId User id number - */ - void setUserId (final Long customerId); - - /** - * Getter for "locked" timestamp - *

- * @return "locked" timestamp - */ - Calendar getUserLastLocked (); - - /** - * Getter for "locked" timestamp - *

- * @param userLocked "locked" timestamp - */ - void setUserLastLocked (final Calendar userLocked); - - /** - * Getter for reason of last locked - *

- * @return Reason of last locked - */ - String getUserLastLockedReason (); - - /** - * Setter for reason of last locked - *

- * @param lastLockedReason Reason of last locked - */ - void setUserLastLockedReason (final String lastLockedReason); - - /** - * Getter for user name - *

- * @return User name - */ - String getUserName (); - - /** - * Setter for user name - *

- * @param userName User name - */ - void setUserName (final String userName); - - /** - * Getter for public user profile flag - *

- * @return Whether the user has a public profile - */ - ProfileMode getUserProfileMode (); - - /** - * Setter for public user profile flag - *

- * @param userPublicProfile Whether the user has a public profile - */ - void setUserProfileMode (final ProfileMode userPublicProfile); - - /** - * Getter for updated timestamp - *

- * @return Updated timestamp - */ - Calendar getUserUpdated (); - - /** - * Setter for updated timestamp - *

- * @param userUpdated Updated timestamp - */ - void setUserUpdated (final Calendar userUpdated); - - /** - * Getter for user's locale - *

- * @return User's locale - */ - Locale getUserLocale (); - - /** - * Setteror user's locale - *

- * @param userLocale User's locale - */ - void setUserLocale (final Locale userLocale); - - /** - * Getter for flag if user needs to change password - *

- * @return Flag if user needs to change password - */ - Boolean getUserMustChangePassword (); - - /** - * Setter for flag if user needs to change password - *

- * @param userMustChangePassword Flag if user needs to change password - */ - void setUserMustChangePassword (final Boolean userMustChangePassword); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jusercore/model/user/UserUtils.java b/src/org/mxchange/jusercore/model/user/UserUtils.java deleted file mode 100644 index ebd64ef..0000000 --- a/src/org/mxchange/jusercore/model/user/UserUtils.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user; - -import java.io.Serializable; -import java.security.SecureRandom; -import java.text.MessageFormat; -import java.util.Properties; -import java.util.Random; -import org.apache.commons.codec.digest.Crypt; -import org.apache.commons.codec.digest.DigestUtils; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jusercore.container.login.LoginContainer; - -/** - * An utilities class for users - *

- * @author Roland Haeder - */ -public class UserUtils implements Serializable { - - /** - * Password alphabet - */ - private static final String PASSWORD_ALPHABET = "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY0123456789-/?!_+#@"; //NOI18N - - /** - * Minimum password length - */ - private static final Integer PASSWORD_MINIMUM_LENGTH = 5; - - /** - * Random number generator - */ - private static final Random RANDOM_NUMBER_GENERATOR; - - /** - * Serial number - */ - private static final long serialVersionUID = 18_356_847_120_972L; - - /** - * Static initializer - */ - static { - // Init RNG - RANDOM_NUMBER_GENERATOR = new SecureRandom(); - } - - /** - * Creates a pseudo-random password with given length - *

- * @param length Length of the password - *

- * @return Pseudo-random password - */ - public static String createRandomPassword (final Integer length) { - // Parameter should be valid - if (null == length) { - // Throw NPE - throw new NullPointerException("length is null"); //NOI18N - } else if (length < PASSWORD_MINIMUM_LENGTH) { - // To weak passwords - throw new IllegalArgumentException(MessageFormat.format("Password length {0} is to short, minimum: {1}", length, PASSWORD_MINIMUM_LENGTH)); //NOI18N - } - - // Init variable - StringBuilder password = new StringBuilder(length); - - // Start creating it - for (int i = 0; i < length; i++) { - // Generate random number - int pos = RANDOM_NUMBER_GENERATOR.nextInt(PASSWORD_ALPHABET.length()); - - // Get char at this position and add it to the final password - password.append(String.valueOf(PASSWORD_ALPHABET.charAt(pos))); - } - - // Should have the wanted length - assert (password.length() == length) : MessageFormat.format("Password length {0} doesn't match requested: {1}", password.length(), length); //NOI18N - - // Return it - return password.toString(); - } - - /** - * Hashes given user password and adds a salt to it - *

- * @param userPassword User password to be hashed - *

- * @return Hashed user password - */ - public static String encryptPassword (final String userPassword) { - // Is it null or empty? - if (null == userPassword) { - // Throw NPE - throw new NullPointerException("userPassword is null"); //NOI18N - } else if (userPassword.isEmpty()) { - // Empty passwords are hardcoded not allowed due to security risks - throw new IllegalArgumentException("userPassword is empty"); //NOI18N - } - - // Generate large number - String number = Long.toString(RANDOM_NUMBER_GENERATOR.nextLong() * 10_000_000_000L); - - // Generate salt - String salt = Crypt.crypt(number); - - // First encrypt password - String encryptedPassword = Crypt.crypt(userPassword, salt); - - // Return it - return encryptedPassword; - } - - /** - * Generates a pseudo-random user name - *

- * @return User name - */ - public static String generateRandomUserName () { - // User name's format is normally "user" + random number (10 digits) - String userName = String.format("user%d", RANDOM_NUMBER_GENERATOR.nextInt(10000000)); //NOI18N - - // Return it - return userName; - } - - /** - * Generate a key suitable for confirmation. This is basicly a large and - * strong hash with a lop entropy. - *

- * @param user User instance to use as additional entropy source - *

- * @return Generated key - */ - public static String generatedConfirmationKey (final User user) { - // Generates random string by creating a random, encrypted password - StringBuilder key = new StringBuilder(encryptPassword(generateRandomUserName())); - - // Is user set? - if (user instanceof User) { - // Add it's name, too - key.append(":").append(user); //NOI18N - - // Is user name set? - if (user.getUserName() instanceof String) { - // Add it - key.append(":").append(user.getUserName()); //NOI18N - } - - // Is password set? - if (user.getUserEncryptedPassword() instanceof String) { - // Add it, too - key.append(":").append(user.getUserEncryptedPassword()); //NOI18N - } - - // Get contact instance - Contact contact = user.getUserContact(); - - // Is contact set? - if (contact instanceof Contact) { - // Add it, too - key.append(":").append(contact); //NOI18N - - // Is email address set? - if (contact.getContactEmailAddress() instanceof String) { - // Add it, too - key.append(":").append(contact.getContactEmailAddress()); //NOI18N - } - } - } - - // Hash key - String hash = DigestUtils.sha256Hex(key.toString()); - - // Return it - return hash; - } - - /** - * Returns a Properties object from given user instance. - *

- * @param user User instance to get all fields from - *

- * @return All properties from given user - */ - public static Properties getAllUserFields (final User user) { - // Parameter should be valid - 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) { - // Not valid number - throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N - } else if (user.getUserName() == null) { - // Throw NPE again - throw new NullPointerException("user.userName is null"); //NOI18N - } else if (user.getUserName().isEmpty()) { - // Empty string - throw new IllegalArgumentException("user.userName is empty"); //NOI18N - } else if (user.getUserAccountStatus() == null) { - // Throw NPE - throw new NullPointerException("user.userAccountStatus is null"); //NOI18N - } - - // Init properties list - Properties properties = new Properties(); - - // Init some vbalues with empty strings - properties.setProperty("userConfirmKey", ""); //NOI18N - properties.setProperty("userUpdated", ""); //NOI18N - properties.setProperty("userLastLockedReason", ""); //NOI18N - properties.setProperty("contactTitle", ""); //NOI18N - properties.setProperty("contactStreet", ""); //NOI18N - properties.setProperty("contactHouseNumber", ""); //NOI18N - properties.setProperty("contacCity", ""); //NOI18N - properties.setProperty("contacCity", ""); //NOI18N - properties.setProperty("contactZipCode", ""); //NOI18N - properties.setProperty("contactBirthday", ""); //NOI18N - properties.setProperty("contactEmailAddress", ""); //NOI18N - properties.setProperty("contactUpdated", ""); //NOI18N - - // Set all: - // - User data - properties.setProperty("userId", Long.toString(user.getUserId())); //NOI18N - properties.setProperty("userName", user.getUserName()); //NOI18N - properties.setProperty("userCreated", user.getUserCreated().toString()); //NOI18N - if (user.getUserUpdated() != null) { - properties.setProperty("contactUpdated", user.getUserUpdated().toString()); //NOI18N - } - if (user.getUserConfirmKey() != null) { - properties.setProperty("userConfirmKey", user.getUserConfirmKey()); //NOI18N - } - if (user.getUserLastLockedReason() != null) { - properties.setProperty("userLastLockedReason", user.getUserLastLockedReason()); //NOI18N - } - properties.setProperty("userAccountStatus", user.getUserAccountStatus().toString()); //NOI18N - - // - Contact data - properties.setProperty("contactGender", user.getUserContact().getContactGender().toString()); //NOI18N - if (user.getUserContact().getContactTitle() != null) { - properties.setProperty("contactTitle", user.getUserContact().getContactTitle()); //NOI18N - } - properties.setProperty("contactFirstName", user.getUserContact().getContactFirstName()); //NOI18N - properties.setProperty("contactFamilyName", user.getUserContact().getContactFamilyName()); //NOI18N - if (user.getUserContact().getContactStreet() != null) { - properties.setProperty("contactStreet", user.getUserContact().getContactStreet()); //NOI18N - } - if (user.getUserContact().getContactHouseNumber() != null) { - properties.setProperty("contactHouseNumber", Short.toString(user.getUserContact().getContactHouseNumber())); //NOI18N - } - if (user.getUserContact().getContactCity() != null) { - properties.setProperty("contacCity", user.getUserContact().getContactCity()); //NOI18N - } - if (user.getUserContact().getContactZipCode() != null) { - properties.setProperty("contactZipCode", Integer.toString(user.getUserContact().getContactZipCode())); //NOI18N - } - if (user.getUserContact().getContactBirthday() != null) { - properties.setProperty("contactBirthday", user.getUserContact().getContactBirthday().toString()); //NOI18N - } - 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 - } - - // Return it - return properties; - } - - /** - * Checks if password from container matches the updatedUser's password - *

- * @param container Container holding user instance and unencrypted password - * @param updatedUser Updated user instance from database - *

- * @return Whether the password matches - */ - public static boolean ifPasswordMatches (final LoginContainer container, final User updatedUser) { - // Validate parameters - if (null == container) { - // Throw NPE - throw new NullPointerException("container is null"); //NOI18N - } else if (null == updatedUser) { - // And again NPE ... - throw new NullPointerException("updatedUser is null"); //NOI18N - } else if (container.getUser() == null) { - // NPE for user in container - throw new NullPointerException("container.user is null"); //NOI18N - } else if (container.getUserPassword() == null) { - // NPE for user password in container - throw new NullPointerException("container.userPassword is null"); //NOI18N - } else if (container.getUserPassword().isEmpty()) { - // Empty password in container - throw new IllegalArgumentException("container.userPassword is empty"); //NOI18N - } - - // Call below method - return ifPasswordMatches(container.getUserPassword(), updatedUser); - } - - /** - * Checks if direct password the updatedUser's password - *

- * @param unencryptedPassword Unencrypted (direct) password - * @param updatedUser Updated user instance from database - *

- * @return Whether the password matches - */ - public static boolean ifPasswordMatches (final String unencryptedPassword, final User updatedUser) { - // Validate parameters - if (null == unencryptedPassword) { - // Throw NPE - throw new NullPointerException("unencryptedPassword is null"); //NOI18N - } else if (unencryptedPassword.isEmpty()) { - // NPE for user in container - throw new NullPointerException("unencryptedPassword is empty."); //NOI18N - } else if (null == updatedUser) { - // And again NPE ... - throw new NullPointerException("updatedUser is null"); //NOI18N - } - - // First encrypt password - String encryptedPassword = Crypt.crypt(unencryptedPassword, updatedUser.getUserEncryptedPassword()); - - // Is it matching? - return encryptedPassword.equals(updatedUser.getUserEncryptedPassword()); - } - - /** - * Checks if password from container matches with from user instance. - *

- * @param container Container holding user instance and unencrypted password - *

- * @return Whether it maches - */ - public static boolean ifPasswordMatches (final LoginContainer container) { - // Validate parameters - if (null == container) { - // Throw NPE - throw new NullPointerException("container is null"); //NOI18N - } else if (container.getUser() == null) { - // NPE for user in container - throw new NullPointerException("container.user is null"); //NOI18N - } else if (container.getUserPassword() == null) { - // NPE for user password in container - throw new NullPointerException("container.userPassword is null"); //NOI18N - } else if (container.getUserPassword().isEmpty()) { - // Empty password in container - throw new IllegalArgumentException("container.userPassword is empty"); //NOI18N - } - - // Call other method - return ifPasswordMatches(container.getUserPassword(), container.getUser()); - } - - /** - * No instance from this class - */ - private UserUtils () { - } -} diff --git a/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java new file mode 100644 index 0000000..d62ab2f --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2016 Cho-Time GmbH + * + * 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 . + */ +package org.mxchange.jusercore.model.user.activity; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jusercore.model.user.User; + +/** + * POJI for logable user activity + *

+ * @author Roland Haeder + */ +public interface LogableUserActivity extends Serializable { + + /** + * Getter for activity id + *

+ * @return Activity id + */ + Long getActivityId (); + + /** + * Getter for activity id + *

+ * @param activityId Activity id + */ + void setActivityId (final Long activityId); + + /** + * Getter for activity message (optional) + *

+ * @return Activity message + */ + String getActivityMessage (); + + /** + * Setter for activity message (optional) + *

+ * @param activityMessage Activity message + */ + void setActivityMessage (final String activityMessage); + + /** + * Getter for activity timestamp + *

+ * @return Activity timestamp + */ + Calendar getActivityTimestamp (); + + /** + * Setter for activity timestamp + *

+ * @param activityTimestamp Activity timestamp + */ + void setActivityTimestamp (final Calendar activityTimestamp); + + /** + * Getter for activity type + *

+ * @return Activity type + */ + String getActivityType (); + + /** + * Setter for activity type + *

+ * @param activityType Activity type + */ + void setActivityType (final String activityType); + + /** + * Getter for activity user (who did it) + *

+ * @return User who did activity + */ + User getActivityUser (); + + /** + * Setter for activity user (who did it) + *

+ * @param activityUser User who did activity + */ + void setActivityUser (final User activityUser); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java new file mode 100644 index 0000000..790c5aa --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2016 Cho-Time GmbH + * + * 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 . + */ +package org.mxchange.jusercore.model.user.activity; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO for user acitivity log + *

+ * @author Roland Haeder + */ +@Entity (name = "user_activity_log") +@Table ( + name = "user_activity_log" +) +@NamedQueries ( + { + @NamedQuery (name = "FindAllUsersActivity", query = "SELECT a FROM user_activity_log AS a WHERE a.activityUser = :activityUser ORDER BY a.activityId DESC"), + @NamedQuery (name = "FindUsersActivityByType", query = "SELECT a FROM user_activity_log AS a WHERE a.activityUser = :activityUser AND a.activityType LIKE :activityType ORDER BY a.activityId DESC") + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class UserActivityLog implements LogableUserActivity { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 12_945_967_867_290_601L; + + /** + * Primary key + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "activity_id", nullable = false, updatable = false) + private Long activityId; + + /** + * Message + */ + @Column (name = "activity_message", updatable = false) + @Lob + private String activityMessage; + + /** + * Timestamp + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "activity_timestamp", nullable = false, updatable = false) + private Calendar activityTimestamp; + + /** + * Type + */ + @Basic (optional = false) + @Column (name = "activity_type", nullable = false, updatable = false) + private String activityType; + + /** + * User instance + */ + @JoinColumn (name = "activity_user_id", referencedColumnName = "user_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.ALL, optional = false) + private User activityUser; + + /** + * Default constructor + */ + public UserActivityLog () { + } + + /** + * Constructor with message, type and user + *

+ * @param activityMessage Message + * @param activityType Type + * @param activityUser User instance + */ + public UserActivityLog (final String activityMessage, final String activityType, final User activityUser) { + this.activityMessage = activityMessage; + this.activityType = activityType; + this.activityUser = activityUser; + } + + @Override + public boolean equals (final Object object) { + if (this == object) { + return true; + } else if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final LogableUserActivity other = (LogableUserActivity) object; + + if (!Objects.equals(this.getActivityMessage(), other.getActivityMessage())) { + return false; + } else if (!Objects.equals(this.getActivityType(), other.getActivityType())) { + return false; + } else if (!Objects.equals(this.getActivityId(), other.getActivityId())) { + return false; + } else if (!Objects.equals(this.getActivityTimestamp(), other.getActivityTimestamp())) { + return false; + } else if (!Objects.equals(this.getActivityUser(), other.getActivityUser())) { + return false; + } + + return true; + } + + @Override + public Long getActivityId () { + return this.activityId; + } + + @Override + public void setActivityId (final Long activityId) { + this.activityId = activityId; + } + + @Override + public String getActivityMessage () { + return this.activityMessage; + } + + @Override + public void setActivityMessage (final String activityMessage) { + this.activityMessage = activityMessage; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getActivityTimestamp () { + return this.activityTimestamp; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setActivityTimestamp (final Calendar activityTimestamp) { + this.activityTimestamp = activityTimestamp; + } + + @Override + public String getActivityType () { + return this.activityType; + } + + @Override + public void setActivityType (final String activityType) { + this.activityType = activityType; + } + + @Override + public User getActivityUser () { + return this.activityUser; + } + + @Override + public void setActivityUser (final User activityUser) { + this.activityUser = activityUser; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 83 * hash + Objects.hashCode(this.getActivityId()); + hash = 83 * hash + Objects.hashCode(this.getActivityMessage()); + hash = 83 * hash + Objects.hashCode(this.getActivityTimestamp()); + hash = 83 * hash + Objects.hashCode(this.getActivityType()); + hash = 83 * hash + Objects.hashCode(this.getActivityUser()); + + return hash; + } + +} diff --git a/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java b/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java deleted file mode 100644 index 8a1c35e..0000000 --- a/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user.password_history; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for user password history - *

- * @author Roland Haeder - */ -public interface PasswordHistory extends Serializable { - - /** - * Getter for timestamp this history entry has been created (usually in - * EJB). - *

- * @return Timestamp when this history entry has been created - */ - Calendar getUserPasswordHistoryCreated (); - - /** - * Setter for timestamp this history entry has been created (usually in - * EJB). - *

- * @param userPasswordHistoryCreated Timestamp when this history entry has - * been created - */ - void setUserPasswordHistoryCreated (final Calendar userPasswordHistoryCreated); - - /** - * Getter for history entry id (primary key) - *

- * @return History entry id (primary key) - */ - Long getUserPasswordHistoryId (); - - /** - * Setter for history entry id (primary key) - *

- * @param userPasswordHistoryId History entry id (primary key) - */ - void setUserPasswordHistoryId (final Long userPasswordHistoryId); - - /** - * Getter for user's password hash - *

- * @return User's password hash - */ - String getUserPasswordHistoryPasswordHash (); - - /** - * Setter for user's password hash - *

- * @param userPasswordHistoryPasswordHash User's password hash - */ - void setUserPasswordHistoryPasswordHash (final String userPasswordHistoryPasswordHash); - - /** - * Getter for user instance - *

- * @return User instance - */ - User getUserPasswordHistoryUser (); - - /** - * Setter for user instance - *

- * @param userPasswordHistoryUser User instance - */ - void setUserPasswordHistoryUser (final User userPasswordHistoryUser); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java deleted file mode 100644 index 1cbdef1..0000000 --- a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user.password_history; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for user password history - *

- * @author Roland Haeder - */ -@Entity (name = "user_password_history") -@Table ( - name = "user_password_history" -) -@NamedQueries ( - { - @NamedQuery (name = "AllUsersHistoryEntries", query = "SELECT h FROM user_password_history AS h WHERE h.userPasswordHistoryUser = :user ORDER BY h.userPasswordHistoryId DESC") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class UserPasswordHistory implements PasswordHistory { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 1L; - - /** - * Timestamp when this entry has been created - */ - @Basic (optional = false) - @Column (name = "history_created", nullable = false, updatable = false) - @Temporal (TemporalType.TIMESTAMP) - private Calendar userPasswordHistoryCreated; - - /** - * Id number (primary key) - */ - @Id - @Column (name = "history_id", updatable = false) - @GeneratedValue (strategy = GenerationType.IDENTITY) - private Long userPasswordHistoryId; - - /** - * Password hash being used - */ - @Basic (optional = false) - @Column (name = "history_password_hash", nullable = false, updatable = false) - private String userPasswordHistoryPasswordHash; - - /** - * User instance for this history entry - */ - @JoinColumn (name = "history_user_id", nullable = true, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH) - private User userPasswordHistoryUser; - - /** - * Default constructor - */ - public UserPasswordHistory () { - } - - /** - * Constructor with password hash and user instance - *

- * @param userPasswordHistoryPasswordHash Password hash - * @param userPasswordHistoryUser User instance - */ - public UserPasswordHistory (final String userPasswordHistoryPasswordHash, final User userPasswordHistoryUser) { - // Set all - this.userPasswordHistoryPasswordHash = userPasswordHistoryPasswordHash; - this.userPasswordHistoryUser = userPasswordHistoryUser; - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (object == null) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final PasswordHistory other = (PasswordHistory) object; - - if (!Objects.equals(this.getUserPasswordHistoryId(), other.getUserPasswordHistoryId())) { - return false; - } else if (!Objects.equals(this.getUserPasswordHistoryPasswordHash(), other.getUserPasswordHistoryPasswordHash())) { - return false; - } else if (!Objects.equals(this.getUserPasswordHistoryUser(), other.getUserPasswordHistoryUser())) { - return false; - } - - return true; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserPasswordHistoryCreated () { - return this.userPasswordHistoryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserPasswordHistoryCreated (final Calendar userPasswordHistoryCreated) { - this.userPasswordHistoryCreated = userPasswordHistoryCreated; - } - - @Override - public Long getUserPasswordHistoryId () { - return this.userPasswordHistoryId; - } - - @Override - public void setUserPasswordHistoryId (final Long userPasswordHistoryId) { - this.userPasswordHistoryId = userPasswordHistoryId; - } - - @Override - public String getUserPasswordHistoryPasswordHash () { - return this.userPasswordHistoryPasswordHash; - } - - @Override - public void setUserPasswordHistoryPasswordHash (final String userPasswordHistoryPasswordHash) { - this.userPasswordHistoryPasswordHash = userPasswordHistoryPasswordHash; - } - - @Override - public User getUserPasswordHistoryUser () { - return this.userPasswordHistoryUser; - } - - @Override - public void setUserPasswordHistoryUser (final User userPasswordHistoryUser) { - this.userPasswordHistoryUser = userPasswordHistoryUser; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 79 * hash + Objects.hashCode(this.getUserPasswordHistoryId()); - hash = 79 * hash + Objects.hashCode(this.getUserPasswordHistoryPasswordHash()); - hash = 79 * hash + Objects.hashCode(this.getUserPasswordHistoryUser()); - - return hash; - } - -} diff --git a/src/org/mxchange/jusercore/model/user/profilemodes/ProfileMode.java b/src/org/mxchange/jusercore/model/user/profilemodes/ProfileMode.java deleted file mode 100644 index c71bae7..0000000 --- a/src/org/mxchange/jusercore/model/user/profilemodes/ProfileMode.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user.profilemodes; - -import java.io.Serializable; - -/** - * User profile modes - *

- * @author Roland Haeder - */ -public enum ProfileMode implements Serializable { - - /** - * Invisible to guests and members (not administrators) - */ - INVISIBLE("PROFILE_MODE_INVISIBLE"), //NOI18N - - /** - * Only visible to members (and administrators) - */ - MEMBERS("PROFILE_MODE_MEMBERS"), //NOI18N - - /** - * Visible to all (public in Internet) - */ - PUBLIC("PROFILE_MODE_PUBLIC"); //NOI18N - - /** - * Message key (i18n) - */ - private final String messageKey; - - /** - * Constructor with message key - *

- * @param messageKey Message key - */ - private ProfileMode (final String messageKey) { - this.messageKey = messageKey; - } - - /** - * Getter for message key (i18n) - *

- * @return Message key - */ - public String getMessageKey () { - return this.messageKey; - } -} diff --git a/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java b/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java deleted file mode 100644 index f1eb67c..0000000 --- a/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 . - */ -package org.mxchange.jusercore.model.user.status; - -import java.io.Serializable; - -/** - * An enumeration for user's account status like confirmed, locked, etc. - *

- * @author Roland Haeder - */ -public enum UserAccountStatus implements Serializable { - - /** - * Unconfirmed (default) - */ - UNCONFIRMED("USER_ACCOUNT_STATUS_UNCONFIRMED", "user_status_unconfirmed"), //NOI18N - - /** - * Confirmed (email address validated) - */ - CONFIRMED("USER_ACCOUNT_STATUS_CONFIRMED", "user_status_confirmed"), //NOI18N - - /** - * Locked (maybe violated T&C) - */ - LOCKED("USER_ACCOUNT_STATUS_LOCKED", "user_status_locked"); //NOI18N - - /** - * Message key - */ - private final String messageKey; - - /** - * CSS style class - */ - private final String styleClass; - - /** - * Constructor with i18n translation key - *

- * @param messageKey Message key (i18n) - * @param styleClass CSS style class - */ - private UserAccountStatus (final String messageKey, final String styleClass) { - // Set it here - this.messageKey = messageKey; - this.styleClass = styleClass; - } - - /** - * Getter for message key - *

- * @return Message key (i18n) - */ - public String getMessageKey () { - return this.messageKey; - } - - /** - * Getter for CSS style class - *

- * @return CSS style class - */ - public String getStyleClass () { - return this.styleClass; - } - -}