/* * User.java * */ package com.temp.entity.security; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * Entity class User * */ @Entity() @Table(name="crmuser") public class User implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="USER_ID_GENERATOR") @SequenceGenerator(name="USER_ID_GENERATOR") private Long id; private String name; private String description; @OneToOne(cascade=CascadeType.ALL) private LogInCredential credential; @OneToMany(cascade=CascadeType.ALL, mappedBy="user") private Collection principals = new ArrayList(); @ManyToOne(cascade=CascadeType.ALL, optional=false) @JoinColumn(name="realm_id") private Realm realm; /** Creates a new instance of User */ public User() { } /** * Gets the id of this User. * @return the id */ public Long getId() { return this.id; } /** * Sets the id of this User to the specified value. * @param id the new id */ public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } /** * NOTE: Intended to be exposed to WS. */ public Realm getRealm() { return realm; } /** * NOTE: Intended to be exposed to WS. */ public void setRealm(Realm realm) { this.realm = realm; } public LogInCredential getCredential() { return credential; } public void setCredential(LogInCredential credential) { this.credential = credential; } public Collection _getPrincipals() { return principals; } public void _setPrincipals(Collection principals) { this.principals = principals; } public void _addPrincipal(Principal o){ this.principals.add(o); } }