/** * Formats a Message object into an HL7 message string using this parser's * default encoding ("VB"). * * @throws HL7Exception * if the data fields in the message do not permit encoding * (e.g. required fields are null) */ protected String doEncode(Message source) throws HL7Exception { // get encoding characters ... Segment msh = (Segment) source.get("MSH"); String fieldSepString = Terser.get(msh, 1, 0, 1, 1); if (fieldSepString == null) throw new HL7Exception("Can't encode message: MSH-1 (field separator) is missing"); char fieldSep = '|'; if (fieldSepString.length() > 0) fieldSep = fieldSepString.charAt(0); EncodingCharacters en = getValidEncodingCharacters(fieldSep, msh); // pass down to group encoding method which will operate recursively on // children ... return encode(source, en, getParserConfiguration(), ""); }
/** * Formats a Message object into an HL7 message string using this parser's * default encoding ("VB"). * * @throws HL7Exception * if the data fields in the message do not permit encoding * (e.g. required fields are null) */ protected String doEncode(Message source) throws HL7Exception { // get encoding characters ... Segment msh = (Segment) source.get("MSH"); String fieldSepString = Terser.get(msh, 1, 0, 1, 1); if (fieldSepString == null) throw new HL7Exception("Can't encode message: MSH-1 (field separator) is missing"); char fieldSep = '|'; if (fieldSepString.length() > 0) fieldSep = fieldSepString.charAt(0); EncodingCharacters en = getValidEncodingCharacters(fieldSep, msh); // pass down to group encoding method which will operate recursively on // children ... return encode(source, en, getParserConfiguration(), ""); }