From 53764f1bbab07a702e96f223840e11340d56e3da Mon Sep 17 00:00:00 2001 From: kske Date: Thu, 9 Apr 2020 14:15:39 +0200 Subject: [PATCH] Configured the project to use Hibernate validation This requires the Hibernate Tools (a part of JBoss Tools) to be installed in Eclipse. --- .project | 6 ++++ ...se.wst.common.project.facet.core.prefs.xml | 0 ....eclipse.wst.common.project.facet.core.xml | 2 +- src/main/java/envoy/server/data/Group.java | 2 +- src/main/java/envoy/server/data/User.java | 31 +++++++++---------- 5 files changed, 23 insertions(+), 18 deletions(-) mode change 100755 => 100644 .settings/org.eclipse.wst.common.project.facet.core.prefs.xml diff --git a/.project b/.project index fdd0c87..d6ba176 100755 --- a/.project +++ b/.project @@ -25,10 +25,16 @@ + + org.hibernate.eclipse.console.hibernateBuilder + + + org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature org.eclipse.wst.common.project.facet.core.nature + org.hibernate.eclipse.console.hibernateNature diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml old mode 100755 new mode 100644 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 2fcb919..fe1f404 100755 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,5 +1,5 @@ - + diff --git a/src/main/java/envoy/server/data/Group.java b/src/main/java/envoy/server/data/Group.java index 3b6cac8..6301624 100644 --- a/src/main/java/envoy/server/data/Group.java +++ b/src/main/java/envoy/server/data/Group.java @@ -24,7 +24,7 @@ import envoy.data.User; @Entity @Table(name = "groups") @NamedQuery(query = "SELECT g FROM Group g WHERE g.name = :name", name = "getGroupByName") -public final class Group extends Contact { +public class Group extends Contact { /** * {@inheritDoc} diff --git a/src/main/java/envoy/server/data/User.java b/src/main/java/envoy/server/data/User.java index 0e63ac1..fa6db47 100755 --- a/src/main/java/envoy/server/data/User.java +++ b/src/main/java/envoy/server/data/User.java @@ -5,11 +5,12 @@ import java.util.stream.Collectors; import javax.persistence.*; +import envoy.data.User.UserStatus; + /** - * This class serves as a way to let Hibernate communicate with the server - * without bringing the dependency of JPA/Hibernate into the client.
- * It will be referenced as "database user" to clarify between the different - * user objects.
+ * This class enables the storage of user specific data inside a database using + * Hibernate. Its objects will be referred to as database users as opposed to + * the common user objects present on both the client and the server.
*
* Project: envoy-server-standalone
* File: User.java
@@ -30,13 +31,14 @@ import javax.persistence.*; name = "searchUsers" ) } ) -public final class User extends Contact { +public class User extends Contact { private byte[] passwordHash; @Temporal(TemporalType.TIMESTAMP) - private Date lastSeen; - private envoy.data.User.UserStatus status; + private Date lastSeen; + + private UserStatus status; /** * {@inheritDoc} @@ -47,7 +49,7 @@ public final class User extends Contact { } /** - * @return the passwordHash of a {link envoy.data.User} + * @return the password hash * @since Envoy Server Standalone v0.1-alpha */ public byte[] getPasswordHash() { return passwordHash; } @@ -55,33 +57,30 @@ public final class User extends Contact { /** * @param passwordHash the password hash to set * @since Envoy Server Standalone v0.1-alpha - * @see User#getPasswordHash() */ public void setPasswordHash(byte[] passwordHash) { this.passwordHash = passwordHash; } /** - * @return the last date an {link envoy.data.User} has been online + * @return the last date the user has been online * @since Envoy Server Standalone v0.1-alpha */ public Date getLastSeen() { return lastSeen; } /** - * @param lastSeen the latest date at which has been seen to set + * @param lastSeen the latest date at which the user has been online to set * @since Envoy Server Standalone v0.1-alpha - * @see User#getLastSeen() */ public void setLastSeen(Date lastSeen) { this.lastSeen = lastSeen; } /** - * @return the status of a {link envoy.data.User} + * @return the status * @since Envoy Server Standalone v0.1-alpha */ - public envoy.data.User.UserStatus getStatus() { return status; } + public UserStatus getStatus() { return status; } /** * @param status the status to set * @since Envoy Server Standalone v0.1-alpha - * @see User#getStatus() */ - public void setStatus(envoy.data.User.UserStatus status) { this.status = status; } + public void setStatus(UserStatus status) { this.status = status; } }