コード例 #1
0
ファイル: InvoiceProcessor.java プロジェクト: VitalPet/OPEN
 /**
  * Processes an invoice.
  *
  * @param document the document to process
  * @param supplier the supplier submitting the invoice
  * @param stockLocation the stock location
  * @param accountId the supplier account identifier
  */
 public void process(
     InboxDocument document, Party supplier, Party stockLocation, String accountId) {
   InvoiceType invoice = (InvoiceType) document.getContent();
   try {
     Delivery delivery = mapper.map(invoice, supplier, stockLocation, accountId);
     service.save(delivery.getActs());
     notifyListener(delivery.getDelivery());
   } catch (Throwable exception) {
     String invoiceId = (invoice.getID() != null) ? invoice.getID().getValue() : null;
     Message message =
         ESCIAdapterMessages.failedToProcessInvoice(
             invoiceId, supplier, stockLocation, exception.getMessage());
     throw new ESCIAdapterException(message, exception);
   }
 }
コード例 #2
0
ファイル: InvoiceProcessor.java プロジェクト: VitalPet/OPEN
 /**
  * Determines if this processor can handle the supplied document.
  *
  * @param document the document
  * @return {@code true} if the processor can handle the document, otherwise {@code false}
  */
 public boolean canHandle(InboxDocument document) {
   return document.getContent() instanceof InvoiceType;
 }