use of org.folio.holdingsiq.model.OkapiData in project mod-kb-ebsco-java by folio-org.
the class EholdingsProvidersImpl method putEholdingsProvidersTagsByProviderId.
@Override
public void putEholdingsProvidersTagsByProviderId(String providerId, String contentType, ProviderTagsPutRequest entity, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
final Tags tags = entity.getData().getAttributes().getTags();
userKbCredentialsService.findByUser(okapiHeaders).thenCompose(creds -> {
ProviderTagsDataAttributes attributes = entity.getData().getAttributes();
providerTagsPutBodyValidator.validate(entity, attributes);
return updateTags(createDbProvider(providerId, UUID.fromString(creds.getId()), entity.getData().getAttributes()), tags, new OkapiData(okapiHeaders).getTenant()).thenAccept(ob -> asyncResultHandler.handle(Future.succeededFuture(PutEholdingsProvidersTagsByProviderIdResponse.respond200WithApplicationVndApiJson(convertToProviderTags(attributes)))));
}).exceptionally(e -> {
new ErrorHandler().addInputValidation422Mapper().handle(asyncResultHandler, e);
return null;
});
}
use of org.folio.holdingsiq.model.OkapiData in project mod-kb-ebsco-java by folio-org.
the class RMAPITemplate method getRmapiTemplateContext.
public CompletableFuture<RMAPITemplateContext> getRmapiTemplateContext() {
headerValidator.validate(okapiHeaders);
return CompletableFuture.completedFuture(null).thenCompose(o -> {
OkapiData okapiData = new OkapiData(okapiHeaders);
contextBuilder.okapiData(okapiData);
return userKbCredentialsService.findByUser(okapiHeaders);
}).thenAccept(contextBuilder::kbCredentials).thenApply(unused -> contextBuilder.build());
}
use of org.folio.holdingsiq.model.OkapiData in project mod-kb-ebsco-java by folio-org.
the class LocaleSettingsServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
Map<String, String> headers = new HashMap<>();
headers.put(XOkapiHeaders.TOKEN, STUB_TOKEN);
headers.put(XOkapiHeaders.TENANT, STUB_TENANT);
headers.put(XOkapiHeaders.URL, getWiremockUrl());
okapiParams = new OkapiData(headers);
}
use of org.folio.holdingsiq.model.OkapiData in project mod-kb-ebsco-java by folio-org.
the class KbCredentialsServiceImpl method verifyCredentials.
private CompletableFuture<Void> verifyCredentials(DbKbCredentials dbKbCredentials, Map<String, String> okapiHeaders) {
Configuration configuration = convertToConfiguration(dbKbCredentials);
return configurationService.verifyCredentials(configuration, context, new OkapiData(okapiHeaders)).thenCompose(errors -> {
if (!errors.isEmpty()) {
CompletableFuture<Void> future = new CompletableFuture<>();
future.completeExceptionally(new ConfigurationInvalidException(errors));
return future;
}
return completedFuture(null);
});
}
Aggregations