View Javadoc
1   /*
2    * Copyright 2009 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.hl7v2.definitions.pdq.v25.group;
17  
18  import org.openehealth.ipf.modules.hl7.HL7v2Exception;
19  
20  import ca.uhn.hl7v2.HL7Exception;
21  import ca.uhn.hl7v2.model.AbstractGroup;
22  import ca.uhn.hl7v2.model.Group;
23  import ca.uhn.hl7v2.model.v25.segment.PD1;
24  import ca.uhn.hl7v2.model.v25.segment.PID;
25  import ca.uhn.hl7v2.model.v25.segment.PV1;
26  import ca.uhn.hl7v2.model.v25.segment.PV2;
27  import ca.uhn.hl7v2.model.v25.segment.QRI;
28  import ca.uhn.hl7v2.parser.ModelClassFactory;
29  
30  
31  /**
32   * Represents the RSP_ZV2_QUERY_RESPONSE group
33   * as described in ITI TF Vol. 2a, pages 219-220.
34   * <p/>
35   * This Group contains the following elements:<p>
36   * 0: PID <br>
37   * 1: PD1 <b>optional</b><br>
38   * 2: PV1 <br>
39   * 3: PV2 <b>optional</b><br>
40   * 4: QRI <b>optional</b><br>
41   */
42  @SuppressWarnings("serial")
43  public class RSP_ZV2_QUERY_RESPONSE extends AbstractGroup {
44  
45      /**
46       * Creates a new RSP_ZV2_QUERY_RESPONSE Group.
47       */
48      public RSP_ZV2_QUERY_RESPONSE(Group parent, ModelClassFactory factory) {
49          super(parent, factory);
50          try {
51              add(PID.class, true, false);
52              add(PD1.class, false, false);
53              add(PV1.class, true, true);
54              add(PV2.class, false, false);
55              add(QRI.class, false, false);
56          } catch (HL7Exception e) {
57              throw new HL7v2Exception(e);
58          }
59      }
60  
61      /**
62       * Returns PID (Patient Identification) - creates it if necessary
63       */
64      public PID getPID() {
65          return getTyped("PID", PID.class);
66      }
67  
68      /**
69       * Returns PD1 (Patient Additional Demographic) - creates it if necessary
70       */
71      public PD1 getPD1() {
72          return getTyped("PD1", PD1.class);
73      }
74  
75  
76      /**
77       * Returns PV1 - creates it if necessary
78       */
79      public PV1 getPV1() {
80          return getTyped("PV1", PV1.class);
81      }
82  
83      /**
84       * Returns PV2 - creates it if necessary
85       */
86      public PV2 getPV2() {
87          return getTyped("PV2", PV2.class);
88      }
89  
90      /**
91       * Returns QRI (Query Response Instance) - creates it if necessary
92       */
93      public QRI getQRI() {
94          return getTyped("QRI", QRI.class);
95      }
96  }