Пример #1
0
 public void run(String filename) {
   System.out.println("opening file '" + filename + "'");
   Reader reader = getReaderOrig(filename);
   System.out.println("reading interchange");
   JwEdiFrameIF interchange = _retrieveInterchange(filename, reader);
   System.out.println("done reading interchange");
   AcEdiInterchangeIF x = createEdiInterchange(interchange);
   int i = 1;
   System.out.println("iterating over messages");
   long tm = System.currentTimeMillis();
   for (AcEdiMessage message : x.getMessageIterable()) {
     System.out.println("processing message " + i);
     message.setHeaderSegment(getHeaderSegment());
     message.setTrailerSegment(getTrailerSegment());
     message.localizeSegments(getSegmentFactory());
     x.postProcess(message);
     String outputFilename = getOutputFilename(filename, i);
     System.out.println("\toutputing to '" + outputFilename + "'");
     outputEdiFile(outputFilename, createInterchange(x, message));
     //            tm -= handleShowMemory();
     i++;
   }
   x.postProcess();
   //        tm -= handleShowMemory();
   System.out.println("done: " + (System.currentTimeMillis() - tm) + " ms");
 }
 public void addBody(AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Claim model) {
   message.add(createMessageCreationDtm(model));
   addLineItems(message, model.getLineItems());
   message.add(createControlUns());
   message.add(createLineCountCnt(model));
   message.add(createAdjustmentAmountMoa(model));
 }
 public void addLineItemSegments(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Item model, int number) {
   message.add(createLin(number));
   message.add(createPia(model));
   message.add(createScheduledDeliveryDtm(model));
   message.add(createRouteDepartureDtm(model));
   message.add(createMailClassCodeFtx(model));
   message.add(createClaimReasonCodeFtx(model));
   message.add(createClaimStatusFtx(model));
   message.add(createPac(model));
   message.add(createWeightMea(model));
   message.add(createPci(model));
   // todo_pta: add line item claims amounts to total?
 }
 public void addFooter(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Claim model, int referenceNumber) {
   message.setUnt(createUnt(message.getSegmentCount() + 1, referenceNumber));
 }
 public void addHeader(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Claim model, int referenceNumber) {
   message.setUnh(createUnh(model, referenceNumber));
   message.add(createBgm(model));
 }
 private void addThirdXferSegments(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Transport transport) {
   message.add(createThirdXferTdt(transport));
   message.add(createXferLoc(transport));
   message.add(createXferDtm(transport));
 }
 private void addLoadSegments(AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Transport transport) {
   message.add(createLoadTdt(transport));
   message.add(createLoadLoc(transport));
   message.add(createLoadDtm(transport));
 }
 private void addPossessionSegments(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Transport transport) {
   message.add(createPossessionTdt(transport));
   message.add(createPossessionLoc(transport));
   message.add(createPossessionDtm(transport));
 }
 private void addDeliverSegments(
     AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Transport transport) {
   message.add(createDeliveryTdt(transport));
   message.add(createDeliveryLoc(transport));
   message.add(createDeliveryDtm(transport));
 }
 public void addLineItem(AcEdiMessage message, AcUspsD1InvoiceClaimV2R1Item model, int number) {
   addLineItemSegments(message, model, number);
   addTransports(message, model.getTransports());
   message.add(createExpectedDeliveryLoc(model));
 }