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"); }
private AcEdiInterchange createInterchange(AcEdiInterchangeIF o, AcEdiMessage e) { AcEdiInterchange x = new AcEdiInterchange(new JwList<AcEdiMessage>(e)); x.setHeader(o.getHeader()); x.setTrailer(new AcEdiUspsUnz()); x.getTrailer().setReferenceNumber(o.getHeader().getReferenceNumber()); return x; }