private void changeReadEncoding(String code, BufferedSegmentReader bufferedSegmentReader) throws EDIParseException, IOException { Charset charset = toCharsetMapping.get(code.toUpperCase()); if(charset == null) { throw new EDIParseException("Unknown UN/EDIFACT character stream encoding code '" + code + "'."); } bufferedSegmentReader.changeEncoding(charset); } }
private void changeReadEncoding(String code, BufferedSegmentReader bufferedSegmentReader) throws EDIParseException, IOException { Charset charset = toCharsetMapping.get(code.toUpperCase()); if(charset == null) { throw new EDIParseException("Unknown UN/EDIFACT character stream encoding code '" + code + "'."); } bufferedSegmentReader.changeEncoding(charset); } }
private void changeReadEncoding(String code, BufferedSegmentReader bufferedSegmentReader) throws EDIParseException, IOException { Charset charset = toCharsetMapping.get(code.toUpperCase()); if(charset == null) { throw new EDIParseException("Unknown UN/EDIFACT character stream encoding code '" + code + "'."); } bufferedSegmentReader.changeEncoding(charset); } }
private void changeReadEncoding(String code, BufferedSegmentReader bufferedSegmentReader) throws EDIParseException, IOException { Charset charset = toCharsetMapping.get(code.toUpperCase()); if(charset == null) { throw new EDIParseException("Unknown UN/EDIFACT character stream encoding code '" + code + "'."); } bufferedSegmentReader.changeEncoding(charset); } }
/** * Inserts data from imported segment into the importing segment. Continues through all * the child segments of the importing segment. * @param segment the importing segment. * @param imp import information like url and namespace. * @param importedSegments the imported segment. * @throws EDIParseException Thrown when a segref attribute in importing segment contains * a value not located in the imported segment but with the namespace referencing the imported file. */ private void applyImportOnSegment(Segment segment, Import imp, Map<String, Segment> importedSegments) throws EDIParseException { if (segment.getNodeTypeRef() != null && segment.getNodeTypeRef().startsWith(imp.getNamespace()+":")) { String key = segment.getNodeTypeRef().substring(segment.getNodeTypeRef().indexOf(':') + 1); Segment importedSegment = importedSegments.get(key); if (importedSegment == null) { throw new EDIParseException(edimap, "Referenced segment [" + key + "] does not exist in imported edi-message-mapping [" + imp.getResource() + "]"); } insertImportedSegmentInfo(segment, importedSegment, imp.isTruncatableSegments(), imp.isTruncatableFields(), imp.isTruncatableComponents()); } }
/** * Inserts data from imported segment into the importing segment. Continues through all * the child segments of the importing segment. * @param segment the importing segment. * @param imp import information like url and namespace. * @param importedSegments the imported segment. * @throws EDIParseException Thrown when a segref attribute in importing segment contains * a value not located in the imported segment but with the namespace referencing the imported file. */ private void applyImportOnSegment(Segment segment, Import imp, Map<String, Segment> importedSegments) throws EDIParseException { if (segment.getNodeTypeRef() != null && segment.getNodeTypeRef().startsWith(imp.getNamespace()+":")) { String key = segment.getNodeTypeRef().substring(segment.getNodeTypeRef().indexOf(':') + 1); Segment importedSegment = importedSegments.get(key); if (importedSegment == null) { throw new EDIParseException(edimap, "Referenced segment [" + key + "] does not exist in imported edi-message-mapping [" + imp.getResource() + "]"); } insertImportedSegmentInfo(segment, importedSegment, imp.isTruncatableSegments(), imp.isTruncatableFields(), imp.isTruncatableComponents()); } }
/** * Inserts data from imported segment into the importing segment. Continues through all * the child segments of the importing segment. * @param segment the importing segment. * @param imp import information like url and namespace. * @param importedSegments the imported segment. * @throws EDIParseException Thrown when a segref attribute in importing segment contains * a value not located in the imported segment but with the namespace referencing the imported file. */ private void applyImportOnSegment(Segment segment, Import imp, Map<String, Segment> importedSegments) throws EDIParseException { if (segment.getNodeTypeRef() != null && segment.getNodeTypeRef().startsWith(imp.getNamespace()+":")) { String key = segment.getNodeTypeRef().substring(segment.getNodeTypeRef().indexOf(':') + 1); Segment importedSegment = importedSegments.get(key); if (importedSegment == null) { throw new EDIParseException(edimap, "Referenced segment [" + key + "] does not exist in imported edi-message-mapping [" + imp.getResource() + "]"); } insertImportedSegmentInfo(segment, importedSegment, imp.isTruncatableSegments(), imp.isTruncatableFields(), imp.isTruncatableComponents()); } }
/** * Inserts data from imported segment into the importing segment. Continues through all * the child segments of the importing segment. * @param segment the importing segment. * @param imp import information like url and namespace. * @param importedSegments the imported segment. * @throws EDIParseException Thrown when a segref attribute in importing segment contains * a value not located in the imported segment but with the namespace referencing the imported file. */ private void applyImportOnSegment(Segment segment, Import imp, Map<String, Segment> importedSegments) throws EDIParseException { if (segment.getNodeTypeRef() != null && segment.getNodeTypeRef().startsWith(imp.getNamespace()+":")) { String key = segment.getNodeTypeRef().substring(segment.getNodeTypeRef().indexOf(':') + 1); Segment importedSegment = importedSegments.get(key); if (importedSegment == null) { throw new EDIParseException(edimap, "Referenced segment [" + key + "] does not exist in imported edi-message-mapping [" + imp.getResource() + "]"); } insertImportedSegmentInfo(segment, importedSegment, imp.isTruncatableSegments(), imp.isTruncatableFields(), imp.isTruncatableComponents()); } }
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); }
public void process(InterchangeContext interchangeContext) throws IOException, SAXException { BufferedSegmentReader segmentReader = interchangeContext.getSegmentReader(); interchangeContext.getControlSegmentParser().startElement("group", ungSegment.getNamespace(), true); segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(ungSegment, true); while(true) { String segCode = segmentReader.peek(3, true); if(segCode.equals("UNE")) { segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(uneSegment, true); break; } else if(segCode.length() > 0) { ControlBlockHandler handler = interchangeContext.getControlBlockHandler(segCode); handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset."); } } interchangeContext.getControlSegmentParser().endElement("group", ungSegment.getNamespace(), true); } }
public void process(InterchangeContext interchangeContext) throws IOException, SAXException { BufferedSegmentReader segmentReader = interchangeContext.getSegmentReader(); interchangeContext.getControlSegmentParser().startElement("group", ungSegment.getNamespace(), true); segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(ungSegment, true); while(true) { String segCode = segmentReader.peek(3, true); if(segCode.equals("UNE")) { segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(uneSegment, true); break; } else if(segCode.length() > 0) { ControlBlockHandler handler = interchangeContext.getControlBlockHandler(segCode); handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset."); } } interchangeContext.getControlSegmentParser().endElement("group", ungSegment.getNamespace(), true); } }
public void process(InterchangeContext interchangeContext) throws IOException, SAXException { BufferedSegmentReader segmentReader = interchangeContext.getSegmentReader(); interchangeContext.getControlSegmentParser().startElement("group", ungSegment.getNamespace(), true); segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(ungSegment, true); while(true) { String segCode = segmentReader.peek(3, true); if(segCode.equals("UNE")) { segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(uneSegment, true); break; } else if(segCode.length() > 0) { ControlBlockHandler handler = interchangeContext.getControlBlockHandler(segCode); handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset."); } } interchangeContext.getControlSegmentParser().endElement("group", ungSegment.getNamespace(), true); } }
public void process(InterchangeContext interchangeContext) throws IOException, SAXException { BufferedSegmentReader segmentReader = interchangeContext.getSegmentReader(); interchangeContext.getControlSegmentParser().startElement("group", ungSegment.getNamespace(), true); segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(ungSegment, true); while(true) { String segCode = segmentReader.peek(3, true); if(segCode.equals("UNE")) { segmentReader.moveToNextSegment(false); interchangeContext.mapControlSegment(uneSegment, true); break; } else if(segCode.length() > 0) { ControlBlockHandler handler = interchangeContext.getControlBlockHandler(segCode); handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset."); } } interchangeContext.getControlSegmentParser().endElement("group", ungSegment.getNamespace(), 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); }
handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset.");
handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset.");
handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset.");
handler.process(interchangeContext); } else { throw new EDIParseException("Unexpected end of UN/EDIFACT data stream. If stream was reset (e.g. after read charset was changed), please make sure underlying stream was properly reset.");