From: Roland Haeder Date: Mon, 5 Oct 2015 13:04:14 +0000 (+0200) Subject: initial import (from jshop-core) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;ds=sidebyside;h=e7b8ecb4a95cb075558771e6661fdf78732a9a00;p=juser-activity-core.git initial import (from jshop-core) Signed-off-by:Roland Häder --- e7b8ecb4a95cb075558771e6661fdf78732a9a00 diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..d542d1a --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project juser-core. + + + diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 0000000..eaf6790 Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/commons-codec-1.10.jar b/lib/commons-codec-1.10.jar new file mode 100644 index 0000000..1d7417c Binary files /dev/null and b/lib/commons-codec-1.10.jar differ diff --git a/lib/javaee-api-7.0/javaee-api-7.0.jar b/lib/javaee-api-7.0/javaee-api-7.0.jar new file mode 100644 index 0000000..9e38d4c Binary files /dev/null and b/lib/javaee-api-7.0/javaee-api-7.0.jar differ diff --git a/lib/javaee-api-7.0/javaee-doc-api.jar b/lib/javaee-api-7.0/javaee-doc-api.jar new file mode 100644 index 0000000..2859e3d Binary files /dev/null and b/lib/javaee-api-7.0/javaee-doc-api.jar differ diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar new file mode 100644 index 0000000..c92ea91 Binary files /dev/null and b/lib/jcontacts-core.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar new file mode 100644 index 0000000..2c6f30e Binary files /dev/null and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar new file mode 100644 index 0000000..8fd4a46 Binary files /dev/null and b/lib/jcoreee.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 0000000..1f1df42 --- /dev/null +++ b/lib/nblibraries.properties @@ -0,0 +1,10 @@ +libs.CopyLibs.classpath=\ + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar +libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=2.0 +libs.javaee-api-7.0.classpath=\ + ${base}/javaee-api-7.0/javaee-api-7.0.jar +libs.javaee-api-7.0.displayName=Java EE 7 API Library +libs.javaee-api-7.0.javadoc=\ + ${base}/javaee-api-7.0/javaee-doc-api.jar +libs.javaee-api-7.0.prop-maven-dependencies=javax:javaee-api:7.0:jar diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..82ef88a --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..0ecbb51 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=648ce58a +build.xml.script.CRC32=18485e38 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=648ce58a +nbproject/build-impl.xml.script.CRC32=1354b001 +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..94b095d --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,102 @@ +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.jcore.jar=lib\\jcore.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.jcore.jar}:\ + ${file.reference.jcoreee.jar}:\ + ${file.reference.jcontacts-core.jar}:\ + ${libs.javaee-api-7.0.classpath}:\ + ${file.reference.commons-codec-1.10.jar} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.deprecation=true +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 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.jcore.jar=../jcore/src/ +source.reference.jcoreee.jar=../jcoreee/src/ +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..437533e --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.java.j2seproject + + + juser-core + + + + + + + + + .\lib\nblibraries.properties + + + diff --git a/src/org/mxchange/jusercore/model/user/LoginUser.java b/src/org/mxchange/jusercore/model/user/LoginUser.java new file mode 100644 index 0000000..7bb10bd --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/LoginUser.java @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2015 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 javax.persistence.Basic; +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.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.contact.UserContact; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; + +/** + * A shop customer class. + *

+ * @author Roland Haeder + */ +@Entity (name = "user") +@Table (name = "user") +public class LoginUser implements User { + + /** + * Serial number + */ + private static final long serialVersionUID = 4_328_454_581_751L; + + /** + * Id number from "contacts" table + */ + @JoinColumn (name = "contact_id", nullable = false, updatable = false, unique = true) + @OneToOne (targetEntity = UserContact.class, optional = false) + private Contact contact; + + /** + * Confirmation key + */ + @Column (name = "user_confirm_key", length = 50) + private String userConfirmKey; + + /** + * "created" timestamp + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "user_created", nullable = false) + private Calendar userCreated; + + /** + * User id + */ + @Id + @Column (name = "user_id", nullable = false, length = 20, updatable = false) + @GeneratedValue (strategy = GenerationType.IDENTITY) + private Long userId; + + /** + * "locked" timestamp + */ + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "user_locked") + private Calendar userLocked; + + /** + * User name + */ + @Column (name = "user_name", nullable = false, length = 20) + private String userName; + + /** + * Password hash + */ + @Column (name = "user_password_hash") + private String userPasswordHash; + + /** + * Account status + */ + @Basic (optional = false) + @Column (name = "user_account_status", nullable = false) + @Enumerated (EnumType.STRING) + private UserAccountStatus userAccountStatus; + + /** + * Default constructor + */ + public LoginUser () { + } + + @Override + public void copyAll (final User user) { + // Copy also contact data + this.getContact().copyAll(user.getContact()); + + // Copy other data + this.setUserConfirmKey(user.getUserConfirmKey()); + this.setUserName(user.getUserName()); + this.setUserPasswordHash(user.getUserPasswordHash()); + this.setUserAccountStatus(user.getUserAccountStatus()); + this.setUserCreated(user.getUserCreated()); + this.setUserLocked(user.getUserLocked()); + } + + @Override + public Contact getContact () { + return this.contact; + } + + @Override + public void setContact (final Contact contact) { + this.contact = contact; + } + + @Override + public String getUserConfirmKey () { + return this.userConfirmKey; + } + + @Override + public void setUserConfirmKey (final String customerConfirmKey) { + this.userConfirmKey = customerConfirmKey; + } + + @Override + public Calendar getUserCreated () { + return this.userCreated; + } + + @Override + public void setUserCreated (final Calendar userCreated) { + this.userCreated = userCreated; + } + + @Override + public Long getUserId () { + return this.userId; + } + + @Override + public void setUserId (final Long userId) { + this.userId = userId; + } + + @Override + public Calendar getUserLocked () { + return this.userLocked; + } + + @Override + public void setUserLocked (final Calendar userLocked) { + this.userLocked = userLocked; + } + + @Override + public String getUserName () { + return this.userName; + } + + @Override + public void setUserName (final String userName) { + this.userName = userName; + } + + @Override + public String getUserPasswordHash () { + return this.userPasswordHash; + } + + @Override + public void setUserPasswordHash (final String userPasswordHash) { + this.userPasswordHash = userPasswordHash; + } + + @Override + public UserAccountStatus getUserAccountStatus () { + return this.userAccountStatus; + } + + @Override + public void setUserAccountStatus (final UserAccountStatus userAccountStatus) { + this.userAccountStatus = userAccountStatus; + } +} diff --git a/src/org/mxchange/jusercore/model/user/User.java b/src/org/mxchange/jusercore/model/user/User.java new file mode 100644 index 0000000..b397f11 --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/User.java @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2015 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 org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; + +/** + * A customer interface + *

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

+ * @param customer Source instance + */ + public void copyAll (final User customer); + + /** + * Getter for contact instance + *

+ * @return Contact id number + */ + public Contact getContact (); + + /** + * Setter for contact instance + *

+ * @param contact Contact instance + */ + public void setContact (final Contact contact); + + /** + * Getter for confirmation key + *

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

+ * @param customerConfirmKey Confirmation key + */ + public void setUserConfirmKey (final String customerConfirmKey); + + /** + * Getter for "created" timestamp + *

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

+ * @param customerCreated "created" timestamp + */ + public void setUserCreated (final Calendar customerCreated); + + /** + * Getter for customer id number + *

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

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

+ * @return "locked" timestamp + */ + public Calendar getUserLocked (); + + /** + * Getter for "locked" timestamp + *

+ * @param customerLocked "locked" timestamp + */ + public void setUserLocked (final Calendar customerLocked); + + /** + * Getter for customer number + *

+ * @return User number + */ + public String getUserName (); + + /** + * Setter for customer number + *

+ * @param customerNumber User number + */ + public void setUserName (final String customerNumber); + + /** + * Getter for password hash + *

+ * @return Password hash + */ + public String getUserPasswordHash (); + + /** + * Setter for password hash + *

+ * @param customerPasswordHash Password hash + */ + public void setUserPasswordHash (final String customerPasswordHash); + + /** + * Getter for account status + *

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

+ * @param customerStatus Account status + */ + public void setUserAccountStatus (final UserAccountStatus customerStatus); +} diff --git a/src/org/mxchange/jusercore/model/user/UserUtils.java b/src/org/mxchange/jusercore/model/user/UserUtils.java new file mode 100644 index 0000000..de555f9 --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/UserUtils.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 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 org.mxchange.jcore.BaseFrameworkSystem; + +/** + * An utilities class for customers + *

+ * @author Roland Haeder + */ +public class UserUtils extends BaseFrameworkSystem { + + /** + * No instance from this class + */ + private UserUtils () { + } +} diff --git a/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java b/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java new file mode 100644 index 0000000..2b75efb --- /dev/null +++ b/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2015 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 enum for user's account status like confirmed, locked, etc. + *

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

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

+ * @return the messageKey + */ + public String getMessageKey () { + return this.messageKey; + } +}