logger.info("Received a \"getNumberOfPayloadsAggregatedByService\" request.");
StringgetPayloadsAggregatedQuery="select count(id) from "+ImpalaConnector.databaseName+".payload where `date` >= cast(cast('2021-01-01' as timestamp) as bigint)";
returngetNumberOfPayloads(getPayloadsAggregatedQuery,"retrieved by the PDF Aggregation Service");
// Note that until all the records are inspected, the "attempt" table contains all the inspected records PLUS very few duplicates (id-url) which come from the publications-database.
// After all the records are inspected, it contains duplicate records of more and more id-urls, as time goes one, since for every eligible record the Service re-attempts to get the full-text.
// So in order to get the number of inspected records, we want the distinct number, which at some point it will remain stable, even though the Service will try again and again some records.
// Before all the records are inspected, this endpoint will report all the inspected records MINUS the duplicate records which come straight from the "publication" table.
logger.info("Received a \"getNumberOfRecordsInspected\" request.");
finalStringgetInspectedRecordsNumberQuery="select count(dist.id) from (select distinct id, original_url from "+ImpalaConnector.databaseName+".attempt) as dist";
returnResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("The inspected records' number could not be retrieved from the database \""+ImpalaConnector.databaseName+"\" using the getInspectedRecordsNumberQuery: "+getInspectedRecordsNumberQuery);
returnResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("The inspected records' number could not be retrieved from the database \""+ImpalaConnector.databaseName+"\" using the getInspectedRecordsNumberQuery: "+getInspectedRecordsNumberQuery);
returnResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("The payloads' number could not be retrieved from the database \""+ImpalaConnector.databaseName+"\" using the getPayloadsNumberQuery: "+getPayloadsNumberQuery);
}catch(EmptyResultDataAccessExceptionerdae){
returnResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("The payloads' number could not be retrieved from the database \""+ImpalaConnector.databaseName+"\" using the getPayloadsNumberQuery: "+getPayloadsNumberQuery);
}catch(Exceptione){
StringerrorMsg="Problem when executing \"getPayloadsNumberQuery\": "+getPayloadsNumberQuery;