1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.dnetlib.dli.resolver.model;
|
5
|
|
6
|
import eu.dnetlib.pid.resolver.model.ObjectProvenance;
|
7
|
import org.apache.commons.lang3.StringEscapeUtils;
|
8
|
|
9
|
// TODO: Auto-generated Javadoc
|
10
|
|
11
|
/**
|
12
|
* The Class DLIProvenance.
|
13
|
*
|
14
|
* @author sandro
|
15
|
*/
|
16
|
public class DLIObjectProvenance implements ObjectProvenance {
|
17
|
|
18
|
/**
|
19
|
* The datasource.
|
20
|
*/
|
21
|
private String datasource;
|
22
|
|
23
|
private String datasourceId;
|
24
|
|
25
|
/**
|
26
|
* The publisher.
|
27
|
*/
|
28
|
private String publisher;
|
29
|
|
30
|
/**
|
31
|
* The publisher identifier can be null
|
32
|
*/
|
33
|
private String publisherId;
|
34
|
|
35
|
/**
|
36
|
* The provision mode.
|
37
|
*/
|
38
|
private String provisionMode;
|
39
|
|
40
|
/**
|
41
|
* The completion status.
|
42
|
*/
|
43
|
private String completionStatus;
|
44
|
|
45
|
/**
|
46
|
* The visible.
|
47
|
*/
|
48
|
private boolean visible;
|
49
|
|
50
|
/**
|
51
|
* The datasource contribution.
|
52
|
*/
|
53
|
private String datasourceContribution;
|
54
|
|
55
|
/**
|
56
|
* The collection date.
|
57
|
*/
|
58
|
private String collectionDate;
|
59
|
|
60
|
/**
|
61
|
* Instantiates a new DLI provenance.
|
62
|
*
|
63
|
* @param datasource the datasource
|
64
|
* @param provisionMode the provision mode
|
65
|
* @param completionStatus the completion status
|
66
|
* @param contribution the contribution
|
67
|
*/
|
68
|
public DLIObjectProvenance(final String datasource, final String provisionMode, final String completionStatus, final String contribution,
|
69
|
final String collectionDate, final boolean visible) {
|
70
|
super();
|
71
|
this.datasource = datasource;
|
72
|
this.provisionMode = provisionMode;
|
73
|
this.completionStatus = completionStatus;
|
74
|
this.datasourceContribution = contribution;
|
75
|
this.collectionDate = collectionDate;
|
76
|
this.visible = visible;
|
77
|
}
|
78
|
|
79
|
public DLIObjectProvenance(final String datasource, final String provisionMode, final String completionStatus, final String contribution,
|
80
|
final String collectionDate, final boolean visible, final String datasourceId, final String publisher, final String publisherId) {
|
81
|
this(datasource, provisionMode, completionStatus, contribution, collectionDate, visible);
|
82
|
this.publisher = publisher;
|
83
|
this.publisherId = publisherId;
|
84
|
this.datasourceId = datasourceId;
|
85
|
}
|
86
|
|
87
|
/**
|
88
|
* Instantiates a new DLI provenance.
|
89
|
*/
|
90
|
public DLIObjectProvenance() {
|
91
|
|
92
|
}
|
93
|
|
94
|
/**
|
95
|
* Get the Publisher identifier
|
96
|
*
|
97
|
* @return the publisher
|
98
|
*/
|
99
|
public String getPublisherId() {
|
100
|
return publisherId;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* Set the Publisher identifier
|
105
|
*
|
106
|
* @param publisherId
|
107
|
*/
|
108
|
public void setPublisherId(String publisherId) {
|
109
|
this.publisherId = publisherId;
|
110
|
}
|
111
|
|
112
|
/**
|
113
|
* Get the Publisher
|
114
|
*
|
115
|
* @return the publisher
|
116
|
*/
|
117
|
public String getPublisher() {
|
118
|
return publisher;
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* Set the Publisher
|
123
|
*
|
124
|
* @param publisher
|
125
|
*/
|
126
|
public void setPublisher(String publisher) {
|
127
|
this.publisher = publisher;
|
128
|
}
|
129
|
|
130
|
public String getEscapedPublisher() {
|
131
|
return StringEscapeUtils.escapeXml11(this.publisher);
|
132
|
}
|
133
|
|
134
|
/**
|
135
|
* Gets the datasource.
|
136
|
*
|
137
|
* @return the datasource
|
138
|
*/
|
139
|
public String getDatasource() {
|
140
|
return datasource;
|
141
|
}
|
142
|
|
143
|
/**
|
144
|
* Sets the datasource.
|
145
|
*
|
146
|
* @param datasource the new datasource
|
147
|
*/
|
148
|
public void setDatasource(final String datasource) {
|
149
|
this.datasource = datasource;
|
150
|
}
|
151
|
|
152
|
/**
|
153
|
* Gets the escaped datasource.
|
154
|
*
|
155
|
* @return the escaped datasource
|
156
|
*/
|
157
|
public String getEscapedDatasource() {
|
158
|
return StringEscapeUtils.escapeXml11(this.datasource);
|
159
|
}
|
160
|
|
161
|
public String getDatasourceId() {
|
162
|
return datasourceId;
|
163
|
}
|
164
|
|
165
|
public void setDatasourceId(String datasourceId) {
|
166
|
this.datasourceId = datasourceId;
|
167
|
}
|
168
|
|
169
|
public String getEscapedDatasourceId() {
|
170
|
return StringEscapeUtils.escapeXml11(this.datasourceId);
|
171
|
}
|
172
|
|
173
|
/**
|
174
|
* Gets the provision mode.
|
175
|
*
|
176
|
* @return the provision mode
|
177
|
*/
|
178
|
public String getProvisionMode() {
|
179
|
return provisionMode;
|
180
|
}
|
181
|
|
182
|
/**
|
183
|
* Sets the provision mode.
|
184
|
*
|
185
|
* @param provisionMode the new provision mode
|
186
|
*/
|
187
|
public void setProvisionMode(final String provisionMode) {
|
188
|
this.provisionMode = provisionMode;
|
189
|
}
|
190
|
|
191
|
/**
|
192
|
* Gets the completion status.
|
193
|
*
|
194
|
* @return the completion status
|
195
|
*/
|
196
|
public String getCompletionStatus() {
|
197
|
return completionStatus;
|
198
|
}
|
199
|
|
200
|
/**
|
201
|
* Sets the completion status.
|
202
|
*
|
203
|
* @param completionStatus the new completion status
|
204
|
*/
|
205
|
public void setCompletionStatus(final String completionStatus) {
|
206
|
this.completionStatus = completionStatus;
|
207
|
}
|
208
|
|
209
|
/**
|
210
|
* {@inheritDoc}
|
211
|
*
|
212
|
* @see Object#toString()
|
213
|
*/
|
214
|
@Override
|
215
|
public String toString() {
|
216
|
String s = "\n\t\t%s \t Completion Status:%s \t Provision Mode:%s";
|
217
|
return String.format(s, this.getDatasource(), this.getCompletionStatus(), this.getProvisionMode());
|
218
|
}
|
219
|
|
220
|
/**
|
221
|
* Gets the datasource contribution.
|
222
|
*
|
223
|
* @return the datasource contribution
|
224
|
*/
|
225
|
public String getDatasourceContribution() {
|
226
|
return datasourceContribution;
|
227
|
}
|
228
|
|
229
|
/**
|
230
|
* Sets the datasource contribution.
|
231
|
*
|
232
|
* @param datasourceContribution the new datasource contribution
|
233
|
*/
|
234
|
public void setDatasourceContribution(final String datasourceContribution) {
|
235
|
this.datasourceContribution = datasourceContribution;
|
236
|
}
|
237
|
|
238
|
/**
|
239
|
* Gets the escaped xml datasource contribution.
|
240
|
*
|
241
|
* @return the escaped xml datasource contribution
|
242
|
*/
|
243
|
public String getEscapedXMLDatasourceContribution() {
|
244
|
return datasourceContribution.replaceAll("\"", "");
|
245
|
}
|
246
|
|
247
|
public boolean isShowPublisher() {
|
248
|
return publisher != null || publisherId != null;
|
249
|
}
|
250
|
|
251
|
public boolean isShowDatasource() {
|
252
|
return datasource != null || datasourceId != null;
|
253
|
}
|
254
|
|
255
|
public boolean isResolved() {
|
256
|
return "resolved".equals(provisionMode);
|
257
|
}
|
258
|
|
259
|
|
260
|
/**
|
261
|
* Gets the collection date.
|
262
|
*
|
263
|
* @return the collection date
|
264
|
*/
|
265
|
public String getCollectionDate() {
|
266
|
return collectionDate;
|
267
|
}
|
268
|
|
269
|
/**
|
270
|
* Sets the collection date.
|
271
|
*
|
272
|
* @param collectionDate the new collection date
|
273
|
*/
|
274
|
public void setCollectionDate(final String collectionDate) {
|
275
|
this.collectionDate = collectionDate;
|
276
|
}
|
277
|
|
278
|
public boolean isVisible() {
|
279
|
return visible;
|
280
|
}
|
281
|
|
282
|
public void setVisible(final boolean visible) {
|
283
|
this.visible = visible;
|
284
|
}
|
285
|
|
286
|
}
|