Project

General

Profile

« Previous | Next » 

Revision 46876

cleanup, added method to search among apis

View differences:

modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/IdentifiersResponse.java
1
package eu.dnetlib.datasource.publisher.model;
2

  
3
import java.util.List;
4

  
5
import com.fasterxml.jackson.annotation.JsonAutoDetect;
6
import io.swagger.annotations.ApiModel;
7

  
8
/**
9
 * Created by claudio on 01/12/2016.
10
 */
11
@ApiModel
12
@JsonAutoDetect
13
public class IdentifiersResponse extends Response {
14

  
15
	private List<String> ids;
16

  
17
	public IdentifiersResponse() {
18
	}
19

  
20
	public IdentifiersResponse(final List<String> ids) {
21
		this.ids = ids;
22
	}
23

  
24
	public List<String> getIds() {
25
		return ids;
26
	}
27

  
28
	public IdentifiersResponse setIds(final List<String> ids) {
29
		this.ids = ids;
30
		return this;
31
	}
32
}
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/Api.java
1
package eu.dnetlib.datasource.publisher.model;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5
import java.util.Objects;
6

  
7
import com.fasterxml.jackson.annotation.JsonAutoDetect;
8
import io.swagger.annotations.ApiModel;
9

  
10
/**
11
 * Api
12
 */
13
@JsonAutoDetect
14
@ApiModel(value = "Datasource Api model", description = "describes the datasource api")
15
public class Api {
16

  
17
	private String id = null;
18
	private String typology = null;
19
	private String compliance;
20
	private String contentdescription = null;
21
	private String accessprotocol = null;
22
	private String baseurl = null;
23
	private boolean active = false;
24
	private boolean removable = false;
25
	private Map<String, String> accessParams = new HashMap<String, String>();
26
	private Map<String, String> extraFields = new HashMap<String, String>();
27

  
28
	public Api id(String id) {
29
		this.id = id;
30
		return this;
31
	}
32

  
33
	/**
34
	 * Get id
35
	 *
36
	 * @return id
37
	 **/
38
	public String getId() {
39
		return id;
40
	}
41

  
42
	public void setId(String id) {
43
		this.id = id;
44
	}
45

  
46
	public Api typology(String typology) {
47
		this.typology = typology;
48
		return this;
49
	}
50

  
51
	/**
52
	 * Get typology
53
	 *
54
	 * @return typology
55
	 **/
56
	public String getTypology() {
57
		return typology;
58
	}
59

  
60
	public void setTypology(String typology) {
61
		this.typology = typology;
62
	}
63

  
64
	public Api compliance(String compliance) {
65
		this.compliance = compliance;
66
		return this;
67
	}
68

  
69
	/**
70
	 * Get typology
71
	 *
72
	 * @return typology
73
	 **/
74
	public String getCompliance() {
75
		return compliance;
76
	}
77

  
78
	public void setCompliance(String compliance) {
79
		this.compliance = compliance;
80
	}
81

  
82
	public Api contentdescription(String contentdescription) {
83
		this.contentdescription = contentdescription;
84
		return this;
85
	}
86

  
87
	/**
88
	 * Get contentdescription
89
	 *
90
	 * @return contentdescription
91
	 **/
92
	public String getContentdescription() {
93
		return contentdescription;
94
	}
95

  
96
	public void setContentdescription(String contentdescription) {
97
		this.contentdescription = contentdescription;
98
	}
99

  
100
	public Api accessprotocol(String accessprotocol) {
101
		this.accessprotocol = accessprotocol;
102
		return this;
103
	}
104

  
105
	/**
106
	 * Get accessprotocol
107
	 *
108
	 * @return accessprotocol
109
	 **/
110
	public String getAccessprotocol() {
111
		return accessprotocol;
112
	}
113

  
114
	public void setAccessprotocol(String accessprotocol) {
115
		this.accessprotocol = accessprotocol;
116
	}
117

  
118
	public Api baseurl(String baseurl) {
119
		this.baseurl = baseurl;
120
		return this;
121
	}
122

  
123
	/**
124
	 * Get baseurl
125
	 *
126
	 * @return baseurl
127
	 **/
128
	public String getBaseurl() {
129
		return baseurl;
130
	}
131

  
132
	public void setBaseurl(String baseurl) {
133
		this.baseurl = baseurl;
134
	}
135

  
136
	public Api active(boolean active) {
137
		this.active = active;
138
		return this;
139
	}
140

  
141
	/**
142
	 * Get active
143
	 *
144
	 * @return active
145
	 **/
146
	public boolean isActive() {
147
		return active;
148
	}
149

  
150
	public void setActive(boolean active) {
151
		this.active = active;
152
	}
153

  
154
	public Api removable(boolean removable) {
155
		this.removable = removable;
156
		return this;
157
	}
158

  
159
	/**
160
	 * Get active
161
	 *
162
	 * @return active
163
	 **/
164
	public boolean isRemovable() {
165
		return removable;
166
	}
167

  
168
	public void setRemovable(boolean removable) {
169
		this.removable = removable;
170
	}
171

  
172
	public Api accessParams(Map<String, String> accessParams) {
173
		this.accessParams = accessParams;
174
		return this;
175
	}
176

  
177
	/**
178
	 * Get active
179
	 *
180
	 * @return active
181
	 **/
182
	public Map<String, String> getAccessParams() {
183
		return accessParams;
184
	}
185

  
186
	public void setAccessParams(Map<String, String> accessParams) {
187
		this.accessParams = accessParams;
188
	}
189

  
190
	///
191

  
192
	public Api extraFields(Map<String, String> extraFields) {
193
		this.extraFields = extraFields;
194
		return this;
195
	}
196

  
197
	/**
198
	 * Get active
199
	 *
200
	 * @return active
201
	 **/
202
	public Map<String, String> getExtraFields() {
203
		return extraFields;
204
	}
205

  
206
	public void setExtraFields(Map<String, String> extraFields) {
207
		this.extraFields = extraFields;
208
	}
209

  
210
	@Override
211
	public boolean equals(Object o) {
212
		if (this == o) {
213
			return true;
214
		}
215
		if (o == null || getClass() != o.getClass()) {
216
			return false;
217
		}
218
		Api api = (Api) o;
219
		return Objects.equals(this.id, api.id) &&
220
				Objects.equals(this.typology, api.typology) &&
221
				Objects.equals(this.contentdescription, api.contentdescription) &&
222
				Objects.equals(this.accessprotocol, api.accessprotocol) &&
223
				Objects.equals(this.baseurl, api.baseurl);
224
	}
225

  
226
	@Override
227
	public int hashCode() {
228
		return Objects.hash(id, typology, contentdescription, accessprotocol, baseurl);
229
	}
230

  
231
	@Override
232
	public String toString() {
233
		StringBuilder sb = new StringBuilder();
234
		sb.append("class Api {\n");
235

  
236
		sb.append("    id: ").append(toIndentedString(id)).append("\n");
237
		sb.append("    typology: ").append(toIndentedString(typology)).append("\n");
238
		sb.append("    contentdescription: ").append(toIndentedString(contentdescription)).append("\n");
239
		sb.append("    accessprotocol: ").append(toIndentedString(accessprotocol)).append("\n");
240
		sb.append("    baseurl: ").append(toIndentedString(baseurl)).append("\n");
241
		sb.append("}");
242
		return sb.toString();
243
	}
244

  
245
	/**
246
	 * Convert the given object to string with each line indented by 4 spaces
247
	 * (except the first line).
248
	 */
249
	private String toIndentedString(Object o) {
250
		if (o == null) {
251
			return "null";
252
		}
253
		return o.toString().replace("\n", "\n    ");
254
	}
255
}
256

  
257 0

  
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/Datasource.java
1
package eu.dnetlib.datasource.publisher.model;
2

  
3
import java.util.List;
4
import java.util.Objects;
5

  
6
import com.fasterxml.jackson.annotation.JsonAutoDetect;
7
import io.swagger.annotations.ApiModel;
8
import io.swagger.annotations.ApiModelProperty;
9

  
10
/**
11
 * Datasource
12
 */
13
@JsonAutoDetect
14
@ApiModel(value = "Datasource model", description = "provides datasource details")
15
public class Datasource {
16

  
17
	private String id = null;
18
	private String officialname = null;
19
	private String englishname = null;
20
	private String websiteurl = null;
21
	private String logourl = null;
22
	private String contactemail = null;
23
	private String countrycode = null;
24
	private String countryname = null;
25
	private String organization = null;
26
	private double latitude;
27
	private double longitude;
28
	private String timezone = null;
29
	private String collectedfrom = null;
30
	private String dateofvalidation = null;
31
	private String registeredby = null;
32
	private String datasourceclass = null;
33
	private String typology = null;
34
	private String activationid = null;
35
	private String description = null;
36
	private String issn = null;
37
	private String eissn = null;
38
	private String lissn = null;
39
	private List<Api> api = null;
40

  
41
	public Datasource id(String id) {
42
		this.id = id;
43
		return this;
44
	}
45

  
46
	/**
47
	 * Get id
48
	 *
49
	 * @return id
50
	 **/
51
	@ApiModelProperty(required = true, value = "")
52
	public String getId() {
53
		return id;
54
	}
55

  
56
	public void setId(String id) {
57
		this.id = id;
58
	}
59

  
60
	public Datasource officialname(String officialname) {
61
		this.officialname = officialname;
62
		return this;
63
	}
64

  
65
	/**
66
	 * Get englishname
67
	 *
68
	 * @return englishname
69
	 **/
70
	public String getEnglishname() {
71
		return englishname;
72
	}
73

  
74
	public void setEnglishname(String englishname) {
75
		this.englishname = englishname;
76
	}
77

  
78
	public Datasource englishname(String englishname) {
79
		this.englishname = englishname;
80
		return this;
81
	}
82

  
83
	/**
84
	 * Get officialname
85
	 *
86
	 * @return officialname
87
	 **/
88
	@ApiModelProperty(required = true, value = "")
89
	public String getOfficialname() {
90
		return officialname;
91
	}
92

  
93
	public void setOfficialname(String officialname) {
94
		this.officialname = officialname;
95
	}
96

  
97

  
98
	public Datasource websiteurl(String websiteurl) {
99
		this.websiteurl = websiteurl;
100
		return this;
101
	}
102

  
103
	/**
104
	 * Get websiteurl
105
	 *
106
	 * @return websiteurl
107
	 **/
108
	public String getWebsiteurl() {
109
		return websiteurl;
110
	}
111

  
112
	public void setWebsiteurl(String websiteurl) {
113
		this.websiteurl = websiteurl;
114
	}
115

  
116
	public Datasource logourl(String logourl) {
117
		this.logourl = logourl;
118
		return this;
119
	}
120

  
121
	/**
122
	 * Get logourl
123
	 *
124
	 * @return logourl
125
	 **/
126
	public String getLogourl() {
127
		return logourl;
128
	}
129

  
130
	public void setLogourl(String logourl) {
131
		this.logourl = logourl;
132
	}
133

  
134
	public Datasource contactemail(String contactemail) {
135
		this.contactemail = contactemail;
136
		return this;
137
	}
138

  
139
	/**
140
	 * Get contactemail
141
	 *
142
	 * @return contactemail
143
	 **/
144
	public String getContactemail() {
145
		return contactemail;
146
	}
147

  
148
	public void setContactemail(String contactemail) {
149
		this.contactemail = contactemail;
150
	}
151

  
152
	public Datasource countrycode(String countrycode) {
153
		this.countrycode = countrycode;
154
		return this;
155
	}
156

  
157
	/**
158
	 * Get countrycode
159
	 *
160
	 * @return countrycode
161
	 **/
162
	public String getCountrycode() {
163
		return countrycode;
164
	}
165

  
166
	public void setCountrycode(String countrycode) {
167
		this.countrycode = countrycode;
168
	}
169

  
170
	public Datasource countryname(String countryname) {
171
		this.countryname = countryname;
172
		return this;
173
	}
174

  
175
	/**
176
	 * Get countryname
177
	 *
178
	 * @return countryname
179
	 **/
180
	public String getCountryname() {
181
		return countryname;
182
	}
183

  
184
	public void setCountryname(String countryname) {
185
		this.countryname = countryname;
186
	}
187

  
188
	public Datasource organization(String organization) {
189
		this.organization = organization;
190
		return this;
191
	}
192

  
193
	/**
194
	 * Get organization
195
	 *
196
	 * @return organization
197
	 **/
198
	public String getOrganization() {
199
		return organization;
200
	}
201

  
202
	public void setOrganization(String organization) {
203
		this.organization = organization;
204
	}
205

  
206
	public Datasource latitude(double latitude) {
207
		this.latitude = latitude;
208
		return this;
209
	}
210

  
211
	/**
212
	 * Get latitude
213
	 *
214
	 * @return latitude
215
	 **/
216
	public double getLatitude() {
217
		return latitude;
218
	}
219

  
220
	public void setLatitude(double latitude) {
221
		this.latitude = latitude;
222
	}
223

  
224
	public Datasource longitude(double longitude) {
225
		this.longitude = longitude;
226
		return this;
227
	}
228

  
229
	/**
230
	 * Get longitude
231
	 *
232
	 * @return longitude
233
	 **/
234
	public double getLongitude() {
235
		return longitude;
236
	}
237

  
238
	public void setLongitude(double longitude) {
239
		this.longitude = longitude;
240
	}
241

  
242
	public Datasource timezone(String timezone) {
243
		this.timezone = timezone;
244
		return this;
245
	}
246

  
247
	/**
248
	 * Get timezone
249
	 *
250
	 * @return timezone
251
	 **/
252
	public String getTimezone() {
253
		return timezone;
254
	}
255

  
256
	public void setTimezone(String timezone) {
257
		this.timezone = timezone;
258
	}
259

  
260
	public Datasource collectedfrom(String collectedfrom) {
261
		this.collectedfrom = collectedfrom;
262
		return this;
263
	}
264

  
265
	/**
266
	 * Get collectedfrom
267
	 *
268
	 * @return collectedfrom
269
	 **/
270
	public String getCollectedfrom() {
271
		return collectedfrom;
272
	}
273

  
274
	public void setCollectedfrom(String collectedfrom) {
275
		this.collectedfrom = collectedfrom;
276
	}
277

  
278
	public Datasource dateofvalidation(String dateofvalidation) {
279
		this.dateofvalidation = dateofvalidation;
280
		return this;
281
	}
282

  
283
	/**
284
	 * Get dateofvalidation
285
	 *
286
	 * @return dateofvalidation
287
	 **/
288
	public String getDateofvalidation() {
289
		return dateofvalidation;
290
	}
291

  
292
	public void setDateofvalidation(String dateofvalidation) {
293
		this.dateofvalidation = dateofvalidation;
294
	}
295

  
296
	public Datasource registeredby(String registeredby) {
297
		this.registeredby = registeredby;
298
		return this;
299
	}
300

  
301
	/**
302
	 * Get registeredby
303
	 *
304
	 * @return registeredby
305
	 **/
306
	public String getRegisteredby() {
307
		return registeredby;
308
	}
309

  
310
	public void setRegisteredby(String registeredby) {
311
		this.registeredby = registeredby;
312
	}
313

  
314
	public Datasource datasourceclass(String datasourcecclass) {
315
		this.datasourceclass = datasourcecclass;
316
		return this;
317
	}
318

  
319
	/**
320
	 * Get datasourcecclass
321
	 *
322
	 * @return datasourcecclass
323
	 **/
324
	public String getDatasourceclass() {
325
		return datasourceclass;
326
	}
327

  
328
	public void setDatasourcecclass(String datasourcecclass) {
329
		this.datasourceclass = datasourcecclass;
330
	}
331

  
332
	public Datasource typology(String typology) {
333
		this.typology = typology;
334
		return this;
335
	}
336

  
337
	/**
338
	 * Get typology
339
	 *
340
	 * @return typology
341
	 **/
342
	public String getTypology() {
343
		return typology;
344
	}
345

  
346
	public void setTypology(String typology) {
347
		this.typology = typology;
348
	}
349

  
350
	public Datasource activationid(String activationid) {
351
		this.activationid = activationid;
352
		return this;
353
	}
354

  
355
	/**
356
	 * Get activationid
357
	 *
358
	 * @return activationid
359
	 **/
360
	public String getActivationid() {
361
		return activationid;
362
	}
363

  
364
	public void setActivationid(String activationid) {
365
		this.activationid = activationid;
366
	}
367

  
368
	public Datasource description(String description) {
369
		this.description = description;
370
		return this;
371
	}
372

  
373
	/**
374
	 * Get description
375
	 *
376
	 * @return description
377
	 **/
378
	public String getDescription() {
379
		return description;
380
	}
381

  
382
	public void setDescription(String description) {
383
		this.description = description;
384
	}
385

  
386
	public Datasource issn(String issn) {
387
		this.issn = issn;
388
		return this;
389
	}
390

  
391
	/**
392
	 * Get issn
393
	 *
394
	 * @return issn
395
	 **/
396
	public String getIssn() {
397
		return issn;
398
	}
399

  
400
	public void setIssn(String issn) {
401
		this.issn = issn;
402
	}
403

  
404
	public Datasource eissn(String eissn) {
405
		this.eissn = eissn;
406
		return this;
407
	}
408

  
409
	/**
410
	 * Get eissn
411
	 *
412
	 * @return eissn
413
	 **/
414
	public String getEissn() {
415
		return eissn;
416
	}
417

  
418
	public void setEissn(String eissn) {
419
		this.eissn = eissn;
420
	}
421

  
422
	public Datasource lissn(String lissn) {
423
		this.lissn = lissn;
424
		return this;
425
	}
426

  
427
	/**
428
	 * Get lissn
429
	 *
430
	 * @return lissn
431
	 **/
432
	public String getLissn() {
433
		return lissn;
434
	}
435

  
436
	public void setLissn(String lissn) {
437
		this.lissn = lissn;
438
	}
439

  
440
	public Datasource api(List<Api> api) {
441
		this.api = api;
442
		return this;
443
	}
444

  
445
	/**
446
	 * Get api
447
	 *
448
	 * @return api
449
	 **/
450
	public List<Api> getApi() {
451
		return api;
452
	}
453

  
454
	public void setApi(List<Api> api) {
455
		this.api = api;
456
	}
457

  
458
	@Override
459
	public boolean equals(Object o) {
460
		if (this == o) {
461
			return true;
462
		}
463
		if (o == null || getClass() != o.getClass()) {
464
			return false;
465
		}
466
		Datasource datasource = (Datasource) o;
467
		return Objects.equals(this.id, datasource.id) &&
468
				Objects.equals(this.officialname, datasource.officialname) &&
469
				Objects.equals(this.englishname, datasource.englishname) &&
470
				Objects.equals(this.websiteurl, datasource.websiteurl) &&
471
				Objects.equals(this.logourl, datasource.logourl) &&
472
				Objects.equals(this.contactemail, datasource.contactemail) &&
473
				Objects.equals(this.countrycode, datasource.countrycode) &&
474
				Objects.equals(this.countryname, datasource.countryname) &&
475
				Objects.equals(this.organization, datasource.organization) &&
476
				Objects.equals(this.latitude, datasource.latitude) &&
477
				Objects.equals(this.longitude, datasource.longitude) &&
478
				Objects.equals(this.timezone, datasource.timezone) &&
479
				Objects.equals(this.collectedfrom, datasource.collectedfrom) &&
480
				Objects.equals(this.dateofvalidation, datasource.dateofvalidation) &&
481
				Objects.equals(this.registeredby, datasource.registeredby) &&
482
				Objects.equals(this.datasourceclass, datasource.datasourceclass) &&
483
				Objects.equals(this.typology, datasource.typology) &&
484
				Objects.equals(this.activationid, datasource.activationid) &&
485
				Objects.equals(this.description, datasource.description) &&
486
				Objects.equals(this.issn, datasource.issn) &&
487
				Objects.equals(this.eissn, datasource.eissn) &&
488
				Objects.equals(this.lissn, datasource.lissn) &&
489
				Objects.equals(this.api, datasource.api);
490
	}
491

  
492
	@Override
493
	public int hashCode() {
494
		return Objects.hash(id, officialname, englishname, websiteurl, logourl, contactemail, countrycode, countryname, organization, latitude, longitude, timezone,
495
				collectedfrom, dateofvalidation, registeredby, datasourceclass, typology, activationid, description,
496
				issn, eissn, lissn, api);
497
	}
498

  
499
	@Override
500
	public String toString() {
501
		StringBuilder sb = new StringBuilder();
502
		sb.append("class Datasource {\n");
503

  
504
		sb.append("    id: ").append(toIndentedString(id)).append("\n");
505
		sb.append("    officialname: ").append(toIndentedString(officialname)).append("\n");
506
		sb.append("    englishname: ").append(toIndentedString(englishname)).append("\n");
507
		sb.append("    websiteurl: ").append(toIndentedString(websiteurl)).append("\n");
508
		sb.append("    logourl: ").append(toIndentedString(logourl)).append("\n");
509
		sb.append("    contactemail: ").append(toIndentedString(contactemail)).append("\n");
510
		sb.append("    countrycode: ").append(toIndentedString(countrycode)).append("\n");
511
		sb.append("    countryname: ").append(toIndentedString(countryname)).append("\n");
512
		sb.append("    organization: ").append(toIndentedString(organization)).append("\n");
513
		sb.append("    latitude: ").append(toIndentedString(latitude)).append("\n");
514
		sb.append("    longitude: ").append(toIndentedString(longitude)).append("\n");
515
		sb.append("    timezone: ").append(toIndentedString(timezone)).append("\n");
516
		sb.append("    collectedfrom: ").append(toIndentedString(collectedfrom)).append("\n");
517
		sb.append("    dateofvalidation: ").append(toIndentedString(dateofvalidation)).append("\n");
518
		sb.append("    registeredby: ").append(toIndentedString(registeredby)).append("\n");
519
		sb.append("    datasourcecclass: ").append(toIndentedString(datasourceclass)).append("\n");
520
		sb.append("    typology: ").append(toIndentedString(typology)).append("\n");
521
		sb.append("    activationid: ").append(toIndentedString(activationid)).append("\n");
522
		sb.append("    description: ").append(toIndentedString(description)).append("\n");
523
		sb.append("    issn: ").append(toIndentedString(issn)).append("\n");
524
		sb.append("    eissn: ").append(toIndentedString(eissn)).append("\n");
525
		sb.append("    lissn: ").append(toIndentedString(lissn)).append("\n");
526
		sb.append("    api: ").append(toIndentedString(api)).append("\n");
527
		sb.append("}");
528
		return sb.toString();
529
	}
530

  
531
	/**
532
	 * Convert the given object to string with each line indented by 4 spaces
533
	 * (except the first line).
534
	 */
535
	private String toIndentedString(Object o) {
536
		if (o == null) {
537
			return "null";
538
		}
539
		return o.toString().replace("\n", "\n    ");
540
	}
541
}
542

  
543 0

  
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/repository/SearchApiRepository.java
1
package eu.dnetlib.datasource.publisher.repository;
2

  
3
import java.util.List;
4

  
5
import eu.dnetlib.datasource.publisher.model.db.SearchInterfacesEntry;
6
import org.springframework.data.jpa.repository.JpaRepository;
7
import org.springframework.stereotype.Repository;
8

  
9
/**
10
 * Created by claudio on 12/04/2017.
11
 */
12
@Repository
13
public interface SearchApiRepository extends JpaRepository<SearchInterfacesEntry, String> {
14

  
15
	SearchInterfacesEntry findOneById(String id);
16

  
17
	List<SearchInterfacesEntry> findByRepoidContainingOrRepoNameContainingOrAlternativeNameContainingOrRepoPrefixContainingOrRepoOrganizationContainingAllIgnoreCase(
18
			String repoId,
19
			String repoName,
20
			String alternativeName,
21
			String repoPrefix,
22
			String repoOrganization);
23

  
24
}
25

  
26

  
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/repository/DatasourceRepository.java
1
package eu.dnetlib.datasource.publisher.repository;
2

  
3
import eu.dnetlib.datasource.publisher.model.db.Datasource;
4
import org.springframework.data.jpa.repository.JpaRepository;
5
import org.springframework.scheduling.annotation.Async;
6
import org.springframework.stereotype.Repository;
7
import org.springframework.util.concurrent.ListenableFuture;
8

  
9
/**
10
 * Created by claudio on 12/04/2017.
11
 */
12
@Repository
13
public interface DatasourceRepository extends JpaRepository<Datasource, String> {
14

  
15
	@Async
16
	ListenableFuture<Datasource> findOneById(String id);
17

  
18
}
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/db/ApiParamKey.java
1
package eu.dnetlib.datasource.publisher.model.db;
2

  
3
import java.io.Serializable;
4
import java.util.Objects;
5
import javax.persistence.Embeddable;
6

  
7
import com.google.common.collect.ComparisonChain;
8

  
9
/**
10
 * Created by claudio on 13/04/2017.
11
 */
12
@Embeddable
13
public class ApiParamKey implements Serializable {
14

  
15
	private String param;
16

  
17
	private String value;
18

  
19
	public String getParam() {
20
		return param;
21
	}
22

  
23
	public String getValue() {
24
		return value;
25
	}
26

  
27
	public ApiParamKey setParam(final String param) {
28
		this.param = param;
29
		return this;
30
	}
31

  
32
	public ApiParamKey setValue(final String value) {
33
		this.value = value;
34
		return this;
35
	}
36

  
37
	@Override
38
	public int hashCode() {
39
		return Objects.hash(getParam(), getValue());
40
	}
41

  
42
	@Override
43
	public boolean equals(final Object o) {
44
		if (this == o) {
45
			return true;
46
		}
47
		if (o == null || getClass() != o.getClass()) {
48
			return false;
49
		}
50
		ApiParamKey apk = (ApiParamKey) o;
51
		return ComparisonChain.start()
52
				.compare(getParam(), apk.getParam())
53
				.compare(getValue(), apk.getValue())
54
				.result() == 0;
55
	}
56
}
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/db/Organization.java
1
package eu.dnetlib.datasource.publisher.model.db;
2

  
3
import java.sql.Date;
4
import java.util.Set;
5
import javax.persistence.*;
6

  
7
import com.fasterxml.jackson.annotation.JsonAutoDetect;
8
import com.fasterxml.jackson.annotation.JsonIgnore;
9
import io.swagger.annotations.ApiModel;
10

  
11
/**
12
 * Created by claudio on 13/04/2017.
13
 */
14
@Entity
15
@Table(name = "organizations")
16
@JsonAutoDetect
17
@ApiModel(value = "Organization model", description = "provides organization details")
18
public class Organization {
19

  
20
	@Id
21
	private String id;
22
	private String legalshortname;
23
	private String legalname;
24
	private String websiteurl;
25
	private String logourl;
26

  
27
	@Column(name = "ec_legalbody")
28
	private Boolean eclegalbody;
29

  
30
	@Column(name = "ec_legalperson")
31
	private Boolean eclegalperson;
32

  
33
	@Column(name = "ec_nonprofit")
34
	private Boolean ecnonprofit;
35

  
36
	@Column(name = "ec_researchorganization")
37
	private Boolean ecresearchorganization;
38

  
39
	@Column(name = "ec_highereducation")
40
	private Boolean echighereducation;
41

  
42
	@Column(name = "ec_internationalorganizationeurinterests")
43
	private Boolean ecinternationalorganizationeurinterests;
44

  
45
	@Column(name = "ec_internationalorganization")
46
	private Boolean ecinternationalorganization;
47

  
48
	@Column(name = "ec_enterprise")
49
	private Boolean ecenterprise;
50

  
51
	@Column(name = "ec_smevalidated")
52
	private Boolean ecsmevalidated;
53

  
54
	@Column(name = "ec_nutscode")
55
	private Boolean ecnutscode;
56

  
57
	private String country;
58
	private String collectedfrom;
59

  
60
	private Date dateofcollection;
61
	private String provenanceaction;
62

  
63
	@JsonIgnore
64
	@ManyToMany(
65
			cascade = { CascadeType.PERSIST, CascadeType.MERGE },
66
			fetch = FetchType.EAGER,
67
			mappedBy = "organizations")
68
	private Set<Datasource> datasources;
69

  
70
	public String getId() {
71
		return id;
72
	}
73

  
74
	public String getLegalshortname() {
75
		return legalshortname;
76
	}
77

  
78
	public String getLegalname() {
79
		return legalname;
80
	}
81

  
82
	public String getWebsiteurl() {
83
		return websiteurl;
84
	}
85

  
86
	public String getLogourl() {
87
		return logourl;
88
	}
89

  
90
	public Boolean isEclegalbody() {
91
		return eclegalbody;
92
	}
93

  
94
	public Boolean isEclegalperson() {
95
		return eclegalperson;
96
	}
97

  
98
	public Boolean isEcnonprofit() {
99
		return ecnonprofit;
100
	}
101

  
102
	public Boolean isEcresearchorganization() {
103
		return ecresearchorganization;
104
	}
105

  
106
	public Boolean isEchighereducation() {
107
		return echighereducation;
108
	}
109

  
110
	public Boolean isEcinternationalorganizationeurinterests() {
111
		return ecinternationalorganizationeurinterests;
112
	}
113

  
114
	public Boolean isEcinternationalorganization() {
115
		return ecinternationalorganization;
116
	}
117

  
118
	public Boolean isEcenterprise() {
119
		return ecenterprise;
120
	}
121

  
122
	public Boolean isEcsmevalidated() {
123
		return ecsmevalidated;
124
	}
125

  
126
	public Boolean isEcnutscode() {
127
		return ecnutscode;
128
	}
129

  
130
	public String getCountry() {
131
		return country;
132
	}
133

  
134
	public String getCollectedfrom() {
135
		return collectedfrom;
136
	}
137

  
138
	public Date getDateofcollection() {
139
		return dateofcollection;
140
	}
141

  
142
	public String getProvenanceaction() {
143
		return provenanceaction;
144
	}
145

  
146
	public Organization setId(final String id) {
147
		this.id = id;
148
		return this;
149
	}
150

  
151
	public Organization setLegalshortname(final String legalshortname) {
152
		this.legalshortname = legalshortname;
153
		return this;
154
	}
155

  
156
	public Organization setLegalname(final String legalname) {
157
		this.legalname = legalname;
158
		return this;
159
	}
160

  
161
	public Organization setWebsiteurl(final String websiteurl) {
162
		this.websiteurl = websiteurl;
163
		return this;
164
	}
165

  
166
	public Organization setLogourl(final String logourl) {
167
		this.logourl = logourl;
168
		return this;
169
	}
170

  
171
	public Organization setEclegalbody(final Boolean eclegalbody) {
172
		this.eclegalbody = eclegalbody;
173
		return this;
174
	}
175

  
176
	public Organization setEclegalperson(final Boolean eclegalperson) {
177
		this.eclegalperson = eclegalperson;
178
		return this;
179
	}
180

  
181
	public Organization setEcnonprofit(final Boolean ecnonprofit) {
182
		this.ecnonprofit = ecnonprofit;
183
		return this;
184
	}
185

  
186
	public Organization setEcresearchorganization(final Boolean ecresearchorganization) {
187
		this.ecresearchorganization = ecresearchorganization;
188
		return this;
189
	}
190

  
191
	public Organization setEchighereducation(final Boolean echighereducation) {
192
		this.echighereducation = echighereducation;
193
		return this;
194
	}
195

  
196
	public Organization setEcinternationalorganizationeurinterests(final Boolean ecinternationalorganizationeurinterests) {
197
		this.ecinternationalorganizationeurinterests = ecinternationalorganizationeurinterests;
198
		return this;
199
	}
200

  
201
	public Organization setEcinternationalorganization(final Boolean ecinternationalorganization) {
202
		this.ecinternationalorganization = ecinternationalorganization;
203
		return this;
204
	}
205

  
206
	public Organization setEcenterprise(final Boolean ecenterprise) {
207
		this.ecenterprise = ecenterprise;
208
		return this;
209
	}
210

  
211
	public Organization setEcsmevalidated(final Boolean ecsmevalidated) {
212
		this.ecsmevalidated = ecsmevalidated;
213
		return this;
214
	}
215

  
216
	public Organization setEcnutscode(final Boolean ecnutscode) {
217
		this.ecnutscode = ecnutscode;
218
		return this;
219
	}
220

  
221
	public Organization setCountry(final String country) {
222
		this.country = country;
223
		return this;
224
	}
225

  
226
	public Organization setCollectedfrom(final String collectedfrom) {
227
		this.collectedfrom = collectedfrom;
228
		return this;
229
	}
230

  
231
	public Organization setDateofcollection(final Date dateofcollection) {
232
		this.dateofcollection = dateofcollection;
233
		return this;
234
	}
235

  
236
	public Organization setProvenanceaction(final String provenanceaction) {
237
		this.provenanceaction = provenanceaction;
238
		return this;
239
	}
240

  
241
	public Set<Datasource> getDatasources() {
242
		return datasources;
243
	}
244

  
245
	public void setDatasources(final Set<Datasource> datasources) {
246
		this.datasources = datasources;
247
	}
248

  
249
}
modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/model/db/Api.java
1
package eu.dnetlib.datasource.publisher.model.db;
2

  
3
import java.sql.Date;
4
import java.util.Objects;
5
import java.util.Set;
6
import javax.persistence.*;
7

  
8
import com.fasterxml.jackson.annotation.JsonAutoDetect;
9
import com.fasterxml.jackson.annotation.JsonIgnore;
10
import com.google.gson.Gson;
11
import io.swagger.annotations.ApiModel;
12

  
13
/**
14
 * Api
15
 */
16
@Entity
17
@Table(name = "api")
18
@JsonAutoDetect
19
@ApiModel(value = "Datasource Api model", description = "describes the datasource api")
20
public class Api {
21

  
22
	@Id
23
	private String id = null;
24

  
25
	private String protocol = null;
26
	@JsonIgnore
27
	@ManyToOne
28
	@JoinColumn(name = "datasource")
29
	private Datasource datasource = null;
30
	private String contentdescription = null;
31
	private Boolean active = false;
32
	private Boolean removable = false;
33
	private String typology = null;
34

  
35
	private String compatibility;
36

  
37
	@Column(name = "metadata_identifier_path")
38
	private String metadataIdentifierPath;
39

  
40
	@Column(name = "last_collection_total")
41
	private Integer lastCollectionTotal;
42
	@Column(name = "last_collection_date")
43
	private Date lastCollectionDate;
44
	@Column(name = "last_collection_mdid")
45
	private String lastCollectionMdid;
46

  
47
	@Column(name = "last_aggregation_total")
48
	private Integer lastAggregationTotal;
49
	@Column(name = "last_aggregation_date")
50
	private Date lastAggregationDate;
51
	@Column(name = "last_aggregation_mdid")
52
	private String lastAggregationMdid;
53

  
54
	@Column(name = "last_download_total")
55
	private Integer lastDownloadTotal;
56
	@Column(name = "last_download_date")
57
	private Date lastDownloadDate;
58
	@Column(name = "last_download_objid")
59
	private String lastDownloadMdid;
60

  
61
	@Column(name = "last_validation_job")
62
	private String lastValidationJob;
63

  
64
	private String baseurl = null;
65

  
66
	@OneToMany(mappedBy="api", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
67
	private Set<Apiparam> apiparam;
68

  
69
	public String getId() {
70
		return id;
71
	}
72

  
73
	public String getProtocol() {
74
		return protocol;
75
	}
76

  
77
	public Datasource getDatasource() {
78
		return datasource;
79
	}
80

  
81
	public String getContentdescription() {
82
		return contentdescription;
83
	}
84

  
85
	public Boolean getActive() {
86
		return active;
87
	}
88

  
89
	public Boolean getRemovable() {
90
		return removable;
91
	}
92

  
93
	public String getTypology() {
94
		return typology;
95
	}
96

  
97
	public String getCompatibility() {
98
		return compatibility;
99
	}
100

  
101
	public String getMetadataIdentifierPath() {
102
		return metadataIdentifierPath;
103
	}
104

  
105
	public Integer getLastCollectionTotal() {
106
		return lastCollectionTotal;
107
	}
108

  
109
	public Date getLastCollectionDate() {
110
		return lastCollectionDate;
111
	}
112

  
113
	public String getLastCollectionMdid() {
114
		return lastCollectionMdid;
115
	}
116

  
117
	public Integer getLastAggregationTotal() {
118
		return lastAggregationTotal;
119
	}
120

  
121
	public Date getLastAggregationDate() {
122
		return lastAggregationDate;
123
	}
124

  
125
	public String getLastAggregationMdid() {
126
		return lastAggregationMdid;
127
	}
128

  
129
	public Integer getLastDownloadTotal() {
130
		return lastDownloadTotal;
131
	}
132

  
133
	public Date getLastDownloadDate() {
134
		return lastDownloadDate;
135
	}
136

  
137
	public String getLastDownloadMdid() {
138
		return lastDownloadMdid;
139
	}
140

  
141
	public String getLastValidationJob() {
142
		return lastValidationJob;
143
	}
144

  
145
	public String getBaseurl() {
146
		return baseurl;
147
	}
148

  
149
	public Set<Apiparam> getApiparam() {
150
		return apiparam;
151
	}
152

  
153
	public Api setId(final String id) {
154
		this.id = id;
155
		return this;
156
	}
157

  
158
	public Api setProtocol(final String protocol) {
159
		this.protocol = protocol;
160
		return this;
161
	}
162

  
163
	public Api setDatasource(final Datasource datasource) {
164
		this.datasource = datasource;
165
		return this;
166
	}
167

  
168
	public Api setContentdescription(final String contentdescription) {
169
		this.contentdescription = contentdescription;
170
		return this;
171
	}
172

  
173
	public Api setActive(final Boolean active) {
174
		this.active = active;
175
		return this;
176
	}
177

  
178
	public Api setRemovable(final Boolean removable) {
179
		this.removable = removable;
180
		return this;
181
	}
182

  
183
	public Api setTypology(final String typology) {
184
		this.typology = typology;
185
		return this;
186
	}
187

  
188
	public Api setCompatibility(final String compatibility) {
189
		this.compatibility = compatibility;
190
		return this;
191
	}
192

  
193
	public Api setMetadataIdentifierPath(final String metadataIdentifierPath) {
194
		this.metadataIdentifierPath = metadataIdentifierPath;
195
		return this;
196
	}
197

  
198
	public Api setLastCollectionTotal(final Integer lastCollectionTotal) {
199
		this.lastCollectionTotal = lastCollectionTotal;
200
		return this;
201
	}
202

  
203
	public Api setLastCollectionDate(final Date lastCollectionDate) {
204
		this.lastCollectionDate = lastCollectionDate;
205
		return this;
206
	}
207

  
208
	public Api setLastCollectionMdid(final String lastCollectionMdid) {
209
		this.lastCollectionMdid = lastCollectionMdid;
210
		return this;
211
	}
212

  
213
	public Api setLastAggregationTotal(final Integer lastAggregationTotal) {
214
		this.lastAggregationTotal = lastAggregationTotal;
215
		return this;
216
	}
217

  
218
	public Api setLastAggregationDate(final Date lastAggregationDate) {
219
		this.lastAggregationDate = lastAggregationDate;
220
		return this;
221
	}
222

  
223
	public Api setLastAggregationMdid(final String lastAggregationMdid) {
224
		this.lastAggregationMdid = lastAggregationMdid;
225
		return this;
226
	}
227

  
228
	public Api setLastDownloadTotal(final Integer lastDownloadTotal) {
229
		this.lastDownloadTotal = lastDownloadTotal;
230
		return this;
231
	}
232

  
233
	public Api setLastDownloadDate(final Date lastDownloadDate) {
234
		this.lastDownloadDate = lastDownloadDate;
235
		return this;
236
	}
237

  
238
	public Api setLastDownloadMdid(final String lastDownloadMdid) {
239
		this.lastDownloadMdid = lastDownloadMdid;
240
		return this;
241
	}
242

  
243
	public Api setLastValidationJob(final String lastValidationJob) {
244
		this.lastValidationJob = lastValidationJob;
245
		return this;
246
	}
247

  
248
	public Api setBaseurl(final String baseurl) {
249
		this.baseurl = baseurl;
250
		return this;
251
	}
252

  
253
	public Api setApiparam(final Set<Apiparam> apiparam) {
254
		this.apiparam = apiparam;
255
		return this;
256
	}
257

  
258
	@Override
259
	public boolean equals(Object o) {
260
		if (this == o) {
261
			return true;
262
		}
263
		if (o == null || getClass() != o.getClass()) {
264
			return false;
265
		}
266
		Api api = (Api) o;
267
		return Objects.equals(this.id, api.id);
268
	}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff