001    /*
002     * This class is an auto-generated source file for a HAPI
003     * HL7 v2.x standard structure class.
004     *
005     * For more information, visit: http://hl7api.sourceforge.net/
006     */
007    
008    package ca.uhn.hl7v2.model.v24.message;
009    
010    import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.segment.*;
012    
013    import ca.uhn.log.HapiLogFactory;
014    import ca.uhn.hl7v2.HL7Exception;
015    import ca.uhn.hl7v2.parser.ModelClassFactory;
016    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017    import ca.uhn.hl7v2.model.AbstractMessage;
018    
019    /**
020     * <p>Represents a QCN_J01 message structure (see chapter 5). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (Message Header) <b> </b></li>
024                     * <li>2: QID (Query Identification) <b> </b></li>
025     * </ul>
026     */
027    public class QCN_J01 extends AbstractMessage  {
028    
029        /**
030         * Creates a new QCN_J01 message with DefaultModelClassFactory. 
031         */ 
032        public QCN_J01() { 
033           this(new DefaultModelClassFactory());
034        }
035    
036        /** 
037         * Creates a new QCN_J01 message with custom ModelClassFactory.
038         */
039        public QCN_J01(ModelClassFactory factory) {
040           super(factory);
041           init(factory);
042        }
043    
044        private void init(ModelClassFactory factory) {
045           try {
046                              this.add(MSH.class, true, false);
047                              this.add(QID.class, true, false);
048           } catch(HL7Exception e) {
049              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating QCN_J01 - this is probably a bug in the source code generator.", e);
050           }
051        }
052    
053        /** 
054         * Returns "2.4"
055         */
056        public String getVersion() {
057           return "2.4";
058        }
059    
060    
061    
062        /**
063         * Returns
064         * MSH (Message Header) - creates it if necessary
065         */
066        public MSH getMSH() { 
067           MSH ret = null;
068           try {
069              ret = (MSH)this.get("MSH");
070           } catch(HL7Exception e) {
071              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
072              throw new RuntimeException(e);
073           }
074           return ret;
075        }
076    
077    
078    
079    
080        /**
081         * Returns
082         * QID (Query Identification) - creates it if necessary
083         */
084        public QID getQID() { 
085           QID ret = null;
086           try {
087              ret = (QID)this.get("QID");
088           } catch(HL7Exception e) {
089              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
090              throw new RuntimeException(e);
091           }
092           return ret;
093        }
094    
095    
096    
097    
098    }
099