Revision 46528
Added by Claudio Atzori about 7 years ago
modules/dnet-springboot-apps/trunk/dnet-simple-aggregation-worker/src/main/java/eu/dnetlib/data/mdstore/repository/MetadataRepositoryImpl.java | ||
---|---|---|
12 | 12 |
import org.apache.commons.logging.LogFactory; |
13 | 13 |
import org.springframework.beans.factory.annotation.Autowired; |
14 | 14 |
import org.springframework.data.mongodb.core.MongoTemplate; |
15 |
import org.springframework.data.mongodb.core.query.Criteria; |
|
16 | 15 |
import org.springframework.data.mongodb.core.query.Update; |
17 | 16 |
|
18 | 17 |
import static eu.dnetlib.data.mdstore.utils.MDStoreConstants.*; |
... | ... | |
36 | 35 |
} |
37 | 36 |
|
38 | 37 |
@Override |
39 |
public void updateSize(final String mdId, final int size) { |
|
40 |
log.debug(String.format("update size for mdtore %s to %s", mdId, size)); |
|
41 |
mongoTemplate.updateFirst( |
|
42 |
query(Criteria.where(MDID).is(mdId)), |
|
43 |
update(SIZE, size), |
|
44 |
Metadata.class); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public void updateCurrentId(final String mdId, final String currentId) { |
|
49 |
log.debug(String.format("update currentId for mdstore %s to %s", mdId, currentId)); |
|
50 |
mongoTemplate.updateFirst( |
|
51 |
query(Criteria.where(MDID).is(mdId)), |
|
52 |
update(CURRENT_ID, currentId), |
|
53 |
Metadata.class); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 | 38 |
public void commit(final Metadata m, final String txId) { |
58 | 39 |
log.debug(String.format("commit mdstore %s, currentId: %s new size %s", m.getMdId(), m.getCurrentId(), m.getSize())); |
59 | 40 |
synchronized (this) { |
modules/dnet-springboot-apps/trunk/dnet-simple-aggregation-worker/src/main/java/eu/dnetlib/data/mdstore/repository/MetadataRepositoryCustom.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
long sumOfSize(String format, String layout, String interpretation); |
21 | 21 |
|
22 |
void updateSize(String mdId, int size); |
|
23 |
|
|
24 |
void updateCurrentId(String mdId, String currentId); |
|
25 |
|
|
26 | 22 |
void commit(Metadata m, String txId); |
27 | 23 |
|
28 | 24 |
void addTransaction(String mdId, Transaction t); |
Also available in: Unified diff
cleanup