Project

General

Profile

« Previous | Next » 

Revision 49994

work in progress

View differences:

modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/DatasourceResponseDbVersion.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
import java.util.List;
4

  
5
import com.fasterxml.jackson.annotation.JsonAutoDetect;
6

  
7
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
8
import eu.dnetlib.enabling.datasources.common.DatasourceResponse;
9
import eu.dnetlib.openaire.exporter.model.datasource.db.DatasourceDbEntry;
10
import io.swagger.annotations.ApiModel;
11
import io.swagger.annotations.ApiModelProperty;
12

  
13
/**
14
 * Created by claudio on 12/09/16.
15
 */
16
@JsonAutoDetect
17
@ApiModel(value = "Datasource response model", description = "provides information about the datasource and its aggregation status")
18
public class DatasourceResponseDbVersion extends DatasourceResponse<DatasourceDbEntry> {
19

  
20
	@ApiModelProperty(position = 1)
21
	public long getIndexRecords() {
22
		return super.getIndexRecords();
23
	}
24

  
25
	@ApiModelProperty(position = 2)
26
	public long getFundedContent() {
27
		return super.getFundedContent();
28
	}
29

  
30
	@ApiModelProperty(position = 3)
31
	public String getLastIndexingDate() {
32
		return super.getLastIndexingDate();
33
	}
34

  
35
	@ApiModelProperty(position = 4)
36
	public DatasourceDbEntry getDatasource() {
37
		return super.getDatasource();
38
	}
39

  
40
	@ApiModelProperty(position = 5)
41
	public List<AggregationInfo> getAggregationHistory() {
42
		return super.getAggregationHistory();
43
	}
44

  
45
	@ApiModelProperty(position = 6)
46
	public AggregationInfo getLastCollection() {
47
		return super.getLastCollection();
48
	}
49

  
50
	@ApiModelProperty(position = 7)
51
	public AggregationInfo getLastTransformation() {
52
		return super.getLastTransformation();
53
	}
54

  
55
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/clients/ClientResponse.java
1
package eu.dnetlib.openaire.exporter.datasource.clients;
2

  
3
import java.util.Queue;
4

  
5
import eu.dnetlib.openaire.exporter.model.datasource.DatasourceResponseDbVersion;
6

  
7
/**
8
 * Created by claudio on 30/11/2016.
9
 */
10
public class ClientResponse {
11

  
12
	private DatasourceResponseDbVersion datasourceResponse;
13

  
14
	private Queue<Throwable> errors;
15

  
16
	public DatasourceResponseDbVersion getDatasourceResponse() {
17
		return datasourceResponse;
18
	}
19

  
20
	public Queue<Throwable> getErrors() {
21
		return errors;
22
	}
23

  
24
	public ClientResponse datasourceInfo(DatasourceResponseDbVersion datasourceResponse) {
25
		this.datasourceResponse = datasourceResponse;
26
		return this;
27
	}
28

  
29
	public ClientResponse errors(Queue<Throwable> errors) {
30
		this.errors = errors;
31
		return this;
32
	}
33
}
modules/dnet-openaire-exporter/branches/dsm/dnet-openaire-exporter.iml
19 19
    <orderEntry type="sourceFolder" forTests="false" />
20 20
    <orderEntry type="library" name="Maven: eu.dnetlib:cnr-rmi-api:2.6.2-SNAPSHOT" level="project" />
21 21
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-core:3.1.5" level="project" />
22
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
23
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
22 24
    <orderEntry type="library" name="Maven: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
23 25
    <orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:3.1.5" level="project" />
24 26
    <orderEntry type="library" name="Maven: xml-resolver:xml-resolver:1.2" level="project" />
......
65 67
    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
66 68
    <orderEntry type="library" name="Maven: eu.dnetlib:dnet-index-solr-common:1.3.1" level="project" />
67 69
    <orderEntry type="library" name="Maven: com.googlecode.protobuf-java-format:protobuf-java-format:1.2" level="project" />
68
    <orderEntry type="library" name="Maven: org.apache.solr:solr-solrj:6.6.0" level="project" />
69
    <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.4.1" level="project" />
70
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
71
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
72
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.3" level="project" />
73
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.10" level="project" />
74
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
75
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
76
    <orderEntry type="library" name="Maven: org.noggit:noggit:0.6" level="project" />
77
    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.24" level="project" />
70
    <orderEntry type="library" name="Maven: eu.dnetlib:dnet-objectstore-rmi:2.0.11-SNAPSHOT" level="project" />
71
    <orderEntry type="library" name="Maven: org.apache.solr:solr-solrj:4.10.4" level="project" />
72
    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.6" level="project" />
73
    <orderEntry type="library" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.7" level="project" />
74
    <orderEntry type="library" name="Maven: org.noggit:noggit:0.5" level="project" />
78 75
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.24" level="project" />
79 76
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.2.RELEASE" level="project" />
80 77
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.2.RELEASE" level="project" />
......
114 111
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.11.1.RELEASE" level="project" />
115 112
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.13.1.RELEASE" level="project" />
116 113
    <orderEntry type="library" name="Maven: org.springframework:spring-orm:4.3.7.RELEASE" level="project" />
114
    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.24" level="project" />
117 115
    <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.7.RELEASE" level="project" />
118 116
    <orderEntry type="library" name="Maven: org.postgresql:postgresql:42.0.0" level="project" />
119 117
    <orderEntry type="library" name="Maven: org.apache.commons:commons-dbcp2:2.1" level="project" />
......
122 120
    <orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
123 121
    <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
124 122
    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
123
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.3" level="project" />
124
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" />
125
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.3" level="project" />
125 126
    <orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
126 127
    <orderEntry type="library" name="Maven: com.google.guava:guava:23.3-jre" level="project" />
127 128
    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/vocabularies/Vocabulary.java
12 12
 */
13 13
public class Vocabulary {
14 14

  
15

  
15 16
	private static final Log log = LogFactory.getLog(Vocabulary.class);
16 17

  
17 18
	private List<Term> terms;
......
35 36

  
36 37
	private void hashByCode() {
37 38
		log.info("hashing vocabulary by code ...");
38
		getTerms().forEach(term -> {
39
			byCode.put(term.getCode(), term);
40
		});
39
		getTerms().forEach(term -> byCode.put(term.getCode(), term));
41 40
		log.info("hashing vocabulary by code ... done!");
42 41
	}
43 42

  
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/DatasourceManagerRMI.java
1 1
package eu.dnetlib.openaire.exporter.datasource;
2 2

  
3
import java.util.List;
3
import eu.dnetlib.enabling.datasources.common.Api;
4
import eu.dnetlib.enabling.datasources.common.Datasource;
5
import eu.dnetlib.enabling.datasources.common.DatasourceManagerCommon;
6
import eu.dnetlib.enabling.datasources.common.DatasourceManagerException;
7
import eu.dnetlib.openaire.exporter.datasource.clients.Response;
4 8

  
5
import eu.dnetlib.enabling.datasources.common.*;
6
import eu.dnetlib.openaire.exporter.vocabularies.Country;
9
public interface DatasourceManagerRMI<DS extends Datasource<?, ?>, API extends Api<?>> extends DatasourceManagerCommon<DS, API> {
7 10

  
8
public interface DatasourceManagerRMI<DS extends Datasource<?, ?>, API extends Api> extends DatasourceManagerCommon<DS, API> {
11
	Response listCountries() throws DatasourceManagerException;
9 12

  
10
	List<Country> listCountries() throws DatasourceManagerException;
13
	Response listIds(int page, int size) throws DatasourceManagerException;
11 14

  
12
	List<String> listIds(int page, int size) throws DatasourceManagerException;
15
	Response getDsInfo(String dsId) throws DatasourceManagerException;
13 16

  
14
	DatasourceResponse<DS> getDsInfo(String id) throws DatasourceManagerException;
17
	Response searchByName(String name, int page, int size) throws DatasourceManagerException;
15 18

  
16
	List<? extends DatasourceResponse<DS>> searchByName(String name, int page, int size) throws DatasourceManagerException;
19
	Response searchByContactemail(String contactemail, int page, int size) throws DatasourceManagerException;
17 20

  
18
	List<? extends DatasourceResponse<DS>> searchByContactemail(String contactemail, int page, int size) throws DatasourceManagerException;
21
	Response searchByCountry(String country, int page, int size) throws DatasourceManagerException;
19 22

  
20
	List<? extends DatasourceResponse<DS>> searchByCountry(String country, int page, int size) throws DatasourceManagerException;
21

  
22 23
	void updateDatasourceName(String dsId, String officialname, String englishname) throws DatasourceManagerException;
23 24

  
24 25
	void updateCoordinates(String dsId, Double latitude, Double longitude) throws DatasourceManagerException;
......
29 30

  
30 31
	void updateTypology(String dsId, String timezone) throws DatasourceManagerException;
31 32

  
33
	void updateRegisteringUser(String dsId, String registeredBy) throws DatasourceManagerException;
32 34

  
35
	void updatePlatform(String dsId, String platform) throws DatasourceManagerException;
36

  
37

  
33 38
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/AbstractExporterController.java
1 1
package eu.dnetlib.openaire.exporter;
2 2

  
3
import com.fasterxml.jackson.annotation.JsonAutoDetect;
3 4
import org.apache.commons.lang3.StringUtils;
4 5
import org.apache.commons.lang3.exception.ExceptionUtils;
5 6
import org.apache.commons.logging.Log;
......
28 29
		}
29 30
	}
30 31

  
32
	@JsonAutoDetect
31 33
	public class ErrorMessage {
32 34

  
33 35
		private final String message;
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/DNetOpenaireExporterBeanFactory.java
6 6
import com.mongodb.MongoClientOptions;
7 7
import com.mongodb.ServerAddress;
8 8
import eu.dnetlib.OpenaireExporterConfig.Jdbc;
9
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
9 10
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
10 11
import io.prometheus.client.exporter.MetricsServlet;
11 12
import io.prometheus.client.hotspot.DefaultExports;
......
31 32

  
32 33
	@Bean
33 34
	public ISLookUpService getLookUpService() {
35
		return getServiceStub(ISLookUpService.class, config.getIsLookupUrl());
36
	}
37

  
38
	@Bean
39
	public ObjectStoreService getObjectStoreService() {
40
		return getServiceStub(ObjectStoreService.class, config.getObjectStoreServiceUrl());
41
	}
42

  
43
	private <T> T getServiceStub(final Class<T> clazz, final String endpoint) {
34 44
		final JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean();
35
		jaxWsProxyFactory.setServiceClass(ISLookUpService.class);
36
		jaxWsProxyFactory.setAddress(config.getIsLookupUrl());
37
		return (ISLookUpService) jaxWsProxyFactory.create();
45
		jaxWsProxyFactory.setServiceClass(clazz);
46
		jaxWsProxyFactory.setAddress(endpoint);
47
		return (T) jaxWsProxyFactory.create();
38 48
	}
39 49

  
40 50
	@Bean
modules/dnet-openaire-exporter/branches/dsm/pom.xml
101 101
			</exclusions>
102 102
		</dependency>
103 103
		<dependency>
104
			<groupId>eu.dnetlib</groupId>
105
			<artifactId>dnet-objectstore-rmi</artifactId>
106
			<version>[2.0.0,3.0.0)</version>
107
		</dependency>
108
		<dependency>
104 109
			<groupId>org.apache.solr</groupId>
105 110
			<artifactId>solr-solrj</artifactId>
106 111
			<version>${apache.solr.version}</version>
......
145 150
			<artifactId>commons-lang3</artifactId>
146 151
			<version>3.5</version>
147 152
		</dependency>
153

  
148 154
		<dependency>
155
			<groupId>org.apache.httpcomponents</groupId>
156
			<artifactId>httpclient</artifactId>
157
			<version>4.5.3</version>
158
		</dependency>
159
		<dependency>
160
			<groupId>org.apache.httpcomponents</groupId>
161
			<artifactId>httpcore</artifactId>
162
			<version>4.4.6</version>
163
		</dependency>
164
		<dependency>
165
			<groupId>org.apache.httpcomponents</groupId>
166
			<artifactId>httpmime</artifactId>
167
			<version>4.5.3</version>
168
		</dependency>
169

  
170
		<dependency>
149 171
			<groupId>commons-io</groupId>
150 172
			<artifactId>commons-io</artifactId>
151 173
			<version>2.5</version>
......
246 268

  
247 269
	<properties>
248 270
		<java.version>1.8</java.version>
249
		<apache.solr.version>6.6.0</apache.solr.version>
271
		<apache.solr.version>4.10.4</apache.solr.version>
250 272
		<mongodb.driver.version>3.4.2</mongodb.driver.version>
251 273
		<springfox-version>2.7.0</springfox-version>
252 274
		<prometheus.version>0.0.25</prometheus.version>
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/ConversionUtils.java
1
package eu.dnetlib.openaire.exporter.model;
2

  
3
import com.fasterxml.jackson.databind.ObjectMapper;
4
import eu.dnetlib.openaire.exporter.model.datasource.ApiDetails;
5
import eu.dnetlib.openaire.exporter.model.datasource.DatasourceDetails;
6
import eu.dnetlib.openaire.exporter.model.datasource.db.ApiDbEntry;
7
import eu.dnetlib.openaire.exporter.model.datasource.db.DatasourceDbEntry;
8

  
9
public class ConversionUtils {
10

  
11
	public static DatasourceDetails asDetails(final DatasourceDbEntry d) {
12
		//TODO replace with direct object mapping to get better performances
13
		final ObjectMapper mapper = new ObjectMapper();
14
		return mapper.convertValue(d, DatasourceDetails.class);
15
	}
16

  
17
	public static ApiDetails asDetails(final ApiDbEntry d) {
18
		//TODO replace with direct object mapping to get better performances
19
		final ObjectMapper mapper = new ObjectMapper();
20
		return mapper.convertValue(d, ApiDetails.class);
21
	}
22

  
23
	public static DatasourceDbEntry asDbEntry(DatasourceDetails d) {
24
		//TODO replace with direct object mapping to get better performances
25
		final ObjectMapper mapper = new ObjectMapper();
26
		return mapper.convertValue(d, DatasourceDbEntry.class);
27
	}
28

  
29
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/ApiDetails.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
import java.sql.Date;
4

  
5
import com.fasterxml.jackson.annotation.JsonAutoDetect;
6
import io.swagger.annotations.ApiModel;
7

  
8
@JsonAutoDetect
9
@ApiModel(value = "Datasource model", description = "provides information about the datasource")
10
public class ApiDetails {
11

  
12
	private String id = null;
13
	private String protocol = null;
14
	private String datasource = null;
15
	private String contentdescription = null;
16
	private String typology = null;
17
	private String compatibility;
18
	private Integer lastCollectionTotal;
19
	private Date lastCollectionDate;
20
	private Integer lastAggregationTotal;
21
	private Date lastAggregationDate;
22
	private Integer lastDownloadTotal;
23
	private Date lastDownloadDate;
24
	private String baseurl;
25

  
26
	public String getId() {
27
		return id;
28
	}
29

  
30
	public String getProtocol() {
31
		return protocol;
32
	}
33

  
34
	public String getDatasource() {
35
		return datasource;
36
	}
37

  
38
	public String getContentdescription() {
39
		return contentdescription;
40
	}
41

  
42
	public String getTypology() {
43
		return typology;
44
	}
45

  
46
	public String getCompatibility() {
47
		return compatibility;
48
	}
49

  
50
	public Integer getLastCollectionTotal() {
51
		return lastCollectionTotal;
52
	}
53

  
54
	public Date getLastCollectionDate() {
55
		return lastCollectionDate;
56
	}
57

  
58
	public Integer getLastAggregationTotal() {
59
		return lastAggregationTotal;
60
	}
61

  
62
	public Date getLastAggregationDate() {
63
		return lastAggregationDate;
64
	}
65

  
66
	public Integer getLastDownloadTotal() {
67
		return lastDownloadTotal;
68
	}
69

  
70
	public Date getLastDownloadDate() {
71
		return lastDownloadDate;
72
	}
73

  
74
	public String getBaseurl() {
75
		return baseurl;
76
	}
77

  
78
	public ApiDetails setId(final String id) {
79
		this.id = id;
80
		return this;
81
	}
82

  
83
	public ApiDetails setProtocol(final String protocol) {
84
		this.protocol = protocol;
85
		return this;
86
	}
87

  
88
	public ApiDetails setDatasource(final String datasource) {
89
		this.datasource = datasource;
90
		return this;
91
	}
92

  
93
	public ApiDetails setContentdescription(final String contentdescription) {
94
		this.contentdescription = contentdescription;
95
		return this;
96
	}
97

  
98
	public ApiDetails setTypology(final String typology) {
99
		this.typology = typology;
100
		return this;
101
	}
102

  
103
	public ApiDetails setCompatibility(final String compatibility) {
104
		this.compatibility = compatibility;
105
		return this;
106
	}
107

  
108
	public ApiDetails setLastCollectionTotal(final Integer lastCollectionTotal) {
109
		this.lastCollectionTotal = lastCollectionTotal;
110
		return this;
111
	}
112

  
113
	public ApiDetails setLastCollectionDate(final Date lastCollectionDate) {
114
		this.lastCollectionDate = lastCollectionDate;
115
		return this;
116
	}
117

  
118
	public ApiDetails setLastAggregationTotal(final Integer lastAggregationTotal) {
119
		this.lastAggregationTotal = lastAggregationTotal;
120
		return this;
121
	}
122

  
123
	public ApiDetails setLastAggregationDate(final Date lastAggregationDate) {
124
		this.lastAggregationDate = lastAggregationDate;
125
		return this;
126
	}
127

  
128
	public ApiDetails setLastDownloadTotal(final Integer lastDownloadTotal) {
129
		this.lastDownloadTotal = lastDownloadTotal;
130
		return this;
131
	}
132

  
133
	public ApiDetails setLastDownloadDate(final Date lastDownloadDate) {
134
		this.lastDownloadDate = lastDownloadDate;
135
		return this;
136
	}
137

  
138
	public ApiDetails setBaseurl(final String baseurl) {
139
		this.baseurl = baseurl;
140
		return this;
141
	}
142

  
143
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/DatasourceDetails.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

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

  
6
import com.fasterxml.jackson.annotation.JsonAutoDetect;
7
import io.swagger.annotations.ApiModel;
8

  
9
/**
10
 * Created by claudio on 12/09/16.
11
 */
12
@JsonAutoDetect
13
@ApiModel(value = "Datasource model", description = "provides information about the datasource")
14
public class DatasourceDetails {
15

  
16
	private String id;
17
	private String officialname;
18
	private String englishname;
19
	private String websiteurl;
20
	private String logourl;
21
	private String contactemail;
22
	private Double latitude;
23
	private Double longitude;
24
	private String timezone;
25
	private String namespaceprefix;
26
	private Date dateofvalidation;
27
	private String typology;
28
	private Date dateofcollection;
29
	private String platform;
30
	private String activationId;
31
	private String description;
32
	private String issn;
33
	private String eissn;
34
	private String lissn;
35
	private String registeredby;
36
	private String subjects;
37
	private Boolean managed;
38
	private Set<ApiDetails> apis;
39
	private Set<OrganizationDetails> organizations;
40
	private Set<IdentitiesDetails> identities;
41

  
42
	public String getId() {
43
		return id;
44
	}
45

  
46
	public String getOfficialname() {
47
		return officialname;
48
	}
49

  
50
	public String getEnglishname() {
51
		return englishname;
52
	}
53

  
54
	public String getWebsiteurl() {
55
		return websiteurl;
56
	}
57

  
58
	public String getLogourl() {
59
		return logourl;
60
	}
61

  
62
	public String getContactemail() {
63
		return contactemail;
64
	}
65

  
66
	public Double getLatitude() {
67
		return latitude;
68
	}
69

  
70
	public Double getLongitude() {
71
		return longitude;
72
	}
73

  
74
	public String getTimezone() {
75
		return timezone;
76
	}
77

  
78
	public String getNamespaceprefix() {
79
		return namespaceprefix;
80
	}
81

  
82
	public Date getDateofvalidation() {
83
		return dateofvalidation;
84
	}
85

  
86
	public String getTypology() {
87
		return typology;
88
	}
89

  
90
	public Date getDateofcollection() {
91
		return dateofcollection;
92
	}
93

  
94
	public String getPlatform() {
95
		return platform;
96
	}
97

  
98
	public String getActivationId() {
99
		return activationId;
100
	}
101

  
102
	public String getDescription() {
103
		return description;
104
	}
105

  
106
	public String getIssn() {
107
		return issn;
108
	}
109

  
110
	public String getEissn() {
111
		return eissn;
112
	}
113

  
114
	public String getLissn() {
115
		return lissn;
116
	}
117

  
118
	public String getRegisteredby() {
119
		return registeredby;
120
	}
121

  
122
	public String getSubjects() {
123
		return subjects;
124
	}
125

  
126
	public Boolean getManaged() {
127
		return managed;
128
	}
129

  
130
	public Set<ApiDetails> getApis() {
131
		return apis;
132
	}
133

  
134
	public Set<OrganizationDetails> getOrganizations() {
135
		return organizations;
136
	}
137

  
138
	public Set<IdentitiesDetails> getIdentities() {
139
		return identities;
140
	}
141

  
142
	public DatasourceDetails setId(final String id) {
143
		this.id = id;
144
		return this;
145
	}
146

  
147
	public DatasourceDetails setOfficialname(final String officialname) {
148
		this.officialname = officialname;
149
		return this;
150
	}
151

  
152
	public DatasourceDetails setEnglishname(final String englishname) {
153
		this.englishname = englishname;
154
		return this;
155
	}
156

  
157
	public DatasourceDetails setWebsiteurl(final String websiteurl) {
158
		this.websiteurl = websiteurl;
159
		return this;
160
	}
161

  
162
	public DatasourceDetails setLogourl(final String logourl) {
163
		this.logourl = logourl;
164
		return this;
165
	}
166

  
167
	public DatasourceDetails setContactemail(final String contactemail) {
168
		this.contactemail = contactemail;
169
		return this;
170
	}
171

  
172
	public DatasourceDetails setLatitude(final Double latitude) {
173
		this.latitude = latitude;
174
		return this;
175
	}
176

  
177
	public DatasourceDetails setLongitude(final Double longitude) {
178
		this.longitude = longitude;
179
		return this;
180
	}
181

  
182
	public DatasourceDetails setTimezone(final String timezone) {
183
		this.timezone = timezone;
184
		return this;
185
	}
186

  
187
	public DatasourceDetails setNamespaceprefix(final String namespaceprefix) {
188
		this.namespaceprefix = namespaceprefix;
189
		return this;
190
	}
191

  
192
	public DatasourceDetails setDateofvalidation(final Date dateofvalidation) {
193
		this.dateofvalidation = dateofvalidation;
194
		return this;
195
	}
196

  
197
	public DatasourceDetails setTypology(final String typology) {
198
		this.typology = typology;
199
		return this;
200
	}
201

  
202
	public DatasourceDetails setDateofcollection(final Date dateofcollection) {
203
		this.dateofcollection = dateofcollection;
204
		return this;
205
	}
206

  
207
	public DatasourceDetails setPlatform(final String platform) {
208
		this.platform = platform;
209
		return this;
210
	}
211

  
212
	public DatasourceDetails setActivationId(final String activationId) {
213
		this.activationId = activationId;
214
		return this;
215
	}
216

  
217
	public DatasourceDetails setDescription(final String description) {
218
		this.description = description;
219
		return this;
220
	}
221

  
222
	public DatasourceDetails setIssn(final String issn) {
223
		this.issn = issn;
224
		return this;
225
	}
226

  
227
	public DatasourceDetails setEissn(final String eissn) {
228
		this.eissn = eissn;
229
		return this;
230
	}
231

  
232
	public DatasourceDetails setLissn(final String lissn) {
233
		this.lissn = lissn;
234
		return this;
235
	}
236

  
237
	public DatasourceDetails setRegisteredby(final String registeredby) {
238
		this.registeredby = registeredby;
239
		return this;
240
	}
241

  
242
	public DatasourceDetails setSubjects(final String subjects) {
243
		this.subjects = subjects;
244
		return this;
245
	}
246

  
247
	public DatasourceDetails setManaged(final Boolean managed) {
248
		this.managed = managed;
249
		return this;
250
	}
251

  
252
	public DatasourceDetails setApis(final Set<ApiDetails> apis) {
253
		this.apis = apis;
254
		return this;
255
	}
256

  
257
	public DatasourceDetails setOrganizations(final Set<OrganizationDetails> organizations) {
258
		this.organizations = organizations;
259
		return this;
260
	}
261

  
262
	public DatasourceDetails setIdentities(final Set<IdentitiesDetails> identities) {
263
		this.identities = identities;
264
		return this;
265
	}
266

  
267
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/ApiDbEntry.java
1 1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2 2

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

  
6 7
import eu.dnetlib.enabling.datasources.common.Api;
7
import io.swagger.annotations.ApiModel;
8 8

  
9 9
/**
10 10
 * Api
11 11
 */
12 12
@Entity
13 13
@Table(name = "dsm_api")
14
@ApiModel(value = "Datasource Api model", description = "describes the datasource api")
15 14
public class ApiDbEntry extends Api<ApiParamDbEntry> {
16 15

  
16
	@Column(name = "compatibility_override")
17
	protected String compatibilityOverride;
18

  
19
	public String getCompatibilityOverride() {
20
		return compatibilityOverride;
21
	}
22

  
23
	public Api setCompatibilityOverride(final String compatibilityOverride) {
24
		this.compatibilityOverride = compatibilityOverride;
25
		return this;
26
	}
27

  
17 28
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/ApiParamDbEntry.java
1 1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2 2

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

  
......
15 16
@Table(name = "dsm_apiparams")
16 17
@JsonIgnoreProperties(ignoreUnknown = true)
17 18
@ApiModel(value = "Datasource Api params model", description = "describes the datasource api params")
18
public class ApiParamDbEntry extends ApiParam<ApiParamKeyDbEntry> {
19
public class ApiParamDbEntry implements ApiParam {
19 20

  
20
	@Override
21
	@EmbeddedId
22
	protected ApiParamKeyDbEntry id;
23

  
24
	protected String value;
25

  
26
	public ApiParamDbEntry() {}
27

  
28
	public ApiParam setId(final ApiParamKeyDbEntry id) {
29
		this.id = id;
30
		return this;
31
	}
32

  
21 33
	@JsonIgnore
22 34
	public ApiParamKeyDbEntry getId() {
23
		return super.getId();
35
		return id;
24 36
	}
25 37

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

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

  
46
	@Override
47
	public String getParam() {
48
		return id.getParam();
49
	}
50

  
51
	@Override
52
	public void setParam(final String param) {
53
		getId().setParam(param);
54
	}
55

  
26 56
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/DatasourceDbEntry.java
4 4
import javax.persistence.Table;
5 5

  
6 6
import eu.dnetlib.enabling.datasources.common.Datasource;
7
import io.swagger.annotations.ApiModel;
8 7

  
9 8
/**
10 9
 * Datasource
11 10
 */
12 11
@Entity
13 12
@Table(name = "dsm_datasources")
14
@ApiModel(value = "Datasource model", description = "provides datasource details")
15 13
public class DatasourceDbEntry extends Datasource<OrganizationDbEntry, IdentityDbEntry> {
16 14

  
17 15
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/db/OrganizationDbEntry.java
1 1
package eu.dnetlib.openaire.exporter.model.datasource.db;
2 2

  
3 3
import java.util.Set;
4
import javax.persistence.*;
4
import javax.persistence.Entity;
5
import javax.persistence.Table;
5 6

  
6 7
import com.fasterxml.jackson.annotation.JsonIgnore;
7 8
import eu.dnetlib.enabling.datasources.common.Organization;
8
import io.swagger.annotations.ApiModel;
9 9

  
10 10
/**
11 11
 * Created by claudio on 13/04/2017.
12 12
 */
13 13
@Entity
14 14
@Table(name = "dsm_organizations")
15
// @JsonAutoDetect
16
@ApiModel(value = "Organization model", description = "provides organization details")
17 15
public class OrganizationDbEntry extends Organization<DatasourceDbEntry> {
18 16

  
19 17
	@Override
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/DatasourceInfo.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
import java.util.List;
4

  
5
import com.fasterxml.jackson.annotation.JsonAutoDetect;
6
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
7
import io.swagger.annotations.ApiModel;
8

  
9
@JsonAutoDetect
10
@ApiModel(value = "Datasource info model", description = "provides information about the datasource and its aggregation status")
11
public class DatasourceInfo {
12

  
13
	private long indexRecords;
14

  
15
	private long fundedContent;
16

  
17
	private long fulltexts;
18

  
19
	private String lastIndexingDate;
20

  
21
	private DatasourceDetails datasourceDetails;
22

  
23
	private List<AggregationInfo> aggregationHistory;
24

  
25
	private AggregationInfo lastCollection;
26

  
27
	private AggregationInfo lastTransformation;
28

  
29
	public DatasourceInfo() {
30
		super();
31
	}
32

  
33
	public DatasourceInfo setIndexRecords(final long indexRecords) {
34
		this.indexRecords = indexRecords;
35
		return this;
36
	}
37

  
38
	public DatasourceInfo setFundedContent(final long fundedContent) {
39
		this.fundedContent = fundedContent;
40
		return this;
41
	}
42

  
43
	public DatasourceInfo setFulltexts(final long fulltexts) {
44
		this.fulltexts = fulltexts;
45
		return this;
46
	}
47

  
48
	public DatasourceInfo setLastIndexingDate(final String lastIndexingDate) {
49
		this.lastIndexingDate = lastIndexingDate;
50
		return this;
51
	}
52

  
53
	public DatasourceInfo setAggregationHistory(final List<AggregationInfo> aggregationHistory) {
54
		this.aggregationHistory = aggregationHistory;
55
		return this;
56
	}
57

  
58
	public DatasourceInfo setLastCollection(final AggregationInfo lastCollection) {
59
		this.lastCollection = lastCollection;
60
		return this;
61
	}
62

  
63
	public DatasourceInfo setLastTransformation(final AggregationInfo lastTransformation) {
64
		this.lastTransformation = lastTransformation;
65
		return this;
66
	}
67

  
68
	public long getIndexRecords() {
69
		return indexRecords;
70
	}
71

  
72
	public long getFundedContent() {
73
		return fundedContent;
74
	}
75

  
76
	public long getFulltexts() {
77
		return fulltexts;
78
	}
79

  
80
	public String getLastIndexingDate() {
81
		return lastIndexingDate;
82
	}
83

  
84
	public List<AggregationInfo> getAggregationHistory() {
85
		return aggregationHistory;
86
	}
87

  
88
	public AggregationInfo getLastCollection() {
89
		return lastCollection;
90
	}
91

  
92
	public AggregationInfo getLastTransformation() {
93
		return lastTransformation;
94
	}
95

  
96
	public DatasourceDetails getDatasourceDetails() {
97
		return datasourceDetails;
98
	}
99

  
100
	public DatasourceInfo setDatasourceDetails(final DatasourceDetails datasourceDetails) {
101
		this.datasourceDetails = datasourceDetails;
102
		return this;
103
	}
104

  
105
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/IdentitiesDetails.java
1
package eu.dnetlib.openaire.exporter.model.datasource;
2

  
3
public class IdentitiesDetails {
4

  
5
	private String pid;
6

  
7
	private String issuertype;
8

  
9
	public String getPid() {
10
		return pid;
11
	}
12

  
13
	public String getIssuertype() {
14
		return issuertype;
15
	}
16

  
17
	public IdentitiesDetails setPid(final String pid) {
18
		this.pid = pid;
19
		return this;
20
	}
21

  
22
	public IdentitiesDetails setIssuertype(final String issuertype) {
23
		this.issuertype = issuertype;
24
		return this;
25
	}
26

  
27
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/model/datasource/OrganizationDetails.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
@JsonAutoDetect
7
@ApiModel(value = "Organization info model", description = "provides information about the organization")
8
public class OrganizationDetails {
9

  
10
	private String id;
11
	private String legalshortname;
12
	private String legalname;
13
	private String websiteurl;
14
	private String logourl;
15

  
16
	private Boolean eclegalbody;
17

  
18
	private Boolean eclegalperson;
19

  
20
	private Boolean ecnonprofit;
21

  
22
	private Boolean ecresearchorganization;
23

  
24
	private Boolean echighereducation;
25

  
26
	private Boolean ecinternationalorganizationeurinterests;
27

  
28
	private Boolean ecinternationalorganization;
29

  
30
	private Boolean ecenterprise;
31

  
32
	private Boolean ecsmevalidated;
33

  
34
	private Boolean ecnutscode;
35

  
36
	private String country;
37

  
38
	public String getId() {
39
		return id;
40
	}
41

  
42
	public String getLegalshortname() {
43
		return legalshortname;
44
	}
45

  
46
	public String getLegalname() {
47
		return legalname;
48
	}
49

  
50
	public String getWebsiteurl() {
51
		return websiteurl;
52
	}
53

  
54
	public String getLogourl() {
55
		return logourl;
56
	}
57

  
58
	public Boolean getEclegalbody() {
59
		return eclegalbody;
60
	}
61

  
62
	public Boolean getEclegalperson() {
63
		return eclegalperson;
64
	}
65

  
66
	public Boolean getEcnonprofit() {
67
		return ecnonprofit;
68
	}
69

  
70
	public Boolean getEcresearchorganization() {
71
		return ecresearchorganization;
72
	}
73

  
74
	public Boolean getEchighereducation() {
75
		return echighereducation;
76
	}
77

  
78
	public Boolean getEcinternationalorganizationeurinterests() {
79
		return ecinternationalorganizationeurinterests;
80
	}
81

  
82
	public Boolean getEcinternationalorganization() {
83
		return ecinternationalorganization;
84
	}
85

  
86
	public Boolean getEcenterprise() {
87
		return ecenterprise;
88
	}
89

  
90
	public Boolean getEcsmevalidated() {
91
		return ecsmevalidated;
92
	}
93

  
94
	public Boolean getEcnutscode() {
95
		return ecnutscode;
96
	}
97

  
98
	public String getCountry() {
99
		return country;
100
	}
101

  
102
	public OrganizationDetails setId(final String id) {
103
		this.id = id;
104
		return this;
105
	}
106

  
107
	public OrganizationDetails setLegalshortname(final String legalshortname) {
108
		this.legalshortname = legalshortname;
109
		return this;
110
	}
111

  
112
	public OrganizationDetails setLegalname(final String legalname) {
113
		this.legalname = legalname;
114
		return this;
115
	}
116

  
117
	public OrganizationDetails setWebsiteurl(final String websiteurl) {
118
		this.websiteurl = websiteurl;
119
		return this;
120
	}
121

  
122
	public OrganizationDetails setLogourl(final String logourl) {
123
		this.logourl = logourl;
124
		return this;
125
	}
126

  
127
	public OrganizationDetails setEclegalbody(final Boolean eclegalbody) {
128
		this.eclegalbody = eclegalbody;
129
		return this;
130
	}
131

  
132
	public OrganizationDetails setEclegalperson(final Boolean eclegalperson) {
133
		this.eclegalperson = eclegalperson;
134
		return this;
135
	}
136

  
137
	public OrganizationDetails setEcnonprofit(final Boolean ecnonprofit) {
138
		this.ecnonprofit = ecnonprofit;
139
		return this;
140
	}
141

  
142
	public OrganizationDetails setEcresearchorganization(final Boolean ecresearchorganization) {
143
		this.ecresearchorganization = ecresearchorganization;
144
		return this;
145
	}
146

  
147
	public OrganizationDetails setEchighereducation(final Boolean echighereducation) {
148
		this.echighereducation = echighereducation;
149
		return this;
150
	}
151

  
152
	public OrganizationDetails setEcinternationalorganizationeurinterests(final Boolean ecinternationalorganizationeurinterests) {
153
		this.ecinternationalorganizationeurinterests = ecinternationalorganizationeurinterests;
154
		return this;
155
	}
156

  
157
	public OrganizationDetails setEcinternationalorganization(final Boolean ecinternationalorganization) {
158
		this.ecinternationalorganization = ecinternationalorganization;
159
		return this;
160
	}
161

  
162
	public OrganizationDetails setEcenterprise(final Boolean ecenterprise) {
163
		this.ecenterprise = ecenterprise;
164
		return this;
165
	}
166

  
167
	public OrganizationDetails setEcsmevalidated(final Boolean ecsmevalidated) {
168
		this.ecsmevalidated = ecsmevalidated;
169
		return this;
170
	}
171

  
172
	public OrganizationDetails setEcnutscode(final Boolean ecnutscode) {
173
		this.ecnutscode = ecnutscode;
174
		return this;
175
	}
176

  
177
	public OrganizationDetails setCountry(final String country) {
178
		this.country = country;
179
		return this;
180
	}
181

  
182
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/repository/ApiDbEntryRepository.java
33 33
	@Modifying
34 34
	@Transactional
35 35
	@Query("update #{#entityName} a set a.compatibility = ?2 where a.id = ?1")
36
	void updateCompatibility(String apiId, String compliance);
36
	void updateCompatibility(String apiId, String compatibility);
37 37

  
38
	@Modifying
39
	@Transactional
40
	@Query("update #{#entityName} a set a.compatibilityOverride = ?2 where a.id = ?1")
41
	void updateCompatibilityOverride(String apiId, String compatibility);
42

  
38 43
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/repository/DatasourceDbEntryRepository.java
3 3
import javax.transaction.Transactional;
4 4

  
5 5
import eu.dnetlib.openaire.exporter.model.datasource.db.DatasourceDbEntry;
6
import org.springframework.data.domain.PageRequest;
6 7
import org.springframework.data.domain.Pageable;
7 8
import org.springframework.data.domain.Slice;
8 9
import org.springframework.data.jpa.repository.JpaRepository;
......
18 19
@Repository
19 20
public interface DatasourceDbEntryRepository extends JpaRepository<DatasourceDbEntry, String> {
20 21

  
21
	@Async
22
	ListenableFuture<DatasourceDbEntry> findOneById(String id);
22
	DatasourceDbEntry findOneById(String id);
23 23

  
24 24
	@Async
25
	ListenableFuture<Slice<DatasourceDbEntry>> findByOfficialnameContainingOrEnglishnameContainingAllIgnoreCase(String officialname,
25
	ListenableFuture<Slice<DatasourceDbEntry>> findDistinctByOfficialnameContainingOrEnglishnameContainingAllIgnoreCase(
26
			String officialname,
26 27
			String englishname,
27 28
			Pageable pageable);
28 29

  
29 30
	@Async
30
	ListenableFuture<Slice<DatasourceDbEntry>> findByContactemailContainingAllIgnoreCase(String contactemail, Pageable pageable);
31
	ListenableFuture<Slice<DatasourceDbEntry>> findDistinctByContactemailContainingAllIgnoreCase(String contactemail, Pageable pageable);
31 32

  
32 33
	@Async
33
	ListenableFuture<Slice<DatasourceDbEntry>> findByOrganizationsCountryIgnoreCase(String country, Pageable pageable);
34
	ListenableFuture<Slice<DatasourceDbEntry>> findDistinctByOrganizationsCountryIgnoreCase(String country, Pageable pageable);
34 35

  
36
	@Async
37
	ListenableFuture<Slice<DatasourceDbEntry>> findDistinctByRegisteredbyIgnoreCase(String registeringUser, PageRequest pageRequest);
38

  
35 39
	@Query("select d.managed from #{#entityName} d where d.id = ?1")
36 40
	boolean isManaged(String id);
37 41

  
......
60 64
	@Query("update #{#entityName} d set d.typology = ?2 where d.id = ?1")
61 65
	void setTypology(String dsId, String typology);
62 66

  
67
	@Modifying
68
	@Transactional
69
	@Query("update #{#entityName} d set d.registeredby = ?2 where d.id = ?1")
70
	void setRegisteringUser(String id, String registeredby);
63 71

  
72
	@Modifying
73
	@Transactional
74
	@Query("update #{#entityName} d set d.platform = ?2 where d.id = ?1")
75
	void setPlatform(String id, String platform);
76

  
64 77
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/clients/ResponseUtils.java
1
package eu.dnetlib.openaire.exporter.datasource.clients;
2

  
3
import java.util.Queue;
4
import java.util.stream.Collectors;
5

  
6
import org.apache.commons.lang3.time.StopWatch;
7
import org.apache.http.HttpStatus;
8

  
9
public class ResponseUtils {
10

  
11
	public static Response prepareResponse(final Queue<Throwable> errors) {
12
		return new Response().setHeader(
13
				new Header().setErrors(
14
						errors.stream()
15
								.map(e -> e.getMessage())
16
								.collect(Collectors.toList())));
17
	}
18

  
19
	public static Response prepareResponse(final Response response, final StopWatch stop) {
20
		response.getHeader().setStatus(HttpStatus.SC_OK).setTime(stop.getTime());
21
		return response;
22
	}
23

  
24
}
modules/dnet-openaire-exporter/branches/dsm/src/main/java/eu/dnetlib/openaire/exporter/datasource/clients/DatasourceDaoImpl.java
1
package eu.dnetlib.openaire.exporter.datasource.clients;
2

  
3
import java.util.List;
4
import java.util.Objects;
5
import java.util.Queue;
6
import java.util.concurrent.ConcurrentLinkedQueue;
7
import java.util.stream.Collectors;
8

  
9
import com.google.common.collect.Lists;
10
import eu.dnetlib.OpenaireExporterConfig;
11
import eu.dnetlib.enabling.datasources.common.DatasourceManagerException;
12
import eu.dnetlib.openaire.exporter.datasource.repository.ApiDbEntryRepository;
13
import eu.dnetlib.openaire.exporter.datasource.repository.CountryTermRepository;
14
import eu.dnetlib.openaire.exporter.datasource.repository.DatasourceDbEntryRepository;
15
import eu.dnetlib.openaire.exporter.model.datasource.db.ApiDbEntry;
16
import eu.dnetlib.openaire.exporter.model.datasource.db.DatasourceDbEntry;
17
import eu.dnetlib.openaire.exporter.vocabularies.Country;
18
import eu.dnetlib.openaire.exporter.vocabularies.Vocabulary;
19
import org.apache.commons.lang.StringUtils;
20
import org.apache.commons.logging.Log;
21
import org.apache.commons.logging.LogFactory;
22
import org.apache.http.HttpStatus;
23
import org.springframework.beans.factory.annotation.Autowired;
24
import org.springframework.data.domain.PageRequest;
25
import org.springframework.data.domain.Slice;
26
import org.springframework.stereotype.Component;
27
import org.springframework.util.concurrent.ListenableFuture;
28

  
29
/**
30
 * Created by claudio on 20/10/2016.
31
 */
32
@Component
33
public class DatasourceDaoImpl implements DatasourceDao<DatasourceDbEntry, ApiDbEntry> {
34

  
35
	private static final Log log = LogFactory.getLog(DatasourceDao.class);
36

  
37
	@Autowired
38
	private OpenaireExporterConfig config;
39

  
40
	@Autowired
41
	private CountryTermRepository countryTermRepository;
42

  
43
	@Autowired
44
	private DatasourceDbEntryRepository dsRepository;
45

  
46
	@Autowired
47
	private ApiDbEntryRepository apiRepository;
48

  
49
	@Autowired
50
	private VocabularyClient vocabularyClient;
51

  
52

  
53
	@Override
54
	public List<Country> listCountries() {
55
		final Queue<Throwable> errors = new ConcurrentLinkedQueue<>();
56
		final List<Country> countries = Lists.newArrayList();
57
		try {
58
			final Vocabulary v = vocabularyClient.getCountries();
59
			countries.addAll(countryTermRepository.findAll().stream()
60
					.filter(Objects::nonNull)
61
					.map(t -> new Country(t.getTerm(), v.getEnglishName(t.getTerm())))
62
					.collect(Collectors.toList()));
63
		} catch (Throwable e) {
64
			errors.offer(e);
65
		}
66
		return countries;
67
	}
68

  
69
	@Override
70
	public List<String> listIds(int page, int size) throws DatasourceManagerException {
71
		final Queue<Throwable> errors = new ConcurrentLinkedQueue<>();
72
		final List<String> ids = Lists.newArrayList();
73
		try {
74
			ids.addAll(dsRepository.findAll(new PageRequest(page, size))
75
					.map(d -> d.getId())
76
					.getContent());
77
		} catch (Throwable e) {
78
			errors.offer(e);
79
		}
80
		return ids;
81
	}
82

  
83
	@Override
84
	public ListenableFuture<Slice<DatasourceDbEntry>> searchByName(final String name, final int page, final int size) {
85
		log.debug(String.format("search ds by name '%s'", name));
86
		return dsRepository.findDistinctByOfficialnameContainingOrEnglishnameContainingAllIgnoreCase(
87
				name,
88
				name,
89
				new PageRequest(page, size));
90
	}
91

  
92
	@Override
93
	public ListenableFuture<Slice<DatasourceDbEntry>> searchByCountry(final String country, final int page, final int size) {
94
		log.debug(String.format("search ds by country '%s'", country));
95
		return dsRepository.findDistinctByOrganizationsCountryIgnoreCase(country, new PageRequest(page, size));
96
	}
97

  
98
	@Override
99
	public ListenableFuture<Slice<DatasourceDbEntry>> searchByContactemail(final String email, final int page, final int size) {
100
		log.debug(String.format("search ds by email '%s'", email));
101
		return dsRepository.findDistinctByContactemailContainingAllIgnoreCase(email, new PageRequest(page, size));
102
	}
103

  
104
	@Override
105
	public ListenableFuture<Slice<DatasourceDbEntry>> searchByRegisteringUser(final String registeringUser, final int page, final int size)
106
			throws DatasourceManagerException {
107
		log.debug(String.format("search ds by registering user '%s'", registeringUser));
108
		return dsRepository.findDistinctByRegisteredbyIgnoreCase(registeringUser, new PageRequest(page, size));
109
	}
110

  
111
	@Override
112
	public DatasourceDbEntry getDs(final String dsId) throws DatasourceManagerException {
113
		return dsRepository.findOne(dsId);
114
	}
115

  
116
	@Override
117
	public void setManaged(final String id, final boolean managed) {
118
		log.info(String.format("setting managed = '%s' for ds '%s'", managed, id));
119
		dsRepository.setManaged(id, managed);
120
	}
121

  
122
	@Override
123
	public boolean isManaged(final String id) {
124
		return dsRepository.isManaged(id);
125
	}
126

  
127
	@Override
128
	public void updateCompliance(String dsId, String apiId, String compliance, boolean override) {
129
		log.info(String.format("setting compatibility = '%s' for ds '%s'", compliance, apiId));
130
		apiRepository.updateCompatibility(apiId, compliance);
131
	}
132

  
133
	@Override
134
	public List<ApiDbEntry> getApis(final String dsId) {
135
		return apiRepository.findByDatasource(dsId);
136
	}
137

  
138
	@Override
139
	public void deleteApi(final String dsId, final String apiId) {
140
		apiRepository.delete(apiId);
141
		log.info(String.format("deleted api '%s'", apiId));
142
	}
143

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff