/** * Map a list of EDI Segments to SAX events. * <p/> * Reads the segments from the input stream and maps them based on the supplied list of expected segments. * @param expectedSegments The list of expected segments. * @throws IOException Error reading an EDI segment from the input stream. * @throws SAXException EDI processing exception. */ private void mapSegments(List<SegmentGroup> expectedSegments) throws IOException, SAXException { mapSegments(expectedSegments, null); }
/** * Map a list of EDI Segments to SAX events. * <p/> * Reads the segments from the input stream and maps them based on the supplied list of expected segments. * @param expectedSegments The list of expected segments. * @throws IOException Error reading an EDI segment from the input stream. * @throws SAXException EDI processing exception. */ private void mapSegments(List<SegmentGroup> expectedSegments) throws IOException, SAXException { mapSegments(expectedSegments, null); }
/** * Map a list of EDI Segments to SAX events. * <p/> * Reads the segments from the input stream and maps them based on the supplied list of expected segments. * @param expectedSegments The list of expected segments. * @throws IOException Error reading an EDI segment from the input stream. * @throws SAXException EDI processing exception. */ private void mapSegments(List<SegmentGroup> expectedSegments) throws IOException, SAXException { mapSegments(expectedSegments, null); }
/** * Map a list of EDI Segments to SAX events. * * Reads the segments from the input stream and maps them based on the supplied list of expected segments. * @param expectedSegments The list of expected segments. * @throws IOException Error reading an EDI segment from the input stream. * @throws SAXException EDI processing exception. */ private void mapSegments(List<SegmentGroup> expectedSegments) throws IOException, SAXException { mapSegments(expectedSegments, null); }
/** * Map a single segment based on the current set of segment fields read from input and the segment mapping * config that these fields should map to. * @param currentSegmentFields Current set of segment fields read from input. * @param expectedSegment The segment mapping config that the currentSegmentFields should map to. * @throws IOException Error reading an EDI segment from the input stream. This will happen as the segment * reader tries to move to the next segment after performing this mapping. * @throws SAXException EDI processing exception. */ private void mapSegment(String[] currentSegmentFields, Segment expectedSegment) throws IOException, SAXException { startElement(expectedSegment, true); mapFields(currentSegmentFields, expectedSegment); if(segmentReader.moveToNextSegment()) { mapSegments(expectedSegment.getSegments()); } endElement(expectedSegment, true); }
/** * Map a single segment based on the current set of segment fields read from input and the segment mapping * config that these fields should map to. * @param currentSegmentFields Current set of segment fields read from input. * @param expectedSegment The segment mapping config that the currentSegmentFields should map to. * @throws IOException Error reading an EDI segment from the input stream. This will happen as the segment * reader tries to move to the next segment after performing this mapping. * @throws SAXException EDI processing exception. */ private void mapSegment(String[] currentSegmentFields, Segment expectedSegment) throws IOException, SAXException { startElement(expectedSegment, true); mapFields(currentSegmentFields, expectedSegment); if(segmentReader.moveToNextSegment()) { mapSegments(expectedSegment.getSegments()); } endElement(expectedSegment, true); }
/** * Map a single segment based on the current set of segment fields read from input and the segment mapping * config that these fields should map to. * @param currentSegmentFields Current set of segment fields read from input. * @param expectedSegment The segment mapping config that the currentSegmentFields should map to. * @throws IOException Error reading an EDI segment from the input stream. This will happen as the segment * reader tries to move to the next segment after performing this mapping. * @throws SAXException EDI processing exception. */ private void mapSegment(String[] currentSegmentFields, Segment expectedSegment) throws IOException, SAXException { startElement(expectedSegment, true); mapFields(currentSegmentFields, expectedSegment); if(segmentReader.moveToNextSegment()) { mapSegments(expectedSegment.getSegments()); } endElement(expectedSegment, true); }
/** * Map a single segment based on the current set of segment fields read from input and the segment mapping * config that these fields should map to. * @param currentSegmentFields Current set of segment fields read from input. * @param expectedSegment The segment mapping config that the currentSegmentFields should map to. * @throws IOException Error reading an EDI segment from the input stream. This will happen as the segment * reader tries to move to the next segment after performing this mapping. * @throws SAXException EDI processing exception. */ private void mapSegment(String[] currentSegmentFields, Segment expectedSegment) throws IOException, SAXException { startElement(expectedSegment, true); mapFields(currentSegmentFields, expectedSegment); if(segmentReader.moveToNextSegment()) { mapSegments(expectedSegment.getSegments()); } endElement(expectedSegment, true); }
private void parse(boolean indent) throws SAXException, IOException, EDIParseException { startElement(edifactModel.getEdimap().getSegments(), indent); // Work through all the segments in the model. Move to the first segment before starting... if(segmentReader.moveToNextSegment()) { mapSegments(edifactModel.getEdimap().getSegments().getSegments()); // If we reach the end of the mapping model and we still have more EDI segments in the message.... while (segmentReader.hasCurrentSegment()) { if (!EMPTY_LINE.matcher(segmentReader.getSegmentBuffer().toString()).matches()) { throw new EDIParseException(edifactModel.getEdimap(), "Reached end of mapping model but there are more EDI segments in the incoming message. Read " + segmentReader.getCurrentSegmentNumber() + " segment(s). Current EDI segment is [" + segmentReader.getSegmentBuffer() + "]"); } segmentReader.moveToNextSegment(); } } // Fire the endDocument event, as well as the endElement event... endElement(edifactModel.getEdimap().getSegments(), true); }
private void parse(boolean indent) throws SAXException, IOException, EDIParseException { boolean ignoreUnmappedSegment = edifactModel.getEdimap().isIgnoreUnmappedSegments(); startElement(edifactModel.getEdimap().getSegments(), indent); // Work through all the segments in the model. Move to the first segment before starting... if(segmentReader.moveToNextSegment()) { mapSegments(edifactModel.getEdimap().getSegments().getSegments()); // If we reach the end of the mapping model and we still have more EDI segments in the message.... while (segmentReader.hasCurrentSegment()) { if (!EMPTY_LINE.matcher(segmentReader.getSegmentBuffer().toString()).matches() && !ignoreUnmappedSegment) { throw new EDIParseException(edifactModel.getEdimap(), "Reached end of mapping model but there are more EDI segments in the incoming message. Read " + segmentReader.getCurrentSegmentNumber() + " segment(s). Current EDI segment is [" + segmentReader.getSegmentBuffer() + "]"); } segmentReader.moveToNextSegment(); } } // Fire the endDocument event, as well as the endElement event... endElement(edifactModel.getEdimap().getSegments(), true); }
private void parse(boolean indent) throws SAXException, IOException, EDIParseException { boolean ignoreUnmappedSegment = edifactModel.getEdimap().isIgnoreUnmappedSegments(); startElement(edifactModel.getEdimap().getSegments(), indent); // Work through all the segments in the model. Move to the first segment before starting... if(segmentReader.moveToNextSegment()) { mapSegments(edifactModel.getEdimap().getSegments().getSegments()); // If we reach the end of the mapping model and we still have more EDI segments in the message.... while (segmentReader.hasCurrentSegment()) { if (!EMPTY_LINE.matcher(segmentReader.getSegmentBuffer().toString()).matches() && !ignoreUnmappedSegment) { throw new EDIParseException(edifactModel.getEdimap(), "Reached end of mapping model but there are more EDI segments in the incoming message. Read " + segmentReader.getCurrentSegmentNumber() + " segment(s). Current EDI segment is [" + segmentReader.getSegmentBuffer() + "]"); } segmentReader.moveToNextSegment(); } } // Fire the endDocument event, as well as the endElement event... endElement(edifactModel.getEdimap().getSegments(), true); }
private void parse(boolean indent) throws SAXException, IOException, EDIParseException { boolean ignoreUnmappedSegment = edifactModel.getEdimap().isIgnoreUnmappedSegments(); startElement(edifactModel.getEdimap().getSegments(), indent); // Work through all the segments in the model. Move to the first segment before starting... if(segmentReader.moveToNextSegment()) { mapSegments(edifactModel.getEdimap().getSegments().getSegments()); // If we reach the end of the mapping model and we still have more EDI segments in the message.... while (segmentReader.hasCurrentSegment()) { if (!EMPTY_LINE.matcher(segmentReader.getSegmentBuffer().toString()).matches() && !ignoreUnmappedSegment) { throw new EDIParseException(edifactModel.getEdimap(), "Reached end of mapping model but there are more EDI segments in the incoming message. Read " + segmentReader.getCurrentSegmentNumber() + " segment(s). Current EDI segment is [" + segmentReader.getSegmentBuffer() + "]"); } segmentReader.moveToNextSegment(); } } // Fire the endDocument event, as well as the endElement event... endElement(edifactModel.getEdimap().getSegments(), true); }
} else { startElement(expectedSegmentGroup, true); mapSegments(expectedSegmentGroup.getSegments(), currentSegmentFields); endElement(expectedSegmentGroup, true);
} else { startElement(expectedSegmentGroup, true); mapSegments(expectedSegmentGroup.getSegments(), currentSegmentFields); endElement(expectedSegmentGroup, true);
} else { startElement(expectedSegmentGroup, true); mapSegments(expectedSegmentGroup.getSegments(), currentSegmentFields); endElement(expectedSegmentGroup, true);
} else { startElement(expectedSegmentGroup, true); mapSegments(expectedSegmentGroup.getSegments(), currentSegmentFields); endElement(expectedSegmentGroup, true);