resolved conflicts

This commit is contained in:
Sandro La Bruzzo 2019-04-03 16:12:57 +02:00
commit 3f4ba71bbd
3 changed files with 27 additions and 0 deletions

View File

@ -33,6 +33,11 @@
</repositories>
<dependencies>
<dependency>
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-common</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>

View File

@ -65,6 +65,18 @@ public class MDStoreController {
return mdstoreWithInfoRepository.findById(mdId).orElseThrow(() -> new NoContentException("Missing mdstore: " + mdId));
}
@Transactional
@ApiOperation(value = "Increase the read count of the current mdstore")
@RequestMapping(value = "/mdstore/{mdId}/startReading", method = RequestMethod.GET)
public MDStoreVersion startReading(@ApiParam("the mdstore identifier") @PathVariable final String mdId) throws NoContentException {
final MDStoreCurrentVersion cv = mdstoreCurrentVersionRepository.findById(mdId).orElseThrow(() -> new NoContentException("Missing mdstore: " + mdId));
final MDStoreVersion v = mdstoreVersionRepository.findById(cv.getCurrentVersion())
.orElseThrow(() -> new NoContentException("Missing version: " + cv.getCurrentVersion()));
v.setReadCount(v.getReadCount() + 1);
mdstoreVersionRepository.save(v);
return v;
}
@ApiOperation(value = "Return the number of mdstores")
@RequestMapping(value = "/count", method = RequestMethod.GET)
public long count() {
@ -165,6 +177,16 @@ public class MDStoreController {
_deleteVersion(versionId, force);
}
@Transactional
@ApiOperation(value = "Decrease the read count of a mdstore version")
@RequestMapping(value = "/version/{versionId}/endReading", method = RequestMethod.GET)
public MDStoreVersion endReading(@ApiParam("the id of the version that has been completely read") @PathVariable final String versionId)
throws MDStoreManagerException {
final MDStoreVersion v = mdstoreVersionRepository.findById(versionId).orElseThrow(() -> new MDStoreManagerException("Version not found"));
v.setReadCount(v.getReadCount() - 1);
return v;
}
@Transactional
@ApiOperation(value = "Delete multiple mdstore versions")
@RequestMapping(value = "/versions/deleteList", method = RequestMethod.POST)