Project

General

Profile

« Previous | Next » 

Revision 41394

Added embargoEndDate field

View differences:

modules/dnet-openaireplus-workflows/trunk/src/test/resources/eu/dnetlib/msro/openaireplus/api/objects/test_record_with_greek_chars.json
14 14
	  "value": "10.000/xyz-123-gr"
15 15
	}
16 16
  ],
17
  "licenseCode": "OPEN",
17
  "licenseCode": "EMBARGO",
18
  "embargoEndDate": "2018-02-02",
18 19
  "resourceType": "0001",
19 20
  "url": "http://test.it/xyz",
20 21
  "collectedFromId": "opendoar____::2659",
modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/objects/PublicationEntry.java
1 1
package eu.dnetlib.msro.openaireplus.api.objects;
2 2

  
3 3
import java.text.SimpleDateFormat;
4
import java.util.*;
4
import java.util.ArrayList;
5
import java.util.Date;
6
import java.util.HashMap;
7
import java.util.List;
8
import java.util.Map;
5 9
import java.util.concurrent.TimeUnit;
6 10

  
7
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
8
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
9
import eu.dnetlib.miscutils.datetime.DateUtils;
10
import eu.dnetlib.miscutils.functional.hash.Hashing;
11
import eu.dnetlib.msro.openaireplus.api.SinglePublicationSubmitterUtils;
12 11
import org.apache.commons.lang.StringUtils;
13 12
import org.apache.commons.logging.Log;
14 13
import org.apache.commons.logging.LogFactory;
......
16 15
import org.apache.velocity.tools.generic.EscapeTool;
17 16
import org.springframework.ui.velocity.VelocityEngineUtils;
18 17

  
18
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
19
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
20
import eu.dnetlib.miscutils.datetime.DateUtils;
21
import eu.dnetlib.miscutils.functional.hash.Hashing;
22
import eu.dnetlib.msro.openaireplus.api.SinglePublicationSubmitterUtils;
23

  
19 24
/**
20 25
 * Created by michele on 02/12/15.
21 26
 */
......
29 34
	private String language;
30 35
	private List<PidEntry> pids = new ArrayList<PidEntry>();
31 36
	private String licenseCode;
37
	private String embargoEndDate;
38

  
39
	public String getEmbargoEndDate() {
40
		return embargoEndDate;
41
	}
42

  
43
	public void setEmbargoEndDate(final String embargoEndDate) {
44
		this.embargoEndDate = embargoEndDate;
45
	}
46

  
32 47
	private String resourceType;
33 48
	private String url;
34 49
	private String collectedFromId;
35 50
	private String hostedById;
36 51

  
37
	// String according to openaire guidelines: info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]
52
	// String according to openaire guidelines:
53
	// info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]
38 54
	private List<String> contexts = new ArrayList<String>();
39 55

  
40 56
	// String according to the EGI context profile, example: egi::classification::natsc::math
......
47 63

  
48 64
	private static final Log log = LogFactory.getLog(PublicationEntry.class);
49 65

  
50
	public PublicationEntry() {
51
	}
66
	public PublicationEntry() {}
52 67

  
53 68
	public String getOriginalId() {
54 69
		return originalId;
......
190 205
	}
191 206

  
192 207
	private synchronized static DatasourceEntry getDatasourceInfo(final String dsId, final ISLookUpService lookupService) throws ISLookUpException {
193
		if (StringUtils.isBlank(dsId)) {
194
			return new DatasourceEntry("openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18", "Unknown Repository", "unknown_____");
195
		}
208
		if (StringUtils
209
				.isBlank(dsId)) { return new DatasourceEntry("openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18", "Unknown Repository", "unknown_____"); }
196 210

  
197 211
		if (!cached_datasources.containsKey(dsId)) {
198 212
			final String query =
......
217 231

  
218 232
	private synchronized static Map<String, String> getVocabulary(final String voc, final ISLookUpService lookupService) throws ISLookUpException {
219 233

  
220
		if (DateUtils.now() - last_cache_update < TimeUnit.MINUTES.toMillis(15) && cached_vocabularies.containsKey(voc)) {
234
		if (((DateUtils.now() - last_cache_update) < TimeUnit.MINUTES.toMillis(15)) && cached_vocabularies.containsKey(voc)) {
221 235
			return cached_vocabularies.get(voc);
222 236
		} else {
223 237
			final String query = "collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType')[.//VOCABULARY_NAME/@code='" + voc
224 238
					+ "']//TERM/concat(@code, ' @@@ ', @english_name)";
225 239

  
226 240
			final Map<String, String> map = new HashMap<String, String>();
227
			for (String s : lookupService.quickSearchProfile(query)) {
241
			for (final String s : lookupService.quickSearchProfile(query)) {
228 242
				final String[] arr = s.split("@@@");
229 243
				map.put(arr[0].trim(), arr[1].trim());
230 244
			}
......
238 252
	}
239 253

  
240 254
	private synchronized static Map<String, String> getContexts(final ISLookUpService lookupService) throws ISLookUpException {
241
		if (DateUtils.now() - last_cache_update > TimeUnit.MINUTES.toMillis(15) || cached_contexts.isEmpty()) {
255
		if (((DateUtils.now() - last_cache_update) > TimeUnit.MINUTES.toMillis(15)) || cached_contexts.isEmpty()) {
242 256
			final String query =
243 257
					"collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')[.//context/@type='community']//*[name()='context' or name()='category' or name()='concept']/concat(@id, ' @@@ ', @label)";
244 258

  
245 259
			cached_contexts.clear();
246
			for (String s : lookupService.quickSearchProfile(query)) {
260
			for (final String s : lookupService.quickSearchProfile(query)) {
247 261
				final String[] arr = s.split("@@@");
248 262
				cached_contexts.put(arr[0].trim(), arr[1].trim());
249 263
			}
......
251 265
		}
252 266
		return cached_contexts;
253 267
	}
254
}
268
}
modules/dnet-openaireplus-workflows/trunk/src/main/resources/eu/dnetlib/msro/openaireplus/api/indexRecord.xml.vm
32 32
                    <subject classid="" classname="" schemeid="" schemename=""/>
33 33
                    <relevantdate classid="" classname="" schemeid="" schemename=""/>
34 34
                    <publisher>$!esc.xml($!pub.publisher)</publisher>
35
                    <embargoenddate/>
35
                    <embargoenddate>$!esc.xml($!pub.embargoEndDate)</embargoenddate>
36 36
                    <source/>
37 37
                    <fulltext/>
38 38
                    <format/>
......
54 54
                    <bestlicense classid="$!esc.xml($!pub.licenseCode)" classname="$!esc.xml($!licenses.get($!pub.licenseCode))"
55 55
                                 schemeid="dnet:access_modes" schemename="dnet:access_modes"/>
56 56

  
57

  
58

  
59 57
					#foreach($ctx in $util.processContexts($!pub.contexts))
60 58
						#context($ctx)
61 59
					#end

Also available in: Unified diff