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:
		@@ -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}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 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; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user