1
|
package eu.dnetlib.validator.service.impls.providers;
|
2
|
|
3
|
import eu.dnetlib.validator.engine.data.DataException;
|
4
|
import eu.dnetlib.validator.engine.data.Provider;
|
5
|
import eu.dnetlib.validator.engine.data.ResultSet;
|
6
|
import eu.dnetlib.validator.engine.execution.ValidationObject;
|
7
|
|
8
|
/**
|
9
|
* A dummy provider that returns a single, dummy Validation Object.
|
10
|
* This provider is used along with Rules that do not need an external validation object to be provided to them.
|
11
|
* @author Manos Karvounis
|
12
|
*/
|
13
|
public class DummyProvider extends Provider {
|
14
|
|
15
|
private static final long serialVersionUID = -8644756507323283600L;
|
16
|
|
17
|
public DummyProvider(Integer id) {
|
18
|
super(id);
|
19
|
}
|
20
|
|
21
|
@Override
|
22
|
public ResultSet<ValidationObject> getValidationObjects() throws ProviderException {
|
23
|
return new DummyResultSet();
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public ResultSet<String> getValidationObjectIds() throws ProviderException {
|
28
|
throw new UnsupportedOperationException();
|
29
|
}
|
30
|
|
31
|
@Override
|
32
|
public ValidationObject getValidationObject(String valObjId) throws ProviderException {
|
33
|
throw new UnsupportedOperationException();
|
34
|
}
|
35
|
|
36
|
private class DummyValidationObject implements ValidationObject {
|
37
|
|
38
|
@Override
|
39
|
public String getId() {
|
40
|
return this.hashCode()+"";
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public void setId(String id) {
|
45
|
}
|
46
|
|
47
|
|
48
|
@Override
|
49
|
public Object getContentAsObject() {
|
50
|
return null;
|
51
|
}
|
52
|
|
53
|
@Override
|
54
|
public String getStatus() {
|
55
|
// TODO Auto-generated method stub
|
56
|
return null;
|
57
|
}
|
58
|
|
59
|
}
|
60
|
|
61
|
private class DummyResultSet implements ResultSet<ValidationObject> {
|
62
|
|
63
|
private boolean done = false;
|
64
|
|
65
|
@Override
|
66
|
public boolean next() throws DataException {
|
67
|
if(!done) {
|
68
|
done = true;
|
69
|
return true;
|
70
|
}
|
71
|
return false;
|
72
|
}
|
73
|
|
74
|
@Override
|
75
|
public ValidationObject get() throws DataException {
|
76
|
return new DummyValidationObject();
|
77
|
}
|
78
|
|
79
|
@Override
|
80
|
public String getError() {
|
81
|
// TODO Auto-generated method stub
|
82
|
return null;
|
83
|
}
|
84
|
}
|
85
|
|
86
|
@Override
|
87
|
public ResultSet<ValidationObject> getValidationObjects(String entity)
|
88
|
throws ProviderException {
|
89
|
// TODO Auto-generated method stub
|
90
|
return null;
|
91
|
}
|
92
|
|
93
|
}
|