Project

General

Profile

1
package eu.dnetlib.goldoa.domain;
2

    
3
import com.fasterxml.jackson.annotation.JsonBackReference;
4
import com.fasterxml.jackson.annotation.JsonManagedReference;
5

    
6
import java.io.Serializable;
7
import java.util.ArrayList;
8
import java.util.List;
9

    
10
import javax.persistence.*;
11

    
12

    
13
@Entity
14
@Table(name="\"user\"")
15
public class User implements Serializable{
16
	private static final long serialVersionUID = 1L;
17

    
18
	@Id
19
	@Column(columnDefinition = "text",unique = true, nullable = false)
20
	private String email;
21
	@Column(columnDefinition = "text")
22
	private String firstname;
23
	@Column(columnDefinition = "text")
24
	private String lastname;
25
	@Column(columnDefinition = "text")
26
	private String initials;
27
	@Column(columnDefinition = "text")
28
	private String telephone;
29
	@Column(columnDefinition = "boolean default false")
30
	private boolean active;
31
	@Column(columnDefinition = "text")
32
	private String source;
33
	@Column(columnDefinition = "text")
34
	private String password;
35
	@Column(columnDefinition = "text")
36
	private String orcidid;
37
	@Column(columnDefinition = "text")
38
	private String id;
39

    
40

    
41
	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
42
	@JoinTable(name = "user_affiliation",  joinColumns = {
43
			@JoinColumn(name = "\"user\"", nullable = false, updatable = false),
44
			},
45
			inverseJoinColumns = { @JoinColumn(name = "affiliation",
46
					nullable = false, updatable = false) })
47
	private List<Affiliation> affiliations = new ArrayList<>();
48

    
49
	@OneToOne(mappedBy="contact")
50
	private Publisher publisher;
51

    
52
	@OneToMany(mappedBy = "pk.user", cascade=CascadeType.ALL)
53
	private List<UserRole> roles = new ArrayList<>();
54

    
55
	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "coordinators")
56
	private List<Project> coordinatedProjects = new ArrayList<>();
57
	
58
	@OneToMany(mappedBy = "user",cascade=CascadeType.ALL)
59
	private List<RequestComment> requestComment = new ArrayList<>();
60

    
61
	public List<UserRole> getRoles() {
62
		return roles;
63
	}
64

    
65
	public void setRole(List<UserRole> roles) {
66
		this.roles = roles;
67
	}
68

    
69
	public void addUserRole(UserRole ur) {
70
		this.roles.add(ur);
71
	}
72

    
73
	public void removeUserRole(UserRole ur) {
74
		this.roles.remove(ur);
75
	}
76

    
77
	public void addUserAffiliation(Affiliation af){
78
		this.affiliations.add(af);
79
	}
80

    
81
	public void removeUserAffiliation(Affiliation af){
82
		this.affiliations.remove(af);
83
	}
84

    
85
	public User() {}
86

    
87
	public String getEmail() {
88
		return email;
89
	}
90

    
91
	public void setEmail(String email) {
92
		this.email = email;
93
	}
94

    
95
	public String getFirstname() {
96
		return firstname;
97
	}
98

    
99
	public void setFirstname(String firstname) {
100
		this.firstname = firstname;
101
	}
102

    
103
	public String getLastname() {
104
		return lastname;
105
	}
106

    
107
	public void setLastname(String lastname) {
108
		this.lastname = lastname;
109
	}
110

    
111
	public String getInitials() {
112
		return initials;
113
	}
114

    
115
	public void setInitials(String initials) {
116
		this.initials = initials;
117
	}
118

    
119
	public String getTelephone() {
120
		return telephone;
121
	}
122

    
123
	public void setTelephone(String telephone) {
124
		this.telephone = telephone;
125
	}
126

    
127
	public boolean isActive() {
128
		return active;
129
	}
130

    
131
	public void setActive(boolean active) {
132
		this.active = active;
133
	}
134

    
135
	public String getSource() {
136
		return source;
137
	}
138

    
139
	public void setSource(String source) {
140
		this.source = source;
141
	}
142

    
143
	public String getPassword() {
144
		return password;
145
	}
146

    
147
	public void setPassword(String password) {
148
		this.password = password;
149
	}
150

    
151
	public String getOrcidid() {
152
		return orcidid;
153
	}
154

    
155
	public void setOrcidid(String orcidid) {
156
		this.orcidid = orcidid;
157
	}
158

    
159
	public String getId() {
160
		return id;
161
	}
162

    
163
	public void setId(String id) {
164
		this.id = id;
165
	}
166

    
167
	public Publisher getPublisher() {
168
		return publisher;
169
	}
170

    
171
	public void setPublisher(Publisher publisher) {
172
		this.publisher = publisher;
173
	}
174

    
175
	public List<Affiliation> getAffiliations() {
176
		return affiliations;
177
	}
178

    
179
	public void setAffiliations(List<Affiliation> affiliations) {
180
		this.affiliations = affiliations;
181
	}
182

    
183
	public List<Project> getCoordinatedProjects() {
184
		return coordinatedProjects;
185
	}
186

    
187
	public void setCoordinatedProjects(List<Project> coordinatedProjects) {
188
		this.coordinatedProjects = coordinatedProjects;
189
	}
190

    
191
	public List<RequestComment> getRequestComment() {
192
		return requestComment;
193
	}
194

    
195
	public void setRequestComment(List<RequestComment> requestComment) {
196
		this.requestComment = requestComment;
197
	}
198

    
199
}
(51-51/54)