1
|
package eu.dnetlib.data.collector.plugins.parthenos.ehri;
|
2
|
|
3
|
import java.io.IOException;
|
4
|
import java.net.URISyntaxException;
|
5
|
import java.util.Iterator;
|
6
|
|
7
|
import eu.dnetlib.rmi.data.CollectorServiceException;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
|
10
|
/**
|
11
|
* Created by Alessia Bardi on 03/05/2017.
|
12
|
*
|
13
|
* @author Alessia Bardi
|
14
|
*/
|
15
|
public class EHRIIteratorFactory {
|
16
|
|
17
|
@Autowired
|
18
|
private EHRIGraphQLClient ehriGraphQLClient;
|
19
|
|
20
|
public Iterator<String> newIterator(final String baseURLIdentifiers, final String queryIdentifiers,
|
21
|
final String baseUrl,
|
22
|
final String suffix) {
|
23
|
try {
|
24
|
Iterator<String> ids = ehriGraphQLClient.collect(baseURLIdentifiers, queryIdentifiers);
|
25
|
return new EHRIIterator(ids, baseUrl, suffix);
|
26
|
} catch (CollectorServiceException | IOException | URISyntaxException e) {
|
27
|
throw new RuntimeException(e);
|
28
|
}
|
29
|
}
|
30
|
|
31
|
public EHRIGraphQLClient getEhriGraphQLClient() {
|
32
|
return ehriGraphQLClient;
|
33
|
}
|
34
|
|
35
|
public void setEhriGraphQLClient(final EHRIGraphQLClient ehriGraphQLClient) {
|
36
|
this.ehriGraphQLClient = ehriGraphQLClient;
|
37
|
}
|
38
|
}
|