Revision 35679
Added by Stefania Martziou over 9 years ago
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/dao/PublicationDAO.java | ||
---|---|---|
28 | 28 |
"from publication p\n" + |
29 | 29 |
"left join publication_affiliation pa on pa.publication=p.id\n" + |
30 | 30 |
"left join publication_identifier i on i.publication = p.id\n" + |
31 |
"group by p.id, title, languages, subjects, doi, source, date, p.type, journal, publisher;"; |
|
31 |
"where p.id=?\n" + |
|
32 |
"group by p.id, title, languages, subjects, doi, source, date, p.type, journal, publisher, repository;"; |
|
32 | 33 |
|
33 | 34 |
private static final String INSERT_PUBLICATION_AFFILIATIONS = |
34 | 35 |
"with aff as (insert into affiliation (person, organization, startdate, enddate, department) values (?, ?, ?, ?, ?) returning id as affid) insert into publication_affiliation (publication, affiliation) select ?, affid from aff"; |
... | ... | |
62 | 63 |
publication.setRepository(rs.getString("repository")); |
63 | 64 |
|
64 | 65 |
publication.setAuthors(new ArrayList<Affiliation>()); |
65 |
for (int aff: (int[]) rs.getArray("authors").getArray())
|
|
66 |
for (int aff: (Integer[]) rs.getArray("authors").getArray())
|
|
66 | 67 |
publication.getAuthors().add(new Affiliation(aff)); |
67 | 68 |
|
68 | 69 |
publication.setIdentifiers(new ArrayList<PublicationIdentifier>()); |
69 | 70 |
for (String s: (String[]) rs.getArray("identifiers").getArray()) { |
70 |
String[] parts = s.split("\\|\\|"); |
|
71 |
if (s != null) { |
|
72 |
String[] parts = s.split("\\|\\|"); |
|
71 | 73 |
|
72 |
publication.getIdentifiers().add(new PublicationIdentifier(parts[0], parts[1])); |
|
74 |
publication.getIdentifiers().add(new PublicationIdentifier(parts[0], parts[1])); |
|
75 |
} |
|
73 | 76 |
} |
74 | 77 |
|
75 | 78 |
return publication; |
... | ... | |
164 | 167 |
person.setEmail(parts[0]); |
165 | 168 |
person.setName(parts[1]); |
166 | 169 |
person.setLastname(parts[2]); |
167 |
person.setInitials(parts[3]); |
|
170 |
if (parts.length > 3) |
|
171 |
person.setInitials(parts[3]); |
|
168 | 172 |
|
169 | 173 |
return person; |
170 | 174 |
} |
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/PublicationManagerImpl.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
loadPublicationRelations(publication); |
38 | 38 |
|
39 |
if (publication.getJournal() != null) |
|
39 |
if (publication.getJournal() != null && publication.getJournal().getId() != null)
|
|
40 | 40 |
publication.setJournal(journalDAO.getJournal(publication.getJournal().getId())); |
41 |
if (publication.getPublisher() != null) |
|
41 |
else |
|
42 |
publication.setJournal(null); |
|
43 |
|
|
44 |
if (publication.getPublisher() != null && publication.getPublisher().getId() != null) |
|
42 | 45 |
publication.setPublisher(publisherDAO.getPublisher(publication.getPublisher().getId())); |
46 |
else |
|
47 |
publication.setPublisher(null); |
|
43 | 48 |
|
44 | 49 |
return publication; |
45 | 50 |
} |
... | ... | |
60 | 65 |
deletePublicationRelations(publication); |
61 | 66 |
insertPublicationRelations(publication); |
62 | 67 |
|
63 |
if (publication.getJournal() != null) |
|
68 |
if (publication.getJournal() != null && publication.getJournal().getId() != null)
|
|
64 | 69 |
publication.setJournal(journalDAO.getJournal(publication.getJournal().getId())); |
65 |
if (publication.getPublisher() != null) |
|
70 |
else |
|
71 |
publication.setJournal(null); |
|
72 |
|
|
73 |
if (publication.getPublisher() != null && publication.getPublisher().getId() != null) |
|
66 | 74 |
publication.setPublisher(publisherDAO.getPublisher(publication.getPublisher().getId())); |
75 |
else |
|
76 |
publication.setPublisher(null); |
|
67 | 77 |
|
68 | 78 |
return publication; |
69 | 79 |
} |
Also available in: Unified diff
Fixed some bugs in getPublication