1
|
package eu.dnetlib.data.collector.plugins.excel;
|
2
|
|
3
|
|
4
|
import eu.dnetlib.data.collector.plugin.AbstractCollectorPlugin;
|
5
|
import eu.dnetlib.data.collector.plugins.HttpCSVCollectorPlugin;
|
6
|
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
|
7
|
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
|
8
|
import org.apache.commons.logging.Log;
|
9
|
import org.apache.commons.logging.LogFactory;
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.beans.factory.annotation.Required;
|
12
|
|
13
|
/**
|
14
|
* Created by miriam on 10/05/2017.
|
15
|
*/
|
16
|
public class ReadExcelPlugin extends AbstractCollectorPlugin{
|
17
|
|
18
|
private static final Log log = LogFactory.getLog(ReadExcelPlugin.class);
|
19
|
@Autowired
|
20
|
HttpCSVCollectorPlugin httpCSVCollectorPlugin;
|
21
|
|
22
|
|
23
|
|
24
|
@Override
|
25
|
public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
26
|
throws CollectorServiceException {
|
27
|
Read r = new Read(interfaceDescriptor);
|
28
|
r.setCollector(httpCSVCollectorPlugin);
|
29
|
|
30
|
try {
|
31
|
return r.parseFile();
|
32
|
}catch(Exception e){
|
33
|
log.error("Error importing excel file");
|
34
|
throw new CollectorServiceException(e);
|
35
|
}
|
36
|
|
37
|
|
38
|
}
|
39
|
}
|