Revision 62039
Added by Alessia Bardi about 2 years ago
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" ?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet45-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
<relativePath /> |
|
8 |
</parent> |
|
9 |
<modelVersion>4.0.0</modelVersion> |
|
10 |
<groupId>eu.dnetlib</groupId> |
|
11 |
<artifactId>dnet-directindex-api</artifactId> |
|
12 |
<packaging>jar</packaging> |
|
13 |
<version>2.3.5</version> |
|
14 |
|
|
15 |
<scm> |
|
16 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5</developerConnection> |
|
17 |
</scm> |
|
18 |
<dependencies> |
|
19 |
<dependency> |
|
20 |
<groupId>eu.dnetlib</groupId> |
|
21 |
<artifactId>dnet-openaireplus-mapping-utils</artifactId> |
|
22 |
<version>[6.3.24,7.0.0)</version> |
|
23 |
<exclusions> |
|
24 |
<exclusion> |
|
25 |
<groupId>eu.dnetlib</groupId> |
|
26 |
<artifactId>dnet-hadoop-commons</artifactId> |
|
27 |
</exclusion> |
|
28 |
</exclusions> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>eu.dnetlib</groupId> |
|
32 |
<artifactId>dnet-index-client</artifactId> |
|
33 |
<version>[2.3.4,3.0.0)</version> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>junit</groupId> |
|
37 |
<artifactId>junit</artifactId> |
|
38 |
<version>${junit.version}</version> |
|
39 |
<scope>test</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>io.springfox</groupId> |
|
43 |
<artifactId>springfox-swagger2</artifactId> |
|
44 |
<version>${springfox-version}</version> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.mockito</groupId> |
|
48 |
<artifactId>mockito-core</artifactId> |
|
49 |
<version>1.9.5</version> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.apache.velocity</groupId> |
|
53 |
<artifactId>velocity</artifactId> |
|
54 |
<version>1.7</version> |
|
55 |
<exclusions> |
|
56 |
<exclusion> |
|
57 |
<artifactId>antlr</artifactId> |
|
58 |
<groupId>antlr</groupId> |
|
59 |
</exclusion> |
|
60 |
</exclusions> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.apache.velocity</groupId> |
|
64 |
<artifactId>velocity-tools</artifactId> |
|
65 |
<version>2.0</version> |
|
66 |
<exclusions> |
|
67 |
<exclusion> |
|
68 |
<artifactId>antlr</artifactId> |
|
69 |
<groupId>antlr</groupId> |
|
70 |
</exclusion> |
|
71 |
</exclusions> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.springframework</groupId> |
|
75 |
<artifactId>spring-context-support</artifactId> |
|
76 |
<version>${spring.version}</version> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>com.fasterxml.jackson.core</groupId> |
|
80 |
<artifactId>jackson-annotations</artifactId> |
|
81 |
<version>2.9.4</version> |
|
82 |
</dependency> |
|
83 |
</dependencies> |
|
84 |
|
|
85 |
<properties> |
|
86 |
<springfox-version>2.5.0</springfox-version> |
|
87 |
</properties> |
|
88 |
</project> |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/OpenAIRESubmitterUtils.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import java.io.StringWriter; |
|
4 |
import java.util.*; |
|
5 |
import java.util.stream.Collectors; |
|
6 |
import java.util.stream.Collectors; |
|
7 |
import java.util.stream.Stream; |
|
8 |
|
|
9 |
import com.google.common.base.Function; |
|
10 |
import com.google.common.collect.Lists; |
|
11 |
import com.google.common.collect.Sets; |
|
12 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
13 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
14 |
import eu.dnetlib.miscutils.functional.hash.Hashing; |
|
15 |
import eu.dnetlib.openaire.directindex.objects.DatasourceEntry; |
|
16 |
import eu.dnetlib.openaire.directindex.objects.ZenodoContextList; |
|
17 |
import org.apache.commons.lang.StringUtils; |
|
18 |
import org.springframework.web.client.RestClientException; |
|
19 |
import org.springframework.web.client.RestTemplate; |
|
20 |
|
|
21 |
/** |
|
22 |
* Created by michele on 15/01/16. |
|
23 |
*/ |
|
24 |
public class OpenAIRESubmitterUtils { |
|
25 |
|
|
26 |
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(OpenAIRESubmitterUtils.class); |
|
27 |
private static final String ZENODO_COMMUNITY = "zenodo.org/communities/"; |
|
28 |
private String community_api; |
|
29 |
|
|
30 |
public OpenAIRESubmitterUtils(String community_api) { |
|
31 |
this.community_api = community_api; |
|
32 |
} |
|
33 |
|
|
34 |
public Map<String, String> calculateProjectInfo(final String link) { |
|
35 |
final Map<String, String> info = new HashMap<String, String>(); |
|
36 |
final String[] arr = link.split("/"); |
|
37 |
// info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble |
|
38 |
|
|
39 |
if (arr.length > 4) { |
|
40 |
final String acronym = arr.length > 7 ? arr[7] : ""; |
|
41 |
final String title = arr.length > 6 ? StringUtils.isNotBlank(arr[6]) ? arr[6] : acronym : ""; |
|
42 |
final String jurisdiction = arr.length > 5 ? arr[5] : ""; |
|
43 |
final String funderId = calculateFunderId(arr[2], arr[3]); |
|
44 |
final String funderShortName = fixFunderShortName(arr[2]); |
|
45 |
final String fundingName = fixFundingName(funderShortName, arr[3]); |
|
46 |
info.put("id", calculateProjectId(arr[2], arr[3], arr[4])); |
|
47 |
info.put("funderShortName", fixFunderShortName(arr[2])); |
|
48 |
info.put("fundingName", fundingName); |
|
49 |
info.put("code", unescape(arr[4])); |
|
50 |
info.put("jurisdiction", jurisdiction); |
|
51 |
info.put("title", title); |
|
52 |
info.put("acronym", acronym); |
|
53 |
info.put("funderId", funderId); |
|
54 |
info.put("funderName", calculateFunderName(arr[2])); |
|
55 |
if (StringUtils.isNotBlank(arr[3])) info.put("fundingId", funderId + "::" + fundingName); |
|
56 |
} |
|
57 |
return info; |
|
58 |
} |
|
59 |
|
|
60 |
//TODO: remove me when Zenodo ingests the good UKRI projects |
|
61 |
protected String fixFunderShortName(final String funderShortName) { |
|
62 |
switch (funderShortName) { |
|
63 |
case "RCUK": |
|
64 |
return "UKRI"; |
|
65 |
default: |
|
66 |
return funderShortName; |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
protected String calculateFunderPrefix(final String funderShortName, final String funding) { |
|
71 |
switch (funderShortName.toLowerCase()) { |
|
72 |
case "conicyt": |
|
73 |
return "conicytf____::"; |
|
74 |
case "dfg": |
|
75 |
return "dfgf________::"; |
|
76 |
case "ec": |
|
77 |
if (funding.equalsIgnoreCase("fp7")) { |
|
78 |
return "corda_______::"; |
|
79 |
} else { |
|
80 |
return "corda__h2020::"; |
|
81 |
} |
|
82 |
case "eea": |
|
83 |
return "euenvagency_::"; |
|
84 |
case "hrzz": |
|
85 |
case "mzos": |
|
86 |
return "irb_hr______::"; |
|
87 |
case "tara": |
|
88 |
return "taraexp_____::"; |
|
89 |
case "tubitak": |
|
90 |
return "tubitakf____::"; |
|
91 |
case "rcuk": |
|
92 |
return "ukri________::"; |
|
93 |
default: |
|
94 |
String prefix = funderShortName.toLowerCase(); |
|
95 |
//ensure we have 12 chars |
|
96 |
while (prefix.length() < 12) prefix += "_"; |
|
97 |
return prefix + "::"; |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
protected String calculateProjectId(final String funderShortName, final String funding, final String code) { |
|
102 |
final String suffix = Hashing.md5(unescape(code)); |
|
103 |
final String funderPrefix = calculateFunderPrefix(funderShortName, funding); |
|
104 |
return funderPrefix + suffix; |
|
105 |
} |
|
106 |
|
|
107 |
private String unescape(String code) { |
|
108 |
return code.replace( "%2F", "/"); |
|
109 |
} |
|
110 |
|
|
111 |
protected String calculateFunderId(final String funderShortName, final String funding) { |
|
112 |
switch (funderShortName.toLowerCase()) { |
|
113 |
case "ec": |
|
114 |
return "ec__________::EC"; |
|
115 |
default: |
|
116 |
String fixedFunderShortName = fixFunderShortName(funderShortName); |
|
117 |
String prefix = calculateFunderPrefix(fixedFunderShortName, funding); |
|
118 |
return prefix + fixedFunderShortName.toUpperCase(); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
|
|
123 |
protected String calculateFunderName(final String funderShortName) { |
|
124 |
|
|
125 |
switch (funderShortName.toLowerCase()) { |
|
126 |
case "aff": |
|
127 |
case "aka": |
|
128 |
return "Academy of Finland"; |
|
129 |
case "anr": |
|
130 |
return "French National Research Agency (ANR)"; |
|
131 |
case "arc": |
|
132 |
return "Australian Research Council (ARC)"; |
|
133 |
case "cihr": |
|
134 |
return "Canadian Institutes of Health Research"; |
|
135 |
case "conicyt": |
|
136 |
return "Comisión Nacional de Investigación Científica y Tecnológica"; |
|
137 |
case "dfg": |
|
138 |
return "Deutsche Forschungsgemeinschaft"; |
|
139 |
case "ec": |
|
140 |
return "European Commission"; |
|
141 |
case "eea": |
|
142 |
return "European Environment Agency"; |
|
143 |
case "fct": |
|
144 |
return "Fundação para a Ciência e a Tecnologia, I.P."; |
|
145 |
case "fwf": |
|
146 |
return "Austrian Science Fund (FWF)"; |
|
147 |
case "gsrt": |
|
148 |
return "General Secretariat of Research and Technology (GSRT)"; |
|
149 |
case "hrzz": |
|
150 |
return "Croatian Science Foundation (CSF)"; |
|
151 |
case "innoviris": |
|
152 |
return "INNOVIRIS"; |
|
153 |
case "mestd": |
|
154 |
return "Ministry of Education, Science and Technological Development of Republic of Serbia"; |
|
155 |
case "miur": |
|
156 |
return "Ministero dell'Istruzione dell'Università e della Ricerca"; |
|
157 |
case "mzos": |
|
158 |
return "Ministry of Science, Education and Sports of the Republic of Croatia (MSES)"; |
|
159 |
case "nhmrc": |
|
160 |
return "National Health and Medical Research Council (NHMRC)"; |
|
161 |
case "nih": |
|
162 |
return "National Institutes of Health"; |
|
163 |
case "nsf": |
|
164 |
return "National Science Foundation"; |
|
165 |
case "nserc": |
|
166 |
return "Natural Sciences and Engineering Research Council of Canada"; |
|
167 |
case "nwo": |
|
168 |
return "Netherlands Organisation for Scientific Research (NWO)"; |
|
169 |
case "rcuk": |
|
170 |
case "ukri": |
|
171 |
return "UK Research and Innovation"; |
|
172 |
case "rif": |
|
173 |
case "rpf": |
|
174 |
return "Research and Innovation Foundation"; |
|
175 |
case "rsf": |
|
176 |
return "Russian Science Foundation"; |
|
177 |
case "sfi": |
|
178 |
return "Science Foundation Ireland"; |
|
179 |
case "sgov": |
|
180 |
return "Gobierno de España"; |
|
181 |
case "snsf": |
|
182 |
return "Swiss National Science Foundation"; |
|
183 |
case "sshrc": |
|
184 |
return "Social Sciences and Humanities Research Council"; |
|
185 |
case "tara": |
|
186 |
return "Tara Expeditions Foundation"; |
|
187 |
case "tubitak": |
|
188 |
return "Türkiye Bilimsel ve Teknolojik Araştırma Kurumu"; |
|
189 |
case "wt": |
|
190 |
return "Wellcome Trust"; |
|
191 |
default: |
|
192 |
log.error("Funder short name '" + funderShortName + "' not managed"); |
|
193 |
return ""; |
|
194 |
} |
|
195 |
} |
|
196 |
|
|
197 |
protected String fixFundingName(final String funderShortName, final String fundingName){ |
|
198 |
switch(funderShortName){ |
|
199 |
case "EC": |
|
200 |
if(fundingName.toLowerCase().startsWith("horizon 2020")) return "H2020"; |
|
201 |
default: return fundingName; |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
public Collection<String> translateZenodoCommunity(final String community) { |
|
206 |
if (community.contains(ZENODO_COMMUNITY)) { |
|
207 |
String context = community.substring(community.lastIndexOf("/") + 1); |
|
208 |
RestTemplate rt = new RestTemplate(); |
|
209 |
try { |
|
210 |
return new HashSet<>(rt.getForObject(community_api + context + "/openairecommunities", ZenodoContextList.class) |
|
211 |
.getOpenAirecommunitylist()); |
|
212 |
} catch (RestClientException rce) { |
|
213 |
log.error("Unable to get object for " + community_api + context + "/openairecommunities"); |
|
214 |
log.error(rce.getMessage()); |
|
215 |
return new HashSet<>(); |
|
216 |
} |
|
217 |
} else return Sets.newHashSet(community); |
|
218 |
} |
|
219 |
|
|
220 |
private ContextInfo createContextInfo(final String[] arr, final int pos, Map<String, String> labelMap) { |
|
221 |
final StringWriter id = new StringWriter(); |
|
222 |
id.write(arr[0]); |
|
223 |
for (int i = 0; i < pos; i++) { |
|
224 |
id.write("::"); |
|
225 |
id.write(arr[i + 1]); |
|
226 |
} |
|
227 |
final String label = labelMap.get(id.toString()); |
|
228 |
final String elem = (pos == 0) ? "context" : (pos == 1) ? "category" : "concept"; |
|
229 |
final ContextInfo info = new ContextInfo(elem, id.toString(), label); |
|
230 |
if ((pos + 1) < arr.length) { |
|
231 |
info.getChildren().add(createContextInfo(arr, pos + 1, labelMap)); |
|
232 |
} |
|
233 |
return info; |
|
234 |
} |
|
235 |
|
|
236 |
public List<ContextInfo> processContexts(final List<String> zenodoCommunities, final Map<String, String> labelMap) { |
|
237 |
return zenodoCommunities.stream().map(c -> translateZenodoCommunity(c)) |
|
238 |
.flatMap(coll -> coll.stream()) |
|
239 |
.map(ctx -> createContextInfo(ctx.split("::"), 0, labelMap)) |
|
240 |
.filter(info -> StringUtils.isNotBlank(info.getLabel())) |
|
241 |
.collect(Collectors.toList()); |
|
242 |
} |
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
public class ContextInfo { |
|
247 |
|
|
248 |
private String elem; |
|
249 |
private String id; |
|
250 |
private String label; |
|
251 |
private List<ContextInfo> children = new ArrayList<ContextInfo>(); |
|
252 |
|
|
253 |
public ContextInfo(final String elem, |
|
254 |
final String id, final String label) { |
|
255 |
this.elem = elem; |
|
256 |
this.id = id; |
|
257 |
this.label = label; |
|
258 |
} |
|
259 |
|
|
260 |
public String getElem() { |
|
261 |
return elem; |
|
262 |
} |
|
263 |
|
|
264 |
public void setElem(final String elem) { |
|
265 |
this.elem = elem; |
|
266 |
} |
|
267 |
|
|
268 |
public String getId() { |
|
269 |
return id; |
|
270 |
} |
|
271 |
|
|
272 |
public void setId(final String id) { |
|
273 |
this.id = id; |
|
274 |
} |
|
275 |
|
|
276 |
public List<ContextInfo> getChildren() { |
|
277 |
return children; |
|
278 |
} |
|
279 |
|
|
280 |
public void setChildren(final List<ContextInfo> children) { |
|
281 |
this.children = children; |
|
282 |
} |
|
283 |
|
|
284 |
public boolean isRoot() { |
|
285 |
return elem.equals("context"); |
|
286 |
} |
|
287 |
|
|
288 |
public String getLabel() { |
|
289 |
return label; |
|
290 |
} |
|
291 |
|
|
292 |
public void setLabel(String label) { |
|
293 |
this.label = label; |
|
294 |
} |
|
295 |
} |
|
296 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_openaireId.json | ||
---|---|---|
1 |
{ |
|
2 |
"openaireId":"dedup_wf_001::ab42e8116f4ae3c4021fb7c643a8167a", |
|
3 |
"originalId": "ORIG_ID_TEST", |
|
4 |
"type": "publication", |
|
5 |
"title": "TEST TITLE", |
|
6 |
"authors": [ |
|
7 |
"Michele Artini", |
|
8 |
"Claudio Atzori", |
|
9 |
"Alessia Bardi" |
|
10 |
], |
|
11 |
"publisher": "Test publisher", |
|
12 |
"description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION", |
|
13 |
"language": "ita", |
|
14 |
"pids": [ |
|
15 |
{ |
|
16 |
"type": "doi", |
|
17 |
"value": "10.000/xyz-123" |
|
18 |
}, |
|
19 |
{ |
|
20 |
"type": "oai", |
|
21 |
"value": "oai:1234" |
|
22 |
} |
|
23 |
], |
|
24 |
"accessRightCode": "EMBARGO", |
|
25 |
"licenseCode": "OPEN", |
|
26 |
"embargoEndDate": "2018-02-02", |
|
27 |
"resourceType": "0001", |
|
28 |
"url": "http://test.it/xyz", |
|
29 |
"collectedFromId": "opendoar____::2659", |
|
30 |
"hostedById": "opendoar____::2659", |
|
31 |
"linksToProjects": [ |
|
32 |
"info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus", |
|
33 |
"info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble" |
|
34 |
], |
|
35 |
"contexts": [ |
|
36 |
"egi::classification::natsc::math::pure", |
|
37 |
"egi::classification::natsc::math::stats" |
|
38 |
] |
|
39 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/OpenaireResultSubmitter.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import java.text.SimpleDateFormat; |
|
4 |
import java.util.Date; |
|
5 |
import javax.annotation.Resource; |
|
6 |
|
|
7 |
import com.google.gson.Gson; |
|
8 |
import eu.dnetlib.common.rmi.DNetRestDocumentation; |
|
9 |
import eu.dnetlib.data.index.CloudIndexClientException; |
|
10 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
11 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
12 |
import eu.dnetlib.functionality.index.solr.feed.StreamingInputDocumentFactory; |
|
13 |
import eu.dnetlib.miscutils.functional.UnaryFunction; |
|
14 |
import eu.dnetlib.openaire.directindex.objects.ResultEntry; |
|
15 |
import eu.dnetlib.openaire.directindex.objects.ResultEntryToOaf; |
|
16 |
import eu.dnetlib.openaire.directindex.utils.OafToIndexRecordFactory; |
|
17 |
import org.apache.commons.lang.exception.ExceptionUtils; |
|
18 |
import org.apache.commons.logging.Log; |
|
19 |
import org.apache.commons.logging.LogFactory; |
|
20 |
import org.apache.solr.client.solrj.impl.CloudSolrClient; |
|
21 |
import org.apache.solr.common.SolrInputDocument; |
|
22 |
import org.apache.velocity.app.VelocityEngine; |
|
23 |
import org.springframework.beans.factory.annotation.Autowired; |
|
24 |
import org.springframework.beans.factory.annotation.Value; |
|
25 |
import org.springframework.http.HttpStatus; |
|
26 |
import org.springframework.stereotype.Controller; |
|
27 |
import org.springframework.web.bind.annotation.*; |
|
28 |
|
|
29 |
/** |
|
30 |
* Created by michele on 11/11/15. |
|
31 |
*/ |
|
32 |
@Controller |
|
33 |
@DNetRestDocumentation |
|
34 |
public class OpenaireResultSubmitter { |
|
35 |
|
|
36 |
private static final Log log = LogFactory.getLog(OpenaireResultSubmitter.class); |
|
37 |
|
|
38 |
@Value(value = "${openaire.api.community}") |
|
39 |
private String community_api; |
|
40 |
|
|
41 |
@Value(value = "oaf.schema.location") |
|
42 |
private String oafSchemaLocation; |
|
43 |
|
|
44 |
@Resource |
|
45 |
private UniqueServiceLocator serviceLocator; |
|
46 |
|
|
47 |
@Resource |
|
48 |
private OafToIndexRecordFactory oafToIndexRecordFactory; |
|
49 |
|
|
50 |
@Resource |
|
51 |
private RecentResultsQueue recentResultsQueue; |
|
52 |
|
|
53 |
@Resource(name = "openaireplusApisVelocityEngine") |
|
54 |
private VelocityEngine velocityEngine; |
|
55 |
|
|
56 |
@Resource(name = "indexClientManager") |
|
57 |
private IndexClientManager clientManager; |
|
58 |
|
|
59 |
@Resource(name = "resultSubmitterService") |
|
60 |
private ResultSubmitterService submitterService; |
|
61 |
|
|
62 |
@Autowired |
|
63 |
private IndexDSRetriever indexDSRetriever; |
|
64 |
|
|
65 |
@RequestMapping(value = { "/api/admin/autocommit/active" }, method = RequestMethod.GET) |
|
66 |
public @ResponseBody Boolean getAutocommit() throws DirecIndexApiException { |
|
67 |
return submitterService.isAutocommitactive(); |
|
68 |
} |
|
69 |
|
|
70 |
@RequestMapping(value = { "/api/admin/autocommit/active" }, method = RequestMethod.POST) |
|
71 |
public @ResponseBody Boolean setAutocommit(@RequestParam(value = "active", required = true) final Boolean active) throws DirecIndexApiException { |
|
72 |
submitterService.setAutocommitactive(active); |
|
73 |
log.info(String.format("automatic commit, active '%s', frequency '%s'", submitterService.isAutocommitactive(), submitterService.getCommitfrquency())); |
|
74 |
return submitterService.isAutocommitactive(); |
|
75 |
} |
|
76 |
|
|
77 |
@RequestMapping(value="/api/admin/evictCache", method=RequestMethod.GET) |
|
78 |
@ResponseStatus(value = HttpStatus.OK) |
|
79 |
public void evictCache(){ |
|
80 |
indexDSRetriever.evictCache(); |
|
81 |
} |
|
82 |
|
|
83 |
@Deprecated |
|
84 |
@RequestMapping(value = { "/api/publications/feedJson", "/api/results/feedJson" }, method = RequestMethod.POST) |
|
85 |
public @ResponseBody String feedObjectJson(@RequestParam(value = "json", required = true) final String json, |
|
86 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws DirecIndexApiException { |
|
87 |
log.debug(json); |
|
88 |
final ResultEntry pub = new Gson().fromJson(json, ResultEntry.class); |
|
89 |
return feedObject(pub, commit); |
|
90 |
} |
|
91 |
|
|
92 |
|
|
93 |
@RequestMapping(value = { "/api/results/feedObject" }, method = RequestMethod.POST) |
|
94 |
public @ResponseBody String feedResult(@RequestBody final ResultEntry pub, |
|
95 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) |
|
96 |
throws DirecIndexApiException { |
|
97 |
return feed(pub,commit); |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
@Deprecated |
|
102 |
@RequestMapping(value = { "/api/publications/feedObject" }, method = RequestMethod.POST) |
|
103 |
public @ResponseBody String feedObject(@RequestBody final ResultEntry pub, |
|
104 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) |
|
105 |
throws DirecIndexApiException { |
|
106 |
return feed(pub, commit); |
|
107 |
} |
|
108 |
|
|
109 |
|
|
110 |
@RequestMapping(value = "/api/result/{openaireId}", method = RequestMethod.DELETE) |
|
111 |
public @ResponseBody boolean deleteResultWithOpenaireId( |
|
112 |
@PathVariable(value = "openaireId") final String openaireId, |
|
113 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws DirecIndexApiException { |
|
114 |
|
|
115 |
return deleteResult(openaireId); |
|
116 |
} |
|
117 |
|
|
118 |
@RequestMapping(value = "/api/results", method = RequestMethod.DELETE) |
|
119 |
public @ResponseBody boolean deleteResultWithOriginalId( |
|
120 |
@RequestParam(value = "originalId", required = true) final String originalId, |
|
121 |
@RequestParam(value = "collectedFromId", required = true) final String collectedFromId, |
|
122 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws Exception { |
|
123 |
|
|
124 |
final String openaireId = ResultEntryToOaf.calculateOpenaireId(originalId, collectedFromId, serviceLocator.getService(ISLookUpService.class)); |
|
125 |
return deleteResult(openaireId); |
|
126 |
} |
|
127 |
|
|
128 |
@Deprecated |
|
129 |
@RequestMapping(value = { "/api/publications/deleteObject", "/api/results/delete" }, method = RequestMethod.POST) |
|
130 |
public @ResponseBody boolean deleteResultPost( |
|
131 |
@RequestParam(value = "originalId", required = true) final String originalId, |
|
132 |
@RequestParam(value = "collectedFromId", required = true) final String collectedFromId, |
|
133 |
@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws Exception { |
|
134 |
|
|
135 |
final String openaireId = ResultEntryToOaf.calculateOpenaireId(originalId, collectedFromId, serviceLocator.getService(ISLookUpService.class)); |
|
136 |
return deleteResult(openaireId); |
|
137 |
} |
|
138 |
|
|
139 |
@Deprecated |
|
140 |
private String feed(final ResultEntry pub, final boolean commit) throws DirecIndexApiException { |
|
141 |
return feed(pub); |
|
142 |
} |
|
143 |
|
|
144 |
private String feed(final ResultEntry pub) throws DirecIndexApiException { |
|
145 |
log.debug(pub); |
|
146 |
try { |
|
147 |
ResultEntryToOaf toOaf = new ResultEntryToOaf(community_api); |
|
148 |
final IndexDsInfo info = indexDSRetriever.calculateCurrentIndexDsInfo(); |
|
149 |
final String oafRecord = toOaf.asOafRecord(pub, velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation); |
|
150 |
final SolrInputDocument solrDocument = prepareSolrDocument(oafRecord, info.getIndexDsId(), oafToIndexRecordFactory.newTransformer(info.getFormat())); |
|
151 |
|
|
152 |
clientManager.getClient(info).add(solrDocument); |
|
153 |
recentResultsQueue.add(oafRecord); |
|
154 |
|
|
155 |
return pub.getOpenaireId(); |
|
156 |
} catch (final Throwable e) { |
|
157 |
log.error("Error saving record", e); |
|
158 |
log.debug(pub.toString()); |
|
159 |
throw new DirecIndexApiException("Error adding publication: " + e.getMessage(), e); |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
private SolrInputDocument prepareSolrDocument(String record, String indexDsId, UnaryFunction<String, String> toIndexRecord) throws CloudIndexClientException { |
|
164 |
try { |
|
165 |
StreamingInputDocumentFactory documentFactory = new StreamingInputDocumentFactory(); |
|
166 |
String version = (new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'")).format(new Date()); |
|
167 |
String indexRecord = toIndexRecord.evaluate(record); |
|
168 |
if (log.isDebugEnabled()) { |
|
169 |
log.debug("***************************************\nSubmitting index record:\n" + indexRecord + "\n***************************************\n"); |
|
170 |
} |
|
171 |
|
|
172 |
return documentFactory.parseDocument(version, indexRecord, indexDsId, "dnetResult"); |
|
173 |
} catch (Throwable e) { |
|
174 |
throw new CloudIndexClientException("Error creating solr document", e); |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
private boolean deleteResult(final String openaireId) throws DirecIndexApiException { |
|
179 |
try { |
|
180 |
IndexDsInfo info = indexDSRetriever.calculateCurrentIndexDsInfo(); |
|
181 |
String query = String.format("objidentifier:\"%s\" OR resultdupid:\"%s\"", openaireId, openaireId); |
|
182 |
final CloudSolrClient client = clientManager.getClient(info); |
|
183 |
client.deleteByQuery(info.getColl(), query); |
|
184 |
log.info("Deleted result with id: " + openaireId + " from: " + info.getIndexBaseUrl()); |
|
185 |
|
|
186 |
recentResultsQueue.remove(openaireId); |
|
187 |
return true; |
|
188 |
} catch (Throwable e) { |
|
189 |
throw new DirecIndexApiException("Error deleting publication: " + e.getMessage(), e); |
|
190 |
} |
|
191 |
} |
|
192 |
|
|
193 |
@ExceptionHandler(Exception.class) |
|
194 |
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) |
|
195 |
public @ResponseBody ErrorMessage handleException(final Exception e) { |
|
196 |
log.error("Error in direct index API", e); |
|
197 |
return new ErrorMessage(e); |
|
198 |
} |
|
199 |
|
|
200 |
public class ErrorMessage { |
|
201 |
|
|
202 |
private final String message; |
|
203 |
private final String stacktrace; |
|
204 |
|
|
205 |
public ErrorMessage(final Exception e) { |
|
206 |
this(e.getMessage(), ExceptionUtils.getStackTrace(e)); |
|
207 |
} |
|
208 |
|
|
209 |
public ErrorMessage(final String message, final String stacktrace) { |
|
210 |
this.message = message; |
|
211 |
this.stacktrace = stacktrace; |
|
212 |
} |
|
213 |
|
|
214 |
public String getMessage() { |
|
215 |
return this.message; |
|
216 |
} |
|
217 |
|
|
218 |
public String getStacktrace() { |
|
219 |
return this.stacktrace; |
|
220 |
} |
|
221 |
|
|
222 |
} |
|
223 |
|
|
224 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/RecentResultsQueue.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
import com.mongodb.*; |
|
8 |
import com.mongodb.client.model.IndexOptions; |
|
9 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
10 |
import org.apache.commons.logging.Log; |
|
11 |
import org.apache.commons.logging.LogFactory; |
|
12 |
import org.dom4j.io.SAXReader; |
|
13 |
import org.springframework.beans.factory.annotation.Required; |
|
14 |
|
|
15 |
/** |
|
16 |
* Created by michele on 11/11/15. |
|
17 |
*/ |
|
18 |
public class RecentResultsQueue implements Iterable<String> { |
|
19 |
|
|
20 |
private static final Log log = LogFactory.getLog(RecentResultsQueue.class); |
|
21 |
|
|
22 |
private DB db; |
|
23 |
private String collection; |
|
24 |
|
|
25 |
public void init() { |
|
26 |
if (!db.collectionExists(collection)) { |
|
27 |
log.info(String.format("creating collection %s", collection)); |
|
28 |
db.createCollection(collection, new BasicDBObject()); |
|
29 |
} |
|
30 |
db.getCollection(collection).createIndex(new BasicDBObject("id", 1), new BasicDBObject("background", true)); |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public Iterator<String> iterator() { |
|
35 |
|
|
36 |
final DBCursor cursor = db.getCollection(collection).find(); |
|
37 |
|
|
38 |
return new Iterator<String>() { |
|
39 |
|
|
40 |
@Override |
|
41 |
public boolean hasNext() { |
|
42 |
return cursor.hasNext(); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public String next() { |
|
47 |
final DBObject obj = cursor.next(); |
|
48 |
return ((obj != null) && obj.containsField("record")) ? obj.get("record").toString() : ""; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public void remove() { |
|
53 |
throw new RuntimeException("NOT IMPLEMENTED"); |
|
54 |
} |
|
55 |
}; |
|
56 |
} |
|
57 |
|
|
58 |
synchronized public void add(final String oaf) throws Exception { |
|
59 |
final String id = (new SAXReader()).read(new StringReader(oaf)).valueOf("//*[local-name() = 'objIdentifier']"); |
|
60 |
|
|
61 |
log.info("Saving record " + id + " in db: " + db.getName() + ", coll: " + collection); |
|
62 |
|
|
63 |
final DBCollection coll = db.getCollection(collection); |
|
64 |
final DBObject obj = BasicDBObjectBuilder.start() |
|
65 |
.append("id", id) |
|
66 |
.append("record", oaf) |
|
67 |
.append("date", DateUtils.now()) |
|
68 |
.get(); |
|
69 |
coll.update(new BasicDBObject("id", id), obj, true, false); |
|
70 |
} |
|
71 |
|
|
72 |
public void remove(final List<String> list) { |
|
73 |
final DBCollection coll = db.getCollection(collection); |
|
74 |
for (final String id : list) { |
|
75 |
coll.remove(new BasicDBObject("id", id)); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
public void remove(final String... ids) { |
|
80 |
final DBCollection coll = db.getCollection(collection); |
|
81 |
for (final String id : ids) { |
|
82 |
coll.remove(new BasicDBObject("id", id)); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
public DB getDb() { |
|
87 |
return db; |
|
88 |
} |
|
89 |
|
|
90 |
@Required |
|
91 |
public void setDb(final DB db) { |
|
92 |
this.db = db; |
|
93 |
} |
|
94 |
|
|
95 |
public String getCollection() { |
|
96 |
return collection; |
|
97 |
} |
|
98 |
|
|
99 |
@Required |
|
100 |
public void setCollection(final String collection) { |
|
101 |
this.collection = collection; |
|
102 |
} |
|
103 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_orp.json | ||
---|---|---|
1 |
{ |
|
2 |
"openaireId":"od_______278::d5b39693ac6c2197e8cf48008a982951", |
|
3 |
"originalId": "oai:rudar.ruc.dk:1800/24691", |
|
4 |
"type": "other", |
|
5 |
"title": "Other test record", |
|
6 |
"authors": [ |
|
7 |
"Sloan, Patrick Alexander Raaby", |
|
8 |
"Strange, Gustav Valdemar" |
|
9 |
], |
|
10 |
"publisher": "", |
|
11 |
"description": "This is for testing software", |
|
12 |
"language": "eng", |
|
13 |
"pids": [], |
|
14 |
"licenseCode": "OPEN SOURCE", |
|
15 |
"resourceType": "0000", |
|
16 |
"url": "http://rudar.ruc.dk/handle/1800/24691", |
|
17 |
"collectedFromId": "opendoar____::278", |
|
18 |
"hostedById": "opendoar____::278", |
|
19 |
"linksToProjects": [], |
|
20 |
"contexts": [] |
|
21 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/IndexClientManager.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import eu.dnetlib.functionality.index.utils.ZkServers; |
|
4 |
import org.apache.commons.logging.Log; |
|
5 |
import org.apache.commons.logging.LogFactory; |
|
6 |
import org.apache.solr.client.solrj.impl.CloudSolrClient; |
|
7 |
|
|
8 |
public class IndexClientManager { |
|
9 |
|
|
10 |
private static final Log log = LogFactory.getLog(IndexClientManager.class); |
|
11 |
|
|
12 |
private CloudSolrClient client = null; |
|
13 |
|
|
14 |
public CloudSolrClient getClient(IndexDsInfo info) { |
|
15 |
|
|
16 |
if (client == null) { |
|
17 |
log.info(String.format("Initializing solr client (%s) with collection %s", info.getIndexBaseUrl(), info.getColl())); |
|
18 |
ZkServers zk = ZkServers.newInstance(info.getIndexBaseUrl()); |
|
19 |
CloudSolrClient.Builder builder = new CloudSolrClient.Builder(zk.getHosts(), zk.getChroot()).withParallelUpdates(true); |
|
20 |
client = builder.build(); |
|
21 |
} |
|
22 |
client.setDefaultCollection(info.getColl()); |
|
23 |
return client; |
|
24 |
} |
|
25 |
|
|
26 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/IndexDSRetriever.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
4 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
5 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
6 |
import org.apache.commons.io.IOUtils; |
|
7 |
import org.apache.commons.logging.Log; |
|
8 |
import org.apache.commons.logging.LogFactory; |
|
9 |
import org.springframework.beans.factory.annotation.Value; |
|
10 |
import org.springframework.cache.annotation.CacheEvict; |
|
11 |
import org.springframework.cache.annotation.Cacheable; |
|
12 |
import org.springframework.core.io.ClassPathResource; |
|
13 |
|
|
14 |
import javax.annotation.Resource; |
|
15 |
import java.io.IOException; |
|
16 |
|
|
17 |
public class IndexDSRetriever { |
|
18 |
|
|
19 |
private static final Log log = LogFactory.getLog(IndexDSRetriever.class); |
|
20 |
@Value(value = "${openaire.api.directindex.findSolrIndexUrl.xquery}") |
|
21 |
private ClassPathResource findSolrIndexUrl; |
|
22 |
|
|
23 |
@Value(value = "${openaire.api.directindex.findIndexDsInfo.xquery}") |
|
24 |
private ClassPathResource findIndexDsInfo; |
|
25 |
|
|
26 |
@Resource |
|
27 |
private UniqueServiceLocator serviceLocator; |
|
28 |
|
|
29 |
@Cacheable("indexDsInfo") |
|
30 |
public IndexDsInfo calculateCurrentIndexDsInfo() throws IOException, ISLookUpException { |
|
31 |
|
|
32 |
log.info("Not using cache"); |
|
33 |
|
|
34 |
final String queryUrl = IOUtils.toString(findSolrIndexUrl.getInputStream()); |
|
35 |
final String queryDs = IOUtils.toString(findIndexDsInfo.getInputStream()); |
|
36 |
|
|
37 |
final ISLookUpService lu = serviceLocator.getService(ISLookUpService.class); |
|
38 |
final String indexBaseUrl = lu.getResourceProfileByQuery(queryUrl); |
|
39 |
|
|
40 |
final String idxDs = lu.getResourceProfileByQuery(queryDs); |
|
41 |
|
|
42 |
if (idxDs.isEmpty()) { |
|
43 |
throw new IllegalStateException(queryDs + "\n\nreturned no results, check IS profiles"); |
|
44 |
} |
|
45 |
|
|
46 |
final String[] arr = idxDs.split("@@@"); |
|
47 |
return new IndexDsInfo(indexBaseUrl, arr[0].trim(), arr[1].trim(), arr[2].trim()); |
|
48 |
} |
|
49 |
|
|
50 |
@CacheEvict(value="indexDsInfo", allEntries = true) |
|
51 |
public void evictCache(){ |
|
52 |
log.info("Evicting indexDsInfo cache"); |
|
53 |
} |
|
54 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodoAmpersandEverywhere.json | ||
---|---|---|
1 |
{ |
|
2 |
"authors": [ |
|
3 |
"Conradt, Tobias", |
|
4 |
"& members of the ISIMIP project (original data provision), cf. Hempel et al. 2013, https://doi.org/10.5194/esd-4-219-2013" |
|
5 |
], |
|
6 |
"collectedFromId": "re3data_____::r3d100010468", |
|
7 |
"description": "<p>ISIMIP-2a climate data cutout provided for Sardinia in the framework of SIM4NEXUS & X<\/p>", |
|
8 |
"hostedById": "re3data_____::r3d100010468", |
|
9 |
"licenseCode": "OPEN", |
|
10 |
"linksToProjects": ["info:eu-repo/grantAgreement/EC/H2020/689150//Sustainable Integrated Management FOR the NEXUS of water-land-food-energy-climate for a resource-efficient Europe & beyond/SIM4NEXUS"], |
|
11 |
"originalId": "10.5281/zenodo.1460665", |
|
12 |
"pids": [ |
|
13 |
{ |
|
14 |
"type": "oai", |
|
15 |
"value": "oai:zenodo.org:1460665" |
|
16 |
}, |
|
17 |
{ |
|
18 |
"type": "doi", |
|
19 |
"value": "10.5281/zenodo.1460665" |
|
20 |
} |
|
21 |
], |
|
22 |
"publisher": "Zenodo & Zenodo", |
|
23 |
"resourceType": "0021", |
|
24 |
"title": "sardinia_tasmax_MIROC-ESM-CHEM_rcp4p5_2006-2099_daily.nc4 & the title has && in it", |
|
25 |
"type": "dataset", |
|
26 |
"url": "https://zenodo.org/record/1460665" |
|
27 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/ResultSubmitterService.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import org.apache.commons.logging.Log; |
|
4 |
import org.apache.commons.logging.LogFactory; |
|
5 |
import org.apache.solr.client.solrj.impl.CloudSolrClient; |
|
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
7 |
import org.springframework.beans.factory.annotation.Value; |
|
8 |
|
|
9 |
import javax.annotation.Resource; |
|
10 |
import java.util.concurrent.Executors; |
|
11 |
import java.util.concurrent.ScheduledExecutorService; |
|
12 |
import java.util.concurrent.TimeUnit; |
|
13 |
|
|
14 |
public class ResultSubmitterService { |
|
15 |
|
|
16 |
private static final Log log = LogFactory.getLog(ResultSubmitterService.class); |
|
17 |
|
|
18 |
@Autowired |
|
19 |
private IndexDSRetriever indexDSRetriever; |
|
20 |
|
|
21 |
@Resource(name = "indexClientManager") |
|
22 |
private IndexClientManager clientManager; |
|
23 |
|
|
24 |
/** |
|
25 |
* Autocommit feature activation flag |
|
26 |
*/ |
|
27 |
@Value(value = "${openaire.api.directindex.autocommit.active}") |
|
28 |
private boolean autocommitactive; |
|
29 |
|
|
30 |
/** |
|
31 |
* Autocommit frequency (Seconds) |
|
32 |
*/ |
|
33 |
@Value(value = "${openaire.api.directindex.autocommit.frequency}") |
|
34 |
private long commitfrquency = 60; |
|
35 |
|
|
36 |
private ScheduledExecutorService executor; |
|
37 |
|
|
38 |
public ResultSubmitterService() { |
|
39 |
executor = Executors.newSingleThreadScheduledExecutor(); |
|
40 |
updateCommitSchedule(); |
|
41 |
} |
|
42 |
|
|
43 |
private void updateCommitSchedule() { |
|
44 |
log.info("updating commit schedule"); |
|
45 |
|
|
46 |
executor.scheduleAtFixedRate(() -> { |
|
47 |
if (isAutocommitactive()) { |
|
48 |
try { |
|
49 |
IndexDsInfo info = indexDSRetriever.calculateCurrentIndexDsInfo(); |
|
50 |
CloudSolrClient client = clientManager.getClient(info); |
|
51 |
log.info("performing commit on " + info.getColl()); |
|
52 |
client.commit(); |
|
53 |
} catch (Throwable e) { |
|
54 |
log.error("unable to perform commit", e); |
|
55 |
} |
|
56 |
} |
|
57 |
}, 0, getCommitfrquency(), TimeUnit.SECONDS); |
|
58 |
} |
|
59 |
|
|
60 |
public boolean isAutocommitactive() { |
|
61 |
return autocommitactive; |
|
62 |
} |
|
63 |
|
|
64 |
public synchronized void setAutocommitactive(boolean autocommitactive) { |
|
65 |
this.autocommitactive = autocommitactive; |
|
66 |
} |
|
67 |
|
|
68 |
public long getCommitfrquency() { |
|
69 |
return commitfrquency; |
|
70 |
} |
|
71 |
|
|
72 |
public synchronized void setCommitfrquency(long commitfrquency) { |
|
73 |
this.commitfrquency = commitfrquency; |
|
74 |
} |
|
75 |
|
|
76 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/IndexDsInfo.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
public class IndexDsInfo { |
|
4 |
|
|
5 |
private final String indexBaseUrl; |
|
6 |
private final String indexDsId; |
|
7 |
private final String format; |
|
8 |
private final String coll; |
|
9 |
|
|
10 |
public IndexDsInfo(final String indexBaseUrl, final String indexDsId, final String format, final String coll) { |
|
11 |
this.indexBaseUrl = indexBaseUrl; |
|
12 |
this.indexDsId = indexDsId; |
|
13 |
this.format = format; |
|
14 |
this.coll = coll; |
|
15 |
} |
|
16 |
|
|
17 |
public String getIndexBaseUrl() { |
|
18 |
return indexBaseUrl; |
|
19 |
} |
|
20 |
|
|
21 |
public String getIndexDsId() { |
|
22 |
return indexDsId; |
|
23 |
} |
|
24 |
|
|
25 |
public String getFormat() { |
|
26 |
return format; |
|
27 |
} |
|
28 |
|
|
29 |
public String getColl() { |
|
30 |
return coll; |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public int hashCode() { |
|
35 |
return getColl().hashCode(); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public boolean equals(Object other) { |
|
40 |
if (!(other instanceof IndexDsInfo)) return false; |
|
41 |
|
|
42 |
return getColl().equals(((IndexDsInfo) other).getColl()); |
|
43 |
} |
|
44 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo_problems.json | ||
---|---|---|
1 |
{ |
|
2 |
"authors": ["Milanese, Alessio", "Mende, Daniel", "Zeller, Georg", "Sunagawa, Shinichi"], |
|
3 |
"collectedFromId": "re3data_____::r3d100010468", |
|
4 |
"description": "<p>We simulated ten human gut metagenomic samples to assess the taxonomic quantification accuracy of the mOTUs tool (<a href=\"http: \// motu-tool.org \/\">link</a>). In this directory you can find the metagenomic samples, the gold standard (used to produce them) and the profiles obtained with four metagenomic profiler tools.</p>\\n\\n<p>Check README.txt for more information.</p>", |
|
5 |
"hostedById": "re3data_____::r3d100010468", |
|
6 |
"licenseCode": "OPEN", |
|
7 |
"originalId": "10.5281/zenodo.1473645", |
|
8 |
"pids": [ |
|
9 |
{"type": "oai", "value": "oai:zenodo.org:1473645"}, |
|
10 |
{"type": "doi", "value": "10.5281/zenodo.1473645"} |
|
11 |
], |
|
12 |
"publisher": "Zenodo", |
|
13 |
"resourceType": "0021", |
|
14 |
"title": "Simulated Human gut metagenomic samples to benchmark mOTUs v2", |
|
15 |
"type": "dataset", |
|
16 |
"url": "https://zenodo.org/record/1473645", |
|
17 |
"version": "2" |
|
18 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/api/DirecIndexApiException.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.api; |
|
2 |
|
|
3 |
import eu.dnetlib.common.rmi.RMIException; |
|
4 |
|
|
5 |
public class DirecIndexApiException extends RMIException { |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
*/ |
|
10 |
private static final long serialVersionUID = -3888037031334809448L; |
|
11 |
|
|
12 |
public DirecIndexApiException(final String string) { |
|
13 |
super(string); |
|
14 |
} |
|
15 |
|
|
16 |
public DirecIndexApiException(final String string, final Throwable exception) { |
|
17 |
super(string, exception); |
|
18 |
} |
|
19 |
|
|
20 |
public DirecIndexApiException(final Throwable exception) { |
|
21 |
super(exception); |
|
22 |
} |
|
23 |
|
|
24 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo_community2.json | ||
---|---|---|
1 |
{"authors":["test"], |
|
2 |
"collectedFromId":"re3data_____::r3d100010468", |
|
3 |
"contexts":["https://zenodo.org/communities/oac-ni"], |
|
4 |
"description":"<p>test</p>", |
|
5 |
"hostedById":"re3data_____::r3d100010468", |
|
6 |
"licenseCode":"OPEN", |
|
7 |
"originalId":"oai:zenodo.org:315784", |
|
8 |
"pids":[{"type":"oai","value":"oai:zenodo.org:315784"}, |
|
9 |
{"type":"doi","value":"10.5072/zenodo.315784"}],"resourceType":"0020","title":"test","type":"other","url":"https://zenodo.org/record/315784"} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_zenodo_community.json | ||
---|---|---|
1 |
{"authors": ["Dag Haug", "Marius J\xf8hndal"], |
|
2 |
"collectedFromId": "re3data_____::r3d100010468", |
|
3 |
"contexts": ["https://sandbox.zenodo.org/communities/oac-ni","pippo", "egi"], |
|
4 |
"description": "<p>Official releases of the PROIEL treebank of ancient Indo-European languages</p>", |
|
5 |
"hostedById": "re3data_____::r3d100010468", |
|
6 |
"licenseCode": "OPEN", |
|
7 |
"originalId": "10.5281/zenodo.11003", |
|
8 |
"pids": [{"type": "oai", "value": "oai:zenodo.org:11003"}, |
|
9 |
{"type": "doi", "value": "10.5281/zenodo.11003"}], |
|
10 |
"publisher": "Zenodo", |
|
11 |
"resourceType": "0021", |
|
12 |
"title": "proiel-treebank: 20140723 version", |
|
13 |
"type": "dataset", |
|
14 |
"url": "https://zenodo.org/record/11003"} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/log4j.properties | ||
---|---|---|
1 |
### Root Level ### |
|
2 |
log4j.rootLogger=WARN, CONSOLE |
|
3 |
### Configuration for the CONSOLE appender ### |
|
4 |
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender |
|
5 |
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout |
|
6 |
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %d %c - %m%n |
|
7 |
org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger |
|
8 |
### Application Level ### |
|
9 |
log4j.logger.eu.dnetlib=INFO |
|
10 |
log4j.logger.eu.dnetlib.msro.openaireplus.workflows.nodes.contexts=DEBUG |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/test/resources/eu/dnetlib/openaire/directindex/objects/test_record_with_greek_chars.json | ||
---|---|---|
1 |
{ |
|
2 |
"originalId": "ORIG_ID_12345", |
|
3 |
"title": "TEST TITLE WITH Greek Characters", |
|
4 |
"authors": [ |
|
5 |
"αβγδεζηθικλμ νξοπρσςτυφχψω", |
|
6 |
"ΑΒΓΔΕΖΗΘΙΚΛ ΜΝΞΟΠΡΣΤΥΦΧΨΩ" |
|
7 |
], |
|
8 |
"publisher": "âââââââ", |
|
9 |
"description": "Αν περιμένατε να βρίσκεται εδώ μια σελίδα και δεν υπάρχει, η σελίδα μπορεί να μην εμφανίζεται λόγω καθυστέρησης στην ανανέωση της βάσης δεδομένων, ή μπορεί να έχει διαγραφεί. (Δείτε την γρήγορη διαγραφή σελίδων για πιθανούς λόγους). Μπορείτε να δοκιμάστε την λειτουργία εκκαθάρισης, και να ελέγξετε το αρχείο διαγραφών.", |
|
10 |
"language": "ell", |
|
11 |
"pids": [ |
|
12 |
{ |
|
13 |
"type": "doi", |
|
14 |
"value": "10.000/xyz-123-gr" |
|
15 |
} |
|
16 |
], |
|
17 |
"licenseCode": "EMBARGO", |
|
18 |
"embargoEndDate": "2018-02-02", |
|
19 |
"resourceType": "0001", |
|
20 |
"url": "http://test.it/xyz", |
|
21 |
"collectedFromId": "opendoar____::2659", |
|
22 |
"hostedById": "opendoar____::2367", |
|
23 |
"linksToProjects": [ |
|
24 |
"info:eu-repo/grantAgreement/EC/FP7/123456/EU//Test" |
|
25 |
], |
|
26 |
"contexts": [ |
|
27 |
"egi::classification::natsc::math::stats" |
|
28 |
] |
|
29 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/objects/ResultEntryToOaf.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.objects; |
|
2 |
|
|
3 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
4 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
5 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
6 |
import eu.dnetlib.miscutils.functional.hash.Hashing; |
|
7 |
import eu.dnetlib.miscutils.functional.string.EscapeXml; |
|
8 |
import eu.dnetlib.openaire.directindex.api.DirecIndexApiException; |
|
9 |
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils; |
|
10 |
import org.apache.commons.lang.StringUtils; |
|
11 |
import org.apache.commons.logging.Log; |
|
12 |
import org.apache.commons.logging.LogFactory; |
|
13 |
import org.apache.velocity.app.VelocityEngine; |
|
14 |
import org.springframework.ui.velocity.VelocityEngineUtils; |
|
15 |
|
|
16 |
import java.text.SimpleDateFormat; |
|
17 |
import java.util.Date; |
|
18 |
import java.util.HashMap; |
|
19 |
import java.util.List; |
|
20 |
import java.util.Map; |
|
21 |
import java.util.concurrent.TimeUnit; |
|
22 |
|
|
23 |
public class ResultEntryToOaf { |
|
24 |
|
|
25 |
private static final Log log = LogFactory.getLog(ResultEntryToOaf.class); |
|
26 |
|
|
27 |
private static long last_cache_update = 0; |
|
28 |
private static final Map<String, Map<String, String>> cached_vocabularies = new HashMap<>(); |
|
29 |
private static final Map<String, DatasourceEntry> cached_datasources = new HashMap<>(); |
|
30 |
private static final Map<String, String> cached_contexts = new HashMap<>(); |
|
31 |
|
|
32 |
private OpenAIRESubmitterUtils utils; |
|
33 |
|
|
34 |
public ResultEntryToOaf(final String community_api){ |
|
35 |
utils = new OpenAIRESubmitterUtils(community_api); |
|
36 |
} |
|
37 |
|
|
38 |
public String asOafRecord(final ResultEntry entry, final VelocityEngine ve, |
|
39 |
final ISLookUpService lookupService, |
|
40 |
final String oafSchemaLocation) throws Exception { |
|
41 |
|
|
42 |
if (StringUtils.isBlank(entry.getOriginalId()) |
|
43 |
&& StringUtils |
|
44 |
.isBlank(entry.getOpenaireId())) { throw new DirecIndexApiException("One of the following fields is required: originalId or openaireId"); } |
|
45 |
if (StringUtils.isBlank(entry.getTitle())) { throw new DirecIndexApiException("A required field is missing: title"); } |
|
46 |
if (StringUtils.isBlank(entry.getUrl())) { throw new DirecIndexApiException("A required field is missing: url"); } |
|
47 |
if (StringUtils.isBlank(entry.getLicenseCode()) && StringUtils.isBlank(entry.getAccessRightCode())) { throw new DirecIndexApiException("A required field is missing: accessRightCode"); } |
|
48 |
if (StringUtils.isBlank(entry.getResourceType())) { throw new DirecIndexApiException("A required field is missing: resourceType"); } |
|
49 |
if (StringUtils.isBlank(entry.getCollectedFromId())) { throw new DirecIndexApiException("A required field is missing: collectedFromId"); } |
|
50 |
if (StringUtils.isBlank(entry.getType())) { throw new DirecIndexApiException("A required field is missing: type"); } |
|
51 |
|
|
52 |
final DatasourceEntry collectedFromEntry = getDatasourceInfo(entry.getCollectedFromId(), lookupService); |
|
53 |
final DatasourceEntry hostedByEntry = getDatasourceInfo(entry.getHostedById(), lookupService); |
|
54 |
|
|
55 |
if (StringUtils.isBlank(entry.getOpenaireId())) { |
|
56 |
entry.setOpenaireId(calculateOpenaireId(entry.getOriginalId(), collectedFromEntry)); |
|
57 |
} |
|
58 |
|
|
59 |
if (!entry.getOpenaireId() |
|
60 |
.matches("^\\w{12}::\\w{32}$")) { throw new DirecIndexApiException( |
|
61 |
"Invalid openaireId: " + entry.getOpenaireId() + " - regex ^\\w{12}::\\w{32}$ not matched"); } |
|
62 |
|
|
63 |
|
|
64 |
final List<OpenAIRESubmitterUtils.ContextInfo> contextInfos = utils.processContexts(entry.getContexts(), getContexts(lookupService)); |
|
65 |
|
|
66 |
final Map<String, Object> model = new HashMap<>(); |
|
67 |
model.put("esc", new EscapeXml()); |
|
68 |
model.put("util",utils); |
|
69 |
model.put("pub", entry); |
|
70 |
model.put("objIdentifier", entry.getOpenaireId()); |
|
71 |
model.put("oafSchemaLocation", oafSchemaLocation); |
|
72 |
model.put("resultTypes", getVocabulary("dnet:result_typologies", lookupService)); |
|
73 |
model.put("rights", getVocabulary("dnet:access_modes", lookupService)); |
|
74 |
model.put("resourceTypes", getVocabulary("dnet:publication_resource", lookupService)); |
|
75 |
model.put("pidTypes", getVocabulary("dnet:pid_types", lookupService)); |
|
76 |
model.put("languages", getVocabulary("dnet:languages", lookupService)); |
|
77 |
model.put("contexts", getContexts(lookupService)); |
|
78 |
model.put("contextInfo",contextInfos); |
|
79 |
model.put("dateOfCollection", new SimpleDateFormat("yyyy-MM-dd\'T\'hh:mm:ss\'Z\'").format(new Date())); |
|
80 |
model.put("collectedFrom", collectedFromEntry); |
|
81 |
model.put("hostedBy", hostedByEntry); |
|
82 |
|
|
83 |
return VelocityEngineUtils.mergeTemplateIntoString(ve, "/eu/dnetlib/openaire/directindex/indexRecord.xml.vm", "UTF-8", model); |
|
84 |
} |
|
85 |
|
|
86 |
private synchronized static DatasourceEntry getDatasourceInfo(final String dsId, final ISLookUpService lookupService) throws ISLookUpException { |
|
87 |
if (StringUtils |
|
88 |
.isBlank(dsId)) { return new DatasourceEntry("openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18", "Unknown Repository", "unknown_____"); } |
|
89 |
|
|
90 |
if (!cached_datasources.containsKey(dsId)) { |
|
91 |
final String query = |
|
92 |
"collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')//CONFIGURATION[./DATASOURCE_ORIGINAL_ID='" + dsId |
|
93 |
+ "']/concat(./OFFICIAL_NAME, ' @@@ ', .//FIELD/value[../key='NamespacePrefix'])"; |
|
94 |
final String s = lookupService.getResourceProfileByQuery(query); |
|
95 |
final String[] arr = s.split("@@@"); |
|
96 |
|
|
97 |
final DatasourceEntry ds = new DatasourceEntry(dsId, arr[0].trim(), arr[1].trim()); |
|
98 |
|
|
99 |
if (StringUtils.isBlank(ds.getName()) || StringUtils.isBlank(ds.getPrefix())) { |
|
100 |
log.error("Invalid datasource id: " + dsId); |
|
101 |
throw new ISLookUpException("Invalid datasource id: " + dsId); |
|
102 |
} else { |
|
103 |
cached_datasources.put(dsId, ds); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
return cached_datasources.get(dsId); |
|
108 |
|
|
109 |
} |
|
110 |
|
|
111 |
private synchronized static Map<String, String> getVocabulary(final String voc, final ISLookUpService lookupService) throws ISLookUpException { |
|
112 |
|
|
113 |
if (DateUtils.now() - last_cache_update < TimeUnit.MINUTES.toMillis(15) && cached_vocabularies.containsKey(voc)) { |
|
114 |
return cached_vocabularies.get(voc); |
|
115 |
} else { |
|
116 |
final String query = "collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType')[.//VOCABULARY_NAME/@code='" + voc |
|
117 |
+ "']//TERM/concat(@code, ' @@@ ', @english_name)"; |
|
118 |
|
|
119 |
final Map<String, String> map = new HashMap<>(); |
|
120 |
for (final String s : lookupService.quickSearchProfile(query)) { |
|
121 |
final String[] arr = s.split("@@@"); |
|
122 |
map.put(arr[0].trim(), arr[1].trim()); |
|
123 |
} |
|
124 |
|
|
125 |
cached_vocabularies.put(voc, map); |
|
126 |
|
|
127 |
last_cache_update = DateUtils.now(); |
|
128 |
|
|
129 |
return map; |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
private synchronized static Map<String, String> getContexts(final ISLookUpService lookupService) throws ISLookUpException { |
|
134 |
if (DateUtils.now() - last_cache_update > TimeUnit.MINUTES.toMillis(15) || cached_contexts.isEmpty()) { |
|
135 |
final String query = |
|
136 |
"collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')[.//context/@type='community' or .//context/@type='ri']//*[name()='context' or name()='category' or name()='concept']/concat(@id, ' @@@ ', @label)"; |
|
137 |
|
|
138 |
cached_contexts.clear(); |
|
139 |
for (final String s : lookupService.quickSearchProfile(query)) { |
|
140 |
final String[] arr = s.split("@@@"); |
|
141 |
cached_contexts.put(arr[0].trim(), arr[1].trim()); |
|
142 |
} |
|
143 |
last_cache_update = DateUtils.now(); |
|
144 |
} |
|
145 |
return cached_contexts; |
|
146 |
} |
|
147 |
|
|
148 |
private static String calculateOpenaireId(final String originalId, final DatasourceEntry collectedFromEntry) { |
|
149 |
return collectedFromEntry.getPrefix() + "::" + Hashing.md5(originalId); |
|
150 |
} |
|
151 |
|
|
152 |
public static String calculateOpenaireId(final String originalId, final String collectedFromId, final ISLookUpService lookupService) |
|
153 |
throws ISLookUpException { |
|
154 |
return calculateOpenaireId(originalId, getDatasourceInfo(collectedFromId, lookupService)); |
|
155 |
} |
|
156 |
public OpenAIRESubmitterUtils getUtils() { |
|
157 |
return utils; |
|
158 |
} |
|
159 |
|
|
160 |
public void setUtils(OpenAIRESubmitterUtils utils) { |
|
161 |
this.utils = utils; |
|
162 |
} |
|
163 |
} |
modules/dnet-directindex-api/tags/dnet-directindex-api-2.3.5/src/main/java/eu/dnetlib/openaire/directindex/objects/ResultEntry.java | ||
---|---|---|
1 |
package eu.dnetlib.openaire.directindex.objects; |
|
2 |
|
|
3 |
import com.google.gson.Gson; |
|
4 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
|
5 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
|
6 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
7 |
import eu.dnetlib.miscutils.functional.hash.Hashing; |
|
8 |
import eu.dnetlib.miscutils.functional.string.EscapeXml; |
|
9 |
import eu.dnetlib.openaire.directindex.api.DirecIndexApiException; |
|
10 |
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils; |
|
11 |
import io.swagger.annotations.ApiModelProperty; |
|
12 |
import org.apache.commons.lang.StringUtils; |
|
13 |
import org.apache.commons.logging.Log; |
|
14 |
import org.apache.commons.logging.LogFactory; |
|
15 |
import org.apache.velocity.app.VelocityEngine; |
|
16 |
import org.springframework.ui.velocity.VelocityEngineUtils; |
|
17 |
|
|
18 |
import java.text.SimpleDateFormat; |
|
19 |
import java.util.*; |
|
20 |
import java.util.concurrent.TimeUnit; |
|
21 |
|
|
22 |
/** |
|
23 |
* Created by michele on 02/12/15. |
|
24 |
*/ |
|
25 |
public class ResultEntry { |
|
26 |
|
|
27 |
|
|
28 |
private String openaireId; |
|
29 |
private String originalId; |
|
30 |
private String title; |
|
31 |
private List<String> authors = new ArrayList<>(); |
|
32 |
private String publisher; |
|
33 |
private String description; |
|
34 |
private String language; |
|
35 |
private List<PidEntry> pids = new ArrayList<>(); |
|
36 |
/** |
|
37 |
* @Deprecated: use accessRightCode |
|
38 |
*/ |
|
39 |
@Deprecated |
|
40 |
private String licenseCode; |
|
41 |
private String accessRightCode; |
|
42 |
private String embargoEndDate; |
|
43 |
/** |
|
44 |
* One of publication, dataset, software, other. Default value is publication. |
|
45 |
*/ |
|
46 |
private String type = "publication"; |
|
47 |
private String resourceType; |
|
48 |
private String url; |
|
49 |
private String collectedFromId; |
|
50 |
private String hostedById; |
|
51 |
|
|
52 |
// String according to the EGI context profile, example: egi::classification::natsc::math |
|
53 |
private List<String> contexts = new ArrayList<>(); |
|
54 |
|
|
55 |
// String according to openaire guidelines: |
|
56 |
// info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym] |
|
57 |
private List<String> linksToProjects = new ArrayList<>(); |
|
58 |
|
|
59 |
private static final Log log = LogFactory.getLog(ResultEntry.class); |
|
60 |
|
|
61 |
public ResultEntry() {} |
|
62 |
|
|
63 |
public String getOpenaireId() { |
|
64 |
return openaireId; |
|
65 |
} |
|
66 |
|
|
67 |
public void setOpenaireId(final String openaireId) { |
|
68 |
this.openaireId = openaireId; |
|
69 |
} |
|
70 |
|
|
71 |
public String getOriginalId() { |
|
72 |
return originalId; |
|
73 |
} |
|
74 |
|
|
75 |
public void setOriginalId(final String originalId) { |
|
76 |
this.originalId = originalId; |
|
77 |
} |
|
78 |
|
|
79 |
@ApiModelProperty(required = true) |
|
80 |
public String getTitle() { |
|
81 |
return title; |
|
82 |
} |
|
83 |
|
|
84 |
public void setTitle(final String title) { |
|
85 |
this.title = title; |
|
86 |
} |
|
87 |
|
|
88 |
public List<String> getAuthors() { |
|
89 |
return authors; |
|
90 |
} |
|
91 |
|
|
92 |
public void setAuthors(final List<String> authors) { |
|
93 |
this.authors = authors; |
|
94 |
} |
|
95 |
|
|
96 |
public String getPublisher() { |
|
97 |
return publisher; |
|
98 |
} |
|
99 |
|
|
100 |
public void setPublisher(final String publisher) { |
|
101 |
this.publisher = publisher; |
|
102 |
} |
|
103 |
|
|
104 |
public String getDescription() { |
|
105 |
return description; |
|
106 |
} |
|
107 |
|
|
108 |
public void setDescription(final String description) { |
|
109 |
this.description = description; |
|
110 |
} |
|
111 |
|
|
112 |
@ApiModelProperty(value = "ISO Alpha-3 code. E.g. 'eng', 'ita'") |
|
113 |
public String getLanguage() { |
|
114 |
return language; |
|
115 |
} |
|
116 |
|
|
117 |
public void setLanguage(final String language) { |
|
118 |
this.language = language; |
|
119 |
} |
|
120 |
|
|
121 |
public List<PidEntry> getPids() { |
|
122 |
return pids; |
|
123 |
} |
|
124 |
|
|
125 |
public void setPids(final List<PidEntry> pids) { |
|
126 |
this.pids = pids; |
|
127 |
} |
|
128 |
|
|
129 |
@Deprecated |
|
130 |
@ApiModelProperty(required = false, allowableValues = "OPEN, CLOSED, RESTRICTED, EMBARGO, UNKNOWN, OTHER, OPEN SOURCE") |
|
131 |
public String getLicenseCode() { |
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-directindex-api-2.3.5