use of org.folio.rest.client.SourceStorageRecordsClient in project mod-inventory by folio-org.
the class Instances method updateSuppressFromDiscoveryFlag.
/**
* Call Source record storage to update suppress from discovery flag in underlying record
*
* @param wContext - webContext
* @param updatedInstance - Updated instance entity
*/
private void updateSuppressFromDiscoveryFlag(WebContext wContext, Instance updatedInstance) {
try {
SourceStorageRecordsClient client = new SourceStorageRecordsClient(wContext.getOkapiLocation(), wContext.getTenantId(), wContext.getToken());
client.putSourceStorageRecordsSuppressFromDiscoveryById(updatedInstance.getId(), "INSTANCE", updatedInstance.getDiscoverySuppress(), httpClientResponse -> {
if (httpClientResponse.result().statusCode() == HttpStatus.HTTP_OK.toInt()) {
log.info(format("Suppress from discovery flag was successfully updated for record in SRS. InstanceID: %s", updatedInstance.getId()));
} else {
log.error(format("Suppress from discovery wasn't changed for SRS record. InstanceID: %s StatusCode: %s", updatedInstance.getId(), httpClientResponse.result().statusCode()));
}
});
} catch (Exception e) {
log.error("Error during updating suppress from discovery flag for record in SRS", e);
}
}
Aggregations