1
|
package eu.dnetlib.openaire.directindex.objects;
|
2
|
|
3
|
import com.google.gson.Gson;
|
4
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
|
5
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
6
|
import eu.dnetlib.miscutils.datetime.DateUtils;
|
7
|
import eu.dnetlib.miscutils.functional.hash.Hashing;
|
8
|
import eu.dnetlib.miscutils.functional.string.EscapeXml;
|
9
|
import eu.dnetlib.openaire.directindex.api.DirecIndexApiException;
|
10
|
import eu.dnetlib.openaire.directindex.api.OpenAIRESubmitterUtils;
|
11
|
import io.swagger.annotations.ApiModelProperty;
|
12
|
import org.apache.commons.lang.StringUtils;
|
13
|
import org.apache.commons.logging.Log;
|
14
|
import org.apache.commons.logging.LogFactory;
|
15
|
import org.apache.velocity.app.VelocityEngine;
|
16
|
import org.springframework.ui.velocity.VelocityEngineUtils;
|
17
|
|
18
|
import java.text.SimpleDateFormat;
|
19
|
import java.util.*;
|
20
|
import java.util.concurrent.TimeUnit;
|
21
|
|
22
|
/**
|
23
|
* Created by michele on 02/12/15.
|
24
|
*/
|
25
|
public class ResultEntry {
|
26
|
|
27
|
|
28
|
private String openaireId;
|
29
|
private String originalId;
|
30
|
private String title;
|
31
|
private List<String> authors = new ArrayList<>();
|
32
|
private String publisher;
|
33
|
private String description;
|
34
|
private String language;
|
35
|
private List<PidEntry> pids = new ArrayList<>();
|
36
|
/**
|
37
|
* @Deprecated: use accessRightCode
|
38
|
*/
|
39
|
@Deprecated
|
40
|
private String licenseCode;
|
41
|
private String accessRightCode;
|
42
|
private String embargoEndDate;
|
43
|
/**
|
44
|
* One of publication, dataset, software, other. Default value is publication.
|
45
|
*/
|
46
|
private String type = "publication";
|
47
|
private String resourceType;
|
48
|
private String url;
|
49
|
private String collectedFromId;
|
50
|
private String hostedById;
|
51
|
|
52
|
// String according to the EGI context profile, example: egi::classification::natsc::math
|
53
|
private List<String> contexts = new ArrayList<>();
|
54
|
|
55
|
// String according to openaire guidelines:
|
56
|
// info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]
|
57
|
private List<String> linksToProjects = new ArrayList<>();
|
58
|
|
59
|
private static final Log log = LogFactory.getLog(ResultEntry.class);
|
60
|
|
61
|
public ResultEntry() {}
|
62
|
|
63
|
public String getOpenaireId() {
|
64
|
return openaireId;
|
65
|
}
|
66
|
|
67
|
public void setOpenaireId(final String openaireId) {
|
68
|
this.openaireId = openaireId;
|
69
|
}
|
70
|
|
71
|
public String getOriginalId() {
|
72
|
return originalId;
|
73
|
}
|
74
|
|
75
|
public void setOriginalId(final String originalId) {
|
76
|
this.originalId = originalId;
|
77
|
}
|
78
|
|
79
|
@ApiModelProperty(required = true)
|
80
|
public String getTitle() {
|
81
|
return title;
|
82
|
}
|
83
|
|
84
|
public void setTitle(final String title) {
|
85
|
this.title = title;
|
86
|
}
|
87
|
|
88
|
public List<String> getAuthors() {
|
89
|
return authors;
|
90
|
}
|
91
|
|
92
|
public void setAuthors(final List<String> authors) {
|
93
|
this.authors = authors;
|
94
|
}
|
95
|
|
96
|
public String getPublisher() {
|
97
|
return publisher;
|
98
|
}
|
99
|
|
100
|
public void setPublisher(final String publisher) {
|
101
|
this.publisher = publisher;
|
102
|
}
|
103
|
|
104
|
public String getDescription() {
|
105
|
return description;
|
106
|
}
|
107
|
|
108
|
public void setDescription(final String description) {
|
109
|
this.description = description;
|
110
|
}
|
111
|
|
112
|
@ApiModelProperty(value = "ISO Alpha-3 code. E.g. 'eng', 'ita'")
|
113
|
public String getLanguage() {
|
114
|
return language;
|
115
|
}
|
116
|
|
117
|
public void setLanguage(final String language) {
|
118
|
this.language = language;
|
119
|
}
|
120
|
|
121
|
public List<PidEntry> getPids() {
|
122
|
return pids;
|
123
|
}
|
124
|
|
125
|
public void setPids(final List<PidEntry> pids) {
|
126
|
this.pids = pids;
|
127
|
}
|
128
|
|
129
|
@Deprecated
|
130
|
@ApiModelProperty(required = false, allowableValues = "OPEN, CLOSED, RESTRICTED, EMBARGO, UNKNOWN, OTHER, OPEN SOURCE")
|
131
|
public String getLicenseCode() {
|
132
|
return licenseCode;
|
133
|
}
|
134
|
@Deprecated
|
135
|
public void setLicenseCode(final String licenseCode) {
|
136
|
this.licenseCode = licenseCode;
|
137
|
}
|
138
|
|
139
|
/**
|
140
|
* Set required = true when the deprecated licenseCode is not used anymore by our client and it is removed
|
141
|
* @return access rights code
|
142
|
*/
|
143
|
@ApiModelProperty(required = false, allowableValues = "OPEN, CLOSED, RESTRICTED, EMBARGO, UNKNOWN, OTHER, OPEN SOURCE")
|
144
|
public String getAccessRightCode() {
|
145
|
return accessRightCode;
|
146
|
}
|
147
|
|
148
|
public void setAccessRightCode(final String accessRightCode) {
|
149
|
this.accessRightCode = accessRightCode;
|
150
|
}
|
151
|
|
152
|
@ApiModelProperty(required = true, value = "Use 001 for articles, 021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
|
153
|
public String getResourceType() {
|
154
|
return resourceType;
|
155
|
}
|
156
|
|
157
|
public void setResourceType(final String resourceType) {
|
158
|
this.resourceType = resourceType;
|
159
|
}
|
160
|
|
161
|
@ApiModelProperty(required = true)
|
162
|
public String getUrl() {
|
163
|
return url;
|
164
|
}
|
165
|
|
166
|
public void setUrl(final String url) {
|
167
|
this.url = url;
|
168
|
}
|
169
|
|
170
|
@ApiModelProperty(required = true, value = "Use opendoar___::2659 for Zenodo Publications; re3data_____::r3d100010468 for Zenodo datasets; infrastruct::openaire for OpenAIRE portal.")
|
171
|
public String getCollectedFromId() {
|
172
|
return collectedFromId;
|
173
|
}
|
174
|
|
175
|
public void setCollectedFromId(final String collectedFromId) {
|
176
|
this.collectedFromId = collectedFromId;
|
177
|
}
|
178
|
|
179
|
public String getHostedById() {
|
180
|
return hostedById;
|
181
|
}
|
182
|
|
183
|
public void setHostedById(final String hostedById) {
|
184
|
this.hostedById = hostedById;
|
185
|
}
|
186
|
|
187
|
@ApiModelProperty(value = "E.g. fet, egi::classification::natsc::math::pure, egi::projects::EMI")
|
188
|
public List<String> getContexts() {
|
189
|
return contexts;
|
190
|
}
|
191
|
|
192
|
public void setContexts(final List<String> contexts) {
|
193
|
this.contexts = contexts;
|
194
|
}
|
195
|
|
196
|
@ApiModelProperty(value = "E.g. info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus")
|
197
|
public List<String> getLinksToProjects() {
|
198
|
return linksToProjects;
|
199
|
}
|
200
|
|
201
|
public void setLinksToProjects(final List<String> linksToProjects) {
|
202
|
this.linksToProjects = linksToProjects;
|
203
|
}
|
204
|
|
205
|
@ApiModelProperty(allowableValues = "publication, dataset, software, other")
|
206
|
public String getType() {
|
207
|
return type;
|
208
|
}
|
209
|
|
210
|
public void setType(final String type) {
|
211
|
this.type = type;
|
212
|
}
|
213
|
|
214
|
public String getEmbargoEndDate() {
|
215
|
return embargoEndDate;
|
216
|
}
|
217
|
|
218
|
public void setEmbargoEndDate(final String embargoEndDate) {
|
219
|
this.embargoEndDate = embargoEndDate;
|
220
|
}
|
221
|
|
222
|
@Override
|
223
|
public String toString() {
|
224
|
return new Gson().toJson(this);
|
225
|
}
|
226
|
|
227
|
public String getAnyId() {
|
228
|
return StringUtils.isNotBlank(openaireId) ? openaireId : originalId;
|
229
|
}
|
230
|
}
|