/*
* Realm.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.OneToMany;
import javax.persistence.SequenceGenerator;
@Entity
public class Realm implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="REALM_ID_GENERATOR")
@SequenceGenerator(name="REALM_ID_GENERATOR")
private Long id;
private String name;
private String description;
/**
* One-to-Many bidirectional relation to User
.
*/
@OneToMany(cascade=CascadeType.ALL, mappedBy="realm")
private Collection users = new ArrayList();
/** Creates a new instance of Realm */
public Realm() {
}
public Long getId() {
return 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;
}
/**
* Retrieves all users under this Realm
.
* @return All users under this Realm
.
*/
public Collection _getUsers() {
return users;
}
public void _addUser(User o){
this.users.add(o);
}
/**
* Sets the users under this Realm
.
* WARNING: This method is NOT aimed to be used EXPLICITLY.
* TODO: Review Access Specifier.
* @return void
*/
public void _setUsers(Collection users) {
this.users = users;
}
}