Project

General

Profile

1
package eu.dnetlib.data.collector.plugins.datacite;
2

    
3
import eu.dnetlib.data.collector.plugin.AbstractCollectorPlugin;
4
import eu.dnetlib.data.collector.plugin.CollectorPlugin;
5
import eu.dnetlib.data.collector.rmi.CollectorServiceException;
6
import eu.dnetlib.data.collector.rmi.InterfaceDescriptor;
7
import eu.dnetlib.miscutils.datetime.DateUtils;
8

    
9
import org.apache.commons.lang3.StringUtils;
10

    
11
import java.util.Date;
12

    
13
public class DataciteCollectorPlugin extends AbstractCollectorPlugin implements CollectorPlugin {
14

    
15

    
16
    @Override
17
    public Iterable<String> collect(InterfaceDescriptor interfaceDescriptor, String fromDate, String untilDate) throws CollectorServiceException {
18

    
19
        long timestamp= 0;
20
        if (StringUtils.isNotBlank(fromDate)) {
21
            Date parsed = new DateUtils().parse(fromDate);
22
            timestamp =parsed.getTime() /1000;
23
        }
24

    
25
        final long finalTimestamp = timestamp;
26
        return () -> {
27
            try {
28
                return new DataciteESIterator(finalTimestamp);
29
            } catch (Exception e) {
30
                throw new RuntimeException(e );
31
            }
32
        };
33
    }
34

    
35
}
(1-1/2)