use of org.folio.service.holdings.message.DeltaReportMessage in project mod-kb-ebsco-java by folio-org.
the class HoldingsServiceImpl method processChanges.
@Override
public void processChanges(DeltaReportMessage holdings) {
final String tenantId = holdings.getTenantId();
final UUID credentialsId = toUUID(holdings.getCredentialsId());
processChanges(holdings.getHoldingList(), OffsetDateTime.now(), credentialsId, tenantId).thenCompose(o -> holdingsStatusRepository.increaseImportedCount(holdings.getHoldingList().size(), 1, credentialsId, tenantId)).thenCompose(status -> {
LoadStatusAttributes attributes = status.getData().getAttributes();
if (hasLoadedLastPage(status)) {
return holdingsStatusRepository.update(getStatusCompleted(attributes.getTotalCount()), credentialsId, tenantId).thenCompose(o -> transactionIdRepository.save(credentialsId, holdings.getTransactionId(), tenantId));
}
return CompletableFuture.completedFuture(null);
}).exceptionally(e -> {
logger.error(FAILED_PROCESS_CHANGES_MESSAGE, e);
return null;
});
}
Aggregations