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
	@ManyToOne(cascade=CascadeType.ALL)
50
	@JoinColumn(name = "publisher")
51
	private Publisher publisher;
52

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

    
56
	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
57
	@JoinTable(name = "project_coordinator",  joinColumns = {
58
			@JoinColumn(name ="\"user\"", nullable = false, updatable = false)},
59
			inverseJoinColumns = {@JoinColumn(name = "project",
60
					nullable = false, updatable = false) })
61
	private List<Project> coordinatedProjects = new ArrayList<>();
62

    
63
	public List<UserRole> getRoles() {
64
		return roles;
65
	}
66

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

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

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

    
79
	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
	public User() {}
88

    
89
	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
	public String getInitials() {
114
		return initials;
115
	}
116

    
117
	public void setInitials(String initials) {
118
		this.initials = initials;
119
	}
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
	public Publisher getPublisher() {
170
		return publisher;
171
	}
172

    
173
	public void setPublisher(Publisher publisher) {
174
		this.publisher = publisher;
175
	}
176

    
177
	public List<Affiliation> getAffiliations() {
178
		return affiliations;
179
	}
180

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

    
185
	public List<Project> getCoordinatedProjects() {
186
		return coordinatedProjects;
187
	}
188

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

    
193
}
(49-49/52)