Search in sources :

Example 1 with ReferenceNumberItem

use of org.folio.rest.acq.model.ReferenceNumberItem in project mod-gobi by folio-org.

the class Mapper method mapVendorDetail.

private void mapVendorDetail(List<CompletableFuture<?>> futures, VendorDetail vendorDetail, Document doc) {
    Optional.ofNullable(mappings.get(Mapping.Field.VENDOR_INSTRUCTIONS)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> vendorDetail.setInstructions((String) o)).exceptionally(Mapper::logException)));
    Optional.ofNullable(mappings.get(Mapping.Field.NOTE_FROM_VENDOR)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> vendorDetail.setNoteFromVendor((String) o)).exceptionally(Mapper::logException)));
    ReferenceNumberItem referenceNumber = new ReferenceNumberItem().withVendorDetailsSource(ReferenceNumberItem.VendorDetailsSource.ORDER_LINE);
    mapRefTypeNumberPair(futures, referenceNumber, doc);
    setObjectIfPresent(referenceNumber, o -> {
        List<ReferenceNumberItem> referenceNumbers = new ArrayList<>();
        referenceNumbers.add(referenceNumber);
        vendorDetail.setReferenceNumbers(referenceNumbers);
    });
    Optional.ofNullable(mappings.get(Mapping.Field.VENDOR_ACCOUNT)).ifPresent(field -> futures.add(field.resolve(doc).thenAccept(o -> vendorDetail.setVendorAccount((String) o)).exceptionally(Mapper::logException)));
}
Also used : Tags(org.folio.rest.acq.model.Tags) Date(java.util.Date) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) Contributor(org.folio.rest.acq.model.Contributor) StringUtils(org.apache.commons.lang3.StringUtils) Ongoing(org.folio.rest.acq.model.Ongoing) Location(org.folio.rest.acq.model.Location) Document(org.w3c.dom.Document) Map(java.util.Map) Claim(org.folio.rest.acq.model.Claim) ReferenceNumberItem(org.folio.rest.acq.model.ReferenceNumberItem) JsonObject(io.vertx.core.json.JsonObject) ZoneOffset(java.time.ZoneOffset) BigDecimal(scala.math.BigDecimal) ReportingCode(org.folio.rest.acq.model.ReportingCode) ProductIdentifier(org.folio.rest.acq.model.ProductIdentifier) Details(org.folio.rest.acq.model.Details) AcquisitionMethod(org.folio.rest.acq.model.AcquisitionMethod) Eresource(org.folio.rest.acq.model.Eresource) Collectors(java.util.stream.Collectors) List(java.util.List) Stream(java.util.stream.Stream) Logger(org.apache.logging.log4j.Logger) Organization(org.folio.rest.acq.model.Organization) Optional(java.util.Optional) HelperUtils.extractFundCode(org.folio.gobi.HelperUtils.extractFundCode) VendorDetail(org.folio.rest.acq.model.VendorDetail) LocalDateTime(java.time.LocalDateTime) CompletableFuture(java.util.concurrent.CompletableFuture) CompositePurchaseOrder(org.folio.rest.acq.model.CompositePurchaseOrder) CompositePoLine(org.folio.rest.acq.model.CompositePoLine) ArrayList(java.util.ArrayList) Alert(org.folio.rest.acq.model.Alert) HelperUtils.extractExpenseClassFromFundCode(org.folio.gobi.HelperUtils.extractExpenseClassFromFundCode) License(org.folio.rest.acq.model.License) PostGobiOrdersHelper(org.folio.rest.impl.PostGobiOrdersHelper) NodeList(org.w3c.dom.NodeList) INVALID_ISBN_PRODUCT_ID_TYPE(org.folio.gobi.HelperUtils.INVALID_ISBN_PRODUCT_ID_TYPE) DateTime(org.joda.time.DateTime) DiscountType(org.folio.rest.acq.model.Cost.DiscountType) Consumer(java.util.function.Consumer) IsbnUtil(org.folio.isbn.IsbnUtil) FundDistribution(org.folio.rest.acq.model.FundDistribution) Mapping(org.folio.rest.mappings.model.Mapping) Physical(org.folio.rest.acq.model.Physical) FUND_CODE_EXPENSE_CLASS_SEPARATOR(org.folio.gobi.HelperUtils.FUND_CODE_EXPENSE_CLASS_SEPARATOR) Cost(org.folio.rest.acq.model.Cost) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) ArrayList(java.util.ArrayList) ReferenceNumberItem(org.folio.rest.acq.model.ReferenceNumberItem)

Aggregations

JsonObject (io.vertx.core.json.JsonObject)1 LocalDateTime (java.time.LocalDateTime)1 ZoneOffset (java.time.ZoneOffset)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 StringUtils (org.apache.commons.lang3.StringUtils)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 FUND_CODE_EXPENSE_CLASS_SEPARATOR (org.folio.gobi.HelperUtils.FUND_CODE_EXPENSE_CLASS_SEPARATOR)1 INVALID_ISBN_PRODUCT_ID_TYPE (org.folio.gobi.HelperUtils.INVALID_ISBN_PRODUCT_ID_TYPE)1 HelperUtils.extractExpenseClassFromFundCode (org.folio.gobi.HelperUtils.extractExpenseClassFromFundCode)1