use of org.folio.rest.acq.model.Alert in project mod-gobi by folio-org.
the class Mapper method mapPurchaseOrderLine.
private void mapPurchaseOrderLine(List<CompletableFuture<?>> futures, CompositePoLine pol, Document doc) {
Optional.ofNullable(mappings.get(Mapping.Field.ALERTS)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> {
Alert alert = new Alert();
alert.setAlert((String) o);
List<Alert> alerts = new ArrayList<>();
alerts.add(alert);
pol.setAlerts(alerts);
}).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.CANCELLATION_RESTRICTION)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setCancellationRestriction((Boolean) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PO_LINE_ORDER_FORMAT)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setOrderFormat(CompositePoLine.OrderFormat.fromValue((String) o))).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.COLLECTION)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setCollection((Boolean) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PO_LINE_DESCRIPTION)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setPoLineDescription((String) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PO_LINE_PAYMENT_STATUS)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setPaymentStatus(CompositePoLine.PaymentStatus.fromValue((String) o))).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PUBLICATION_DATE)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setPublicationDate((String) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PUBLISHER)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setPublisher((String) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PURCHASE_ORDER_ID)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setPurchaseOrderId((String) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.RECEIPT_DATE)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setReceiptDate((Date) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.RUSH)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setRush((Boolean) o)).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.TAGS)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> {
Tags tags = new Tags();
List<String> tagList = new ArrayList<>();
tagList.add((String) o);
tags.setTagList(tagList);
pol.setTags(tags);
}).exceptionally(Mapper::logException)));
Optional.ofNullable(mappings.get(Mapping.Field.PO_LINE_RECEIPT_STATUS)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> pol.setReceiptStatus(CompositePoLine.ReceiptStatus.fromValue((String) o))).exceptionally(Mapper::logException)));
}
Aggregations