/** * Returns an instance of encoding characters with the standard ER7 encoding characters * defined: |^~\& * * @return a default instance of encoding characters */ public static EncodingCharacters defaultInstance() { return new EncodingCharacters('|', null); }
public DefaultValidator(HapiContext context) { super(context); enc = new EncodingCharacters('|', null); // the | is assumed later -- don't change }
public GazelleProfileRule(HL7V2XConformanceProfile profile) { enc = new EncodingCharacters('|', null); // the | is assumed later -- don't change this.profile = profile; }
/** * Returns an instance of encoding characters with the standard ER7 encoding characters * defined: |^~\& * * @return a default instance of encoding characters */ public static EncodingCharacters defaultInstance() { return new EncodingCharacters('|', null); }
public DefaultValidator(HapiContext context) { super(context); enc = new EncodingCharacters('|', null); // the | is assumed later -- don't change }
throw new HL7Exception(Context.getMessageSourceService().getMessage( "ORUR01.error.improperlyFormattedOBX", new Object[] { PipeParser.encode(obx, new EncodingCharacters('|', "^~\\&")) }, null), HL7Exception.DATA_TYPE_ERROR, errorInHL7Queue);
public Object clone() throws CloneNotSupportedException { super.clone(); return new EncodingCharacters(this); }
public Object clone() throws CloneNotSupportedException { super.clone(); return new EncodingCharacters(this); }
/** * Returns object that contains the field separator and encoding characters * for this message. */ private static EncodingCharacters getEncodingChars(String message) { return new EncodingCharacters(message.charAt(3), message.substring(4, 8)); }
/** * Returns object that contains the field separator and encoding characters * for this message. */ private static EncodingCharacters getEncodingChars(String message) { return new EncodingCharacters(message.charAt(3), message.substring(4, 8)); }
/** * Returns object that contains the field separator and encoding characters * for this message. * * There's an additional character starting with v2.7 (truncation), but we will * accept it in messages of any version. * * @throws HL7Exception */ private static EncodingCharacters getEncodingChars(String message) throws HL7Exception { if (message.length() < 9) { throw new HL7Exception("Invalid message content: \"" + message + "\""); } return new EncodingCharacters(message.charAt(3), message.substring(4, 9)); }
/** * Returns object that contains the field separator and encoding characters * for this message. * * There's an additional character starting with v2.7 (truncation), but we will * accept it in messages of any version. * * @throws HL7Exception */ private static EncodingCharacters getEncodingChars(String message) throws HL7Exception { if (message.length() < 9) { throw new HL7Exception("Invalid message content: \"" + message + "\""); } return new EncodingCharacters(message.charAt(3), message.substring(4, 9)); }
/** Parses message and dumps contents to props, with keys in the ZYX[a]-b[c]-d-e style. */ public static boolean parseMessage(/*out*/ Properties props, /*in*/ List<DatumPath> msgMask, /*in*/ String message) { boolean ok = false; if(message != null) { if(props == null) props = new Properties(); StringTokenizer messageTokenizer = new StringTokenizer(message, segmentSeparators); if(messageTokenizer.hasMoreTokens()) { String firstSegment = messageTokenizer.nextToken(); EncodingCharacters encodingChars = new EncodingCharacters('0', "0000"); if(parseMSHSegmentWhole(props, msgMask, encodingChars, firstSegment)) { ok = true; SortedMap<String, Integer> segmentId2nextRepIdx = new TreeMap<String, Integer>(); segmentId2nextRepIdx.put(new String("MSH"), 1); // in case we find another MSH segment, heh. while(messageTokenizer.hasMoreTokens()) { parseSegmentWhole(props, segmentId2nextRepIdx, msgMask, encodingChars, messageTokenizer.nextToken()); } } } } return ok; }
/** Parses message and dumps contents to props, with keys in the ZYX[a]-b[c]-d-e style. */ public static boolean parseMessage(/*out*/ Properties props, /*in*/ List<DatumPath> msgMask, /*in*/ String message) { boolean ok = false; if(message != null) { if(props == null) props = new Properties(); StringTokenizer messageTokenizer = new StringTokenizer(message, segmentSeparators); if(messageTokenizer.hasMoreTokens()) { String firstSegment = messageTokenizer.nextToken(); EncodingCharacters encodingChars = new EncodingCharacters('0', "0000"); if(parseMSHSegmentWhole(props, msgMask, encodingChars, firstSegment)) { ok = true; SortedMap<String, Integer> segmentId2nextRepIdx = new TreeMap<String, Integer>(); segmentId2nextRepIdx.put(new String("MSH"), 1); // in case we find another MSH segment, heh. while(messageTokenizer.hasMoreTokens()) { parseSegmentWhole(props, segmentId2nextRepIdx, msgMask, encodingChars, messageTokenizer.nextToken()); } } } } return ok; }
private EncodingCharacters getValidEncodingCharacters(char fieldSep, Segment msh) throws HL7Exception { String encCharString = Terser.get(msh, 2, 0, 1, 1); if (encCharString == null) { throw new HL7Exception("Can't encode message: MSH-2 (encoding characters) is missing"); } if (Version.V27.isGreaterThan(Version.versionOf(msh.getMessage().getVersion())) && encCharString.length() != 4) { throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR); } else if (encCharString.length() != 4 && encCharString.length() != 5) { throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 or 5 characters", ErrorCode.DATA_TYPE_ERROR); } return new EncodingCharacters(fieldSep, encCharString); }
private EncodingCharacters getValidEncodingCharacters(char fieldSep, Segment msh) throws HL7Exception { String encCharString = Terser.get(msh, 2, 0, 1, 1); if (encCharString == null) { throw new HL7Exception("Can't encode message: MSH-2 (encoding characters) is missing"); } if (Version.V27.isGreaterThan(Version.versionOf(msh.getMessage().getVersion())) && encCharString.length() != 4) { throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR); } else if (encCharString.length() != 4 && encCharString.length() != 5) { throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 or 5 characters", ErrorCode.DATA_TYPE_ERROR); } return new EncodingCharacters(fieldSep, encCharString); }
/** * Returns an instance using the MSH-1 and MSH-2 values of the given message * * @param message the message * @return the encoding characters for this message * @throws HL7Exception If either MSH-1 or MSH-2 are not populated * @since 1.0 */ public static EncodingCharacters getInstance(Message message) throws HL7Exception { final String encodingCharactersValue = message.getEncodingCharactersValue(); if (encodingCharactersValue == null || encodingCharactersValue.length() == 0) { throw new HL7Exception("encoding characters not populated"); } final Character fieldSeparatorValue = message.getFieldSeparatorValue(); if (fieldSeparatorValue == null) { throw new HL7Exception("Field separator not populated"); } return new EncodingCharacters(fieldSeparatorValue, encodingCharactersValue); }
/** * Returns an instance using the MSH-1 and MSH-2 values of the given message * * @param message the message * @return the encoding characters for this message * @throws HL7Exception If either MSH-1 or MSH-2 are not populated * @since 1.0 */ public static EncodingCharacters getInstance(Message message) throws HL7Exception { final String encodingCharactersValue = message.getEncodingCharactersValue(); if (encodingCharactersValue == null || encodingCharactersValue.length() == 0) { throw new HL7Exception("encoding characters not populated"); } final Character fieldSeparatorValue = message.getFieldSeparatorValue(); if (fieldSeparatorValue == null) { throw new HL7Exception("Field separator not populated"); } return new EncodingCharacters(fieldSeparatorValue, encodingCharactersValue); }
"Encoding characters '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR); EncodingCharacters en = new EncodingCharacters(fieldSep, encCharString);
"Encoding characters '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR); EncodingCharacters en = new EncodingCharacters(fieldSep, encCharString);