1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.consistency;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import javax.annotation.Resource;
|
6
|
|
7
|
import org.springframework.beans.factory.annotation.Autowired;
|
8
|
|
9
|
import com.googlecode.sarasvati.Arc;
|
10
|
import com.googlecode.sarasvati.NodeToken;
|
11
|
|
12
|
import eu.dnetlib.data.mdstore.modular.MDStoreDescription;
|
13
|
import eu.dnetlib.data.mdstore.modular.MDStoreFeeder;
|
14
|
import eu.dnetlib.data.mdstore.modular.connector.MDStoreDao;
|
15
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
16
|
import eu.dnetlib.msro.workflows.util.ProgressProvider;
|
17
|
|
18
|
public class VerifyMdStoreSizesJobNode extends SimpleJobNode implements ProgressProvider {
|
19
|
|
20
|
private int current = 0;
|
21
|
private int total = 0;
|
22
|
|
23
|
@Autowired
|
24
|
private MDStoreFeeder feeder;
|
25
|
|
26
|
@Resource(name = "mongodbMDStoreDao")
|
27
|
private MDStoreDao dao;
|
28
|
|
29
|
@Override
|
30
|
protected String execute(final NodeToken token) throws Exception {
|
31
|
|
32
|
final List<MDStoreDescription> list = dao.listMDStores();
|
33
|
total = list.size();
|
34
|
current = 0;
|
35
|
|
36
|
for (final MDStoreDescription mdstore : list) {
|
37
|
current++;
|
38
|
feeder.touchSize(mdstore.getId(), dao.getMDStore(mdstore.getId()).getSize());
|
39
|
}
|
40
|
return Arc.DEFAULT_ARC;
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public int getTotalValue() {
|
45
|
return total;
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public int getCurrentValue() {
|
50
|
return current;
|
51
|
}
|
52
|
|
53
|
@Override
|
54
|
public boolean isInaccurate() {
|
55
|
return false;
|
56
|
}
|
57
|
|
58
|
}
|