Project

General

Profile

1 44995 panagiotis
package eu.dnetlib.goldoa.domain;
2
3 46303 panagiotis
import com.fasterxml.jackson.annotation.JsonBackReference;
4
import com.fasterxml.jackson.annotation.JsonManagedReference;
5
6 44995 panagiotis
import java.io.Serializable;
7
import java.util.ArrayList;
8
import java.util.List;
9
10
import javax.persistence.*;
11
12
13
@Entity
14 45777 panagiotis
@Table(name="\"user\"")
15 44995 panagiotis
public class User implements Serializable{
16
	private static final long serialVersionUID = 1L;
17
18
	@Id
19 46138 panagiotis
	@Column(columnDefinition = "text",unique = true, nullable = false)
20 44995 panagiotis
	private String email;
21 46138 panagiotis
	@Column(columnDefinition = "text")
22 44995 panagiotis
	private String firstname;
23 46138 panagiotis
	@Column(columnDefinition = "text")
24 44995 panagiotis
	private String lastname;
25 46138 panagiotis
	@Column(columnDefinition = "text")
26 45963 panagiotis
	private String initials;
27 46138 panagiotis
	@Column(columnDefinition = "text")
28 44995 panagiotis
	private String telephone;
29
	@Column(columnDefinition = "boolean default false")
30
	private boolean active;
31 46138 panagiotis
	@Column(columnDefinition = "text")
32 44995 panagiotis
	private String source;
33 46138 panagiotis
	@Column(columnDefinition = "text")
34 44995 panagiotis
	private String password;
35 46138 panagiotis
	@Column(columnDefinition = "text")
36 44995 panagiotis
	private String orcidid;
37 46138 panagiotis
	@Column(columnDefinition = "text")
38 44995 panagiotis
	private String id;
39 45438 panagiotis
40 45978 panagiotis
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 46303 panagiotis
	//@JsonManagedReference
48 45978 panagiotis
	private List<Affiliation> affiliations = new ArrayList<>();
49
50 45963 panagiotis
	@OneToOne(mappedBy="contact")
51
	private Publisher publisher;
52
53 45403 panagiotis
	@OneToMany(mappedBy = "pk.user", cascade=CascadeType.ALL)
54 46303 panagiotis
	//@JsonBackReference
55 45403 panagiotis
	private List<UserRole> roles = new ArrayList<>();
56 45489 panagiotis
57
	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "coordinators")
58
	private List<Project> coordinatedProjects = new ArrayList<>();
59 44995 panagiotis
60
	@OneToMany(mappedBy = "user",cascade=CascadeType.ALL)
61
	private List<RequestComment> requestComment = new ArrayList<>();
62
63 45403 panagiotis
	public List<UserRole> getRoles() {
64 45131 panagiotis
		return roles;
65 44995 panagiotis
	}
66
67 45403 panagiotis
	public void setRole(List<UserRole> roles) {
68
		this.roles = roles;
69 44995 panagiotis
	}
70
71 45403 panagiotis
	public void addUserRole(UserRole ur) {
72
		this.roles.add(ur);
73 44995 panagiotis
	}
74 45438 panagiotis
75 45403 panagiotis
	public void removeUserRole(UserRole ur) {
76
		this.roles.remove(ur);
77 44995 panagiotis
	}
78
79 45438 panagiotis
	public void addUserAffiliation(Affiliation af){
80
		this.affiliations.add(af);
81
	}
82
83
	public void removeUserAffiliation(Affiliation af){
84
		this.affiliations.remove(af);
85
	}
86
87 44995 panagiotis
	public User() {}
88 45561 panagiotis
89 44995 panagiotis
	public String getEmail() {
90
		return email;
91
	}
92
93
	public void setEmail(String email) {
94
		this.email = email;
95
	}
96
97
	public String getFirstname() {
98
		return firstname;
99
	}
100
101
	public void setFirstname(String firstname) {
102
		this.firstname = firstname;
103
	}
104
105
	public String getLastname() {
106
		return lastname;
107
	}
108
109
	public void setLastname(String lastname) {
110
		this.lastname = lastname;
111
	}
112
113 45963 panagiotis
	public String getInitials() {
114
		return initials;
115 44995 panagiotis
	}
116
117 45963 panagiotis
	public void setInitials(String initials) {
118
		this.initials = initials;
119 44995 panagiotis
	}
120
121
	public String getTelephone() {
122
		return telephone;
123
	}
124
125
	public void setTelephone(String telephone) {
126
		this.telephone = telephone;
127
	}
128
129
	public boolean isActive() {
130
		return active;
131
	}
132
133
	public void setActive(boolean active) {
134
		this.active = active;
135
	}
136
137
	public String getSource() {
138
		return source;
139
	}
140
141
	public void setSource(String source) {
142
		this.source = source;
143
	}
144
145
	public String getPassword() {
146
		return password;
147
	}
148
149
	public void setPassword(String password) {
150
		this.password = password;
151
	}
152
153
	public String getOrcidid() {
154
		return orcidid;
155
	}
156
157
	public void setOrcidid(String orcidid) {
158
		this.orcidid = orcidid;
159
	}
160
161
	public String getId() {
162
		return id;
163
	}
164
165
	public void setId(String id) {
166
		this.id = id;
167
	}
168
169 45963 panagiotis
	public Publisher getPublisher() {
170 44995 panagiotis
		return publisher;
171
	}
172
173 45040 panagiotis
	public void setPublisher(Publisher publisher) {
174 44995 panagiotis
		this.publisher = publisher;
175 45963 panagiotis
	}
176 45026 panagiotis
177
	public List<Affiliation> getAffiliations() {
178
		return affiliations;
179
	}
180
181
	public void setAffiliations(List<Affiliation> affiliations) {
182
		this.affiliations = affiliations;
183
	}
184
185 45489 panagiotis
	public List<Project> getCoordinatedProjects() {
186
		return coordinatedProjects;
187 45026 panagiotis
	}
188
189 45489 panagiotis
	public void setCoordinatedProjects(List<Project> coordinatedProjects) {
190
		this.coordinatedProjects = coordinatedProjects;
191 45026 panagiotis
	}
192
193
	public List<RequestComment> getRequestComment() {
194
		return requestComment;
195
	}
196
197
	public void setRequestComment(List<RequestComment> requestComment) {
198
		this.requestComment = requestComment;
199
	}
200 45978 panagiotis
201
202 44995 panagiotis
}