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 2444 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.entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
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.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")})
public class ExperimentPolicy extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentPolicyId")
private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
@JoinColumn(name = "experiment_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private Experiment experimentId;
@JoinColumn(name = "policy_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyType policyTypeId;
public ExperimentPolicy() {
}
public ExperimentPolicy(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@XmlTransient
public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
return experimentPolicyPropertyValueList;
}
public void setExperimentPolicyPropertyValueList(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
}
public Experiment getExperimentId() {
return experimentId;
}
public void setExperimentId(Experiment experimentId) {
this.experimentId = experimentId;
}
public PolicyType getPolicyTypeId() {
return policyTypeId;
}
public void setPolicyTypeId(PolicyType policyTypeId) {
this.policyTypeId = policyTypeId;
}
@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;
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.entities2.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 sveseli
*/
@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.findByModifiedBy", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.modifiedBy = :modifiedBy")
, @NamedQuery(name = "ExperimentPolicyPropertyValue.findByModifiedDate", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.modifiedDate = :modifiedDate")
, @NamedQuery(name = "ExperimentPolicyPropertyValue.findByPolicyPropertyValue", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.policyPropertyValue = :policyPropertyValue")})
public class ExperimentPolicyPropertyValue extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
@Column(name = "modified_by")
private String modifiedBy;
@Basic(optional = false)
@NotNull
@Column(name = "modified_date")
@Temporal(TemporalType.DATE)
private Date modifiedDate;
@Size(max = 2147483647)
@Column(name = "policy_property_value")
private String policyPropertyValue;
@JoinColumn(name = "experiment_policy_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private ExperimentPolicy experimentPolicyId;
@JoinColumn(name = "policy_property_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyProperty policyPropertyId;
public ExperimentPolicyPropertyValue() {
}
public ExperimentPolicyPropertyValue(Integer id) {
this.id = id;
}
public ExperimentPolicyPropertyValue(Integer id, String modifiedBy, Date modifiedDate) {
this.id = id;
this.modifiedBy = modifiedBy;
this.modifiedDate = modifiedDate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
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 getPolicyPropertyValue() {
return policyPropertyValue;
}
public void setPolicyPropertyValue(String policyPropertyValue) {
this.policyPropertyValue = policyPropertyValue;
}
public ExperimentPolicy getExperimentPolicyId() {
return experimentPolicyId;
}
public void setExperimentPolicyId(ExperimentPolicy experimentPolicyId) {
this.experimentPolicyId = experimentPolicyId;
}
public PolicyProperty getPolicyPropertyId() {
return policyPropertyId;
}
public void setPolicyPropertyId(PolicyProperty policyPropertyId) {
this.policyPropertyId = policyPropertyId;
}
@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;
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.entities2.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.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_role_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ExperimentRoleType.findAll", query = "SELECT e FROM ExperimentRoleType e")
, @NamedQuery(name = "ExperimentRoleType.findById", query = "SELECT e FROM ExperimentRoleType e WHERE e.id = :id")
, @NamedQuery(name = "ExperimentRoleType.findByName", query = "SELECT e FROM ExperimentRoleType e WHERE e.name = :name")
, @NamedQuery(name = "ExperimentRoleType.findByDescription", query = "SELECT e FROM ExperimentRoleType e WHERE e.description = :description")
})
public class ExperimentRoleType extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Size(max = 2147483647)
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentRoleType")
private List<UserExperimentRole> userExperimentRoleList;
public ExperimentRoleType() {
}
public ExperimentRoleType(Integer id) {
this.id = id;
}
public ExperimentRoleType(Integer id, String name) {
this.id = id;
this.name = name;
}
@Override
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<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 ExperimentRoleType)) {
return false;
}
ExperimentRoleType other = (ExperimentRoleType) 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.entities2.ExperimentRoleType[ 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.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.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "experiment_station")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ExperimentStation.findAll", query = "SELECT e FROM ExperimentStation e")
, @NamedQuery(name = "ExperimentStation.findById", query = "SELECT e FROM ExperimentStation e WHERE e.id = :id")
, @NamedQuery(name = "ExperimentStation.findByName", query = "SELECT e FROM ExperimentStation e WHERE e.name = :name")
, @NamedQuery(name = "ExperimentStation.findByDescription", query = "SELECT e FROM ExperimentStation e WHERE e.description = :description")
})
public class ExperimentStation extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
private String name;
private String description;
@JoinTable(name = "allowed_experiment_station_experiment_type", joinColumns = {
@JoinColumn(name = "experiment_station_id", referencedColumnName = "id")}, inverseJoinColumns = {
@JoinColumn(name = "experiment_type_id", referencedColumnName = "id")})
@ManyToMany
private List<ExperimentType> experimentTypeList;
@OneToMany(mappedBy = "experimentStation")
private List<UserSystemRole> userSystemRoleList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentStation")
private List<Experiment> experimentList;
public ExperimentStation() {
}
public ExperimentStation(Integer id) {
this.id = id;
}
public ExperimentStation(Integer id, String name) {
this.id = id;
this.name = name;
}
@Override
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<ExperimentType> getExperimentTypeList() {
return experimentTypeList;
}
public void setExperimentTypeList(List<ExperimentType> experimentTypeList) {
this.experimentTypeList = experimentTypeList;
}
@XmlTransient
public List<UserSystemRole> getUserSystemRoleList() {
return userSystemRoleList;
}
public void setUserSystemRoleList(List<UserSystemRole> userSystemRoleList) {
this.userSystemRoleList = userSystemRoleList;
}
@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 ExperimentStation)) {
return false;
}
ExperimentStation other = (ExperimentStation) 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.entities2.ExperimentStation[ 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.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
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.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")})
public class ExperimentType extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
private String name;
private String description;
@ManyToMany(mappedBy = "experimentTypeList")
private List<ExperimentStation> experimentStationList;
@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;
}
@Override
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<ExperimentStation> getExperimentStationList() {
return experimentStationList;
}
public void setExperimentStationList(List<ExperimentStation> experimentStationList) {
this.experimentStationList = experimentStationList;
}
@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.entities2.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 sveseli
*/
@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.findByUnits", query = "SELECT p FROM PolicyProperty p WHERE p.units = :units")
, @NamedQuery(name = "PolicyProperty.findByLowerLimit", query = "SELECT p FROM PolicyProperty p WHERE p.lowerLimit = :lowerLimit")
, @NamedQuery(name = "PolicyProperty.findByUpperLimit", query = "SELECT p FROM PolicyProperty p WHERE p.upperLimit = :upperLimit")
, @NamedQuery(name = "PolicyProperty.findByDefaultValue", query = "SELECT p FROM PolicyProperty p WHERE p.defaultValue = :defaultValue")
, @NamedQuery(name = "PolicyProperty.findByDescription", query = "SELECT p FROM PolicyProperty p WHERE p.description = :description")})
public class PolicyProperty extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Size(max = 2147483647)
private String units;
@Size(max = 2147483647)
@Column(name = "lower_limit")
private String lowerLimit;
@Size(max = 2147483647)
@Column(name = "upper_limit")
private String upperLimit;
@Size(max = 2147483647)
@Column(name = "default_value")
private String defaultValue;
@Size(max = 2147483647)
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyPropertyId")
private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
@JoinColumn(name = "policy_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private PolicyType policyTypeId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyPropertyId")
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 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 String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlTransient
public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
return experimentPolicyPropertyValueList;
}
public void setExperimentPolicyPropertyValueList(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
}
public PolicyType getPolicyTypeId() {
return policyTypeId;
}
public void setPolicyTypeId(PolicyType policyTypeId) {
this.policyTypeId = policyTypeId;
}
@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;
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.entities2.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.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 DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Size(max = 2147483647)
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyTypeId")
private List<PolicyProperty> policyPropertyList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "policyTypeId")
private List<ExperimentPolicy> experimentPolicyList;
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<PolicyProperty> getPolicyPropertyList() {
return policyPropertyList;
}
public void setPolicyPropertyList(List<PolicyProperty> policyPropertyList) {
this.policyPropertyList = policyPropertyList;
}
@XmlTransient
public List<ExperimentPolicy> getExperimentPolicyList() {
return experimentPolicyList;
}
public void setExperimentPolicyList(List<ExperimentPolicy> experimentPolicyList) {
this.experimentPolicyList = experimentPolicyList;
}
@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;
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.entities2.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.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 DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Size(max = 2147483647)
private String description;
@Size(max = 2147483647)
@Column(name = "default_value")
private String defaultValue;
@Column(name = "is_user_modifiable")
private Boolean isUserModifiable;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settingTypeId")
private List<AllowedSettingValue> allowedSettingValueList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settingTypeId")
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;
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.entities2.SettingType[ 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.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Storage.findAll", query = "SELECT s FROM Storage s")
, @NamedQuery(name = "Storage.findById", query = "SELECT s FROM Storage s WHERE s.id = :id")
, @NamedQuery(name = "Storage.findByName", query = "SELECT s FROM Storage s WHERE s.name = :name")
, @NamedQuery(name = "Storage.findByDefaultScheme", query = "SELECT s FROM Storage s WHERE s.defaultScheme = :defaultScheme")
, @NamedQuery(name = "Storage.findByDescription", query = "SELECT s FROM Storage s WHERE s.description = :description")})
public class Storage extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
@Column(name = "default_scheme")
private String defaultScheme;
@Size(max = 2147483647)
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "storageId")
private List<DataFolder> dataFolderList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "storageId")
private List<Endpoint> endpointList;
public Storage() {
}
public Storage(Integer id) {
this.id = id;
}
public Storage(Integer id, String name, String defaultScheme) {
this.id = id;
this.name = name;
this.defaultScheme = defaultScheme;
}
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 getDefaultScheme() {
return defaultScheme;
}
public void setDefaultScheme(String defaultScheme) {
this.defaultScheme = defaultScheme;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlTransient
public List<DataFolder> getDataFolderList() {
return dataFolderList;
}
public void setDataFolderList(List<DataFolder> dataFolderList) {
this.dataFolderList = dataFolderList;
}
@XmlTransient
public List<Endpoint> getEndpointList() {
return endpointList;
}
public void setEndpointList(List<Endpoint> endpointList) {
this.endpointList = endpointList;
}
@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 Storage)) {
return false;
}
Storage other = (Storage) 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.entities2.Storage[ 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.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 = "system_role_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "SystemRoleType.findAll", query = "SELECT s FROM SystemRoleType s")
, @NamedQuery(name = "SystemRoleType.findById", query = "SELECT s FROM SystemRoleType s WHERE s.id = :id")
, @NamedQuery(name = "SystemRoleType.findByName", query = "SELECT s FROM SystemRoleType s WHERE s.name = :name")
, @NamedQuery(name = "SystemRoleType.findByDescription", query = "SELECT s FROM SystemRoleType s WHERE s.description = :description")
})
public class SystemRoleType extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 2147483647)
private String name;
@Size(max = 2147483647)
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "systemRoleType")
private List<UserSystemRole> userSystemRoleList;
public SystemRoleType() {
}
public SystemRoleType(Integer id) {
this.id = id;
}
public SystemRoleType(Integer id, String name) {
this.id = id;
this.name = name;
}
@Override
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<UserSystemRole> getUserSystemRoleList() {
return userSystemRoleList;
}
public void setUserSystemRoleList(List<UserSystemRole> userSystemRoleList) {
this.userSystemRoleList = userSystemRoleList;
}
@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 SystemRoleType)) {
return false;
}
SystemRoleType other = (SystemRoleType) 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.entities2.SystemRoleType[ 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.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "user_experiment_role")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "UserExperimentRole.findAll", query = "SELECT u FROM UserExperimentRole u")
, @NamedQuery(name = "UserExperimentRole.findByUser", query = "SELECT u FROM UserExperimentRole u WHERE u.userExperimentRolePK.userId = :userId")
, @NamedQuery(name = "UserExperimentRole.findByExperiment", query = "SELECT u FROM UserExperimentRole u WHERE u.userExperimentRolePK.experimentId = :experimentId")
, @NamedQuery(name = "UserExperimentRole.findByRoleType", query = "SELECT u FROM UserExperimentRole u WHERE u.userExperimentRolePK.roleTypeId = :roleTypeId")
, @NamedQuery(name = "UserExperimentRole.findByUserAndExperiment", query = "SELECT u FROM UserExperimentRole u WHERE u.userExperimentRolePK.userId = :userId AND u.userExperimentRolePK.experimentId = :experimentId")
, @NamedQuery(name = "UserExperimentRole.findByUserAndExperimentAndRoleType", query = "SELECT u FROM UserExperimentRole u WHERE u.userExperimentRolePK.userId = :userId AND u.userExperimentRolePK.experimentId = :experimentId AND u.userExperimentRolePK.roleTypeId = :roleTypeId")
})
public class UserExperimentRole extends DmEntity {
@EmbeddedId
protected UserExperimentRolePK userExperimentRolePK;
@JoinColumn(name = "experiment_id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne(optional = false)
private Experiment experiment;
@JoinColumn(name = "role_type_id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne(optional = false)
private ExperimentRoleType experimentRoleType;
@JoinColumn(name = "user_id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne(optional = false)
private UserInfo userInfo;
public UserExperimentRole() {
}
public UserExperimentRole(UserExperimentRolePK userExperimentRolePK) {
this.userExperimentRolePK = userExperimentRolePK;
}
public UserExperimentRole(int userId, int experimentId, int roleTypeId) {
this.userExperimentRolePK = new UserExperimentRolePK(userId, experimentId, roleTypeId);
}
public UserExperimentRolePK getUserExperimentRolePK() {
return userExperimentRolePK;
}
public void setUserExperimentRolePK(UserExperimentRolePK userExperimentRolePK) {
this.userExperimentRolePK = userExperimentRolePK;
}
public Experiment getExperiment() {
return experiment;
}
public void setExperiment(Experiment experiment) {
this.experiment = experiment;
}
public ExperimentRoleType getExperimentRoleType() {
return experimentRoleType;
}
public void setExperimentRoleType(ExperimentRoleType experimentRoleType) {
this.experimentRoleType = experimentRoleType;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (userExperimentRolePK != null ? userExperimentRolePK.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 UserExperimentRole)) {
return false;
}
UserExperimentRole other = (UserExperimentRole) object;
return !((this.userExperimentRolePK == null && other.userExperimentRolePK != null) || (this.userExperimentRolePK != null && !this.userExperimentRolePK.equals(other.userExperimentRolePK)));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities2.UserExperimentRole[ userExperimentRolePK=" + userExperimentRolePK + " ]";
}
}
/*
* 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.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
/**
*
* @author sveseli
*/
@Embeddable
public class UserExperimentRolePK implements Serializable {
@Basic(optional = false)
@NotNull
@Column(name = "user_id")
private int userId;
@Basic(optional = false)
@NotNull
@Column(name = "experiment_id")
private int experimentId;
@Basic(optional = false)
@NotNull
@Column(name = "role_type_id")
private int roleTypeId;
public UserExperimentRolePK() {
}
public UserExperimentRolePK(int userId, int experimentId, int roleTypeId) {
this.userId = userId;
this.experimentId = experimentId;
this.roleTypeId = roleTypeId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getExperimentId() {
return experimentId;
}
public void setExperimentId(int experimentId) {
this.experimentId = experimentId;
}
public int getRoleTypeId() {
return roleTypeId;
}
public void setRoleTypeId(int roleTypeId) {
this.roleTypeId = roleTypeId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) userId;
hash += (int) experimentId;
hash += (int) roleTypeId;
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 UserExperimentRolePK)) {
return false;
}
UserExperimentRolePK other = (UserExperimentRolePK) object;
if (this.userId != other.userId) {
return false;
}
if (this.experimentId != other.experimentId) {
return false;
}
return this.roleTypeId == other.roleTypeId;
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities2.UserExperimentRolePK[ userId=" + userId + ", experimentId=" + experimentId + ", roleTypeId=" + roleTypeId + " ]";
}
}
/*
* 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.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.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "user_info")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "UserInfo.findAll", query = "SELECT u FROM UserInfo u")
, @NamedQuery(name = "UserInfo.findById", query = "SELECT u FROM UserInfo u WHERE u.id = :id")
, @NamedQuery(name = "UserInfo.findByUsername", query = "SELECT u FROM UserInfo u WHERE u.username = :username")
, @NamedQuery(name = "UserInfo.findByFirstName", query = "SELECT u FROM UserInfo u WHERE u.firstName = :firstName")
, @NamedQuery(name = "UserInfo.findByLastName", query = "SELECT u FROM UserInfo u WHERE u.lastName = :lastName")
, @NamedQuery(name = "UserInfo.findByMiddleName", query = "SELECT u FROM UserInfo u WHERE u.middleName = :middleName")
, @NamedQuery(name = "UserInfo.findByEmail", query = "SELECT u FROM UserInfo u WHERE u.email = :email")
, @NamedQuery(name = "UserInfo.findByBadge", query = "SELECT u FROM UserInfo u WHERE u.badge = :badge")
, @NamedQuery(name = "UserInfo.findByGlobusUsername", query = "SELECT u FROM UserInfo u WHERE u.globusUsername = :globusUsername")
, @NamedQuery(name = "UserInfo.findByDescription", query = "SELECT u FROM UserInfo u WHERE u.description = :description")
, @NamedQuery(name = "UserInfo.findByPassword", query = "SELECT u FROM UserInfo u WHERE u.password = :password")
, @NamedQuery(name = "UserInfo.findByIsLocalUser", query = "SELECT u FROM UserInfo u WHERE u.isLocalUser = :isLocalUser")
, @NamedQuery(name = "UserInfo.findByLastUpdate", query = "SELECT u FROM UserInfo u WHERE u.lastUpdate = :lastUpdate")
})
public class UserInfo extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Basic(optional = false)
@NotNull
private String username;
@Basic(optional = false)
@NotNull
@Column(name = "first_name")
private String firstName;
@Basic(optional = false)
@NotNull
@Column(name = "last_name")
private String lastName;
@Column(name = "middle_name")
private String middleName;
// @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
private String email;
private String badge;
@Column(name = "globus_username")
private String globusUsername;
private String description;
private String password;
@Basic(optional = false)
@NotNull
@Column(name = "is_local_user")
private boolean isLocalUser;
@Column(name = "last_update")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userInfo")
private List<UserExperimentRole> userExperimentRoleList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userInfo")
private List<UserSystemRole> userSystemRoleList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userId")
private List<UserSetting> userSettingList;
public UserInfo() {
}
public UserInfo(Integer id) {
this.id = id;
}
public UserInfo(Integer id, String username, String firstName, String lastName, boolean isLocalUser) {
this.id = id;
this.username = username;
this.firstName = firstName;
this.lastName = lastName;
this.isLocalUser = isLocalUser;
}
@Override
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getMiddleName() {
return middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getBadge() {
return badge;
}
public void setBadge(String badge) {
this.badge = badge;
}
public String getGlobusUsername() {
return globusUsername;
}
public void setGlobusUsername(String globusUsername) {
this.globusUsername = globusUsername;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean getIsLocalUser() {
return isLocalUser;
}
public void setIsLocalUser(boolean isLocalUser) {
this.isLocalUser = isLocalUser;
}
public boolean isLocalUser() {
return isLocalUser;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
@XmlTransient
public List<UserExperimentRole> getUserExperimentRoleList() {
return userExperimentRoleList;
}
public void setUserExperimentRoleList(List<UserExperimentRole> userExperimentRoleList) {
this.userExperimentRoleList = userExperimentRoleList;
}
@XmlTransient
public List<UserSystemRole> getUserSystemRoleList() {
return userSystemRoleList;
}
public void setUserSystemRoleList(List<UserSystemRole> userSystemRoleList) {
this.userSystemRoleList = userSystemRoleList;
}
@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 UserInfo)) {
return false;
}
UserInfo other = (UserInfo) 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.entities2.UserInfo[ 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 = "user_setting")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "UserSetting.findAll", query = "SELECT u FROM UserSetting u")
, @NamedQuery(name = "UserSetting.findById", query = "SELECT u FROM UserSetting u WHERE u.id = :id")
, @NamedQuery(name = "UserSetting.findBySettingValue", query = "SELECT u FROM UserSetting u WHERE u.settingValue = :settingValue")})
public class UserSetting extends DmEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer id;
@Size(max = 2147483647)
@Column(name = "setting_value")
private String settingValue;
@JoinColumn(name = "setting_type_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private SettingType settingTypeId;
@JoinColumn(name = "user_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private UserInfo userId;
public UserSetting() {
}
public UserSetting(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 SettingType getSettingTypeId() {
return settingTypeId;
}
public void setSettingTypeId(SettingType settingTypeId) {
this.settingTypeId = settingTypeId;
}
public UserInfo getUserId() {
return userId;
}
public void setUserId(UserInfo userId) {
this.userId = userId;
}
@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 UserSetting)) {
return false;
}
UserSetting other = (UserSetting) 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.entities2.UserSetting[ 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.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "user_system_role")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "UserSystemRole.findAll", query = "SELECT u FROM UserSystemRole u")
, @NamedQuery(name = "UserSystemRole.findByUser", query = "SELECT u FROM UserSystemRole u WHERE u.userSystemRolePK.userId = :userId")
, @NamedQuery(name = "UserSystemRole.findByRoleType", query = "SELECT u FROM UserSystemRole u WHERE u.userSystemRolePK.roleTypeId = :roleTypeId")
, @NamedQuery(name = "UserSystemRole.findByUserAndRoleTypeAndExperimentStation", query = "SELECT u FROM UserSystemRole u WHERE u.userSystemRolePK.userId = :userId AND u.userSystemRolePK.roleTypeId = :roleTypeId AND u.experimentStation.id = :experimentStationId")
})
public class UserSystemRole extends DmEntity {
@EmbeddedId
protected UserSystemRolePK userSystemRolePK;
@JoinColumn(name = "experiment_station_id", referencedColumnName = "id")
@ManyToOne
private ExperimentStation experimentStation;
@JoinColumn(name = "role_type_id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne(optional = false)
private SystemRoleType systemRoleType;
@JoinColumn(name = "user_id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne(optional = false)
private UserInfo userInfo;
public UserSystemRole() {
}
public UserSystemRole(UserSystemRolePK userSystemRolePK) {
this.userSystemRolePK = userSystemRolePK;
}
public UserSystemRole(int userId, int roleTypeId) {
this.userSystemRolePK = new UserSystemRolePK(userId, roleTypeId);
}
public UserSystemRolePK getUserSystemRolePK() {
return userSystemRolePK;
}
public void setUserSystemRolePK(UserSystemRolePK userSystemRolePK) {
this.userSystemRolePK = userSystemRolePK;
}
public ExperimentStation getExperimentStation() {
return experimentStation;
}
public void setExperimentStation(ExperimentStation experimentStation) {
this.experimentStation = experimentStation;
}
public SystemRoleType getSystemRoleType() {
return systemRoleType;
}
public void setSystemRoleType(SystemRoleType systemRoleType) {
this.systemRoleType = systemRoleType;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (userSystemRolePK != null ? userSystemRolePK.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 UserSystemRole)) {
return false;
}
UserSystemRole other = (UserSystemRole) object;
return !((this.userSystemRolePK == null && other.userSystemRolePK != null) || (this.userSystemRolePK != null && !this.userSystemRolePK.equals(other.userSystemRolePK)));
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities2.UserSystemRole[ userSystemRolePK=" + userSystemRolePK + " ]";
}
}
/*
* 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.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
/**
*
* @author sveseli
*/
@Embeddable
public class UserSystemRolePK implements Serializable {
@Basic(optional = false)
@NotNull
@Column(name = "user_id")
private int userId;
@Basic(optional = false)
@NotNull
@Column(name = "role_type_id")
private int roleTypeId;
public UserSystemRolePK() {
}
public UserSystemRolePK(int userId, int roleTypeId) {
this.userId = userId;
this.roleTypeId = roleTypeId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getRoleTypeId() {
return roleTypeId;
}
public void setRoleTypeId(int roleTypeId) {
this.roleTypeId = roleTypeId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) userId;
hash += (int) roleTypeId;
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 UserSystemRolePK)) {
return false;
}
UserSystemRolePK other = (UserSystemRolePK) object;
if (this.userId != other.userId) {
return false;
}
return this.roleTypeId == other.roleTypeId;
}
@Override
public String toString() {
return "gov.anl.aps.dm.portal.model.entities2.UserSystemRolePK[ userId=" + userId + ", roleTypeId=" + roleTypeId + " ]";
}
}
/*
* 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.Id;
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.xml.bind.annotation.XmlRootElement;
/**
*
* @author sveseli
*/
@Entity
@Table(name = "users_last_update")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "UsersLastUpdate.findAll", query = "SELECT u FROM UsersLastUpdate u")
, @NamedQuery(name = "UsersLastUpdate.findById", query = "SELECT u FROM UsersLastUpdate u WHERE u.id = :id")
, @NamedQuery(name = "UsersLastUpdate.findByLastUpdate", query = "SELECT u FROM UsersLastUpdate u WHERE u.lastUpdate = :lastUpdate")})
public class UsersLastUpdate extends DmEntity {
@Id
@Basic(optional = false)
@NotNull
private Integer id;
@Column(name = "last_update")
@Temporal(TemporalType.DATE)
private Date lastUpdate;
public UsersLastUpdate() {
}
public UsersLastUpdate(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
@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 UsersLastUpdate)) {
return false;
}
UsersLastUpdate other = (UsersLastUpdate) 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.entities2.UsersLastUpdate[ 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.utilities;
import gov.anl.aps.dm.portal.model.entities.Experiment;
import gov.anl.aps.dm.portal.model.entities.ExperimentStation;
import gov.anl.aps.dm.portal.model.entities.UserInfo;
import gov.anl.aps.dm.portal.model.entities.UserSystemRole;
/**
*
* @author sveseli
*/
public class AuthorizationUtility {
public static final int ADMINISTRATOR_SYSTEM_ROLE_ID = 1;
public static final int MANAGER_SYSTEM_ROLE_ID = 2;
public static final int PI_EXPERIMENT_ROLE_ID = 1;
public static final int USER_EXPERIMENT_ROLE_ID = 2;
public static boolean isAdministrator(UserInfo user) {
return user.getUserSystemRoleList().stream().anyMatch((userSystemRole) -> (userSystemRole.getSystemRoleType().getId() == ADMINISTRATOR_SYSTEM_ROLE_ID));
}
public static boolean isStationManager(UserInfo user, ExperimentStation experimentStation) {
return user.getUserSystemRoleList().stream().anyMatch((userSystemRole) -> (userSystemRole.getSystemRoleType().getId() == MANAGER_SYSTEM_ROLE_ID
&& userSystemRole.getExperimentStation().getId().equals(experimentStation.getId())));
}
public static boolean isExperimentPi(UserInfo user, Experiment experiment) {
return user.getUserExperimentRoleList().stream().anyMatch((userExperimentRole) -> (userExperimentRole.getExperimentRoleType().getId() == PI_EXPERIMENT_ROLE_ID
&& userExperimentRole.getExperiment().getId().equals(experiment.getId())));
}
public static boolean isExperimentUser(UserInfo user, Experiment experiment) {
return user.getUserExperimentRoleList().stream().anyMatch((userExperimentRole) -> (userExperimentRole.getExperimentRoleType().getId() == USER_EXPERIMENT_ROLE_ID
&& userExperimentRole.getExperiment().getId().equals(experiment.getId())));
}
public static boolean canManageStation(UserInfo user, ExperimentStation experimentStation) {
return isAdministrator(user) || isStationManager(user, experimentStation);
}
public static boolean canManageExperiment(UserInfo user, Experiment experiment) {
return canManageStation(user, experiment.getExperimentStation()) || isExperimentPi(user, experiment);
}
public static boolean canCreateExperiment(UserInfo user) {
return !user.getUserSystemRoleList().isEmpty();
}
}
package gov.anl.aps.dm.portal.utilities;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.log4j.Logger;
public class ConfigurationUtility {
public static final String PropertiesPath = "dm.portal.properties";
public static final String PropertiesDelimiter = ",";
private static final Logger logger = Logger.getLogger(ConfigurationUtility.class.getName());
private static final Properties portalProperties = loadProperties(PropertiesPath);
public Properties getPortalProperties() {
return portalProperties;
}
public static String getPortalProperty(String propertyName) {
return portalProperties.getProperty(propertyName, "");
}
public static String getPortalProperty(String propertyName, String defaultValue) {
return portalProperties.getProperty(propertyName, defaultValue);
}
public static List<String> getPortalPropertyList(String propertyName) {
return getPortalPropertyList(propertyName, "");
}
public static List<String> getPortalPropertyList(String propertyName, String defaultValue) {
String[] propertyArray = portalProperties.getProperty(propertyName, defaultValue).split(PropertiesDelimiter);
logger.debug("Looking for property " + propertyName);
ArrayList propertyList = new ArrayList();
for (String property : propertyArray) {
String p = property.trim();
if (p.length() > 0) {
propertyList.add(property.trim());
}
}
logger.debug("Resulting property list: " + propertyList);
return propertyList;
}
/**
* Load properties.
*
* @param path
* @return loaded properties
*/
public static Properties loadProperties(String path) {
Properties properties = new Properties();
if (path != null) {
try {
logger.debug("Loading properties from " + path);
InputStream inputStream = ConfigurationUtility.class.getClassLoader().getResourceAsStream(path);
properties.load(inputStream);
} catch (IOException ex) {
logger.warn("Could not load properties from file " + path + ": " + ex);
}
} else {
logger.warn("Properties path not specified.");
}
return properties;
}
/**
* Get system property.
*
* @param propertyName property name
* @return property value
*/
public static String getSystemProperty(String propertyName) {
Properties p = System.getProperties();
return p.getProperty(propertyName);
}
/**
* Get system property.
*
* @param propertyName property name
* @param defaultValue default property value
* @return property value
*/
public static String getSystemProperty(String propertyName, String defaultValue) {
Properties p = System.getProperties();
return p.getProperty(propertyName, defaultValue);
}
/**
* Get environment variable.
*
* @param name Environment variable name
* @return environment variable value, or null if it is not defined
*/
public static String getEnvVar(String name) {
return System.getenv(name);
}
}
package gov.anl.aps.dm.portal.utilities;
import gov.anl.aps.dm.api.ExperimentDsApi;
import gov.anl.aps.dm.common.constants.DmProperty;
import gov.anl.aps.dm.common.exceptions.ConfigurationError;
import gov.anl.aps.dm.common.exceptions.DmException;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.apache.log4j.Logger;
public class DmApiFactory {
private static final Logger logger = Logger.getLogger(DmApiFactory.class.getName());
public static ExperimentDsApi getExperimentDsApi() throws DmException {
String webServiceUrl = ConfigurationUtility.getPortalProperty(DmProperty.DS_WEB_SERVICE_URL_PROPERTY_NAME);
String loginUsername = ConfigurationUtility.getPortalProperty(DmProperty.SYSTEM_USER_PROPERTY_NAME);
String loginPasswordFileName = ConfigurationUtility.getPortalProperty(DmProperty.SYSTEM_PASSWORD_FILE_PROPERTY_NAME);
try {
String loginPassword = new Scanner(new File(loginPasswordFileName)).useDelimiter("\\Z").next();
return new ExperimentDsApi(webServiceUrl, loginUsername, loginPassword);
} catch (FileNotFoundException ex) {
logger.error("Cannot find system password file: " + loginPasswordFileName);
throw new ConfigurationError(ex);
}
}
}