示例#1
0
        /// <summary> Creates a version-specific MSH object and returns it as a version-independent
        /// MSH interface.
        /// throws HL7Exception if there is a problem, e.g. invalid version, code not available
        /// for given version.
        /// </summary>
        public static Segment makeControlMSH(System.String version, NuGenModelClassFactory factory)
        {
            Segment msh = null;

            try
            {
                Message dummy = (Message)GenericMessage.getGenericMessageClass(version).GetConstructor(new System.Type[] { typeof(NuGenModelClassFactory) }).Invoke(new System.Object[] { factory });

                System.Type[]   constructorParamTypes = new System.Type[] { typeof(Group), typeof(NuGenModelClassFactory) };
                System.Object[] constructorParamArgs  = new System.Object[] { dummy, factory };
                System.Type     c = factory.getSegmentClass("MSH", version);
                System.Reflection.ConstructorInfo constructor = c.GetConstructor(constructorParamTypes);
                msh = (Segment)constructor.Invoke(constructorParamArgs);
            }
            catch (System.Exception e)
            {
                throw new NuGenHL7Exception("Couldn't create MSH for version " + version + " (does your classpath include this version?) ... ", NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e);
            }
            return(msh);
        }
示例#2
0
 /// <param name="theFactory">custom factory to use for model class lookup
 /// </param>
 public NuGenParser(NuGenModelClassFactory theFactory)
 {
     myFactory = theFactory;
     setValidationContext(new DefaultValidation());
 }
示例#3
0
 /// <summary> Uses DefaultModelClassFactory for model class lookup. </summary>
 public NuGenParser()
 {
     myFactory = new NuGenDefaultModelClassFactory();
     setValidationContext(new DefaultValidation());
 }
示例#4
0
		/// <param name="theFactory">custom factory to use for model class lookup 
		/// </param>
		public NuGenParser(NuGenModelClassFactory theFactory)
		{
			myFactory = theFactory;
			setValidationContext(new DefaultValidation());
		}
示例#5
0
		/// <summary> Uses DefaultModelClassFactory for model class lookup. </summary>
		public NuGenParser()
		{
			myFactory = new NuGenDefaultModelClassFactory();
			setValidationContext(new DefaultValidation());
		}
示例#6
0
		/// <summary> Creates a version-specific MSH object and returns it as a version-independent 
		/// MSH interface. 
		/// throws HL7Exception if there is a problem, e.g. invalid version, code not available 
		/// for given version. 
		/// </summary>
		public static Segment makeControlMSH(System.String version, NuGenModelClassFactory factory)
		{
			Segment msh = null;
			try
			{
				Message dummy = (Message) GenericMessage.getGenericMessageClass(version).GetConstructor(new System.Type[]{typeof(NuGenModelClassFactory)}).Invoke(new System.Object[]{factory});
				
				System.Type[] constructorParamTypes = new System.Type[]{typeof(Group), typeof(NuGenModelClassFactory)};
				System.Object[] constructorParamArgs = new System.Object[]{dummy, factory};
				System.Type c = factory.getSegmentClass("MSH", version);
				System.Reflection.ConstructorInfo constructor = c.GetConstructor(constructorParamTypes);
				msh = (Segment) constructor.Invoke(constructorParamArgs);
			}
			catch (System.Exception e)
			{
				throw new NuGenHL7Exception("Couldn't create MSH for version " + version + " (does your classpath include this version?) ... ", NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e);
			}
			return msh;
		}