Updating LastUpdateTime before starting to execute any kind of operation when the AggregationStatus were already created on db

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@154349 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-09-21 08:03:56 +00:00
parent f531cd4e8c
commit 6a9c463ac9
2 changed files with 17 additions and 8 deletions

View File

@ -103,14 +103,16 @@ public class Elaborator {
if(aggregationStatus.getAggregationState()==null){
aggregationStatus.setState(AggregationState.STARTED, startTime, true);
}
if(aggregationStatus.getAggregationState()==AggregationState.COMPLETED){
logger.info("{} is {}. Nothing to do :-). \n Details {}",
AggregationStatus.class.getSimpleName(),
aggregationStatus.getAggregationState(),
DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
return;
}else{
if(aggregationStatus.getAggregationState()==AggregationState.COMPLETED){
logger.info("{} is {}. Nothing to do :-). \n Details {}",
AggregationStatus.class.getSimpleName(),
aggregationStatus.getAggregationState(),
DSMapper.getObjectMapper().writeValueAsString(aggregationStatus));
return;
}else{
aggregationStatus.updateLastUpdateTime(true);
}
}
String recordType = aggregationInfo.getRecordType();

View File

@ -158,4 +158,11 @@ public class AggregationStatus {
this.malformedRecordNumber = malformedRecordNumber;
}
public void updateLastUpdateTime(boolean sync) throws Exception {
this.lastUpdateTime = Utility.getUTCCalendarInstance();
if(sync){
CouchBaseConnector.upsertAggregationStatus(this);
}
}
}