예제 #1
0
        //private Message message;
        //private String name;

        /// <summary> Calls the abstract init() method to create the fields in this segment.
        ///
        /// </summary>
        /// <param name="parent">parent group
        /// </param>
        /// <param name="factory">all implementors need a model class factory to find datatype classes, so we
        /// include it as an arg here to emphasize that fact ... AbstractSegment doesn't actually
        /// use it though
        /// </param>
        public AbstractSegment(Group parent, ModelClassFactory factory)
        {
            this.parent            = parent;
            this.fields            = new System.Collections.ArrayList();
            this.types             = new System.Collections.ArrayList();
            this.required          = new System.Collections.ArrayList();
            this.length            = new System.Collections.ArrayList();
            this.args              = new System.Collections.ArrayList();
            this.maxReps           = new System.Collections.ArrayList();
            this.fieldDescriptions = new System.Collections.ArrayList();
        }
예제 #2
0
 //private Message message;
 //private String name;
 /// <summary> Calls the abstract init() method to create the fields in this segment.
 /// 
 /// </summary>
 /// <param name="parent">parent group
 /// </param>
 /// <param name="factory">all implementors need a model class factory to find datatype classes, so we 
 /// include it as an arg here to emphasize that fact ... AbstractSegment doesn't actually 
 /// use it though
 /// </param>
 public AbstractSegment(Group parent, ModelClassFactory factory)
 {
     this.parent = parent;
     this.fields = new System.Collections.ArrayList();
     this.types = new System.Collections.ArrayList();
     this.required = new System.Collections.ArrayList();
     this.length = new System.Collections.ArrayList();
     this.args = new System.Collections.ArrayList();
     this.maxReps = new System.Collections.ArrayList();
     this.fieldDescriptions = new System.Collections.ArrayList();
 }
예제 #3
0
 /// <summary> Creates a new instance of GenericMessage.
 ///
 /// </summary>
 /// <param name="factory">class factory for contained structures
 /// </param>
 public GenericMessage(ModelClassFactory factory) : base(factory)
 {
     try
     {
         this.addNonstandardSegment("MSH");
     }
     catch (HL7Exception e)
     {
         System.String message = "Unexpected error adding GenericSegment to GenericMessage.";
         HapiLogFactory.getHapiLog(this.GetType()).error(message, e);
         throw new System.ApplicationException(message);
     }
 }
예제 #4
0
 /// <summary> Creates a new instance of GenericMessage. 
 /// 
 /// </summary>
 /// <param name="factory">class factory for contained structures 
 /// </param>
 public GenericMessage(ModelClassFactory factory)
     : base(factory)
 {
     try
     {
         this.addNonstandardSegment("MSH");
     }
     catch (HL7Exception e)
     {
         System.String message = "Unexpected error adding GenericSegment to GenericMessage.";
         HapiLogFactory.getHapiLog(this.GetType()).error(message, e);
         throw new System.ApplicationException(message);
     }
 }
예제 #5
0
        /// <summary> Sets the data type of field 5 in the given OBX segment to the value of OBX-2.  The argument
        /// is a Segment as opposed to a particular OBX because it is meant to work with any version.
        /// </summary>
        public static void  fixOBX5(Segment segment, ModelClassFactory factory)
        {
            try
            {
                //get unqualified class name
                Primitive obx2 = (Primitive)segment.getField(2, 0);
                Varies    v    = (Varies)segment.getField(5, 0);

                if (obx2.Value == null)
                {
                    if (v.Data != null)
                    {
                        if (!(v.Data is Primitive) || ((Primitive)v.Data).Value != null)
                        {
                            throw new HL7Exception("OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2.", HL7Exception.REQUIRED_FIELD_MISSING);
                        }
                    }
                }
                else
                {
                    //set class
                    System.Type c = factory.getTypeClass(obx2.Value, segment.Message.Version);
                    //                Class c = ca.uhn.hl7v2.parser.Parser.findClass(obx2.getValue(),
                    //                                                segment.getMessage().getVersion(),
                    //                                                "datatype");
                    v.Data = (Type)c.GetConstructor(new System.Type[] { typeof(Message) }).Invoke(new System.Object[] { v.Message });
                }
            }
            catch (HL7Exception e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                throw new HL7Exception(e.GetType().FullName + " trying to set data type of OBX-5", HL7Exception.APPLICATION_INTERNAL_ERROR, e);
            }
        }
예제 #6
0
 /// <param name="theFactory">factory for model classes (e.g. group, segment) for this message 
 /// </param>
 public AbstractMessage(ModelClassFactory theFactory)
     : base(theFactory)
 {
 }
예제 #7
0
 public V21(ModelClassFactory factory)
     : base(factory)
 {
 }
예제 #8
0
 /// <summary> This constructor should only be used by classes that implement Message directly.
 ///
 /// </summary>
 /// <param name="factory">the factory for classes of segments, groups, and datatypes under this group
 /// </param>
 protected internal AbstractGroup(ModelClassFactory factory)
 {
     this.myFactory = factory;
     init();
 }
예제 #9
0
 /// <summary> This constructor should be used by implementing classes that do not
 /// also implement Message.
 ///
 /// </summary>
 /// <param name="parent">the group to which this Group belongs.
 /// </param>
 /// <param name="factory">the factory for classes of segments, groups, and datatypes under this group
 /// </param>
 protected internal AbstractGroup(Group parent, ModelClassFactory factory)
 {
     this.parent    = parent;
     this.myFactory = factory;
     init();
 }
예제 #10
0
 /// <param name="theFactory">factory for model classes (e.g. group, segment) for this message
 /// </param>
 public AbstractMessage(ModelClassFactory theFactory) : base(theFactory)
 {
 }
예제 #11
0
파일: Varies.cs 프로젝트: snosrap/nhapi
        /// <summary> Sets the data type of field 5 in the given OBX segment to the value of OBX-2.  The argument 
        /// is a Segment as opposed to a particular OBX because it is meant to work with any version.  
        /// </summary>
        public static void fixOBX5(Segment segment, ModelClassFactory factory)
        {
            try
            {
                //get unqualified class name
                Primitive obx2 = (Primitive) segment.getField(2, 0);
                Varies v = (Varies) segment.getField(5, 0);

                if (obx2.Value == null)
                {
                    if (v.Data != null)
                    {
                        if (!(v.Data is Primitive) || ((Primitive) v.Data).Value != null)
                        {
                            throw new HL7Exception("OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2.", HL7Exception.REQUIRED_FIELD_MISSING);
                        }
                    }
                }
                else
                {
                    //set class
                    System.Type c = factory.getTypeClass(obx2.Value, segment.Message.Version);
                    //                Class c = ca.uhn.hl7v2.parser.Parser.findClass(obx2.getValue(),
                    //                                                segment.getMessage().getVersion(),
                    //                                                "datatype");
                    v.Data = (Type) c.GetConstructor(new System.Type[]{typeof(Message)}).Invoke(new System.Object[]{v.Message});
                }
            }
            catch (HL7Exception e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                throw new HL7Exception(e.GetType().FullName + " trying to set data type of OBX-5", HL7Exception.APPLICATION_INTERNAL_ERROR, e);
            }
        }
예제 #12
0
 public V22(ModelClassFactory factory) : base(factory)
 {
 }
예제 #13
0
 /// <summary>Creates a new instance of GenericGroup </summary>
 public GenericGroup(Group parent, System.String name, ModelClassFactory factory) : base(parent, factory)
 {
     this.name = name;
 }
예제 #14
0
 /// <summary> This constructor should only be used by classes that implement Message directly.
 /// 
 /// </summary>
 /// <param name="factory">the factory for classes of segments, groups, and datatypes under this group
 /// </param>
 protected internal AbstractGroup(ModelClassFactory factory)
 {
     this.myFactory = factory;
     init();
 }
예제 #15
0
 /// <summary> This constructor should be used by implementing classes that do not 
 /// also implement Message.
 /// 
 /// </summary>
 /// <param name="parent">the group to which this Group belongs.
 /// </param>
 /// <param name="factory">the factory for classes of segments, groups, and datatypes under this group
 /// </param>
 protected internal AbstractGroup(Group parent, ModelClassFactory factory)
 {
     this.parent = parent;
     this.myFactory = factory;
     init();
 }
예제 #16
0
 /// <summary>Creates a new instance of GenericGroup </summary>
 public GenericGroup(Group parent, System.String name, ModelClassFactory factory)
     : base(parent, factory)
 {
     this.name = name;
 }