use of me.escoffier.vertx.completablefuture.VertxCompletableFuture in project mod-gobi by folio-org.
the class PostGobiOrdersHelper method mapToPurchaseOrder.
public CompletableFuture<CompositePurchaseOrder> mapToPurchaseOrder(Document doc) {
final OrderMappings.OrderType orderType = getOrderType(doc);
VertxCompletableFuture<CompositePurchaseOrder> future = new VertxCompletableFuture<>(ctx);
lookupOrderMappings(orderType).thenAccept(ordermappings -> {
logger.info("Using Mappings {}", ordermappings);
new Mapper(ordermappings).map(doc, this).thenAccept(future::complete);
}).exceptionally(e -> {
logger.error("Exception looking up Order mappings", e);
future.completeExceptionally(e);
return null;
});
return future;
}
use of me.escoffier.vertx.completablefuture.VertxCompletableFuture in project mod-gobi by folio-org.
the class PostGobiOrdersHelper method parse.
public CompletableFuture<Document> parse(String entity) {
VertxCompletableFuture<Document> future = new VertxCompletableFuture<>(ctx);
final GobiPurchaseOrderParser parser = GobiPurchaseOrderParser.getParser();
try {
future.complete(parser.parse(entity));
} catch (GobiPurchaseOrderParserException e) {
logger.error("Failed to parse GobiPurchaseOrder", e);
future.completeExceptionally(e);
}
return future;
}
Aggregations