Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • DM/dm-docs
  • hammonds/dm-docs
  • hparraga/dm-docs
3 results
Show changes
Showing
with 2219 additions and 0 deletions
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.PolicyProperty;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
/**
*
* @author bfrosik
*/
@Stateless
public class PolicyPropertyFacade extends AbstractFacade<PolicyProperty>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
// @Override
// public void remove(PolicyProperty entity) {
// Object o = em.merge(entity);
// em.remove(o);
// }
public PolicyPropertyFacade() {
super(PolicyProperty.class);
}
public PolicyProperty findByName(String name) {
try {
return (PolicyProperty) em.createNamedQuery("PolicyProperty.findByName")
.setParameter("name", name)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
public PolicyProperty findById(int id) {
try {
return (PolicyProperty) em.createNamedQuery("PolicyProperty.findById")
.setParameter("id", id)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
public List<PolicyProperty> findByPolicyTypeId(int id) {
try {
return (List<PolicyProperty>) em.createNamedQuery("PolicyProperty.findByPolicyTypeId")
.setParameter("policyTypeId", id)
.getResultList();
}
catch (NoResultException ex) {
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.PolicyType;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class PolicyTypeFacade extends AbstractFacade<PolicyType>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public PolicyTypeFacade() {
super(PolicyType.class);
}
public PolicyType findByName(String name) {
try {
return (PolicyType) em.createNamedQuery("PolicyType.findByName")
.setParameter("name", name)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
public PolicyType findById(int id) {
try {
return (PolicyType) em.createNamedQuery("PolicyType.findById")
.setParameter("id", id)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.RoleType;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class RoleTypeFacade extends AbstractFacade<RoleType>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public RoleTypeFacade() {
super(RoleType.class);
}
public RoleType findByName(String name) {
try {
return (RoleType) em.createNamedQuery("RoleType.findByName")
.setParameter("name", name)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
public RoleType findById(int id) {
try {
return (RoleType) em.createNamedQuery("RoleType.findById")
.setParameter("id", id)
.getSingleResult();
} catch (NoResultException ex) {
}
return null;
}
public boolean checkIfNameExists(String name) {
return findByName(name) != null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.SettingType;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class SettingTypeFacade extends AbstractFacade<SettingType>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public SettingTypeFacade() {
super(SettingType.class);
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.UserExperimentRole;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class UserExperimentRoleFacade extends AbstractFacade<UserExperimentRole>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public UserExperimentRoleFacade() {
super(UserExperimentRole.class);
}
public UserExperimentRole findByUserExperimentRole(int userId, int experimentId, int roleId) {
try {
return (UserExperimentRole) em.createNamedQuery("UserExperimentRole.findByUserExperimentRole")
.setParameter("userId", userId)
.setParameter("experimentId", experimentId)
.setParameter("roleTypeId", roleId)
.getSingleResult();
}
catch (NoResultException ex) {
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.Experiment;
import gov.anl.aps.dm.portal.model.entities.UserInfo;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class UserInfoFacade extends AbstractFacade<UserInfo>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public UserInfoFacade() {
super(UserInfo.class);
}
public UserInfo findByUsername(String username) {
try {
return (UserInfo) em.createNamedQuery("UserInfo.findByUsername")
.setParameter("username", username)
.getSingleResult();
}
catch (NoResultException ex) {
}
return null;
}
public boolean checkIfUsernameExists(String username) {
return findByUsername(username) != null;
}
public List<UserInfo> findNoSystemRoleUsers(Integer roleTypeId) {
try {
return (List<UserInfo>) em.createNamedQuery("UserInfo.findNonAdmins")
.setParameter("roleTypeId", roleTypeId)
.getResultList();
}
catch (NoResultException ex) {
}
return null;
}
public List<UserInfo> findSystemRoleUsers(int roleTypeId) {
try {
return (List<UserInfo>) em.createNamedQuery("UserInfo.findUsersInRole")
.setParameter("roleTypeId", roleTypeId)
.getResultList();
}
catch (NoResultException ex) {
}
return null;
}
public List<UserInfo> findUsersInExperiment(int experimentId) {
try {
return (List<UserInfo>) em.createNamedQuery("UserInfo.findUsersInExperiment")
.setParameter("experimentId", experimentId)
.getResultList();
} catch (NoResultException ex) {
}
return null;
}
public List<UserInfo> findNoUsersInExperiment(int experimentId) {
try {
return (List<UserInfo>) em.createNamedQuery("UserInfo.findNoUsersInExperiment")
.setParameter("experimentId", experimentId)
.getResultList();
} catch (NoResultException ex) {
}
return null;
}
public List<Experiment> findExperimentsInUser(int userId) {
try {
return (List<Experiment>) em.createNamedQuery("UserInfo.findExperimentsInUser")
.setParameter("userId", userId)
.getResultList();
} catch (NoResultException ex) {
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.beans;
import gov.anl.aps.dm.portal.model.entities.UserSetting;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author sveseli
*/
@Stateless
public class UserSettingFacade extends AbstractFacade<UserSetting>
{
@PersistenceContext(unitName = "DmWebPortalPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public UserSettingFacade() {
super(UserSetting.class);
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import javax.persistence.Basic;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "allowed_policy_value")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "AllowedPolicyValue.findAll", query = "SELECT a FROM AllowedPolicyValue a"),
@NamedQuery(name = "AllowedPolicyValue.findById", query = "SELECT a FROM AllowedPolicyValue a WHERE a.id = :id"),
@NamedQuery(name = "AllowedPolicyValue.findByPolicyValue", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyValue = :policyValue"),
@NamedQuery(name = "AllowedPolicyValue.findByDescription", query = "SELECT a FROM AllowedPolicyValue a WHERE a.description = :description"),
@NamedQuery(name = "AllowedPolicyValue.findByPolicyPropertyId", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyProperty.id = :policyPropertyId")})
public class AllowedPolicyValue extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 256)
@Column(name = "policy_value")
private String policyValue;
@Size(max = 256)
@Column(name = "description")
private String description;
@JoinColumn(name = "policy_property_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyProperty policyProperty;
public AllowedPolicyValue() {
}
public AllowedPolicyValue(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPolicyValue() {
return policyValue;
}
public void setPolicyValue(String policyValue) {
this.policyValue = policyValue;
}
public String getName() {
return policyValue;
}
public void setName(String policyValue) {
this.policyValue = policyValue;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public PolicyProperty getPolicyProperty() {
return policyProperty;
}
public void setPolicyProperty(PolicyProperty policyProperty) {
this.policyProperty = policyProperty;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AllowedPolicyValue)) {
return false;
}
AllowedPolicyValue other = (AllowedPolicyValue) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.AllowedPolicyValue[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import javax.persistence.Basic;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "allowed_setting_value")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "AllowedSettingValue.findAll", query = "SELECT a FROM AllowedSettingValue a"),
@NamedQuery(name = "AllowedSettingValue.findById", query = "SELECT a FROM AllowedSettingValue a WHERE a.id = :id"),
@NamedQuery(name = "AllowedSettingValue.findBySettingValue", query = "SELECT a FROM AllowedSettingValue a WHERE a.settingValue = :settingValue"),
@NamedQuery(name = "AllowedSettingValue.findByDescription", query = "SELECT a FROM AllowedSettingValue a WHERE a.description = :description")})
public class AllowedSettingValue extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 256)
@Column(name = "setting_value")
private String settingValue;
@Size(max = 256)
@Column(name = "description")
private String description;
@JoinColumn(name = "setting_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private SettingType settingType;
public AllowedSettingValue() {
}
public AllowedSettingValue(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSettingValue() {
return settingValue;
}
public void setSettingValue(String settingValue) {
this.settingValue = settingValue;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public SettingType getSettingType() {
return settingType;
}
public void setSettingType(SettingType settingType) {
this.settingType = settingType;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AllowedSettingValue)) {
return false;
}
AllowedSettingValue other = (AllowedSettingValue) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.AllowedSettingValue[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import gov.anl.aps.dm.portal.utilities.SearchResult;
import java.io.Serializable;
import java.util.regex.Pattern;
/**
*
* @author sveseli
*/
public class CloneableEntity implements Serializable, Cloneable
{
protected static final long serialVersionUID = 1L;
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public SearchResult search(Pattern searchPattern) {
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "data_folder")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "DataFolder.findAll", query = "SELECT d FROM DataFolder d"),
@NamedQuery(name = "DataFolder.findById", query = "SELECT d FROM DataFolder d WHERE d.id = :id"),
@NamedQuery(name = "DataFolder.findByDataPath", query = "SELECT d FROM DataFolder d WHERE d.dataPath = :dataPath"),
@NamedQuery(name = "DataFolder.findByDescription", query = "SELECT d FROM DataFolder d WHERE d.description = :description")})
public class DataFolder extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 1024)
@Column(name = "data_path")
private String dataPath;
@Size(max = 256)
@Column(name = "description")
private String description;
@JoinTable(name = "experiment_data_folder", joinColumns = {
@JoinColumn(name = "data_folder_id", referencedColumnName = "id")}, inverseJoinColumns = {
@JoinColumn(name = "experiment_id", referencedColumnName = "id")})
@ManyToMany
private List<Experiment> experimentList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "dataFolder")
private List<DataFolderPermission> dataFolderPermissionList;
@OneToMany(mappedBy = "parentDataFolder")
private List<DataFolder> dataFolderList;
@JoinColumn(name = "parent_data_folder_id", referencedColumnName = "id")
@ManyToOne
private DataFolder parentDataFolder;
public DataFolder() {
}
public DataFolder(Integer id) {
this.id = id;
}
public DataFolder(Integer id, String path) {
this.id = id;
this.dataPath = path;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDataPath() {
return dataPath;
}
public void setDataPath(String dataPath) {
this.dataPath = dataPath;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlTransient
public List<Experiment> getExperimentList() {
return experimentList;
}
public void setExperimentList(List<Experiment> experimentList) {
this.experimentList = experimentList;
}
@XmlTransient
public List<DataFolderPermission> getDataFolderPermissionList() {
return dataFolderPermissionList;
}
public void setDataFolderPermissionList(List<DataFolderPermission> dataFolderPermissionList) {
this.dataFolderPermissionList = dataFolderPermissionList;
}
@XmlTransient
public List<DataFolder> getDataFolderList() {
return dataFolderList;
}
public void setDataFolderList(List<DataFolder> dataFolderList) {
this.dataFolderList = dataFolderList;
}
public DataFolder getParentDataFolder() {
return parentDataFolder;
}
public void setParentDataFolder(DataFolder parentDataFolder) {
this.parentDataFolder = parentDataFolder;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DataFolder)) {
return false;
}
DataFolder other = (DataFolder) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.DataFolder[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import javax.persistence.Basic;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "data_folder_permission")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "DataFolderPermission.findAll", query = "SELECT d FROM DataFolderPermission d"),
@NamedQuery(name = "DataFolderPermission.findById", query = "SELECT d FROM DataFolderPermission d WHERE d.id = :id"),
@NamedQuery(name = "DataFolderPermission.findByPermissionValue", query = "SELECT d FROM DataFolderPermission d WHERE d.permissionValue = :permissionValue"),
@NamedQuery(name = "DataFolderPermission.findByDescription", query = "SELECT d FROM DataFolderPermission d WHERE d.description = :description")})
public class DataFolderPermission extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "permission_value")
private String permissionValue;
@Size(max = 256)
@Column(name = "description")
private String description;
@JoinColumn(name = "data_folder_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private DataFolder dataFolder;
public DataFolderPermission() {
}
public DataFolderPermission(Integer id) {
this.id = id;
}
public DataFolderPermission(Integer id, String value) {
this.id = id;
this.permissionValue = value;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPermissionValue() {
return permissionValue;
}
public void setPermissionValue(String permissionValue) {
this.permissionValue = permissionValue;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public DataFolder getDataFolder() {
return dataFolder;
}
public void setDataFolder(DataFolder dataFolder) {
this.dataFolder = dataFolder;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DataFolderPermission)) {
return false;
}
DataFolderPermission other = (DataFolderPermission) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.DataFolderPermission[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "experiment")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Experiment.findAll", query = "SELECT e FROM Experiment e"),
@NamedQuery(name = "Experiment.findById", query = "SELECT e FROM Experiment e WHERE e.id = :id"),
@NamedQuery(name = "Experiment.findByName", query = "SELECT e FROM Experiment e WHERE e.name = :name"),
@NamedQuery(name = "Experiment.findByDescription", query = "SELECT e FROM Experiment e WHERE e.description = :description"),
@NamedQuery(name = "Experiment.findByStartDate", query = "SELECT e FROM Experiment e WHERE e.startDate = :startDate"),
@NamedQuery(name = "Experiment.findByEndDate", query = "SELECT e FROM Experiment e WHERE e.endDate = :endDate")})
public class Experiment extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 64)
@Column(name = "name")
private String name;
@Size(max = 2000)
@Column(name = "description")
private String description;
@Column(name = "start_date", columnDefinition="TIMESTAMP WITH TIME ZONE")
@Temporal(TemporalType.TIMESTAMP)
private Date startDate;
@Column(name = "end_date", columnDefinition="TIMESTAMP WITH TIME ZONE")
@Temporal(TemporalType.TIMESTAMP)
private Date endDate;
@ManyToMany(mappedBy = "experimentList")
private List<DataFolder> dataFolderList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experiment")
private List<UserExperimentRole> userExperimentRoleList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experiment")
private List<ExperimentPolicy> experimentPolicyList;
@JoinColumn(name = "experiment_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private ExperimentType experimentType;
public Experiment() {
}
public Experiment(Integer id) {
this.id = id;
}
public Experiment(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
@XmlTransient
public List<DataFolder> getDataFolderList() {
return dataFolderList;
}
public void setDataFolderList(List<DataFolder> dataFolderList) {
this.dataFolderList = dataFolderList;
}
@XmlTransient
public List<UserExperimentRole> getUserExperimentRoleList() {
return userExperimentRoleList;
}
public void setUserExperimentRoleList(List<UserExperimentRole> userExperimentRoleList) {
this.userExperimentRoleList = userExperimentRoleList;
}
@XmlTransient
public List<ExperimentPolicy> getExperimentPolicyList() {
return experimentPolicyList;
}
public void setExperimentPolicyList(List<ExperimentPolicy> experimentPolicyList) {
this.experimentPolicyList = experimentPolicyList;
}
public ExperimentType getExperimentType() {
return experimentType;
}
public void setExperimentType(ExperimentType experimentType) {
this.experimentType = experimentType;
}
public ExperimentPolicy getPolicyForType(int typeId) {
for (ExperimentPolicy experimentPolicy : experimentPolicyList) {
if (experimentPolicy.getPolicyType().getId() == typeId) {
return experimentPolicy;
}
}
return null;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Experiment)) {
return false;
}
Experiment other = (Experiment) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.Experiment[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "experiment_policy")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ExperimentPolicy.findAll", query = "SELECT e FROM ExperimentPolicy e"),
@NamedQuery(name = "ExperimentPolicy.findById", query = "SELECT e FROM ExperimentPolicy e WHERE e.id = :id"),
@NamedQuery(name = "ExperimentPolicy.findByExperimentId", query = "SELECT e FROM ExperimentPolicy e WHERE e.experiment.id = :experimentId"),
@NamedQuery(name = "ExperimentPolicy.findByPolicyTypeId", query = "SELECT e FROM ExperimentPolicy e WHERE e.policyType.id = :policyTypeId")})
public class ExperimentPolicy extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@JoinColumn(name = "policy_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyType policyType;
@JoinColumn(name = "experiment_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Experiment experiment;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentPolicy")
private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
public ExperimentPolicy() {
}
public ExperimentPolicy(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public PolicyType getPolicyType() {
return policyType;
}
public void setPolicyType(PolicyType policyType) {
this.policyType = policyType;
}
public Experiment getExperiment() {
return experiment;
}
public void setExperiment(Experiment experiment) {
this.experiment = experiment;
}
@XmlTransient
public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
return experimentPolicyPropertyValueList;
}
public void setExperimentPolicyPropertyValue(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ExperimentPolicy)) {
return false;
}
ExperimentPolicy other = (ExperimentPolicy) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.ExperimentPolicy[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author bfrosik
*/
@Entity
@Table(name = "experiment_policy_property_value")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ExperimentPolicyPropertyValue.findAll", query = "SELECT e FROM ExperimentPolicyPropertyValue e"),
@NamedQuery(name = "ExperimentPolicyPropertyValue.findById", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.id = :id"),
@NamedQuery(name = "ExperimentPolicyPropertyValue.findByPolicyPropertyValue", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.policyPropertyValue = :policyPropertyValue"),
@NamedQuery(name = "ExperimentPolicyPropertyValue.findByPolicyPropertyId", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.policyProperty.id = :policyPropertyId"),
@NamedQuery(name = "ExperimentPolicyPropertyValue.findByExperimentPolicyId", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.experimentPolicy.id = :experimentPolicyId")})
public class ExperimentPolicyPropertyValue extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Size(max = 256)
@Column(name = "policy_property_value")
private String policyPropertyValue;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "modified_by")
private String modifiedBy;
@Basic(optional = false)
@NotNull
@Column(name = "modified_date")
@Temporal(TemporalType.DATE)
private Date modifiedDate;
@JoinColumn(name = "policy_property_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyProperty policyProperty;
@JoinColumn(name = "experiment_policy_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private ExperimentPolicy experimentPolicy;
public ExperimentPolicyPropertyValue() {
}
public ExperimentPolicyPropertyValue(Integer id) {
this.id = id;
}
public ExperimentPolicyPropertyValue(Integer id, String value) {
this.id = id;
this.policyPropertyValue = value;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPolicyPropertyValue() {
return policyPropertyValue;
}
public void setPolicyPropertyValue(String policyPropertyValue) {
this.policyPropertyValue = policyPropertyValue;
}
public PolicyProperty getPolicyProperty() {
return policyProperty;
}
public void setPolicyProperty(PolicyProperty policyProperty) {
this.policyProperty = policyProperty;
}
public ExperimentPolicy getExperimentPolicy() {
return experimentPolicy;
}
public void setExperimentPolicy(ExperimentPolicy experimentPolicy) {
this.experimentPolicy = experimentPolicy;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public Date getModifiedDate() {
return modifiedDate;
}
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
public String getUnits() {
return policyProperty.getUnits();
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ExperimentPolicyPropertyValue)) {
return false;
}
ExperimentPolicyPropertyValue other = (ExperimentPolicyPropertyValue) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.ExperimentPolicyPropertyValue[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "experiment_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ExperimentType.findAll", query = "SELECT e FROM ExperimentType e"),
@NamedQuery(name = "ExperimentType.findById", query = "SELECT e FROM ExperimentType e WHERE e.id = :id"),
@NamedQuery(name = "ExperimentType.findByName", query = "SELECT e FROM ExperimentType e WHERE e.name = :name"),
@NamedQuery(name = "ExperimentType.findByDescription", query = "SELECT e FROM ExperimentType e WHERE e.description = :description"),
@NamedQuery(name = "ExperimentType.findByRootDataPath", query = "SELECT e FROM ExperimentType e WHERE e.rootDataPath = :rootDataPath")})
public class ExperimentType extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 64)
@Column(name = "name")
private String name;
@Size(max = 256)
@Column(name = "description")
private String description;
@Size(max = 256)
@Column(name = "root_data_path")
private String rootDataPath;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentType")
private List<Experiment> experimentList;
public ExperimentType() {
}
public ExperimentType(Integer id) {
this.id = id;
}
public ExperimentType(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
public String getRootDataPath() {
return rootDataPath;
}
public void setRootDataPath(String rootDataPath) {
this.rootDataPath = rootDataPath;
}
@XmlTransient
public List<Experiment> getExperimentList() {
return experimentList;
}
public void setExperimentList(List<Experiment> experimentList) {
this.experimentList = experimentList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ExperimentType)) {
return false;
}
ExperimentType other = (ExperimentType) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.ExperimentType[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author bfrosik
*/
@Entity
@Table(name = "policy_property")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "PolicyProperty.findAll", query = "SELECT p FROM PolicyProperty p"),
@NamedQuery(name = "PolicyProperty.findById", query = "SELECT p FROM PolicyProperty p WHERE p.id = :id"),
@NamedQuery(name = "PolicyProperty.findByName", query = "SELECT p FROM PolicyProperty p WHERE p.name = :name"),
@NamedQuery(name = "PolicyProperty.findByDescription", query = "SELECT p FROM PolicyProperty p WHERE p.description = :description"),
@NamedQuery(name = "PolicyProperty.findByUnits", query = "SELECT p FROM PolicyProperty p WHERE p.units = :units"),
@NamedQuery(name = "PolicyProperty.findByPolicyTypeId", query = "SELECT p FROM PolicyProperty p WHERE p.policyType.id = :policyTypeId")})
public class PolicyProperty extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "name")
private String name;
@Size(max = 256)
@Column(name = "units")
private String units;
@Size(max = 256)
@Column(name = "lower_limit")
private String lowerLimit;
@Size(max = 256)
@Column(name = "upper_limit")
private String upperLimit;
@Size(max = 256)
@Column(name = "default_value")
private String defaultValue;
@Size(max = 256)
@Column(name = "description")
private String description;
@JoinColumn(name = "policy_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyType policyType;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyProperty")
private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyProperty")
private List<AllowedPolicyValue> allowedPolicyValueList;
public PolicyProperty() {
}
public PolicyProperty(Integer id) {
this.id = id;
}
public PolicyProperty(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
public String getUnits() {
return units;
}
public void setUnits(String units) {
this.units = units;
}
public String getLowerLimit() {
return lowerLimit;
}
public void setLowerLimit(String lowerLimit) {
this.lowerLimit = lowerLimit;
}
public String getUpperLimit() {
return upperLimit;
}
public void setUpperLimit(String upperLimit) {
this.upperLimit = upperLimit;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public PolicyType getPolicyType() {
return policyType;
}
public void setPolicyType(PolicyType policyType) {
this.policyType = policyType;
}
@XmlTransient
public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
return experimentPolicyPropertyValueList;
}
public void setExperimentPolicyPropertyValueList(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
}
@XmlTransient
public List<AllowedPolicyValue> getAllowedPolicyValueList() {
return allowedPolicyValueList;
}
public void setAllowedPolicyValueList(List<AllowedPolicyValue> allowedPolicyValueList) {
this.allowedPolicyValueList = allowedPolicyValueList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof PolicyProperty)) {
return false;
}
PolicyProperty other = (PolicyProperty) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.PolicyProperty[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "policy_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "PolicyType.findAll", query = "SELECT p FROM PolicyType p"),
@NamedQuery(name = "PolicyType.findById", query = "SELECT p FROM PolicyType p WHERE p.id = :id"),
@NamedQuery(name = "PolicyType.findByName", query = "SELECT p FROM PolicyType p WHERE p.name = :name"),
@NamedQuery(name = "PolicyType.findByDescription", query = "SELECT p FROM PolicyType p WHERE p.description = :description")})
public class PolicyType extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "name")
private String name;
@Size(max = 256)
@Column(name = "description")
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyType")
private List<ExperimentPolicy> experimentPolicyList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyType")
private List<PolicyProperty> policyPropertyList;
public PolicyType() {
}
public PolicyType(Integer id) {
this.id = id;
}
public PolicyType(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
@XmlTransient
public List<ExperimentPolicy> getExperimentPolicyList() {
return experimentPolicyList;
}
public void setExperimentPolicyList(List<ExperimentPolicy> experimentPolicyList) {
this.experimentPolicyList = experimentPolicyList;
}
@XmlTransient
public List<PolicyProperty> getPolicyPropertyList() {
return policyPropertyList;
}
public void setPolicyPropertyList(List<PolicyProperty> policyPropertyList) {
this.policyPropertyList = policyPropertyList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof PolicyType)) {
return false;
}
PolicyType other = (PolicyType) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.PolicyType[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "role_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "RoleType.findAll", query = "SELECT r FROM RoleType r"),
@NamedQuery(name = "RoleType.findById", query = "SELECT r FROM RoleType r WHERE r.id = :id"),
@NamedQuery(name = "RoleType.findByName", query = "SELECT r FROM RoleType r WHERE r.name = :name"),
@NamedQuery(name = "RoleType.findByDescription", query = "SELECT r FROM RoleType r WHERE r.description = :description")})
public class RoleType extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "name")
private String name;
@Size(max = 3000)
@Column(name = "description")
private String description;
@NotNull
@Column(name = "is_system_role")
private boolean isSystemRole;
@JoinTable(name = "user_system_role", joinColumns = {
@JoinColumn(name = "role_type_id", referencedColumnName = "id")}, inverseJoinColumns = {
@JoinColumn(name = "user_id", referencedColumnName = "id")})
@ManyToMany
private List<UserInfo> userInfoList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "roleType")
private List<UserExperimentRole> userExperimentRoleList;
public RoleType() {
}
public RoleType(Integer id) {
this.id = id;
}
public RoleType(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
public boolean isIsSystemRole() {
return isSystemRole;
}
public void setIsSystemRole(boolean isSystemRole) {
this.isSystemRole = isSystemRole;
}
@XmlTransient
public List<UserInfo> getUserInfoList() {
return userInfoList;
}
public void setUserInfoList(List<UserInfo> userInfoList) {
this.userInfoList = userInfoList;
}
public void addRoleTypeToUser(UserInfo userInfo) {
if (userInfoList == null)
userInfoList = new ArrayList();
if (!userInfoList.contains(userInfo)) {
userInfoList.add(userInfo);
}
}
public void removeRoleTypeFromUser(UserInfo userInfo) {
userInfoList.remove(userInfo);
}
public boolean isAdmin(String userName) {
for (UserInfo userInfo : getUserInfoList())
{
if (userInfo.getUsername().equals(userName))
return true;
}
return false;
}
@XmlTransient
public List<UserExperimentRole> getUserExperimentRoleList() {
return userExperimentRoleList;
}
public void setUserExperimentRoleList(List<UserExperimentRole> userExperimentRoleList) {
this.userExperimentRoleList = userExperimentRoleList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof RoleType)) {
return false;
}
RoleType other = (RoleType) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.RoleType[ id=" + id + " ]";
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gov.anl.aps.dm.portal.model.entities;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "setting_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "SettingType.findAll", query = "SELECT s FROM SettingType s"),
@NamedQuery(name = "SettingType.findById", query = "SELECT s FROM SettingType s WHERE s.id = :id"),
@NamedQuery(name = "SettingType.findByName", query = "SELECT s FROM SettingType s WHERE s.name = :name"),
@NamedQuery(name = "SettingType.findByDescription", query = "SELECT s FROM SettingType s WHERE s.description = :description"),
@NamedQuery(name = "SettingType.findByDefaultValue", query = "SELECT s FROM SettingType s WHERE s.defaultValue = :defaultValue"),
@NamedQuery(name = "SettingType.findByIsUserModifiable", query = "SELECT s FROM SettingType s WHERE s.isUserModifiable = :isUserModifiable")})
public class SettingType extends CloneableEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(max = 256)
@Column(name = "name")
private String name;
@Size(max = 256)
@Column(name = "description")
private String description;
@Size(max = 256)
@Column(name = "default_value")
private String defaultValue;
@Column(name = "is_user_modifiable")
private Boolean isUserModifiable;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settingType")
private List<AllowedSettingValue> allowedSettingValueList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settingType")
private List<UserSetting> userSettingList;
public SettingType() {
}
public SettingType(Integer id) {
this.id = id;
}
public SettingType(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer 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;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public Boolean getIsUserModifiable() {
return isUserModifiable;
}
public void setIsUserModifiable(Boolean isUserModifiable) {
this.isUserModifiable = isUserModifiable;
}
@XmlTransient
public List<AllowedSettingValue> getAllowedSettingValueList() {
return allowedSettingValueList;
}
public void setAllowedSettingValueList(List<AllowedSettingValue> allowedSettingValueList) {
this.allowedSettingValueList = allowedSettingValueList;
}
@XmlTransient
public List<UserSetting> getUserSettingList() {
return userSettingList;
}
public void setUserSettingList(List<UserSetting> userSettingList) {
this.userSettingList = userSettingList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SettingType)) {
return false;
}
SettingType other = (SettingType) object;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities.SettingType[ id=" + id + " ]";
}
}