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 QRY_Q02 message structure (see chapter ?). This structure contains the 
021     * following elements: </p>
022     * <ul>
023                     * <li>1: MSH (Message Header) <b> </b></li>
024                     * <li>2: QRD (Original-Style Query Definition) <b> </b></li>
025                     * <li>3: QRF (Original Style Query Filter) <b>optional </b></li>
026                     * <li>4: DSC (Continuation Pointer) <b>optional </b></li>
027     * </ul>
028     */
029    public class QRY_Q02 extends AbstractMessage  {
030    
031        /**
032         * Creates a new QRY_Q02 message with DefaultModelClassFactory. 
033         */ 
034        public QRY_Q02() { 
035           this(new DefaultModelClassFactory());
036        }
037    
038        /** 
039         * Creates a new QRY_Q02 message with custom ModelClassFactory.
040         */
041        public QRY_Q02(ModelClassFactory factory) {
042           super(factory);
043           init(factory);
044        }
045    
046        private void init(ModelClassFactory factory) {
047           try {
048                              this.add(MSH.class, true, false);
049                              this.add(QRD.class, true, false);
050                              this.add(QRF.class, false, false);
051                              this.add(DSC.class, false, false);
052           } catch(HL7Exception e) {
053              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating QRY_Q02 - this is probably a bug in the source code generator.", e);
054           }
055        }
056    
057        /** 
058         * Returns "2.4"
059         */
060        public String getVersion() {
061           return "2.4";
062        }
063    
064    
065    
066        /**
067         * Returns
068         * MSH (Message Header) - creates it if necessary
069         */
070        public MSH getMSH() { 
071           MSH ret = null;
072           try {
073              ret = (MSH)this.get("MSH");
074           } catch(HL7Exception e) {
075              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
076              throw new RuntimeException(e);
077           }
078           return ret;
079        }
080    
081    
082    
083    
084        /**
085         * Returns
086         * QRD (Original-Style Query Definition) - creates it if necessary
087         */
088        public QRD getQRD() { 
089           QRD ret = null;
090           try {
091              ret = (QRD)this.get("QRD");
092           } catch(HL7Exception e) {
093              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
094              throw new RuntimeException(e);
095           }
096           return ret;
097        }
098    
099    
100    
101    
102        /**
103         * Returns
104         * QRF (Original Style Query Filter) - creates it if necessary
105         */
106        public QRF getQRF() { 
107           QRF ret = null;
108           try {
109              ret = (QRF)this.get("QRF");
110           } catch(HL7Exception e) {
111              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
112              throw new RuntimeException(e);
113           }
114           return ret;
115        }
116    
117    
118    
119    
120        /**
121         * Returns
122         * DSC (Continuation Pointer) - creates it if necessary
123         */
124        public DSC getDSC() { 
125           DSC ret = null;
126           try {
127              ret = (DSC)this.get("DSC");
128           } catch(HL7Exception e) {
129              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
130              throw new RuntimeException(e);
131           }
132           return ret;
133        }
134    
135    
136    
137    
138    }
139