package entities; import java.io.Serializable; import java.util.Date; import java.util.Set; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Proxy; import org.hibernate.annotations.Type; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.JsonInclude.Include; import entities.security.UserAuth; @Entity @Table(name="\"UserInfo\"") //@Proxy(lazy = false) //@JsonInclude(Include.NON_NULL) @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id") public class UserInfo implements Serializable{ private static final long serialVersionUID = 1225151430484658395L; @Id @GeneratedValue @GenericGenerator(name = "uuid2", strategy = "uuid2") @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)") private UUID id; @Column(name = "email", nullable = false) private String email = null; @Column(name = "authorization_level", nullable = false) private Short authorization_level; //0 admin, 1 user @Column(name = "usertype", nullable = false) private Short usertype; // 0 internal, 1 external @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "authentication", nullable = true) private UserAuth authentication; @Column(name = "verified_email", nullable = true) private Boolean verified_email = null; @Column(name = "name", nullable = true) private String name = null; @Column(name = "created", nullable = false) private Date created = null; @Column(name = "lastloggedin", nullable = true) private Date lastloggedin = null; @Type(type="typedefinition.XMLType") @Column(name = "additionalinfo", columnDefinition = "xml", nullable = true) private String additionalinfo; @OneToMany(fetch = FetchType.LAZY) @JoinTable(name="\"UserProject\"", joinColumns={@JoinColumn(name="usr", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn(name="project", referencedColumnName="\"ID\"")} ) private Set projects; public Set getProjects() { return projects; } public void setProjects(Set projects) { this.projects = projects; } public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getLastloggedin() { return lastloggedin; } public void setLastloggedin(Date lastloggedin) { this.lastloggedin = lastloggedin; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Short getAuthorization_level() { return authorization_level; } public void setAuthorization_level(Short authorization_level) { this.authorization_level = authorization_level; } public Short getUsertype() { return usertype; } public void setUsertype(Short usertype) { this.usertype = usertype; } public UserAuth getAuthentication() { return authentication; } public void setAuthentication(UserAuth authentication) { this.authentication = authentication; } public Boolean getVerified_email() { return verified_email; } public void setVerified_email(Boolean verified_email) { this.verified_email = verified_email; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAdditionalinfo() { return additionalinfo; } public void setAdditionalinfo(String additionalinfo) { this.additionalinfo = additionalinfo; } }