Added patch to support old model which uses usageRecordType instead recortType field.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@153060 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9c0a14ae7b
commit
d0ce92e10a
|
@ -116,21 +116,28 @@ public class Aggregator {
|
|||
|
||||
int originalRecordsCounter = 0;
|
||||
for (ViewRow row : viewResult) {
|
||||
String record = row.document().content().toString();
|
||||
|
||||
// Backup the Record on local file
|
||||
Utility.printLine(originalRecordsbackupFile, record);
|
||||
|
||||
// Aggregate the Record
|
||||
aggregateRow(aggregatorBuffer, record);
|
||||
|
||||
++originalRecordsCounter;
|
||||
if(originalRecordsCounter%1000==0){
|
||||
int aggregatedRecordsNumber = aggregatorBuffer.getAggregatedRecords().size();
|
||||
int diff = originalRecordsCounter - aggregatedRecordsNumber;
|
||||
float percentage = (100 * diff) / originalRecordsCounter;
|
||||
logger.info("{} At the moment, the elaborated original records are {}. The Aggregated records are {}. Difference {}. We are recovering {}% of Documents",
|
||||
aggregationStatus.getAggregationInfo(), originalRecordsCounter, aggregatedRecordsNumber, diff, percentage);
|
||||
try {
|
||||
String record = row.document().content().toString();
|
||||
|
||||
record.replace("usageRecordType", "recordType");
|
||||
|
||||
// Backup the Record on local file
|
||||
Utility.printLine(originalRecordsbackupFile, record);
|
||||
|
||||
// Aggregate the Record
|
||||
aggregateRow(aggregatorBuffer, record);
|
||||
|
||||
++originalRecordsCounter;
|
||||
if(originalRecordsCounter%1000==0){
|
||||
int aggregatedRecordsNumber = aggregatorBuffer.getAggregatedRecords().size();
|
||||
int diff = originalRecordsCounter - aggregatedRecordsNumber;
|
||||
float percentage = (100 * diff) / originalRecordsCounter;
|
||||
logger.info("{} At the moment, the elaborated original records are {}. The Aggregated records are {}. Difference {}. We are recovering {}% of Documents",
|
||||
aggregationStatus.getAggregationInfo(), originalRecordsCounter, aggregatedRecordsNumber, diff, percentage);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.error("Unable to elaborate {} {}", ViewRow.class.getSimpleName(), row, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue