]> SALOME platform Git repositories - modules/gde.git/blob - projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/ProfileAttribute.java
Salome HOME
- Code refactoring and simplification
[modules/gde.git] / projects / GDE_App / GDE-ejb / src / java / com / edf / gde / entities / ProfileAttribute.java
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 package com.edf.gde.entities;
7
8 import java.io.Serializable;
9 import java.util.Objects;
10 import javax.persistence.Basic;
11 import javax.persistence.Column;
12 import javax.persistence.Entity;
13 import javax.persistence.GeneratedValue;
14 import javax.persistence.GenerationType;
15 import javax.persistence.Id;
16 import javax.persistence.JoinColumn;
17 import javax.persistence.ManyToOne;
18 import javax.persistence.NamedQueries;
19 import javax.persistence.NamedQuery;
20 import javax.persistence.SequenceGenerator;
21 import javax.persistence.Table;
22 import javax.validation.constraints.NotNull;
23 import javax.validation.constraints.Size;
24 import javax.xml.bind.annotation.XmlRootElement;
25
26 /**
27  *
28  * @author F62173
29  */
30 @Entity
31 @Table(name = "profile_attribute")
32 @XmlRootElement
33 @NamedQueries({
34     @NamedQuery(name = "ProfileAttribute.findAll", query = "SELECT p FROM ProfileAttribute p"),
35     @NamedQuery(name = "ProfileAttribute.findById", query = "SELECT p FROM ProfileAttribute p WHERE p.id = :id"),
36     @NamedQuery(name = "ProfileAttribute.findByName", query = "SELECT p FROM ProfileAttribute p WHERE p.name = :name"),
37     @NamedQuery(name = "ProfileAttribute.findByType", query = "SELECT p FROM ProfileAttribute p WHERE p.type = :type"),
38     //@NamedQuery(name = "ProfileAttribute.findByMandatory", query = "SELECT p FROM ProfileAttribute p WHERE p.mandatory = :mandatory")
39 })
40 public class ProfileAttribute implements Serializable {
41     private static final long serialVersionUID = 1L;
42     @Id
43     @Basic(optional = false)
44     @NotNull
45     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN_SEQUENCE")
46     @SequenceGenerator(name = "SEQ_GEN_SEQUENCE", allocationSize = 50)
47     @Column(name = "id")
48     private Long id;
49     @Size(max = 255)
50     @Column(name = "name")
51     private String name;
52     @Size(max = 255)
53     @Column(name = "type")
54     private String type;
55     @Column(name = "mandatory")
56     private Boolean mandatory;
57     @JoinColumn(name = "profile_id", referencedColumnName = "id", nullable = false)
58     @ManyToOne
59     private Profile profileId;
60
61     public ProfileAttribute() {
62     }
63
64     public ProfileAttribute(Long id) {
65         this.id = id;
66     }
67
68     public Long getId() {
69         return id;
70     }
71
72     public void setId(Long id) {
73         this.id = id;
74     }
75
76     public String getName() {
77         return name;
78     }
79
80     public void setName(String name) {
81         this.name = name;
82     }
83
84     public String getType() {
85         return type;
86     }
87
88     public void setType(String type) {
89         this.type = type;
90     }
91
92     public Boolean getMandatory() {
93         return mandatory;
94     }
95
96     public void setMandatory(Boolean mandatory) {
97         this.mandatory = mandatory;
98     }
99
100     public Profile getProfileId() {
101         return profileId;
102     }
103
104     public void setProfileId(Profile profileId) {
105         this.profileId = profileId;
106     }
107
108     @Override
109     public String toString() {
110         return "com.edf.gde.entities.ProfileAttribute[ id=" + id + " ]";
111     }
112
113     @Override
114     public int hashCode() {
115         int hash = 5;
116         hash = 71 * hash + Objects.hashCode(this.id);
117         hash = 71 * hash + Objects.hashCode(this.name);
118         hash = 71 * hash + Objects.hashCode(this.type);
119         hash = 71 * hash + Objects.hashCode(this.mandatory);
120         hash = 71 * hash + Objects.hashCode(this.profileId);
121         return hash;
122     }
123
124     @Override
125     public boolean equals(Object obj) {
126         if (obj == null) {
127             return false;
128         }
129         if (getClass() != obj.getClass()) {
130             return false;
131         }
132         final ProfileAttribute other = (ProfileAttribute) obj;
133         if (!Objects.equals(this.id, other.id)) {
134             return false;
135         }
136         return true;
137     }
138     
139 }