コード例 #1
0
        /// <summary> Returns a package list for the given version, including the standard package
        /// for that version and also user-defined packages (see packageList()).
        /// </summary>
        private static System.String[] loadPackages(System.String version)
        {
            //PETE: Removed custom packages, now only loads the defaul - consider removing this method
            //packages.Add(version, SourceGenerator.getVersionPackageName(version));
            String[] retVal = new String[1];
            //packages.Values.CopyTo(retVal, 0);

            retVal[0] = SourceGenerator.getVersionPackageName(version);
            return(retVal);
        }
コード例 #2
0
        /// <summary> Creates an ACK message with the minimum required information from an inbound message.
        /// Optional fields can be filled in afterwards, before the message is returned.  Pleaase
        /// note that MSH-10, the outbound message control ID, is also set using the class
        /// <code>Genetibase.NuGenHL7.util.MessageIDGenerator</code>.  Also note that the ACK messages returned
        /// is the same version as the version stated in the inbound MSH if there is a generic ACK for that
        /// version, otherwise a version 2.4 ACK is returned. MSA-1 is set to AA by default.
        ///
        /// </summary>
        /// <param name="inboundHeader">the MSH segment if the inbound message
        /// </param>
        /// <throws>  IOException if there is a problem reading or writing the message ID file </throws>
        /// <throws>  DataTypeException if there is a problem setting ACK values </throws>
        public static Message makeACK(Segment inboundHeader)
        {
            if (!inboundHeader.getName().Equals("MSH"))
            {
                throw new NuGenHL7Exception("Need an MSH segment to create a response ACK (got " + inboundHeader.getName() + ")");
            }

            //make ACK of correct version
            System.String version = null;
            try
            {
                version = Terser.get_Renamed(inboundHeader, 12, 0, 1, 1);
            }
            catch (NuGenHL7Exception)
            {
                /* proceed with null */
            }
            if (version == null)
            {
                version = "2.4";
            }

            System.String ackClassName = SourceGenerator.getVersionPackageName(version) + "message.ACK";

            Message out_Renamed = null;

            try
            {
                System.Type ackClass = System.Type.GetType(ackClassName);
                out_Renamed = (Message)System.Activator.CreateInstance(ackClass);
            }
            catch (System.Exception e)
            {
                throw new NuGenHL7Exception("Can't instantiate ACK of class " + ackClassName + ": " + e.GetType().FullName);
            }
            Terser terser = new Terser(out_Renamed);

            //populate outbound MSH using data from inbound message ...
            Segment outHeader = (Segment)out_Renamed.get_Renamed("MSH");

            fillResponseHeader(inboundHeader, outHeader);

            terser.set_Renamed("/MSH-9", "ACK");
            terser.set_Renamed("/MSH-12", version);
            terser.set_Renamed("/MSA-1", "AA");
            terser.set_Renamed("/MSA-2", Genetibase.NuGenHL7.util.NuGenTerser.get_Renamed(inboundHeader, 10, 0, 1, 1));

            return(out_Renamed);
        }