Project

General

Profile

« Previous | Next » 

Revision 61307

Added by Andreas Czerniak almost 3 years ago

adding from/until dates aligned with OAI v2

View differences:

modules/dnet-modular-collector-service/trunk/src/main/java/eu/dnetlib/data/collector/plugins/oai/OaiIterator.java
89 89
			String url = baseUrl + "?verb=ListRecords&metadataPrefix=" + URLEncoder.encode(mdFormat,"UTF-8");
90 90
			if ((set != null) && !set.isEmpty()) {
91 91
				url += "&set=" + URLEncoder.encode(set,"UTF-8");
92
			}
93
			if ((fromDate != null) && fromDate.matches("\\d{4}-\\d{2}-\\d{2}")) {
92
			} 
93
			// http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates , eg. 1957-03-20T20:30:00Z
94
			if ((fromDate != null) && (fromDate.matches("\\d{4}-\\d{2}-\\d{2}") || fromDate.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z"))  ) {
94 95
				url += "&from=" + URLEncoder.encode(fromDate,"UTF-8");
95 96
			}
96
			if ((untilDate != null) && untilDate.matches("\\d{4}-\\d{2}-\\d{2}")) {
97
			if ((untilDate != null) && (untilDate.matches("\\d{4}-\\d{2}-\\d{2}") || untilDate.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z")) ) {
97 98
				url += "&until=" + URLEncoder.encode(untilDate,"UTF-8");
98 99
			}
99 100
			log.info("Start harvesting using url: " + url);
......
130 131
    private String downloadPage(final String url) throws CollectorServiceException {
131 132

  
132 133
        final String xml = httpConnector.getInputSource(url);
133
        Document doc;
134
		Document doc;
134 135
        try {
135 136
            doc = reader.read(new StringReader(xml));
136 137
        } catch (DocumentException e) {
modules/dnet-modular-collector-service/trunk/pom.xml
10 10
	<groupId>eu.dnetlib</groupId>
11 11
	<artifactId>dnet-modular-collector-service</artifactId>
12 12
	<packaging>jar</packaging>
13
	<version>3.3.28-SNAPSHOT</version>
13
	<version>3.3.29-SNAPSHOT</version>
14 14
	<scm>
15 15
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-collector-service/trunk</developerConnection>
16 16
	</scm>

Also available in: Unified diff