Configured the project to use Hibernate validation

This requires the Hibernate Tools (a part of JBoss Tools) to be
installed in Eclipse.
This commit is contained in:
Kai S. K. Engelbart 2020-04-09 14:15:39 +02:00
parent 98632f97bb
commit 8096d3ff58
5 changed files with 23 additions and 18 deletions

View File

@ -25,10 +25,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.hibernate.eclipse.console.hibernateBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.hibernate.eclipse.console.hibernateNature</nature>
</natures>
</projectDescription>

View File

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jpt.jpa" version="2.1"/>
<installed facet="java" version="11"/>
<installed facet="jpt.jpa" version="2.1"/>
</faceted-project>

View File

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

View File

@ -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.<br>
* It will be referenced as "database user" to clarify between the different
* user objects.<br>
* 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.<br>
* <br>
* Project: <strong>envoy-server-standalone</strong><br>
* File: <strong>User.java</strong><br>
@ -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 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; }
}