Project

General

Profile

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
import java.util.List;
7

    
8
import eu.dnetlib.rmi.data.CollectorServiceException;
9
import org.springframework.beans.factory.annotation.Autowired;
10

    
11
/**
12
 * Created by Alessia Bardi on 03/05/2017.
13
 *
14
 * @author Alessia Bardi
15
 */
16
public class EHRIIteratorFactory {
17

    
18
	@Autowired
19
	private EHRIGraphQLClient ehriGraphQLClient;
20

    
21
	public Iterator<String> newIterator(final String baseURLIdentifiers, final String queryIdentifiers,
22
			final String baseUrl,
23
			final String suffix) {
24

    
25
		List<String> ids = null;
26
		try {
27
			ids = ehriGraphQLClient.collect(baseURLIdentifiers, queryIdentifiers);
28
			return new EHRIIterator(ids, baseUrl, suffix);
29
		} catch (CollectorServiceException | IOException | URISyntaxException e) {
30
			throw new RuntimeException(e);
31
		}
32
	}
33

    
34
	public EHRIGraphQLClient getEhriGraphQLClient() {
35
		return ehriGraphQLClient;
36
	}
37

    
38
	public void setEhriGraphQLClient(final EHRIGraphQLClient ehriGraphQLClient) {
39
		this.ehriGraphQLClient = ehriGraphQLClient;
40
	}
41
}
(4-4/4)