]> SALOME platform Git repositories - modules/gde.git/blob - projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/Profile.java
Salome HOME
(no commit message)
[modules/gde.git] / projects / GDE_App / GDE-ejb / src / java / com / edf / gde / entities / Profile.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.Collection;
10 import java.util.Objects;
11 import javax.persistence.Basic;
12 import javax.persistence.Column;
13 import javax.persistence.Entity;
14 import javax.persistence.GeneratedValue;
15 import javax.persistence.GenerationType;
16 import javax.persistence.Id;
17 import javax.persistence.NamedQueries;
18 import javax.persistence.NamedQuery;
19 import javax.persistence.OneToMany;
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 import javax.xml.bind.annotation.XmlTransient;
26
27 /**
28  *
29  * @author F62173
30  */
31 @Entity
32 @Table(name = "profile")
33 @XmlRootElement
34 @NamedQueries({
35     @NamedQuery(name = "Profile.findAll", query = "SELECT p FROM Profile p"),
36     @NamedQuery(name = "Profile.findById", query = "SELECT p FROM Profile p WHERE p.id = :id"),
37     @NamedQuery(name = "Profile.findByName", query = "SELECT p FROM Profile p WHERE p.name = :name")
38 })
39 public class Profile implements Serializable {
40     private static final long serialVersionUID = 1L;
41     @Id
42     @Basic(optional = false)
43     @NotNull
44     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN_SEQUENCE")
45     @SequenceGenerator(name = "SEQ_GEN_SEQUENCE", allocationSize = 50)
46     @Column(name = "id")
47     private Long id;
48     @Size(max = 255)
49     @Column(name = "name")
50     private String name;
51     @OneToMany(mappedBy = "profileId")
52     private Collection<ProfileAttribute> profileAttributeCollection;
53
54     public Profile() {
55     }
56
57     public Profile(Long id) {
58         this.id = id;
59     }
60
61     public Long getId() {
62         return id;
63     }
64
65     public void setId(Long id) {
66         this.id = id;
67     }
68
69     public String getName() {
70         return name;
71     }
72
73     public void setName(String name) {
74         this.name = name;
75     }
76
77     @XmlTransient
78     public Collection<ProfileAttribute> getProfileAttributeCollection() {
79         return profileAttributeCollection;
80     }
81
82     public void setProfileAttributeCollection(Collection<ProfileAttribute> profileAttributeCollection) {
83         this.profileAttributeCollection = profileAttributeCollection;
84     }
85
86     @Override
87     public String toString() {
88         return "com.edf.gde.entities.Profile[ id=" + id + " ]";
89     }
90
91     @Override
92     public int hashCode() {
93         int hash = 3;
94         hash = 83 * hash + Objects.hashCode(this.id);
95         hash = 83 * hash + Objects.hashCode(this.name);
96         hash = 83 * hash + Objects.hashCode(this.profileAttributeCollection);
97         return hash;
98     }
99
100     @Override
101     public boolean equals(Object obj) {
102         if (obj == null) {
103             return false;
104         }
105         if (getClass() != obj.getClass()) {
106             return false;
107         }
108         final Profile other = (Profile) obj;
109         if (!Objects.equals(this.id, other.id)) {
110             return false;
111         }
112         return true;
113     }
114     
115 }