Revision 45978
Added by Panagiotis Kanakakis about 7 years ago
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/AffiliationPK.java | ||
---|---|---|
1 |
package eu.dnetlib.goldoa.domain; |
|
2 |
|
|
3 |
import javax.persistence.GeneratedValue; |
|
4 |
import javax.persistence.GenerationType; |
|
5 |
import javax.persistence.Id; |
|
6 |
import javax.persistence.ManyToOne; |
|
7 |
import java.io.Serializable; |
|
8 |
|
|
9 |
/** |
|
10 |
* Created by panagiotis on 17/1/2017. |
|
11 |
*/ |
|
12 |
public class AffiliationPK implements Serializable { |
|
13 |
|
|
14 |
private static final long serialVersionUID = 1L; |
|
15 |
|
|
16 |
@ManyToOne |
|
17 |
private User user; |
|
18 |
@ManyToOne |
|
19 |
private Organization organization; |
|
20 |
|
|
21 |
public User getUser() { |
|
22 |
return user; |
|
23 |
} |
|
24 |
|
|
25 |
public void setUser(User user) { |
|
26 |
this.user = user; |
|
27 |
} |
|
28 |
|
|
29 |
public Organization getOrganization() { |
|
30 |
return organization; |
|
31 |
} |
|
32 |
|
|
33 |
public void setOrganization(Organization organization) { |
|
34 |
this.organization = organization; |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public boolean equals(Object o) { |
|
39 |
if (this == o) return true; |
|
40 |
if (o == null || getClass() != o.getClass()) return false; |
|
41 |
|
|
42 |
AffiliationPK that = (AffiliationPK) o; |
|
43 |
|
|
44 |
if (!user.equals(that.user)) return false; |
|
45 |
return organization.equals(that.organization); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public int hashCode() { |
|
50 |
int result = user.hashCode(); |
|
51 |
result = 31 * result + organization.hashCode(); |
|
52 |
return result; |
|
53 |
} |
|
54 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Publication_Author.java | ||
---|---|---|
1 |
package eu.dnetlib.goldoa.domain; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
import javax.persistence.*; |
|
5 |
|
|
6 |
|
|
7 |
/** |
|
8 |
* The persistent class for the publication_affiliation database table. |
|
9 |
* |
|
10 |
*/ |
|
11 |
@Entity |
|
12 |
@Table(name="publication_author") |
|
13 |
public class Publication_Author implements Serializable { |
|
14 |
private static final long serialVersionUID = 1L; |
|
15 |
|
|
16 |
@Id |
|
17 |
@ManyToOne |
|
18 |
@JoinColumn(name = "author") |
|
19 |
private Author author; |
|
20 |
|
|
21 |
@Id |
|
22 |
@ManyToOne |
|
23 |
@JoinColumn(name = "publication") |
|
24 |
private Publication publication; |
|
25 |
|
|
26 |
public Publication_Author() { |
|
27 |
} |
|
28 |
|
|
29 |
|
|
30 |
public Author getAuthor() { |
|
31 |
return author; |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
public void setAuthor(Author author) { |
|
36 |
this.author = author; |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
public Publication getPublication() { |
|
42 |
return this.publication; |
|
43 |
} |
|
44 |
|
|
45 |
public void setPublication(Publication publication) { |
|
46 |
this.publication = publication; |
|
47 |
} |
|
48 |
|
|
49 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/UserActionsTest.java | ||
---|---|---|
49 | 49 |
user.setEmail("pkanakakis@di.uoa.gr"); |
50 | 50 |
user.setPassword(DigestUtils.md5DigestAsHex( "1q2w3e4r".getBytes(Charset.forName("UTF-8")))); |
51 | 51 |
|
52 |
AffiliationPK afk = new AffiliationPK(); |
|
53 |
afk.setUser(user); |
|
54 |
afk.setOrganization(org); |
|
52 |
|
|
55 | 53 |
Affiliation af = new Affiliation(); |
56 |
af.setPk(afk); |
|
57 |
|
|
54 |
af.setOrganization(org); |
|
58 | 55 |
user.addUserAffiliation(af); |
59 | 56 |
|
60 | 57 |
try { |
... | ... | |
80 | 77 |
@Transactional |
81 | 78 |
@Rollback(true) |
82 | 79 |
public void createPublicationAffiliation() { |
83 |
Organization org = new Organization(); |
|
80 |
/* Organization org = new Organization();
|
|
84 | 81 |
org.setId("1"); |
85 | 82 |
try { |
86 | 83 |
om.saveOrganization(org); |
... | ... | |
90 | 87 |
|
91 | 88 |
User user = new User(); |
92 | 89 |
user.setEmail("pkanakakis@di.uoa.gr"); |
93 |
user.setPassword(DigestUtils.md5DigestAsHex( "1q2w3e4r".getBytes(Charset.forName("UTF-8"))));
|
|
90 |
user.setDepartment(DigestUtils.md5DigestAsHex( "1q2w3e4r".getBytes(Charset.forName("UTF-8"))));
|
|
94 | 91 |
|
95 |
AffiliationPK afk = new AffiliationPK(); |
|
96 |
afk.setUser(user); |
|
97 |
afk.setOrganization(org); |
|
92 |
|
|
98 | 93 |
Affiliation af = new Affiliation(); |
99 |
af.setPk(afk);
|
|
94 |
af.setOrganization(org);
|
|
100 | 95 |
|
101 | 96 |
user.addUserAffiliation(af); |
102 | 97 |
|
... | ... | |
119 | 114 |
List<Affiliation> afs = u.getAffiliations(); |
120 | 115 |
for(Affiliation a: afs) |
121 | 116 |
assertEquals(a.getPublications().get(0).getId(),p.getId()); |
117 |
*/ |
|
122 | 118 |
|
123 |
|
|
124 | 119 |
} |
125 | 120 |
|
126 | 121 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/test/java/unitest/ProfileTest.java | ||
---|---|---|
51 | 51 |
public void register(){ |
52 | 52 |
/*User user = new User(); |
53 | 53 |
user.setEmail("pkanakakis@di.uoa.gr"); |
54 |
user.setPassword(DigestUtils.md5DigestAsHex( "1q2w3e4r".getBytes(Charset.forName("UTF-8"))));
|
|
54 |
user.setDepartment(DigestUtils.md5DigestAsHex( "1q2w3e4r".getBytes(Charset.forName("UTF-8"))));
|
|
55 | 55 |
|
56 | 56 |
Organization org1 = new Organization(); |
57 | 57 |
org1.setName("ATHENA RESEARCH AND INNOVATION CENTER IN INFORMATION " |
modules/uoa-goldoa-service/branches/hibernate/src/test/resources/applicationContext-goldoa-service.properties | ||
---|---|---|
1 | 1 |
goldoa.db.driverClassName = org.postgresql.Driver |
2 |
goldoa.db.url = jdbc:postgresql://194.177.192.119:5432/goldoa-test |
|
2 |
goldoa.db.url = jdbc:postgresql://194.177.192.119:5432/goldoa-test-1
|
|
3 | 3 |
goldoa.db.username = dnet |
4 | 4 |
goldoa.db.password = dnetPwd |
5 | 5 |
|
modules/uoa-goldoa-service/branches/hibernate/src/test/resources/dataSource.xml | ||
---|---|---|
9 | 9 |
<property name="driverClassName" value="org.hsqldb.jdbcDriver" /> |
10 | 10 |
<property name="url" value="jdbc:hsqldb:mem:testDB"/> |
11 | 11 |
<property name="username" value="SA" /> |
12 |
<property name="password" value="" />
|
|
12 |
<property name="department" value="" />
|
|
13 | 13 |
</bean> |
14 | 14 |
--> |
15 | 15 |
<bean id="goldoa.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
modules/uoa-goldoa-service/branches/hibernate/src/test/resources/hibernate-cfg.xml | ||
---|---|---|
8 | 8 |
<hibernate-configuration> |
9 | 9 |
<session-factory> |
10 | 10 |
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL9Dialect</property> |
11 |
<!--<property name="hibernate.hbm2ddl.auto">create</property>-->
|
|
11 |
<property name="hibernate.hbm2ddl.auto">create</property>
|
|
12 | 12 |
<property name="show_sql">true</property> |
13 | 13 |
<property name="connection.pool_size">1</property> |
14 | 14 |
<property name="format_sql">true</property> |
... | ... | |
20 | 20 |
<mapping class = "eu.dnetlib.goldoa.domain.UserRolePK"/> |
21 | 21 |
<mapping class = "eu.dnetlib.goldoa.domain.Organization"/> |
22 | 22 |
<mapping class = "eu.dnetlib.goldoa.domain.Affiliation"/> |
23 |
<mapping class = "eu.dnetlib.goldoa.domain.AffiliationPK"/> |
|
23 |
|
|
24 | 24 |
<mapping class = "eu.dnetlib.goldoa.domain.Country"/> |
25 | 25 |
<mapping class = "eu.dnetlib.goldoa.domain.File"/> |
26 | 26 |
<mapping class = "eu.dnetlib.goldoa.domain.Funder"/> |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/META-INF/persistence.xml | ||
---|---|---|
38 | 38 |
<!-- <properties> |
39 | 39 |
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/> |
40 | 40 |
<property name="hibernate.connection.username" value="SA"/> |
41 |
<property name="hibernate.connection.password" value=""/>
|
|
41 |
<property name="hibernate.connection.department" value=""/>
|
|
42 | 42 |
<property name="hibernate.connection.url" value="jdbc:hsqldb:file:testDB"/> |
43 | 43 |
</properties> --> |
44 | 44 |
|
... | ... | |
46 | 46 |
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/goldoa-local" /> |
47 | 47 |
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> |
48 | 48 |
<property name="javax.persistence.jdbc.user" value="postgres" /> |
49 |
<property name="javax.persistence.jdbc.password" value="1q2w3e4r" />
|
|
49 |
<property name="javax.persistence.jdbc.department" value="1q2w3e4r" />
|
|
50 | 50 |
<property name="eclipselink.logging.level" value="ALL" /> |
51 | 51 |
</properties> --> |
52 | 52 |
</persistence-unit> |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/dao/OrganizationDAO.java | ||
---|---|---|
87 | 87 |
List<Affiliation> afs = user.getAffiliations(); |
88 | 88 |
List<Organization> orgs = new ArrayList<>(); |
89 | 89 |
for(Affiliation af : afs) |
90 |
orgs.add(af.getPk().getOrganization());
|
|
90 |
orgs.add(af.getOrganization()); |
|
91 | 91 |
return orgs; |
92 | 92 |
} |
93 | 93 |
|
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/PublicationManagerImpl.java | ||
---|---|---|
60 | 60 |
publication.setId("portal::" + DigestUtils.md5Hex(publication.getTitle())); |
61 | 61 |
} |
62 | 62 |
|
63 |
publicationDAO.savePublication(publication); |
|
64 |
/* |
|
65 |
deletePublicationRelations(publication); |
|
66 | 63 |
|
64 |
//deletePublicationRelations(publication); |
|
65 |
|
|
67 | 66 |
try { |
68 | 67 |
insertPublicationRelations(publication); |
69 | 68 |
} catch (PersonManagerException e) { |
... | ... | |
92 | 91 |
|
93 | 92 |
publication.setPublisher(publisherManager.getPublisher(publication.getPublisher().getId())); |
94 | 93 |
} |
95 |
*/
|
|
94 |
publicationDAO.savePublication(publication);
|
|
96 | 95 |
return publication; |
97 | 96 |
} |
98 | 97 |
|
... | ... | |
172 | 171 |
publication.setJournal(this.parseJournal(root.path("message").path("container-title"), root.path("message").path("ISSN"))); |
173 | 172 |
publication.getJournal().setPublisher(this.parsePublisher(root.path("message").path("publisher"))); |
174 | 173 |
|
175 |
publication.setAffiliations(new ArrayList<Affiliation>()); |
|
174 |
/*publication.setAffiliations(new ArrayList<Affiliation>());
|
|
176 | 175 |
for (JsonNode author : root.path("message").path("author")) { |
177 | 176 |
publication.getAffiliations().add(this.parseAffiliation(author)); |
178 |
} |
|
177 |
}*/
|
|
179 | 178 |
|
180 | 179 |
publication.setLicense(root.path("message").path("license").path(0).path("URL").textValue()); |
181 | 180 |
|
... | ... | |
208 | 207 |
user.setAffiliations(new ArrayList<Affiliation>()); |
209 | 208 |
|
210 | 209 |
Affiliation af = new Affiliation(); |
211 |
AffiliationPK afpk = new AffiliationPK(); |
|
212 |
afpk.setUser(user); |
|
213 |
af.setPk(afpk); |
|
214 | 210 |
user.getAffiliations().add(af); |
215 | 211 |
return af; |
216 | 212 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/UserManagerImpl.java | ||
---|---|---|
41 | 41 |
public static int generateId(Affiliation affiliation) { |
42 | 42 |
StringBuilder sb = new StringBuilder(); |
43 | 43 |
|
44 |
if (affiliation.getPk().getUser() != null)
|
|
45 |
sb.append(affiliation.getPk().getUser().getId());
|
|
46 |
if (affiliation.getPk().getOrganization() != null)
|
|
47 |
sb.append(affiliation.getPk().getOrganization().getId());
|
|
44 |
if (affiliation.getUsers().get(0) != null)
|
|
45 |
sb.append(affiliation.getUsers().get(0).getId());
|
|
46 |
if (affiliation.getOrganization() != null) |
|
47 |
sb.append(affiliation.getOrganization().getId()); |
|
48 | 48 |
|
49 | 49 |
return DigestUtils.md5Hex(sb.toString()).hashCode(); |
50 | 50 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/service/utils/EmailUtilsImpl.java | ||
---|---|---|
371 | 371 |
String text = "Dear moderator,\n" + |
372 | 372 |
"\n" + |
373 | 373 |
"User " + user.getFirstname() + " " + user.getLastname(); |
374 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getPk().getOrganization() != null &&
|
|
375 |
user.getAffiliations().get(0).getPk().getOrganization().getName() != null)
|
|
376 |
text += " from organization " + user.getAffiliations().get(0).getPk().getOrganization().getName();
|
|
374 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null && |
|
375 |
user.getAffiliations().get(0).getOrganization().getName() != null) |
|
376 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
377 | 377 |
text += " has been upgraded/granted the " + role.getRole() + " status.\n" + |
378 | 378 |
" \n" + |
379 | 379 |
"Best,\n" + |
... | ... | |
407 | 407 |
String text = "Dear moderator,\n" + |
408 | 408 |
"\n" + |
409 | 409 |
"User " + user.getFirstname() + " " + user.getLastname(); |
410 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getPk().getOrganization() != null
|
|
411 |
&& user.getAffiliations().get(0).getPk().getOrganization().getName() != null)
|
|
412 |
text += " from organization " + user.getAffiliations().get(0).getPk().getOrganization().getName();
|
|
410 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null |
|
411 |
&& user.getAffiliations().get(0).getOrganization().getName() != null) |
|
412 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
413 | 413 |
text += "has not been upgraded/granted the " + role.getRole() + " status.\n" + |
414 | 414 |
" \n" + |
415 | 415 |
"Best,\n" + |
... | ... | |
459 | 459 |
String text = "Dear moderator,\n" + |
460 | 460 |
"\n" + |
461 | 461 |
"User " + user.getFirstname() + " " + user.getLastname(); |
462 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getPk().getOrganization() != null
|
|
463 |
&& user.getAffiliations().get(0).getPk().getOrganization().getName() != null)
|
|
464 |
text += " from organization " + user.getAffiliations().get(0).getPk().getOrganization().getName();
|
|
462 |
if (user.getAffiliations().size() > 0 && user.getAffiliations().get(0).getOrganization() != null |
|
463 |
&& user.getAffiliations().get(0).getOrganization().getName() != null) |
|
464 |
text += " from organization " + user.getAffiliations().get(0).getOrganization().getName(); |
|
465 | 465 |
text += " has requested to upgraded/be granted the "; |
466 | 466 |
for (Role role : roles) { |
467 | 467 |
text += role.getRole() + ", "; |
... | ... | |
1076 | 1076 |
|
1077 | 1077 |
|
1078 | 1078 |
if (!request.getUser().getId().equals(request.getResearcher().getId())) { |
1079 |
text += request.getUser().getFirstname() + " " + request.getUser().getLastname() + " from " + request.getUser().getAffiliations().get(0).getPk().getOrganization().getName() +
|
|
1079 |
text += request.getUser().getFirstname() + " " + request.getUser().getLastname() + " from " + request.getUser().getAffiliations().get(0).getOrganization().getName() + |
|
1080 | 1080 |
" has requested on behalf of " + request.getResearcher().getFirstname() + " " + request.getResearcher().getLastname() + |
1081 | 1081 |
" the funding of the following publication:\n"; |
1082 | 1082 |
} else { |
1083 |
text += request.getResearcher().getFirstname() + " " + request.getResearcher().getLastname() + " from " + request.getUser().getAffiliations().get(0).getPk().getOrganization().getName() +
|
|
1083 |
text += request.getResearcher().getFirstname() + " " + request.getResearcher().getLastname() + " from " + request.getUser().getAffiliations().get(0).getOrganization().getName() + |
|
1084 | 1084 |
" has requested the funding of the following publication:\n"; |
1085 | 1085 |
} |
1086 | 1086 |
|
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Organization.java | ||
---|---|---|
26 | 26 |
private Country country; |
27 | 27 |
|
28 | 28 |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.organization") |
29 |
private List<Affiliation> affiliations = new ArrayList<>(); |
|
30 |
|
|
31 |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.organization") |
|
32 | 29 |
private List<JournalDiscount> journalDiscounts = new ArrayList<>(); |
33 | 30 |
|
34 | 31 |
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
... | ... | |
86 | 83 |
this.source = source; |
87 | 84 |
} |
88 | 85 |
|
89 |
public List<Affiliation> getAffiliations() { |
|
90 |
return affiliations; |
|
91 |
} |
|
92 |
|
|
93 |
public void setAffiliations(List<Affiliation> affiliations) { |
|
94 |
this.affiliations = affiliations; |
|
95 |
} |
|
96 |
|
|
97 | 86 |
public List<Budget> getBudgets() { |
98 | 87 |
return budgets; |
99 | 88 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/User.java | ||
---|---|---|
37 | 37 |
//@Column(columnDefinition = "text") |
38 | 38 |
private String id; |
39 | 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 |
|
|
40 | 49 |
@OneToOne(mappedBy="contact") |
41 | 50 |
private Publisher publisher; |
42 | 51 |
|
43 | 52 |
@OneToMany(mappedBy = "pk.user", cascade=CascadeType.ALL) |
44 | 53 |
private List<UserRole> roles = new ArrayList<>(); |
45 | 54 |
|
46 |
@OneToMany(mappedBy = "pk.user", cascade=CascadeType.ALL) |
|
47 |
private List<Affiliation> affiliations = new ArrayList<>(); |
|
48 |
|
|
49 | 55 |
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "coordinators") |
50 | 56 |
private List<Project> coordinatedProjects = new ArrayList<>(); |
51 | 57 |
|
... | ... | |
189 | 195 |
public void setRequestComment(List<RequestComment> requestComment) { |
190 | 196 |
this.requestComment = requestComment; |
191 | 197 |
} |
198 |
|
|
199 |
|
|
192 | 200 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Affiliation.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
@Entity |
11 | 11 |
@Table(name="Affiliation") |
12 |
@AssociationOverrides({ |
|
12 |
/*@AssociationOverrides({
|
|
13 | 13 |
@AssociationOverride(name = "pk.user", |
14 | 14 |
joinColumns = @JoinColumn(name = "\"user\"")), |
15 | 15 |
@AssociationOverride(name = "pk.organization", |
16 |
joinColumns = @JoinColumn(name = "organization")) }) |
|
16 |
joinColumns = @JoinColumn(name = "organization")) })*/
|
|
17 | 17 |
public class Affiliation implements Serializable { |
18 | 18 |
private static final long serialVersionUID = 1L; |
19 | 19 |
|
20 |
@EmbeddedId |
|
21 |
private AffiliationPK pk = new AffiliationPK(); |
|
20 |
/*@EmbeddedId
|
|
21 |
private AffiliationPK pk = new AffiliationPK();*/
|
|
22 | 22 |
|
23 |
@Id |
|
24 |
private Integer id; |
|
25 |
|
|
26 |
@OneToOne |
|
27 |
@JoinColumn(name="organization") |
|
28 |
private Organization organization; |
|
23 | 29 |
//@Column(columnDefinition = "text") |
24 | 30 |
private String department; |
25 | 31 |
private Timestamp enddate; |
26 | 32 |
private Timestamp startdate; |
27 | 33 |
|
34 |
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "affiliations") |
|
35 |
private List<User> users = new ArrayList<>(); |
|
36 |
|
|
37 |
public Integer getId() { |
|
38 |
return id; |
|
39 |
} |
|
40 |
|
|
41 |
public void setId(Integer id) { |
|
42 |
this.id = id; |
|
43 |
} |
|
44 |
|
|
45 |
public Organization getOrganization() { |
|
46 |
return organization; |
|
47 |
} |
|
48 |
|
|
49 |
public void setOrganization(Organization organization) { |
|
50 |
this.organization = organization; |
|
51 |
} |
|
52 |
|
|
28 | 53 |
public String getDepartment() { |
29 | 54 |
return department; |
30 | 55 |
} |
... | ... | |
49 | 74 |
this.startdate = startdate; |
50 | 75 |
} |
51 | 76 |
|
52 |
public AffiliationPK getPk() {
|
|
53 |
return pk;
|
|
77 |
public List<User> getUsers() {
|
|
78 |
return users;
|
|
54 | 79 |
} |
55 | 80 |
|
56 |
public void setPk(AffiliationPK pk) {
|
|
57 |
this.pk = pk;
|
|
81 |
public void setUsers(List<User> users) {
|
|
82 |
this.users = users;
|
|
58 | 83 |
} |
59 | 84 |
|
60 |
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
|
61 |
@JoinTable(name = "publication_affiliation", joinColumns = { |
|
62 |
@JoinColumn(name = "\"user\"", nullable = false, updatable = false), |
|
63 |
@JoinColumn(name = "organization", nullable = false, updatable = false)}, |
|
64 |
inverseJoinColumns = { @JoinColumn(name = "publication", |
|
65 |
nullable = false, updatable = false) }) |
|
66 |
private List<Publication> publications = new ArrayList<>(); |
|
67 |
|
|
68 |
public List<Publication> getPublications() { |
|
69 |
return publications; |
|
70 |
} |
|
71 |
|
|
72 |
public void setPublications(List<Publication> publications) { |
|
73 |
this.publications = publications; |
|
74 |
} |
|
75 |
|
|
76 |
public void addPublication(Publication p){ |
|
77 |
this.publications.add(p); |
|
78 |
} |
|
79 |
|
|
80 |
public void removePublication(Publication p){ |
|
81 |
this.publications.remove(p); |
|
82 |
} |
|
83 | 85 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Author.java | ||
---|---|---|
12 | 12 |
private static final long serialVersionUID = 1L; |
13 | 13 |
|
14 | 14 |
@Id |
15 |
//@Column(columnDefinition = "text")
|
|
15 |
@Column(columnDefinition = "text") |
|
16 | 16 |
private String id; |
17 | 17 |
|
18 |
//@Column(columnDefinition = "text",nullable=false)
|
|
18 |
@Column(columnDefinition = "text",nullable=false) |
|
19 | 19 |
private String firstname; |
20 | 20 |
|
21 |
//@Column(columnDefinition = "text",nullable=false)
|
|
21 |
@Column(columnDefinition = "text",nullable=false) |
|
22 | 22 |
private String lastname; |
23 | 23 |
|
24 |
//@Column(columnDefinition = "text")
|
|
24 |
@Column(columnDefinition = "text") |
|
25 | 25 |
private String initial; |
26 | 26 |
|
27 |
//@Column(columnDefinition = "text")
|
|
28 |
private String telephone;
|
|
27 |
@Column(columnDefinition = "text") |
|
28 |
private String email;
|
|
29 | 29 |
|
30 |
//@Column(columnDefinition = "text")
|
|
31 |
private String password;
|
|
30 |
@Column(columnDefinition = "text") |
|
31 |
private String department;
|
|
32 | 32 |
|
33 |
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "authors") |
|
33 |
@OneToOne |
|
34 |
@JoinColumn(name="organization") |
|
35 |
private Organization organization; |
|
36 |
|
|
37 |
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
|
38 |
@JoinTable(name = "publication_author", joinColumns = { |
|
39 |
@JoinColumn(name = "author", nullable = false, updatable = false), |
|
40 |
}, |
|
41 |
inverseJoinColumns = { @JoinColumn(name = "publication", |
|
42 |
nullable = false, updatable = false) }) |
|
34 | 43 |
private List<Publication> publications = new ArrayList<>(); |
35 |
|
|
44 |
|
|
36 | 45 |
public Author() {} |
37 |
|
|
38 | 46 |
|
39 | 47 |
public String getFirstname() { |
40 | 48 |
return firstname; |
41 | 49 |
} |
42 | 50 |
|
43 |
|
|
44 |
|
|
45 | 51 |
public void setFirstname(String firstname) { |
46 | 52 |
this.firstname = firstname; |
47 | 53 |
} |
48 | 54 |
|
49 |
|
|
50 |
|
|
51 | 55 |
public String getLastname() { |
52 | 56 |
return lastname; |
53 | 57 |
} |
54 | 58 |
|
55 |
|
|
56 |
|
|
57 | 59 |
public void setLastname(String lastname) { |
58 | 60 |
this.lastname = lastname; |
59 | 61 |
} |
60 | 62 |
|
61 |
|
|
62 |
|
|
63 | 63 |
public String getInitial() { |
64 | 64 |
return initial; |
65 | 65 |
} |
66 | 66 |
|
67 |
|
|
68 |
|
|
69 | 67 |
public void setInitial(String initial) { |
70 | 68 |
this.initial = initial; |
71 | 69 |
} |
72 | 70 |
|
73 |
|
|
74 |
|
|
75 |
public String getTelephone() { |
|
76 |
return telephone; |
|
71 |
public String getEmail() { |
|
72 |
return email; |
|
77 | 73 |
} |
78 | 74 |
|
79 |
|
|
80 |
|
|
81 |
public void setTelephone(String telephone) { |
|
82 |
this.telephone = telephone; |
|
75 |
public void setEmail(String email) { |
|
76 |
this.email = email; |
|
83 | 77 |
} |
84 | 78 |
|
85 |
|
|
86 |
public String getPassword() { |
|
87 |
return password; |
|
79 |
public String getDepartment() { |
|
80 |
return department; |
|
88 | 81 |
} |
89 | 82 |
|
90 |
|
|
91 |
|
|
92 |
public void setPassword(String password) { |
|
93 |
this.password = password; |
|
83 |
public void setDepartment(String department) { |
|
84 |
this.department = department; |
|
94 | 85 |
} |
95 | 86 |
|
96 | 87 |
public String getId() { |
... | ... | |
101 | 92 |
this.id = id; |
102 | 93 |
} |
103 | 94 |
|
95 |
public List<Publication> getPublications() { |
|
96 |
return publications; |
|
97 |
} |
|
98 |
|
|
99 |
public void setPublications(List<Publication> publications) { |
|
100 |
this.publications = publications; |
|
101 |
} |
|
102 |
|
|
103 |
public Organization getOrganization() { |
|
104 |
return organization; |
|
105 |
} |
|
106 |
|
|
107 |
public void setOrganization(Organization organization) { |
|
108 |
this.organization = organization; |
|
109 |
} |
|
104 | 110 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/java/eu/dnetlib/goldoa/domain/Publication.java | ||
---|---|---|
58 | 58 |
private PublicationType type; |
59 | 59 |
|
60 | 60 |
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "publications") |
61 |
private List<Affiliation> affiliations = new ArrayList<>(); |
|
62 |
|
|
63 |
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
|
64 |
@JoinTable(name = "publication_author", joinColumns = { |
|
65 |
@JoinColumn(name = "publication", nullable = false, updatable = false) |
|
66 |
}, |
|
67 |
inverseJoinColumns = { @JoinColumn(name = "author", |
|
68 |
nullable = false, updatable = false) }) |
|
69 | 61 |
private List<Author> authors = new ArrayList<>(); |
70 | 62 |
|
71 | 63 |
@OneToMany(mappedBy = "publication",cascade=CascadeType.ALL) |
... | ... | |
217 | 209 |
this.publicationIdentifiers.remove(i); |
218 | 210 |
} |
219 | 211 |
|
220 |
public List<Affiliation> getAffiliations() { |
|
221 |
return affiliations; |
|
222 |
} |
|
223 |
|
|
224 |
public void setAffiliations(List<Affiliation> affiliations) { |
|
225 |
this.affiliations = affiliations; |
|
226 |
} |
|
227 |
|
|
228 | 212 |
public List<Author> getAuthors() { |
229 | 213 |
return authors; |
230 | 214 |
} |
modules/uoa-goldoa-service/branches/hibernate/src/main/resources/eu/dnetlib/goldoa/service/applicationContext-goldoa-service.properties | ||
---|---|---|
1 | 1 |
goldoa.db.driverClassName = org.postgresql.Driver |
2 | 2 |
goldoa.db.url = jdbc:postgresql://194.177.192.221:5432/goldoa |
3 | 3 |
goldoa.db.username = dnet |
4 |
goldoa.db.password = dnetPwd
|
|
4 |
goldoa.db.department = dnetPwd
|
|
5 | 5 |
|
6 | 6 |
goldoa.mail.host = smtp.gmail.com |
7 | 7 |
goldoa.mail.from = test.espas@gmail.com |
8 | 8 |
goldoa.mail.replyTo = test.espas@gmail.com |
9 | 9 |
goldoa.mail.port = 465 |
10 | 10 |
goldoa.mail.username = test.espas@gmail.com |
11 |
goldoa.mail.password = s.a.g.a.p.w
|
|
11 |
goldoa.mail.department = s.a.g.a.p.w
|
|
12 | 12 |
goldoa.mail.authenticate = true |
13 | 13 |
goldoa.mail.mode = ssl |
14 | 14 |
goldoa.mail.debug = true |
Also available in: Unified diff