Project

General

Profile

1
package eu.dnetlib.enabling.datasources.common;
2

    
3
import java.sql.Date;
4
import java.util.Objects;
5
import java.util.Set;
6

    
7
import com.google.common.collect.ComparisonChain;
8
import com.google.gson.Gson;
9

    
10
/**
11
 * Api
12
 */
13
public class Api implements Comparable<Api> {
14

    
15
	private String id = null;
16
	private String protocol = null;
17
	private String datasource = null;
18
	private String contentdescription = null;
19
	private Boolean active = false;
20
	private Boolean removable = false;
21
	private String typology = null;
22
	private String compatibility;
23
	private String metadataIdentifierPath;
24
	private Integer lastCollectionTotal;
25
	private Date lastCollectionDate;
26
	private String lastCollectionMdid;
27
	private Integer lastAggregationTotal;
28
	private Date lastAggregationDate;
29
	private String lastAggregationMdid;
30
	private Integer lastDownloadTotal;
31
	private Date lastDownloadDate;
32
	private String lastDownloadMdid;
33
	private String lastValidationJob;
34
	private String baseurl = null;
35
	private Set<ApiParam> apiParams;
36

    
37
	public Api() {}
38

    
39
	public String getId() {
40
		return id;
41
	}
42

    
43
	public String getProtocol() {
44
		return protocol;
45
	}
46

    
47
	public String getDatasource() {
48
		return datasource;
49
	}
50

    
51
	public String getContentdescription() {
52
		return contentdescription;
53
	}
54

    
55
	public Boolean getActive() {
56
		return active;
57
	}
58

    
59
	public Boolean getRemovable() {
60
		return removable;
61
	}
62

    
63
	public String getTypology() {
64
		return typology;
65
	}
66

    
67
	public String getCompatibility() {
68
		return compatibility;
69
	}
70

    
71
	public String getMetadataIdentifierPath() {
72
		return metadataIdentifierPath;
73
	}
74

    
75
	public Integer getLastCollectionTotal() {
76
		return lastCollectionTotal;
77
	}
78

    
79
	public Date getLastCollectionDate() {
80
		return lastCollectionDate;
81
	}
82

    
83
	public String getLastCollectionMdid() {
84
		return lastCollectionMdid;
85
	}
86

    
87
	public Integer getLastAggregationTotal() {
88
		return lastAggregationTotal;
89
	}
90

    
91
	public Date getLastAggregationDate() {
92
		return lastAggregationDate;
93
	}
94

    
95
	public String getLastAggregationMdid() {
96
		return lastAggregationMdid;
97
	}
98

    
99
	public Integer getLastDownloadTotal() {
100
		return lastDownloadTotal;
101
	}
102

    
103
	public Date getLastDownloadDate() {
104
		return lastDownloadDate;
105
	}
106

    
107
	public String getLastDownloadMdid() {
108
		return lastDownloadMdid;
109
	}
110

    
111
	public String getLastValidationJob() {
112
		return lastValidationJob;
113
	}
114

    
115
	public String getBaseurl() {
116
		return baseurl;
117
	}
118

    
119
	public Set<ApiParam> getApiParams() {
120
		return apiParams;
121
	}
122

    
123
	public Api setId(final String id) {
124
		this.id = id;
125
		return this;
126
	}
127

    
128
	public Api setProtocol(final String protocol) {
129
		this.protocol = protocol;
130
		return this;
131
	}
132

    
133
	public Api setDatasource(final String datasource) {
134
		this.datasource = datasource;
135
		return this;
136
	}
137

    
138
	public Api setContentdescription(final String contentdescription) {
139
		this.contentdescription = contentdescription;
140
		return this;
141
	}
142

    
143
	public Api setActive(final Boolean active) {
144
		this.active = active;
145
		return this;
146
	}
147

    
148
	public Api setRemovable(final Boolean removable) {
149
		this.removable = removable;
150
		return this;
151
	}
152

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

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

    
163
	public Api setMetadataIdentifierPath(final String metadataIdentifierPath) {
164
		this.metadataIdentifierPath = metadataIdentifierPath;
165
		return this;
166
	}
167

    
168
	public Api setLastCollectionTotal(final Integer lastCollectionTotal) {
169
		this.lastCollectionTotal = lastCollectionTotal;
170
		return this;
171
	}
172

    
173
	public Api setLastCollectionDate(final Date lastCollectionDate) {
174
		this.lastCollectionDate = lastCollectionDate;
175
		return this;
176
	}
177

    
178
	public Api setLastCollectionMdid(final String lastCollectionMdid) {
179
		this.lastCollectionMdid = lastCollectionMdid;
180
		return this;
181
	}
182

    
183
	public Api setLastAggregationTotal(final Integer lastAggregationTotal) {
184
		this.lastAggregationTotal = lastAggregationTotal;
185
		return this;
186
	}
187

    
188
	public Api setLastAggregationDate(final Date lastAggregationDate) {
189
		this.lastAggregationDate = lastAggregationDate;
190
		return this;
191
	}
192

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

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

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

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

    
213
	public Api setLastValidationJob(final String lastValidationJob) {
214
		this.lastValidationJob = lastValidationJob;
215
		return this;
216
	}
217

    
218
	public Api setBaseurl(final String baseurl) {
219
		this.baseurl = baseurl;
220
		return this;
221
	}
222

    
223
	public Api setApiParams(final Set<ApiParam> apiParams) {
224
		this.apiParams = apiParams;
225
		return this;
226
	}
227

    
228
	public boolean equals(Object o) {
229
		if (this == o) { return true; }
230
		if (o == null || getClass() != o.getClass()) { return false; }
231
		Api api = (Api) o;
232
		return Objects.equals(this.id, api.id);
233
	}
234

    
235
	/*
236
	 * (non-Javadoc)
237
	 * 
238
	 * @see eu.dnetlib.openaire.exporter.model.datasource.db.ApiInterface#hashCode()
239
	 */
240

    
241
	public int hashCode() {
242
		return Objects.hash(id);
243
	}
244

    
245
	public String toString() {
246
		return new Gson().toJson(this);
247
	}
248

    
249
	public int compareTo(final Api a) {
250
		return ComparisonChain.start()
251
				.compare(getId(), a.getId())
252
				.result();
253
	}
254

    
255
}
(3-3/14)