Project

General

Profile

« Previous | Next » 

Revision 49615

[maven-release-plugin] copy for tag dnet-openaire-exporter-1.0.10

View differences:

modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
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/xsd/maven-4.0.0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<groupId>eu.dnetlib</groupId>
5
	<artifactId>dnet-openaire-exporter</artifactId>
6
	<version>1.0.10</version>
7
	<scm>
8
	  <developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10</developerConnection>
9
      <url>https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10</url>
10
  </scm>
11
	<ciManagement>
12
		<system>jenkins</system>
13
		<url>https://jenkins-dnet.d4science.org/view/DNet45/job/DSL45_dnet-openaire-exporter/</url>
14
	</ciManagement>
15
	<distributionManagement>
16
		<repository>
17
			<id>dnet45-releases</id>
18
			<name>D-Net 45 Releases</name>
19
			<url>http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-releases</url>
20
			<layout>default</layout>
21
		</repository>
22
	</distributionManagement>
23

  
24
	<!-- Inherit defaults from Spring Boot -->
25
	<parent>
26
		<groupId>org.springframework.boot</groupId>
27
		<artifactId>spring-boot-starter-parent</artifactId>
28
		<version>1.5.2.RELEASE</version>
29
	</parent>
30

  
31
	<repositories>
32
		<repository>
33
			<id>dnet-deps</id>
34
			<name>dnet-dependencies</name>
35
			<url>http://maven.research-infrastructures.eu/nexus/content/repositories/dnet-deps</url>
36
			<layout>default</layout>
37
		</repository>
38
		<repository>
39
			<id>dnet45-releases</id>
40
			<name>D-Net 45 Releases</name>
41
			<url>http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-releases</url>
42
			<layout>default</layout>
43
			<snapshots>
44
				<enabled>true</enabled>
45
			</snapshots>
46
		</repository>
47
		<repository>
48
			<id>dnet45-snapshots</id>
49
			<name>D-Net 45 Snapshots</name>
50
			<url>http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots</url>
51
			<layout>default</layout>
52
			<snapshots>
53
				<enabled>true</enabled>
54
			</snapshots>
55
		</repository>
56
	</repositories>
57
	<profiles>
58
		<profile>
59
			<id>java8-doclint-disabled</id>
60
			<activation>
61
				<jdk>[1.8,)</jdk>
62
			</activation>
63
			<properties>
64
				<javadoc.opts>-Xdoclint:none</javadoc.opts>
65
			</properties>
66
		</profile>
67
	</profiles>
68

  
69
	<!-- Add typical dependencies for a web application -->
70
	<dependencies>
71

  
72
		<dependency>
73
			<groupId>eu.dnetlib</groupId>
74
			<artifactId>cnr-rmi-api</artifactId>
75
			<version>[2.0.0,3.0.0)</version>
76
		</dependency>
77
		<dependency>
78
			<groupId>org.apache.cxf</groupId>
79
			<artifactId>cxf-rt-transports-http</artifactId>
80
			<version>3.1.5</version>
81
		</dependency>
82
		<dependency>
83
			<groupId>eu.dnetlib</groupId>
84
			<artifactId>cnr-service-common</artifactId>
85
			<version>[2.0.0,3.0.0)</version>
86
		</dependency>
87
		<dependency>
88
			<groupId>eu.dnetlib</groupId>
89
			<artifactId>dnet-openaireplus-mapping-utils</artifactId>
90
			<version>[6.0.0,7.0.0)</version>
91
			<exclusions>
92
				<exclusion>
93
					<groupId>com.sun.jersey</groupId>
94
					<artifactId>jersey-client</artifactId>
95
				</exclusion>
96
				<exclusion>
97
					<groupId>eu.dnetlib</groupId>
98
					<artifactId>dnet-hadoop-commons</artifactId>
99
				</exclusion>
100
			</exclusions>
101
		</dependency>
102
		<dependency>
103
			<groupId>org.apache.solr</groupId>
104
			<artifactId>solr-solrj</artifactId>
105
			<version>${apache.solr.version}</version>
106
		</dependency>
107

  
108
		<dependency>
109
			<groupId>org.springframework.boot</groupId>
110
			<artifactId>spring-boot-starter-web</artifactId>
111
		</dependency>
112

  
113
		<dependency>
114
			<groupId>org.springframework.boot</groupId>
115
			<artifactId>spring-boot-starter-jdbc</artifactId>
116
		</dependency>
117
		<dependency>
118
			<groupId>org.springframework.boot</groupId>
119
			<artifactId>spring-boot-starter-data-jpa</artifactId>
120
		</dependency>
121
		<dependency>
122
			<groupId>org.postgresql</groupId>
123
			<artifactId>postgresql</artifactId>
124
			<version>42.0.0</version>
125
		</dependency>
126
		<dependency>
127
			<groupId>org.apache.commons</groupId>
128
			<artifactId>commons-dbcp2</artifactId>
129
			<version>2.1</version>
130
		</dependency>
131
		<!-- TODO: migrate to stringtemplate4 -->
132
		<!--<dependency>-->
133
		<!--<groupId>org.antlr</groupId>-->
134
		<!--<artifactId>stringtemplate</artifactId>-->
135
		<!--<version>4.0.2</version>-->
136
		<!--</dependency>-->
137
		<dependency>
138
			<groupId>org.antlr</groupId>
139
			<artifactId>stringtemplate</artifactId>
140
			<version>3.2.1</version>
141
		</dependency>
142
		<dependency>
143
			<groupId>org.apache.commons</groupId>
144
			<artifactId>commons-lang3</artifactId>
145
			<version>3.5</version>
146
		</dependency>
147
		<dependency>
148
			<groupId>commons-io</groupId>
149
			<artifactId>commons-io</artifactId>
150
			<version>2.5</version>
151
		</dependency>
152

  
153
		<dependency>
154
			<groupId>com.google.guava</groupId>
155
			<artifactId>guava</artifactId>
156
			<version>21.0</version>
157
		</dependency>
158
		<dependency>
159
			<groupId>net.sf.supercsv</groupId>
160
			<artifactId>super-csv</artifactId>
161
			<version>2.4.0</version>
162
		</dependency>
163
		<dependency>
164
			<groupId>com.google.code.gson</groupId>
165
			<artifactId>gson</artifactId>
166
			<version>2.8.0</version>
167
		</dependency>
168

  
169

  
170
		<dependency>
171
			<groupId>com.fasterxml.jackson.datatype</groupId>
172
			<artifactId>jackson-datatype-joda</artifactId>
173
			<version>2.6.6</version>
174
		</dependency>
175
		<dependency>
176
			<groupId>joda-time</groupId>
177
			<artifactId>joda-time</artifactId>
178
			<version>2.8.2</version>
179
		</dependency>
180

  
181
		<dependency>
182
			<groupId>org.mongodb</groupId>
183
			<artifactId>mongo-java-driver</artifactId>
184
			<version>${mongodb.driver.version}</version>
185
		</dependency>
186

  
187
		<dependency>
188
			<groupId>io.springfox</groupId>
189
			<artifactId>springfox-swagger2</artifactId>
190
			<version>${springfox-version}</version>
191
		</dependency>
192
		<dependency>
193
			<groupId>io.springfox</groupId>
194
			<artifactId>springfox-swagger-ui</artifactId>
195
			<version>${springfox-version}</version>
196
		</dependency>
197

  
198
		<!-- for /metrics and /health controllers -->
199
		<dependency>
200
			<groupId>io.prometheus</groupId>
201
			<artifactId>simpleclient_spring_boot</artifactId>
202
			<version>${prometheus.version}</version>
203
			<exclusions>
204
				<exclusion>
205
					<groupId>org.springframework</groupId>
206
					<artifactId>spring-web</artifactId>
207
				</exclusion>
208
			</exclusions>
209
		</dependency>
210
		<dependency>
211
			<groupId>io.prometheus</groupId>
212
			<artifactId>simpleclient_hotspot</artifactId>
213
			<version>${prometheus.version}</version>
214
		</dependency>
215
		<dependency>
216
			<groupId>io.prometheus</groupId>
217
			<artifactId>simpleclient_servlet</artifactId>
218
			<version>${prometheus.version}</version>
219
		</dependency>
220

  
221
		<dependency>
222
			<groupId>org.springframework.boot</groupId>
223
			<artifactId>spring-boot-starter-test</artifactId>
224
			<scope>test</scope>
225
		</dependency>
226

  
227
	</dependencies>
228

  
229
	<build>
230
		<plugins>
231
			<plugin>
232
				<groupId>org.springframework.boot</groupId>
233
				<artifactId>spring-boot-maven-plugin</artifactId>
234
				<configuration>
235
					<executable>true</executable>
236
				</configuration>
237
			</plugin>
238
		</plugins>
239
	</build>
240

  
241
	<properties>
242
		<java.version>1.8</java.version>
243
		<apache.solr.version>6.6.0</apache.solr.version>
244
		<mongodb.driver.version>3.4.2</mongodb.driver.version>
245
		<springfox-version>2.7.0</springfox-version>
246
		<prometheus.version>0.0.25</prometheus.version>
247
		<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
248
	</properties>
249
</project>
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/datasource/repository/DatasourceApiRepository.java
1
package eu.dnetlib.openaire.exporter.datasource.repository;
2

  
3
import eu.dnetlib.openaire.exporter.model.datasource.DatasourceApi;
4
import org.springframework.data.domain.Pageable;
5
import org.springframework.data.domain.Slice;
6
import org.springframework.data.jpa.repository.JpaRepository;
7
import org.springframework.data.jpa.repository.Query;
8

  
9
/**
10
 * Repository that support search over datasource and api attributes, one row per api.
11
 */
12
public interface DatasourceApiRepository extends JpaRepository<DatasourceApi, String> {
13

  
14
	@Query("select distinct da.baseurl from DatasourceApi da where lower(contactemail) = lower(?1) and managed = ?2")
15
	Slice<String> searchBaseUrlManaged(String contactemail, boolean managed, Pageable pageable);
16

  
17
	@Query("select distinct da.baseurl from DatasourceApi da where lower(contactemail) = lower(?1)")
18
	Slice<String> searchBaseUrl(String contactemail, Pageable pageable);
19
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/CountryTerm.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import javax.persistence.Entity;
4
import javax.persistence.Id;
5
import javax.persistence.Table;
6

  
7
import com.fasterxml.jackson.annotation.JsonAutoDetect;
8
import eu.dnetlib.openaire.exporter.model.datasource.BrowseTerm;
9
import io.swagger.annotations.ApiModel;
10

  
11
/**
12
 * Created by claudio on 20/04/2017.
13
 */
14
@Entity
15
@Table(name = "browse_countries")
16
@ApiModel
17
@JsonAutoDetect
18
public class CountryTerm implements Comparable<CountryTerm>, BrowseTerm {
19

  
20
	@Id
21
	private String term;
22
	private long total;
23

  
24
	@Override
25
	public String getTerm() {
26
		return term;
27
	}
28

  
29
	public void setTerm(final String term) {
30
		this.term = term;
31
	}
32

  
33
	@Override
34
	public long getTotal() {
35
		return total;
36
	}
37

  
38
	public void setTotal(final long total) {
39
		this.total = total;
40
	}
41

  
42
	@Override
43
	public int compareTo(final CountryTerm o) {
44
		return getTerm().compareTo(o.getTerm());
45
	}
46

  
47
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/Datasource.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import java.sql.Date;
4
import java.util.Set;
5

  
6
import javax.persistence.*;
7

  
8
import io.swagger.annotations.ApiModel;
9

  
10
/**
11
 * Datasource
12
 */
13
@Entity
14
@Table(name = "dsm_datasources")
15
@ApiModel(value = "Datasource model", description = "provides datasource details")
16
public class Datasource {
17

  
18
	@Id
19
	private String id = null;
20
	private String officialname = null;
21
	private String englishname = null;
22
	private String websiteurl = null;
23
	private String logourl = null;
24
	private String contactemail = null;
25
	private Double latitude;
26
	private Double longitude;
27
	private String timezone = null;
28

  
29
	@Column(name = "namespaceprefix", columnDefinition = "bpchar(12)")
30
	private String namespaceprefix;
31

  
32
	private String languages;
33

  
34
	private String od_contenttypes;
35
	private String collectedfrom = null;
36
	private Date dateofvalidation = null;
37
	private String typology = null;
38
	private String provenanceaction;
39
	private Date dateofcollection;
40
	private String platform;
41

  
42
	@Column(name = "activationid")
43
	private String activationId;
44
	private String description = null;
45

  
46
	private Date releasestartdate;
47
	private Date releaseenddate;
48
	private String missionstatementurl;
49
	private Boolean dataprovider;
50
	private Boolean serviceprovider;
51

  
52
	private String databaseaccesstype;
53
	private String datauploadtype;
54
	private String databaseaccessrestriction;
55
	private String datauploadrestriction;
56

  
57
	private Boolean versioning;
58
	private String citationguidelineurl;
59
	private String qualitymanagementkind;
60
	private String pidsystems;
61

  
62
	private String certificates;
63
	private String aggregator;
64

  
65
	private String issn = null;
66
	private String eissn = null;
67
	private String lissn = null;
68

  
69
	private String registeredby = null;
70

  
71
	private String subjects;
72

  
73
	private Boolean managed;
74

  
75
	/*
76
	@JsonIgnore
77
	@OneToMany(mappedBy = "datasource", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
78
	private Set<Api> api = null;
79
	*/
80

  
81
	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
82
	@JoinTable(
83
			name = "dsm_datasource_organization",
84
			joinColumns = @JoinColumn(name="datasource"),
85
			inverseJoinColumns = @JoinColumn(name="organization"))
86
	private Set<Organization> organizations;
87

  
88
	@ManyToMany(
89
			cascade = { CascadeType.PERSIST, CascadeType.MERGE },
90
	        fetch = FetchType.LAZY )
91
	@JoinTable(
92
			name = "dsm_datasourcepids",
93
			joinColumns = @JoinColumn(name = "datasource"),
94
			inverseJoinColumns = @JoinColumn(name="pid"))
95
	private Set<Identity> identities;
96

  
97
	public Datasource() {}
98

  
99
	public String getId() {
100
		return id;
101
	}
102

  
103
	public String getOfficialname() {
104
		return officialname;
105
	}
106

  
107
	public String getEnglishname() {
108
		return englishname;
109
	}
110

  
111
	public String getWebsiteurl() {
112
		return websiteurl;
113
	}
114

  
115
	public String getLogourl() {
116
		return logourl;
117
	}
118

  
119
	public String getContactemail() {
120
		return contactemail;
121
	}
122

  
123
	public Double getLatitude() {
124
		return latitude;
125
	}
126

  
127
	public Double getLongitude() {
128
		return longitude;
129
	}
130

  
131
	public String getTimezone() {
132
		return timezone;
133
	}
134

  
135
	public String getNamespaceprefix() {
136
		return namespaceprefix;
137
	}
138

  
139
	public String getLanguages() {
140
		return languages;
141
	}
142

  
143
	public String getOd_contenttypes() {
144
		return od_contenttypes;
145
	}
146

  
147
	public String getCollectedfrom() {
148
		return collectedfrom;
149
	}
150

  
151
	public Date getDateofvalidation() {
152
		return dateofvalidation;
153
	}
154

  
155
	public String getTypology() {
156
		return typology;
157
	}
158

  
159
	public String getProvenanceaction() {
160
		return provenanceaction;
161
	}
162

  
163
	public Date getDateofcollection() {
164
		return dateofcollection;
165
	}
166

  
167
	public String getPlatform() {
168
		return platform;
169
	}
170

  
171
	public String getActivationId() {
172
		return activationId;
173
	}
174

  
175
	public String getDescription() {
176
		return description;
177
	}
178

  
179
	public Date getReleasestartdate() {
180
		return releasestartdate;
181
	}
182

  
183
	public Date getReleaseenddate() {
184
		return releaseenddate;
185
	}
186

  
187
	public String getMissionstatementurl() {
188
		return missionstatementurl;
189
	}
190

  
191
	public Boolean isDataprovider() {
192
		return dataprovider;
193
	}
194

  
195
	public Boolean isServiceprovider() {
196
		return serviceprovider;
197
	}
198

  
199
	public String getDatabaseaccesstype() {
200
		return databaseaccesstype;
201
	}
202

  
203
	public String getDatauploadtype() {
204
		return datauploadtype;
205
	}
206

  
207
	public String getDatabaseaccessrestriction() {
208
		return databaseaccessrestriction;
209
	}
210

  
211
	public String getDatauploadrestriction() {
212
		return datauploadrestriction;
213
	}
214

  
215
	public Boolean isVersioning() {
216
		return versioning;
217
	}
218

  
219
	public String getCitationguidelineurl() {
220
		return citationguidelineurl;
221
	}
222

  
223
	public String getQualitymanagementkind() {
224
		return qualitymanagementkind;
225
	}
226

  
227
	public String getPidsystems() {
228
		return pidsystems;
229
	}
230

  
231
	public String getCertificates() {
232
		return certificates;
233
	}
234

  
235
	public String getAggregator() {
236
		return aggregator;
237
	}
238

  
239
	public String getIssn() {
240
		return issn;
241
	}
242

  
243
	public String getEissn() {
244
		return eissn;
245
	}
246

  
247
	public String getLissn() {
248
		return lissn;
249
	}
250

  
251
	public String getRegisteredby() {
252
		return registeredby;
253
	}
254

  
255
	public String getSubjects() {
256
		return subjects;
257
	}
258

  
259
	public Boolean isManaged() {
260
		return managed;
261
	}
262

  
263
	public Set<Organization> getOrganizations() {
264
		return organizations;
265
	}
266

  
267
	public Set<Identity> getIdentities() {
268
		return identities;
269
	}
270

  
271
	public Datasource setId(final String id) {
272
		this.id = id;
273
		return this;
274
	}
275

  
276
	public Datasource setOfficialname(final String officialname) {
277
		this.officialname = officialname;
278
		return this;
279
	}
280

  
281
	public Datasource setEnglishname(final String englishname) {
282
		this.englishname = englishname;
283
		return this;
284
	}
285

  
286
	public Datasource setWebsiteurl(final String websiteurl) {
287
		this.websiteurl = websiteurl;
288
		return this;
289
	}
290

  
291
	public Datasource setLogourl(final String logourl) {
292
		this.logourl = logourl;
293
		return this;
294
	}
295

  
296
	public Datasource setContactemail(final String contactemail) {
297
		this.contactemail = contactemail;
298
		return this;
299
	}
300

  
301
	public Datasource setLatitude(final Double latitude) {
302
		this.latitude = latitude;
303
		return this;
304
	}
305

  
306
	public Datasource setLongitude(final Double longitude) {
307
		this.longitude = longitude;
308
		return this;
309
	}
310

  
311
	public Datasource setTimezone(final String timezone) {
312
		this.timezone = timezone;
313
		return this;
314
	}
315

  
316
	public Datasource setNamespaceprefix(final String namespaceprefix) {
317
		this.namespaceprefix = namespaceprefix;
318
		return this;
319
	}
320

  
321
	public Datasource setLanguages(final String languages) {
322
		this.languages = languages;
323
		return this;
324
	}
325

  
326
	public Datasource setOd_contenttypes(final String od_contenttypes) {
327
		this.od_contenttypes = od_contenttypes;
328
		return this;
329
	}
330

  
331
	public Datasource setCollectedfrom(final String collectedfrom) {
332
		this.collectedfrom = collectedfrom;
333
		return this;
334
	}
335

  
336
	public Datasource setDateofvalidation(final Date dateofvalidation) {
337
		this.dateofvalidation = dateofvalidation;
338
		return this;
339
	}
340

  
341
	public Datasource setTypology(final String typology) {
342
		this.typology = typology;
343
		return this;
344
	}
345

  
346
	public Datasource setProvenanceaction(final String provenanceaction) {
347
		this.provenanceaction = provenanceaction;
348
		return this;
349
	}
350

  
351
	public Datasource setDateofcollection(final Date dateofcollection) {
352
		this.dateofcollection = dateofcollection;
353
		return this;
354
	}
355

  
356
	public Datasource setPlatform(final String platform) {
357
		this.platform = platform;
358
		return this;
359
	}
360

  
361
	public Datasource setActivationId(final String activationId) {
362
		this.activationId = activationId;
363
		return this;
364
	}
365

  
366
	public Datasource setDescription(final String description) {
367
		this.description = description;
368
		return this;
369
	}
370

  
371
	public Datasource setReleasestartdate(final Date releasestartdate) {
372
		this.releasestartdate = releasestartdate;
373
		return this;
374
	}
375

  
376
	public Datasource setReleaseenddate(final Date releaseenddate) {
377
		this.releaseenddate = releaseenddate;
378
		return this;
379
	}
380

  
381
	public Datasource setMissionstatementurl(final String missionstatementurl) {
382
		this.missionstatementurl = missionstatementurl;
383
		return this;
384
	}
385

  
386
	public Datasource setDataprovider(final Boolean dataprovider) {
387
		this.dataprovider = dataprovider;
388
		return this;
389
	}
390

  
391
	public Datasource setServiceprovider(final Boolean serviceprovider) {
392
		this.serviceprovider = serviceprovider;
393
		return this;
394
	}
395

  
396
	public Datasource setDatabaseaccesstype(final String databaseaccesstype) {
397
		this.databaseaccesstype = databaseaccesstype;
398
		return this;
399
	}
400

  
401
	public Datasource setDatauploadtype(final String datauploadtype) {
402
		this.datauploadtype = datauploadtype;
403
		return this;
404
	}
405

  
406
	public Datasource setDatabaseaccessrestriction(final String databaseaccessrestriction) {
407
		this.databaseaccessrestriction = databaseaccessrestriction;
408
		return this;
409
	}
410

  
411
	public Datasource setDatauploadrestriction(final String datauploadrestriction) {
412
		this.datauploadrestriction = datauploadrestriction;
413
		return this;
414
	}
415

  
416
	public Datasource setVersioning(final Boolean versioning) {
417
		this.versioning = versioning;
418
		return this;
419
	}
420

  
421
	public Datasource setCitationguidelineurl(final String citationguidelineurl) {
422
		this.citationguidelineurl = citationguidelineurl;
423
		return this;
424
	}
425

  
426
	public Datasource setQualitymanagementkind(final String qualitymanagementkind) {
427
		this.qualitymanagementkind = qualitymanagementkind;
428
		return this;
429
	}
430

  
431
	public Datasource setPidsystems(final String pidsystems) {
432
		this.pidsystems = pidsystems;
433
		return this;
434
	}
435

  
436
	public Datasource setCertificates(final String certificates) {
437
		this.certificates = certificates;
438
		return this;
439
	}
440

  
441
	public Datasource setAggregator(final String aggregator) {
442
		this.aggregator = aggregator;
443
		return this;
444
	}
445

  
446
	public Datasource setIssn(final String issn) {
447
		this.issn = issn;
448
		return this;
449
	}
450

  
451
	public Datasource setEissn(final String eissn) {
452
		this.eissn = eissn;
453
		return this;
454
	}
455

  
456
	public Datasource setLissn(final String lissn) {
457
		this.lissn = lissn;
458
		return this;
459
	}
460

  
461
	public Datasource setRegisteredby(final String registeredby) {
462
		this.registeredby = registeredby;
463
		return this;
464
	}
465

  
466
	public Datasource setSubjects(final String subjects) {
467
		this.subjects = subjects;
468
		return this;
469
	}
470

  
471
	public Datasource setManaged(final Boolean managed) {
472
		this.managed = managed;
473
		return this;
474
	}
475

  
476
	public Datasource setOrganizations(final Set<Organization> organizations) {
477
		this.organizations = organizations;
478
		return this;
479
	}
480

  
481
	public Datasource setIdentities(final Set<Identity> identities) {
482
		this.identities = identities;
483
		return this;
484
	}
485

  
486
}
487

  
0 488

  
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/CollectionMode.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
import com.fasterxml.jackson.annotation.JsonAutoDetect;
4
import io.swagger.annotations.ApiModel;
5

  
6
/**
7
 * Created by claudio on 12/09/16.
8
 */
9
@ApiModel
10
@JsonAutoDetect
11
public enum CollectionMode {
12
	REFRESH, INCREMENTAL
13
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/CollectionInfo.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
import com.fasterxml.jackson.annotation.JsonAutoDetect;
4
import io.swagger.annotations.ApiModel;
5

  
6
/**
7
 * Created by claudio on 29/11/2016.
8
 */
9
@ApiModel
10
@JsonAutoDetect
11
public class CollectionInfo extends AggregationInfo {
12

  
13
	private CollectionMode collectionMode;
14

  
15
	public CollectionMode getCollectionMode() {
16
		return collectionMode;
17
	}
18

  
19
	public void setCollectionMode(final CollectionMode collectionMode) {
20
		this.collectionMode = collectionMode;
21
	}
22

  
23
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/AggregationStage.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
/**
4
 * Created by claudio on 12/09/16.
5
 */
6
public enum AggregationStage {
7
	COLLECT, TRANSFORM;
8

  
9
	public static AggregationStage parse(final String s) {
10
		switch (s) {
11
		case "collect":
12
		case "collection":
13
		case "COLLECT":
14
		case "COLLECTION":
15
			return AggregationStage.COLLECT;
16
		case "transform":
17
		case "transformation":
18
		case "TRANSFORM":
19
		case "TRANSFORMATION":
20
			return AggregationStage.TRANSFORM;
21

  
22
		}
23
		throw new IllegalArgumentException("invalid AggregationStage: " + s);
24
	}
25
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/ApiParamKey.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import java.io.Serializable;
4
import java.util.Objects;
5
import javax.persistence.Embeddable;
6
import javax.persistence.JoinColumn;
7
import javax.persistence.ManyToOne;
8

  
9
import com.fasterxml.jackson.annotation.JsonIgnore;
10
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
11
import com.google.common.collect.ComparisonChain;
12

  
13
/**
14
 * Created by claudio on 13/04/2017.
15
 */
16
@Embeddable
17
@JsonIgnoreProperties(ignoreUnknown = true)
18
public class ApiParamKey implements Serializable {
19

  
20
	@JsonIgnore
21
	@ManyToOne
22
	@JoinColumn(name = "api")
23
	private Api api = null;
24

  
25
	private String param;
26

  
27
	public ApiParamKey() {}
28

  
29
	public String getParam() {
30
		return param;
31
	}
32

  
33
	public ApiParamKey setParam(final String param) {
34
		this.param = param;
35
		return this;
36
	}
37

  
38
	public Api getApi() {
39
		return api;
40
	}
41

  
42
	public void setApi(final Api api) {
43
		this.api = api;
44
	}
45

  
46
	@Override
47
	public int hashCode() {
48
		return Objects.hash(getParam(), getApi().getId());
49
	}
50

  
51
	@Override
52
	public boolean equals(final Object o) {
53
		if (this == o) {
54
			return true;
55
		}
56
		if (o == null || getClass() != o.getClass()) {
57
			return false;
58
		}
59
		ApiParamKey apk = (ApiParamKey) o;
60
		return ComparisonChain.start()
61
				.compare(getParam(), apk.getParam())
62
				.compare(getApi(), apk.getApi())
63
				.result() == 0;
64
	}
65

  
66

  
67
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/ActivationTerm.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import javax.persistence.Entity;
4
import javax.persistence.Id;
5
import javax.persistence.Table;
6

  
7
import com.fasterxml.jackson.annotation.JsonAutoDetect;
8
import eu.dnetlib.openaire.exporter.model.datasource.BrowseTerm;
9
import io.swagger.annotations.ApiModel;
10

  
11
/**
12
 * Created by claudio on 20/04/2017.
13
 */
14
@Entity
15
@Table(name = "browse_activation")
16
@ApiModel
17
@JsonAutoDetect
18
public class ActivationTerm implements Comparable<ActivationTerm>, BrowseTerm {
19

  
20
	@Id
21
	private String term;
22
	private long total;
23

  
24
	@Override
25
	public String getTerm() {
26
		return term;
27
	}
28

  
29
	public void setTerm(final String term) {
30
		this.term = term;
31
	}
32

  
33
	@Override
34
	public long getTotal() {
35
		return total;
36
	}
37

  
38
	public void setTotal(final long total) {
39
		this.total = total;
40
	}
41

  
42
	@Override
43
	public int compareTo(final ActivationTerm o) {
44
		return getTerm().compareTo(o.getTerm());
45
	}
46

  
47
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/Identity.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import javax.persistence.Entity;
4
import javax.persistence.Id;
5
import javax.persistence.Table;
6

  
7
import io.swagger.annotations.ApiModel;
8

  
9
/**
10
 * Created by claudio on 13/04/2017.
11
 */
12

  
13
@Entity
14
@Table(name = "dsm_identities")
15
//@JsonAutoDetect
16
@ApiModel(value = "Identities model", description = "provides identity details")
17
public class Identity {
18

  
19
	@Id
20
	private String pid;
21

  
22
	private String issuertype;
23

  
24
	public Identity() {}
25

  
26
	public String getPid() {
27
		return this.pid;
28
	}
29

  
30
	public String getIssuertype() {
31
		return this.issuertype;
32
	}
33

  
34
	public Identity setPid(final String pid) {
35
		this.pid = pid;
36
		return this;
37
	}
38

  
39
	public Identity setIssuertype(final String issuertype) {
40
		this.issuertype = issuertype;
41
		return this;
42
	}
43

  
44
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/project/ProjectApi.java
1
package eu.dnetlib.openaire.exporter.model.project;
2

  
3
import java.sql.Date;
4
import java.util.ArrayList;
5
import javax.persistence.Entity;
6
import javax.persistence.Id;
7
import javax.persistence.Table;
8

  
9
import com.fasterxml.jackson.annotation.JsonIgnore;
10
import com.google.common.base.Splitter;
11
import com.google.common.collect.Lists;
12
import io.swagger.annotations.ApiModel;
13
import org.apache.commons.lang3.StringUtils;
14

  
15
/**
16
 * Created by claudio on 20/09/16.
17
 */
18
@Entity
19
@Table(name = "projects_api")
20
@ApiModel(value = "Project api model", description = "Project api model used by DSpace and Eprints exporter")
21
public class ProjectApi {
22

  
23
	public static final String INFO_EU_REPO_GRANT_AGREEMENT = "info:eu-repo/grantAgreement/";
24

  
25
	@Id
26
	@JsonIgnore
27
	private String id;
28

  
29
	private String code;
30
	private String acronym;
31
	private String title;
32
	private String funder;
33
	private String jurisdiction;
34
	private Date startdate;
35
	private Date enddate;
36
	private String fundingpathid;
37

  
38
	public ProjectApi() { }
39

  
40
	public String getIdnamespace() {
41
		String res = INFO_EU_REPO_GRANT_AGREEMENT + getFunder()+"/";
42
		final String fundingProgram = asFundingProgram(getFundingpathid());
43
		if (StringUtils.isNotBlank(fundingProgram)) {
44
			res += fundingProgram;
45
		}
46
		res += "/" + escapeCode(getCode());
47
		if (StringUtils.isNotBlank(getJurisdiction())) {
48
			res += "/" + getJurisdiction();
49
		}
50
		return res;
51
	}
52

  
53
	public String getListLabel() {
54
		return String.format("for:value:component:_%s_project_id", asFunder(getFunder()));
55
	}
56

  
57
	private String asFunder(final String legalshortname) {
58
		switch (legalshortname.toLowerCase()) {
59
		case "ec":
60
			return asFundingProgram(getFundingpathid()).toLowerCase();
61
		default:
62
			return legalshortname.toLowerCase();
63
		}
64
	}
65

  
66
	private String escapeCode(final String code) {
67
		return replaceSlash(code);
68
	}
69

  
70
	private String asFundingProgram(final String fundingpathid) {
71
		final ArrayList<String> strings = Lists.newArrayList(Splitter.on("::").split(fundingpathid));
72
		if(strings.size() <= 1) throw new IllegalStateException("Unexpected funding id: "+fundingpathid);
73
		if(strings.size() == 2) return "";
74
		else return replaceSlash(strings.get(2));
75
	}
76

  
77
	private String replaceSlash(final String s) {
78
		return s.replaceAll("/", "%2F");
79
	}
80

  
81
	public String getId() {
82
		return id;
83
	}
84

  
85
	public void setId(final String id) {
86
		this.id = id;
87
	}
88

  
89
	public String getCode() {
90
		return code;
91
	}
92

  
93
	public void setCode(final String code) {
94
		this.code = code;
95
	}
96

  
97
	public String getAcronym() {
98
		return acronym;
99
	}
100

  
101
	public void setAcronym(final String acronym) {
102
		this.acronym = acronym;
103
	}
104

  
105
	public String getTitle() {
106
		return title;
107
	}
108

  
109
	public void setTitle(final String title) {
110
		this.title = title;
111
	}
112

  
113
	public String getFunder() {
114
		return funder;
115
	}
116

  
117
	public void setFunder(final String funder) {
118
		this.funder = funder;
119
	}
120

  
121
	public String getJurisdiction() {
122
		return jurisdiction;
123
	}
124

  
125
	public void setJurisdiction(final String jurisdiction) {
126
		this.jurisdiction = jurisdiction;
127
	}
128

  
129
	public Date getStartdate() {
130
		return startdate;
131
	}
132

  
133
	public void setStartdate(final Date startdate) {
134
		this.startdate = startdate;
135
	}
136

  
137
	public Date getEnddate() {
138
		return enddate;
139
	}
140

  
141
	public void setEnddate(final Date enddate) {
142
		this.enddate = enddate;
143
	}
144

  
145
	public String getFundingpathid() {
146
		return fundingpathid;
147
	}
148

  
149
	public void setFundingpathid(final String fundingpathid) {
150
		this.fundingpathid = fundingpathid;
151
	}
152
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/Apiparam.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import javax.persistence.EmbeddedId;
4
import javax.persistence.Entity;
5
import javax.persistence.Table;
6

  
7
import com.fasterxml.jackson.annotation.JsonIgnore;
8
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
9
import io.swagger.annotations.ApiModel;
10

  
11
/**
12
 * Created by claudio on 13/04/2017.
13
 */
14
@Entity
15
@Table(name = "dsm_apiparams")
16
@JsonIgnoreProperties(ignoreUnknown = true)
17
@ApiModel(value = "Datasource Api params model", description = "describes the datasource api params")
18
public class Apiparam {
19

  
20
	@JsonIgnore
21
	@EmbeddedId
22
	private ApiParamKey id;
23

  
24
	private String value;
25

  
26
	public Apiparam() {}
27

  
28
	public ApiParamKey getId() {
29
		return id;
30
	}
31

  
32
	public Apiparam setId(final ApiParamKey id) {
33
		this.id = id;
34
		return this;
35
	}
36

  
37
	public String getValue() {
38
		return value;
39
	}
40

  
41
	public void setValue(final String value) {
42
		this.value = value;
43
	}
44

  
45
	public String getParam() {
46
		return id.getParam();
47
	}
48

  
49
	public void setParam(final String param) {
50
		getId().setParam(param);
51
	}
52

  
53
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/TypologyTerm.java
1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2

  
3
import javax.persistence.Entity;
4
import javax.persistence.Id;
5
import javax.persistence.Table;
6

  
7
import com.fasterxml.jackson.annotation.JsonAutoDetect;
8
import eu.dnetlib.openaire.exporter.model.datasource.BrowseTerm;
9
import io.swagger.annotations.ApiModel;
10

  
11
/**
12
 * Created by claudio on 20/04/2017.
13
 */
14
@Entity
15
@Table(name = "browse_typologies")
16
@ApiModel
17
@JsonAutoDetect
18
public class TypologyTerm implements Comparable<TypologyTerm>, BrowseTerm {
19

  
20
	@Id
21
	private String term;
22
	private long total;
23

  
24
	@Override
25
	public String getTerm() {
26
		return term;
27
	}
28

  
29
	public void setTerm(final String term) {
30
		this.term = term;
31
	}
32

  
33
	@Override
34
	public long getTotal() {
35
		return total;
36
	}
37

  
38
	public void setTotal(final long total) {
39
		this.total = total;
40
	}
41

  
42
	@Override
43
	public int compareTo(final TypologyTerm o) {
44
		return getTerm().compareTo(o.getTerm());
45
	}
46

  
47
}
modules/dnet-openaire-exporter/tags/dnet-openaire-exporter-1.0.10/src/main/java/eu/dnetlib/openaire/exporter/project/JdbcApiDao.java
1
package eu.dnetlib.openaire.exporter.project;
2

  
3
import java.io.BufferedOutputStream;
4
import java.io.IOException;
5
import java.io.OutputStream;
6
import java.nio.charset.Charset;
7
import java.sql.*;
8
import java.time.Duration;
9
import java.time.LocalDateTime;
10
import java.util.Arrays;
11
import java.util.List;
12
import java.util.Map;
13
import java.util.Set;
14
import java.util.zip.GZIPOutputStream;
15
import java.util.zip.ZipEntry;
16
import java.util.zip.ZipOutputStream;
17

  
18
import com.google.common.base.Joiner;
19
import com.google.common.base.Splitter;
20
import com.google.common.collect.Maps;
21
import com.google.common.collect.Sets;
22
import eu.dnetlib.OpenaireExporterConfig;
23
import eu.dnetlib.openaire.exporter.model.project.Project;
24
import eu.dnetlib.openaire.exporter.model.project.ProjectDetails;
25
import eu.dnetlib.openaire.exporter.model.project.ProjectTsv;
26
import eu.dnetlib.openaire.exporter.project.repository.ProjectTsvRepository;
27
import org.antlr.stringtemplate.StringTemplate;
28
import org.apache.commons.dbcp2.BasicDataSource;
29
import org.apache.commons.lang3.StringUtils;
30
import org.apache.commons.logging.Log;
31
import org.apache.commons.logging.LogFactory;
32
import org.springframework.beans.factory.annotation.Autowired;
33
import org.springframework.cache.annotation.CacheEvict;
34
import org.springframework.cache.annotation.Cacheable;
35
import org.springframework.stereotype.Component;
36

  
37
/**
38
 * Created by claudio on 20/09/16.
39
 */
40
@Component
41
public class JdbcApiDao {
42

  
43
	public static final Charset UTF8 = Charset.forName("UTF-8");
44

  
45
	private static final Log log = LogFactory.getLog(JdbcApiDao.class);
46

  
47
	@Autowired
48
	private OpenaireExporterConfig config;
49

  
50
	@Autowired
51
	private BasicDataSource projectApiDataSource;
52

  
53
	@Autowired
54
	private ProjectTsvRepository projectTsvRepository;
55

  
56
	@Cacheable("fundingpath-ids")
57
	public Map<String, String> readFundingpathIds() {
58

  
59
		log.debug("loading funding ids");
60
		final String sql = "SELECT id FROM fundingpaths";
61
		final Set<String> ids = Sets.newHashSet();
62
		try (final Connection con = getConn(); final PreparedStatement stm = getStm(sql, con); final ResultSet rs = stm.executeQuery()) {
63
			while (rs.next()) {
64
				ids.add(rs.getString("id"));
65
			}
66
		} catch (SQLException e) {
67
			throw new RuntimeException(e);
68
		}
69
		log.debug(String.format("loaded %s funding ids", ids.size()));
70

  
71
		final Map<String, String> res = Maps.newHashMap();
72
		final Splitter sp = Splitter.on("::").trimResults();
73
		ids.stream()
74
				.filter(s -> sp.splitToList(s).size() < 3)
75
				.forEach(s -> res.put(StringUtils.substringAfterLast(s, "::").toUpperCase(), s));
76

  
77
		res.put("FP7", "ec__________::EC::FP7");
78
		res.put("H2020", "ec__________::EC::H2020");
79
		log.debug(String.format("processed %s funding ids", res.size()));
80
		res.forEach((k,v) -> log.debug(String.format("%s : '%s'", k, v)));
81
		return res;
82
	}
83

  
84
	@CacheEvict(cacheNames = "fundingpath-ids", allEntries = true)
85
	public void dropCache() {
86
		log.info("dropped project exporter fundingpath ids cache");
87
	}
88

  
89
	public void processProjectDetails(final OutputStream outputStream, String format, Boolean compress) throws IOException {
90
		final OutputStream out = getOutputStream(new BufferedOutputStream(outputStream), compress);
91
		try {
92
			final String sql = "SELECT * FROM project_details";
93
			try (final Connection con = getConn(); final PreparedStatement stm = getStm(sql, con); final ResultSet rs = stm.executeQuery()) {
94
				while (rs.next()) {
95
					try {
96
						switch (format) {
97
						case "csv":
98
							out.write(getProjectDetails(rs).asCSV().getBytes(UTF8));
99
							break;
100
						case "json":
101
							out.write(getProjectDetails(rs).asJson().getBytes(UTF8));
102
							break;
103
						}
104
					} catch (IOException e) {
105
						throw new RuntimeException(e);
106
					}
107
				}
108
			} catch (SQLException e) {
109
				throw new RuntimeException(e);
110
			}
111
		} finally {
112
			if (out instanceof GZIPOutputStream) {
113
				((GZIPOutputStream) out).finish();
114
			}
115
			out.close();
116
		}
117
	}
118

  
119
	private OutputStream getOutputStream(final OutputStream outputStream, final Boolean compress) throws IOException {
120
		if (compress != null && compress) {
121
			return new GZIPOutputStream(outputStream);
122
		}
123
		return outputStream;
124
	}
125

  
126
	private ProjectDetails getProjectDetails(final ResultSet rs) throws SQLException {
127
		return new ProjectDetails()
128
				.setProjectId(rs.getString("projectid"))
129
				.setAcronym(rs.getString("acronym"))
130
				.setCode(rs.getString("code"))
131
				.setOptional1(rs.getString("optional1"))
132
				.setOptional2(rs.getString("optional2"))
133
				.setJsonextrainfo(rs.getString("jsonextrainfo"))
134
				.setFundingPath(asList(rs.getArray("fundingpath")));
135
	}
136

  
137
	private String[] asList(final Array value) throws SQLException {
138
		if (value != null) {
139
			final List<Object> list = Arrays.asList((Object[]) value.getArray());
140
			return list.stream()
141
					.map(o -> o != null ? o.toString() : null)
142
					.toArray(String[]::new);
143
		}
144
		return new String[0];
145
	}
146

  
147
	public void processTsvRequest(final ZipOutputStream out, final Boolean article293, final String fundingPrefix, final String filename) throws IOException {
148
		out.putNextEntry(new ZipEntry(filename));
149
		writeTsvLine(out, Splitter.on(",").trimResults().splitToList(config.getProject().getTsvFields()));
150
		queryForTsv(fundingPrefix, article293).forEach(p -> {
151
			try {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff