Esempio n. 1
0
        /// <summary> Returns a subclass of GenericMessage corresponding to a certain version.
        /// This is needed so that version-specific segments can be added as the message
        /// is parsed.
        /// </summary>
        public static System.Type getGenericMessageClass(System.String version)
        {
            if (!Parser.validVersion(version))
            {
                throw new System.ArgumentException("The version " + version + " is not recognized");
            }

            System.Type c = null;
            if (version.Equals("2.1"))
            {
                c = typeof(V21);
            }
            else if (version.Equals("2.2"))
            {
                c = typeof(V22);
            }
            else if (version.Equals("2.3"))
            {
                c = typeof(V23);
            }
            else if (version.Equals("2.3.1"))
            {
                c = typeof(V231);
            }
            else if (version.Equals("2.4"))
            {
                c = typeof(V24);
            }
            else if (version.Equals("2.5"))
            {
                c = typeof(V25);
            }
            return(c);
        }
Esempio n. 2
0
 /// <summary> Returns the path to the base package for model elements of the given version
 /// - e.g. "ca/uhn/hl7v2/model/v24/".
 /// This package should have the packages datatype, segment, group, and message
 /// under it. The path ends in with a slash.
 /// </summary>
 public static System.String getVersionPackageDirectory(System.String ver)
 {
     if (Parser.validVersion(ver) == false)
     {
         throw new HL7Exception("The HL7 version " + ver + " is not recognized", HL7Exception.UNSUPPORTED_VERSION_ID);
     }
     System.Text.StringBuilder path = new System.Text.StringBuilder("v");
     char[] versionChars            = new char[ver.Length];
     SupportClass.GetCharsFromString(ver, 0, ver.Length, versionChars, 0);
     for (int i = 0; i < versionChars.Length; i++)
     {
         if (versionChars[i] != '.')
         {
             path.Append(versionChars[i]);
         }
     }
     path.Append('/');
     return(path.ToString());
 }