1
|
package eu.dnetlib.msro.workflows.util;
|
2
|
|
3
|
import eu.dnetlib.enabling.resultset.ResultSetInfo;
|
4
|
import eu.dnetlib.enabling.resultset.client.ResultSetClient;
|
5
|
import eu.dnetlib.rmi.common.ResultSet;
|
6
|
|
7
|
public class ResultsetProgressProvider implements ProgressProvider {
|
8
|
|
9
|
private int currentValue = -1;
|
10
|
private int totalValue = -1;
|
11
|
private boolean inaccurate = true;
|
12
|
|
13
|
public static final ResultsetProgressProvider newInstance(final ResultSet<?> rs, final ResultSetClient rsClient) {
|
14
|
final ResultSetInfo info = rsClient.info(rs);
|
15
|
return new ResultsetProgressProvider(info.getCursor(), info.getTotal(), info.isInaccurate());
|
16
|
}
|
17
|
|
18
|
private ResultsetProgressProvider(final int currentValue, final int totalValue, final boolean inaccurate) {
|
19
|
super();
|
20
|
this.currentValue = currentValue;
|
21
|
this.totalValue = totalValue;
|
22
|
this.inaccurate = inaccurate;
|
23
|
}
|
24
|
|
25
|
@Override
|
26
|
public int getTotalValue() {
|
27
|
return this.totalValue;
|
28
|
}
|
29
|
|
30
|
public void setTotalValue(final int totalValue) {
|
31
|
this.totalValue = totalValue;
|
32
|
}
|
33
|
|
34
|
@Override
|
35
|
public int getCurrentValue() {
|
36
|
return this.currentValue;
|
37
|
}
|
38
|
|
39
|
public void setCurrentValue(final int currentValue) {
|
40
|
this.currentValue = currentValue;
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public boolean isInaccurate() {
|
45
|
return this.inaccurate;
|
46
|
}
|
47
|
|
48
|
public void setInaccurate(final boolean inaccurate) {
|
49
|
this.inaccurate = inaccurate;
|
50
|
}
|
51
|
|
52
|
}
|