Revision 39076
Added by Antonis Lempesis over 8 years ago
PersonManagerImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.goldoa.service; |
2 | 2 |
|
3 |
import eu.dnetlib.goldoa.domain.*; |
|
3 |
import eu.dnetlib.goldoa.domain.Affiliation; |
|
4 |
import eu.dnetlib.goldoa.domain.OrganizationManagerException; |
|
5 |
import eu.dnetlib.goldoa.domain.Person; |
|
6 |
import eu.dnetlib.goldoa.domain.PersonManagerException; |
|
7 |
import eu.dnetlib.goldoa.domain.PersonRole; |
|
8 |
import eu.dnetlib.goldoa.domain.Project; |
|
9 |
import eu.dnetlib.goldoa.domain.Role; |
|
4 | 10 |
import eu.dnetlib.goldoa.service.dao.OrganizationDAO; |
5 | 11 |
import eu.dnetlib.goldoa.service.dao.PersonDAO; |
6 | 12 |
import eu.dnetlib.goldoa.service.dao.ProjectDAO; |
7 |
import eu.dnetlib.goldoa.service.dao.PublisherDAO; |
|
8 | 13 |
import eu.dnetlib.goldoa.service.utils.EmailUtils; |
9 | 14 |
import org.apache.commons.codec.digest.DigestUtils; |
10 | 15 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
25 | 30 |
@Transactional |
26 | 31 |
public class PersonManagerImpl implements PersonManager { |
27 | 32 |
|
28 |
@Autowired
|
|
33 |
@Autowired
|
|
29 | 34 |
private PersonDAO personDAO; |
30 |
@Autowired
|
|
35 |
@Autowired
|
|
31 | 36 |
private ProjectDAO projectDAO; |
32 |
@Autowired
|
|
33 |
private OrganizationDAO organizationDAO;
|
|
34 |
@Autowired
|
|
35 |
private PublisherManager publisherManager;
|
|
36 |
@Autowired
|
|
37 |
private OrganizationManager organizationManager;
|
|
38 |
@Autowired
|
|
39 |
private EmailUtils emailUtils;
|
|
40 |
@Autowired
|
|
41 |
ExecutorService executorService;
|
|
37 |
@Autowired
|
|
38 |
private OrganizationDAO organizationDAO;
|
|
39 |
@Autowired
|
|
40 |
private PublisherManager publisherManager;
|
|
41 |
@Autowired
|
|
42 |
private OrganizationManager organizationManager;
|
|
43 |
@Autowired
|
|
44 |
private EmailUtils emailUtils;
|
|
45 |
@Autowired
|
|
46 |
ExecutorService executorService;
|
|
42 | 47 |
|
43 | 48 |
private int tokenTTL = 30; |
44 | 49 |
|
45 |
public static int generateId(Affiliation affiliation) {
|
|
46 |
StringBuilder sb = new StringBuilder();
|
|
50 |
public static int generateId(Affiliation affiliation) {
|
|
51 |
StringBuilder sb = new StringBuilder();
|
|
47 | 52 |
|
48 |
if (affiliation.getPerson()!= null)
|
|
49 |
sb.append(affiliation.getPerson().getId());
|
|
50 |
if (affiliation.getOrganization() != null)
|
|
51 |
sb.append(affiliation.getOrganization().getId());
|
|
53 |
if (affiliation.getPerson() != null)
|
|
54 |
sb.append(affiliation.getPerson().getId());
|
|
55 |
if (affiliation.getOrganization() != null)
|
|
56 |
sb.append(affiliation.getOrganization().getId());
|
|
52 | 57 |
|
53 |
return DigestUtils.md5Hex(sb.toString()).hashCode();
|
|
54 |
}
|
|
58 |
return DigestUtils.md5Hex(sb.toString()).hashCode();
|
|
59 |
}
|
|
55 | 60 |
|
56 |
@Override
|
|
57 |
public Person getById(String personId) throws PersonManagerException {
|
|
58 |
try {
|
|
59 |
Person person = personDAO.getPersonById(personId);
|
|
61 |
@Override
|
|
62 |
public Person getById(String personId) throws PersonManagerException {
|
|
63 |
try {
|
|
64 |
Person person = personDAO.getPersonById(personId);
|
|
60 | 65 |
|
61 |
loadPersonRelations(person);
|
|
66 |
loadPersonRelations(person);
|
|
62 | 67 |
|
63 |
return person;
|
|
64 |
} catch (EmptyResultDataAccessException e) {
|
|
65 |
throw new PersonManagerException(PersonManagerException.ErrorCause.NOT_EXISTS);
|
|
66 |
}
|
|
67 |
}
|
|
68 |
return person;
|
|
69 |
} catch (EmptyResultDataAccessException e) {
|
|
70 |
throw new PersonManagerException(PersonManagerException.ErrorCause.NOT_EXISTS);
|
|
71 |
}
|
|
72 |
}
|
|
68 | 73 |
|
69 |
@Override
|
|
74 |
@Override
|
|
70 | 75 |
public Person getByEmail(final String email) throws PersonManagerException { |
71 | 76 |
try { |
72 | 77 |
Person person = personDAO.getPersonByEmail(email); |
... | ... | |
79 | 84 |
} |
80 | 85 |
} |
81 | 86 |
|
82 |
@Override
|
|
83 |
public Person savePerson(final Person person) throws PersonManagerException {
|
|
84 |
final List<PersonRole> previousRoles;
|
|
87 |
@Override
|
|
88 |
public Person savePerson(final Person person) throws PersonManagerException {
|
|
89 |
final List<PersonRole> previousRoles;
|
|
85 | 90 |
|
86 |
if (person.getId() == null) {
|
|
87 |
person.setId(generateId(person));
|
|
88 |
person.setSource("portal");
|
|
91 |
if (person.getId() == null) {
|
|
92 |
person.setId(generateId(person));
|
|
93 |
person.setSource("portal");
|
|
89 | 94 |
|
90 |
previousRoles = new ArrayList<PersonRole>();
|
|
91 |
} else {
|
|
92 |
previousRoles = personDAO.getPersonById(person.getId()).getRoles();
|
|
93 |
}
|
|
95 |
previousRoles = new ArrayList<PersonRole>();
|
|
96 |
} else {
|
|
97 |
previousRoles = personDAO.getPersonById(person.getId()).getRoles();
|
|
98 |
}
|
|
94 | 99 |
|
95 |
personDAO.savePerson(person);
|
|
96 |
deletePersonRelations(person);
|
|
97 |
savePersonRelations(person);
|
|
100 |
personDAO.savePerson(person);
|
|
101 |
deletePersonRelations(person);
|
|
102 |
savePersonRelations(person);
|
|
98 | 103 |
|
99 |
loadPersonRelations(person);
|
|
104 |
loadPersonRelations(person);
|
|
100 | 105 |
|
101 |
executorService.submit(new Runnable() {
|
|
102 |
@Override
|
|
103 |
public void run() {
|
|
104 |
try {
|
|
105 |
List<Role> roles = new ArrayList<Role>();
|
|
106 |
executorService.submit(new Runnable() {
|
|
107 |
@Override
|
|
108 |
public void run() {
|
|
109 |
try {
|
|
110 |
List<Role> roles = new ArrayList<Role>();
|
|
106 | 111 |
|
107 |
for (PersonRole pRole : person.getRoles()) {
|
|
108 |
if (!previousRoles.contains(pRole) && !pRole.isApproved())
|
|
109 |
roles.add(pRole.getRole());
|
|
110 |
}
|
|
112 |
for (PersonRole pRole : person.getRoles()) {
|
|
113 |
if (!previousRoles.contains(pRole) && !pRole.isApproved())
|
|
114 |
roles.add(pRole.getRole());
|
|
115 |
}
|
|
111 | 116 |
|
112 |
if (roles.size() > 0) {
|
|
113 |
List<Person> moderators = getModerators();
|
|
117 |
if (roles.size() > 0) {
|
|
118 |
List<Person> moderators = getModerators();
|
|
114 | 119 |
|
115 |
emailUtils.sendUserRoleRequestedEmail(person, roles);
|
|
120 |
emailUtils.sendUserRoleRequestedEmail(person, roles);
|
|
116 | 121 |
|
117 |
for (Person moderator : moderators)
|
|
118 |
emailUtils.sendModeratorRoleRequestedEmail(moderator, person, roles);
|
|
119 |
}
|
|
120 |
} catch (MessagingException e) {
|
|
121 |
e.printStackTrace();
|
|
122 |
}
|
|
123 |
}
|
|
124 |
});
|
|
122 |
for (Person moderator : moderators)
|
|
123 |
emailUtils.sendModeratorRoleRequestedEmail(moderator, person, roles);
|
|
124 |
}
|
|
125 |
} catch (MessagingException e) {
|
|
126 |
e.printStackTrace();
|
|
127 |
}
|
|
128 |
}
|
|
129 |
});
|
|
125 | 130 |
|
126 |
return person;
|
|
127 |
}
|
|
131 |
return person;
|
|
132 |
}
|
|
128 | 133 |
|
129 | 134 |
@Override |
130 | 135 |
public void register(final Person person) throws PersonManagerException { |
131 | 136 |
final String token = UUID.randomUUID().toString(); |
132 | 137 |
|
133 |
try {
|
|
134 |
personDAO.getPersonByEmail(person.getEmail());
|
|
135 |
throw new PersonManagerException(PersonManagerException.ErrorCause.ALREADY_EXISTS);
|
|
136 |
} catch (EmptyResultDataAccessException e) {
|
|
137 |
} catch (PersonManagerException e) {
|
|
138 |
throw e;
|
|
139 |
} catch (RuntimeException e) {
|
|
140 |
e.printStackTrace();
|
|
141 |
throw e;
|
|
142 |
}
|
|
138 |
try { |
|
139 |
personDAO.getPersonByEmail(person.getEmail()); |
|
140 |
throw new PersonManagerException(PersonManagerException.ErrorCause.ALREADY_EXISTS);
|
|
141 |
} catch (EmptyResultDataAccessException e) {
|
|
142 |
} catch (PersonManagerException e) {
|
|
143 |
throw e;
|
|
144 |
} catch (RuntimeException e) {
|
|
145 |
e.printStackTrace();
|
|
146 |
throw e;
|
|
147 |
}
|
|
143 | 148 |
|
144 |
this.savePerson(person);
|
|
149 |
this.savePerson(person);
|
|
145 | 150 |
personDAO.saveToken(person.getId(), token, tokenTTL); |
146 | 151 |
|
147 |
executorService.submit(new Runnable() {
|
|
148 |
@Override
|
|
149 |
public void run() {
|
|
150 |
try {
|
|
151 |
emailUtils.sendActivationEmail(person, token);
|
|
152 |
} catch (MessagingException e) {
|
|
153 |
e.printStackTrace();
|
|
154 |
}
|
|
155 |
}
|
|
156 |
});
|
|
152 |
executorService.submit(new Runnable() {
|
|
153 |
@Override
|
|
154 |
public void run() {
|
|
155 |
try {
|
|
156 |
emailUtils.sendActivationEmail(person, token);
|
|
157 |
} catch (MessagingException e) {
|
|
158 |
e.printStackTrace();
|
|
159 |
}
|
|
160 |
}
|
|
161 |
});
|
|
157 | 162 |
} |
158 | 163 |
|
159 | 164 |
@Override |
... | ... | |
176 | 181 |
|
177 | 182 |
if (!personDAO.verifyToken(email, token)) |
178 | 183 |
throw new PersonManagerException(PersonManagerException.ErrorCause.NOT_EXISTS); |
179 |
else {
|
|
180 |
Person person = personDAO.getPersonByEmail(email);
|
|
184 |
else {
|
|
185 |
Person person = personDAO.getPersonByEmail(email);
|
|
181 | 186 |
|
182 |
personDAO.activateUser(person.getId());
|
|
183 |
personDAO.deleteToken(person.getId(), token);
|
|
184 |
}
|
|
187 |
personDAO.activateUser(person.getId());
|
|
188 |
personDAO.deleteToken(person.getId(), token);
|
|
189 |
}
|
|
185 | 190 |
|
186 | 191 |
return getByEmail(email); |
187 | 192 |
} |
... | ... | |
195 | 200 |
throw new PersonManagerException(PersonManagerException.ErrorCause.NOT_EXISTS); |
196 | 201 |
} |
197 | 202 |
|
198 |
executorService.submit(new Runnable() {
|
|
199 |
@Override
|
|
200 |
public void run() {
|
|
201 |
Person person = personDAO.getPersonByEmail(email);
|
|
203 |
executorService.submit(new Runnable() {
|
|
204 |
@Override
|
|
205 |
public void run() {
|
|
206 |
Person person = personDAO.getPersonByEmail(email);
|
|
202 | 207 |
|
203 |
try {
|
|
204 |
emailUtils.sendResetPasswordEmail(person, newPassword);
|
|
205 |
} catch (MessagingException e) {
|
|
206 |
e.printStackTrace();
|
|
207 |
}
|
|
208 |
}
|
|
209 |
});
|
|
208 |
try {
|
|
209 |
emailUtils.sendResetPasswordEmail(person, newPassword);
|
|
210 |
} catch (MessagingException e) {
|
|
211 |
e.printStackTrace();
|
|
212 |
}
|
|
213 |
}
|
|
214 |
});
|
|
210 | 215 |
} |
211 | 216 |
|
212 | 217 |
@Override |
... | ... | |
214 | 219 |
return personDAO.getRoles(); |
215 | 220 |
} |
216 | 221 |
|
217 |
@Override
|
|
218 |
public List<Person> getModerators() {
|
|
219 |
return personDAO.getModerators();
|
|
220 |
}
|
|
222 |
@Override
|
|
223 |
public List<Person> getModerators() {
|
|
224 |
return personDAO.getModerators();
|
|
225 |
}
|
|
221 | 226 |
|
222 |
@Override
|
|
223 |
public List<Person> getAccountingOfficers() {
|
|
224 |
return personDAO.getAccountingOfficers();
|
|
225 |
}
|
|
227 |
@Override
|
|
228 |
public List<Person> getAccountingOfficers() {
|
|
229 |
return personDAO.getAccountingOfficers();
|
|
230 |
}
|
|
226 | 231 |
|
227 |
@Override
|
|
228 |
public void activateUser(String userId) {
|
|
229 |
personDAO.activateUser(userId);
|
|
230 |
}
|
|
232 |
@Override
|
|
233 |
public void activateUser(String userId) {
|
|
234 |
personDAO.activateUser(userId);
|
|
235 |
}
|
|
231 | 236 |
|
232 |
@Override
|
|
233 |
public void activateUsers(List<String> userIds) {
|
|
234 |
for (String userId:userIds) {
|
|
235 |
personDAO.activateUser(userId);
|
|
236 |
}
|
|
237 |
}
|
|
237 |
@Override
|
|
238 |
public void activateUsers(List<String> userIds) {
|
|
239 |
for (String userId : userIds) {
|
|
240 |
personDAO.activateUser(userId);
|
|
241 |
}
|
|
242 |
}
|
|
238 | 243 |
|
239 |
@Override
|
|
240 |
public void deactivateUser(String userId) {
|
|
241 |
personDAO.deactivateUser(userId);
|
|
242 |
}
|
|
244 |
@Override
|
|
245 |
public void deactivateUser(String userId) {
|
|
246 |
personDAO.deactivateUser(userId);
|
|
247 |
}
|
|
243 | 248 |
|
244 |
@Override
|
|
245 |
public void deactivateUsers(List<String> userIds) {
|
|
246 |
for (String userId:userIds) {
|
|
247 |
personDAO.deactivateUser(userId);
|
|
248 |
}
|
|
249 |
}
|
|
249 |
@Override
|
|
250 |
public void deactivateUsers(List<String> userIds) {
|
|
251 |
for (String userId : userIds) {
|
|
252 |
personDAO.deactivateUser(userId);
|
|
253 |
}
|
|
254 |
}
|
|
250 | 255 |
|
251 |
@Override
|
|
252 |
public void acceptUserRole(final String userId, final String roleId) {
|
|
253 |
personDAO.acceptUserRole(userId, roleId);
|
|
256 |
@Override
|
|
257 |
public void acceptUserRole(final String userId, final String roleId) {
|
|
258 |
personDAO.acceptUserRole(userId, roleId);
|
|
254 | 259 |
|
255 |
executorService.submit(new Runnable() {
|
|
256 |
@Override
|
|
257 |
public void run() {
|
|
258 |
Person person = personDAO.getPersonById(userId);
|
|
259 |
Role role = personDAO.getRole(roleId);
|
|
260 |
List<Person> moderators = getModerators();
|
|
260 |
executorService.submit(new Runnable() {
|
|
261 |
@Override
|
|
262 |
public void run() {
|
|
263 |
Person person = personDAO.getPersonById(userId);
|
|
264 |
Role role = personDAO.getRole(roleId);
|
|
265 |
List<Person> moderators = getModerators();
|
|
261 | 266 |
|
262 |
try {
|
|
263 |
emailUtils.sendUserRoleAcceptedEmail(person, role);
|
|
267 |
try {
|
|
268 |
emailUtils.sendUserRoleAcceptedEmail(person, role);
|
|
264 | 269 |
|
265 |
for (Person moderator:moderators)
|
|
266 |
emailUtils.sendModeratorRoleAcceptedEmail(moderator, person, role);
|
|
267 |
} catch (MessagingException e) {
|
|
268 |
e.printStackTrace();
|
|
269 |
}
|
|
270 |
}
|
|
271 |
});
|
|
272 |
}
|
|
270 |
for (Person moderator : moderators)
|
|
271 |
emailUtils.sendModeratorRoleAcceptedEmail(moderator, person, role);
|
|
272 |
} catch (MessagingException e) {
|
|
273 |
e.printStackTrace();
|
|
274 |
}
|
|
275 |
}
|
|
276 |
});
|
|
277 |
}
|
|
273 | 278 |
|
274 |
@Override
|
|
275 |
public void rejectRole(final String userId, final String roleId) {
|
|
276 |
personDAO.rejectUserRole(userId, roleId);
|
|
279 |
@Override
|
|
280 |
public void rejectRole(final String userId, final String roleId) {
|
|
281 |
personDAO.rejectUserRole(userId, roleId);
|
|
277 | 282 |
|
278 |
executorService.submit(new Runnable() {
|
|
279 |
@Override
|
|
280 |
public void run() {
|
|
281 |
Person person = personDAO.getPersonById(userId);
|
|
282 |
Role role = personDAO.getRole(roleId);
|
|
283 |
List<Person> moderators = getModerators();
|
|
283 |
executorService.submit(new Runnable() {
|
|
284 |
@Override
|
|
285 |
public void run() {
|
|
286 |
Person person = personDAO.getPersonById(userId);
|
|
287 |
Role role = personDAO.getRole(roleId);
|
|
288 |
List<Person> moderators = getModerators();
|
|
284 | 289 |
|
285 |
try {
|
|
286 |
emailUtils.sendUserRoleRejectedEmail(person, role);
|
|
290 |
try {
|
|
291 |
emailUtils.sendUserRoleRejectedEmail(person, role);
|
|
287 | 292 |
|
288 |
for (Person moderator : moderators)
|
|
289 |
emailUtils.sendModeratorRoleRejectedEmail(moderator, person, role);
|
|
290 |
} catch (MessagingException e) {
|
|
291 |
e.printStackTrace();
|
|
292 |
}
|
|
293 |
}
|
|
294 |
});
|
|
295 |
}
|
|
293 |
for (Person moderator : moderators)
|
|
294 |
emailUtils.sendModeratorRoleRejectedEmail(moderator, person, role);
|
|
295 |
} catch (MessagingException e) {
|
|
296 |
e.printStackTrace();
|
|
297 |
}
|
|
298 |
}
|
|
299 |
});
|
|
300 |
}
|
|
296 | 301 |
|
297 |
@Override
|
|
298 |
public List<Person> getUsers() {
|
|
299 |
List<Person> persons = personDAO.getUsers();
|
|
302 |
@Override
|
|
303 |
public List<Person> getUsers() {
|
|
304 |
List<Person> persons = personDAO.getUsers();
|
|
300 | 305 |
|
301 |
for (Person person:persons) { |
|
302 |
loadPersonRelations(person); |
|
303 |
} |
|
304 |
|
|
305 |
return persons; |
|
306 |
} |
|
306 |
for (Person person : persons) { |
|
307 |
loadPersonRelations(person); |
|
308 |
} |
|
307 | 309 |
|
308 |
@Override |
|
309 |
public String generateId(Person person) { |
|
310 |
StringBuilder sb = new StringBuilder(); |
|
310 |
return persons; |
|
311 |
} |
|
311 | 312 |
|
312 |
sb.append(person.getName()).append(person.getLastname()).append(person.getEmail());
|
|
313 |
return "portal::" + DigestUtils.md5Hex(sb.toString());
|
|
314 |
}
|
|
313 |
@Override
|
|
314 |
public String generateId(Person person) {
|
|
315 |
StringBuilder sb = new StringBuilder();
|
|
315 | 316 |
|
316 |
private void deletePersonRelations(final Person person) { |
|
317 |
sb.append(person.getName()).append(person.getLastname()).append(person.getEmail()); |
|
318 |
return "portal::" + DigestUtils.md5Hex(sb.toString()); |
|
319 |
} |
|
320 |
|
|
321 |
private void deletePersonRelations(final Person person) { |
|
317 | 322 |
personDAO.deleteAffiliations(person.getId()); |
318 | 323 |
personDAO.deletePersonRoles(person.getId()); |
319 | 324 |
personDAO.removeProjectCoordinators(person.getId()); |
... | ... | |
322 | 327 |
private void savePersonRelations(final Person person) { |
323 | 328 |
List<String> projectIds = new ArrayList<String>(); |
324 | 329 |
|
325 |
if (person.getCoordinatedProjects() != null)
|
|
326 |
for (Project project:person.getCoordinatedProjects())
|
|
327 |
projectIds.add(project.getId());
|
|
330 |
if (person.getCoordinatedProjects() != null)
|
|
331 |
for (Project project : person.getCoordinatedProjects())
|
|
332 |
projectIds.add(project.getId());
|
|
328 | 333 |
|
329 |
if (person.getPublisher() != null && person.getPublisher().getId() == null)
|
|
330 |
publisherManager.savePublisher(person.getPublisher());
|
|
334 |
if (person.getPublisher() != null && person.getPublisher().getId() == null)
|
|
335 |
publisherManager.savePublisher(person.getPublisher());
|
|
331 | 336 |
|
332 |
for (Affiliation affiliation:person.getAffiliations()) {
|
|
333 |
if (affiliation.getOrganization() != null && affiliation.getOrganization().getId() == null)
|
|
334 |
try {
|
|
335 |
organizationManager.saveOrganization(affiliation.getOrganization());
|
|
336 |
} catch (OrganizationManagerException e) {
|
|
337 |
e.printStackTrace();
|
|
338 |
}
|
|
339 |
}
|
|
337 |
for (Affiliation affiliation : person.getAffiliations()) {
|
|
338 |
if (affiliation.getOrganization() != null && affiliation.getOrganization().getId() == null)
|
|
339 |
try {
|
|
340 |
organizationManager.saveOrganization(affiliation.getOrganization());
|
|
341 |
} catch (OrganizationManagerException e) {
|
|
342 |
e.printStackTrace();
|
|
343 |
}
|
|
344 |
}
|
|
340 | 345 |
|
341 | 346 |
personDAO.saveProjectCoordinators(person.getId(), projectIds); |
342 | 347 |
personDAO.savePersonRoles(person.getId(), person.getRoles()); |
... | ... | |
347 | 352 |
|
348 | 353 |
private void loadPersonRelations(Person person) { |
349 | 354 |
|
350 |
if (person.getPublisher() != null && person.getPublisher().getId() != null) {
|
|
351 |
person.setPublisher(publisherManager.getPublisher(person.getPublisher().getId()));
|
|
352 |
} else {
|
|
353 |
person.setPublisher(null);
|
|
354 |
}
|
|
355 |
if (person.getPublisher() != null && person.getPublisher().getId() != null) {
|
|
356 |
person.setPublisher(publisherManager.getPublisher(person.getPublisher().getId()));
|
|
357 |
} else {
|
|
358 |
person.setPublisher(null);
|
|
359 |
}
|
|
355 | 360 |
|
356 | 361 |
person.setCoordinatedProjects(projectDAO.getProjectsCoordinatedBy(person.getId())); |
357 | 362 |
|
358 |
if (person.getAffiliations() != null) {
|
|
359 |
for (Affiliation affiliation : person.getAffiliations()) {
|
|
360 |
if (affiliation.getOrganization() != null)
|
|
361 |
affiliation.setOrganization(organizationDAO.getOrganization(affiliation.getOrganization().getId()));
|
|
362 |
}
|
|
363 |
}
|
|
363 |
if (person.getAffiliations() != null) {
|
|
364 |
for (Affiliation affiliation : person.getAffiliations()) {
|
|
365 |
if (affiliation.getOrganization() != null)
|
|
366 |
affiliation.setOrganization(organizationDAO.getOrganization(affiliation.getOrganization().getId()));
|
|
367 |
}
|
|
368 |
}
|
|
364 | 369 |
|
365 |
if (person.getRoles() != null)
|
|
366 |
for (int i = 0; i < person.getRoles().size(); i++) {
|
|
367 |
person.getRoles().get(i).setRole(personDAO.getRole(person.getRoles().get(i).getRole().getId()));
|
|
368 |
}
|
|
370 |
if (person.getRoles() != null)
|
|
371 |
for (int i = 0; i < person.getRoles().size(); i++) {
|
|
372 |
person.getRoles().get(i).setRole(personDAO.getRole(person.getRoles().get(i).getRole().getId()));
|
|
373 |
}
|
|
369 | 374 |
} |
370 | 375 |
|
371 | 376 |
public int getTokenTTL() { |
Also available in: Unified diff
reformatted code