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.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 ORG message segment (Practitioner Organization Unit). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>ORG-1: Set ID - ORG (SI) <b> </b>
027         * <li>ORG-2: Organization Unit Code (CE) <b>optional </b>
028         * <li>ORG-3: Organization Unit Type Code - ORG (CE) <b>optional </b>
029         * <li>ORG-4: Primary Org Unit Indicator (ID) <b>optional </b>
030         * <li>ORG-5: Practitioner Org Unit Identifier (CX) <b>optional </b>
031         * <li>ORG-6: Health Care Provider Type Code (CE) <b>optional </b>
032         * <li>ORG-7: Health Care Provider Classification Code (CE) <b>optional </b>
033         * <li>ORG-8: Health Care Provider Area of Specialization Code (CE) <b>optional </b>
034         * <li>ORG-9: Effective Date Range (DR) <b>optional </b>
035         * <li>ORG-10: Employment Status Code (CE) <b>optional </b>
036         * <li>ORG-11: Board Approval Indicator (ID) <b>optional </b>
037         * <li>ORG-12: Primary Care Physician Indicator (ID) <b>optional </b>
038     * </ul>
039     */
040    public class ORG extends AbstractSegment {
041    
042        /** 
043         * Creates a new ORG segment
044         */
045        public ORG(Group parent, ModelClassFactory factory) {
046           super(parent, factory);
047           init(factory);
048        }
049    
050        private void init(ModelClassFactory factory) {
051           try {
052                                      this.add(SI.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Set ID - ORG");
053                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(405) }, "Organization Unit Code");
054                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(474) }, "Organization Unit Type Code - ORG");
055                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Primary Org Unit Indicator");
056                                      this.add(CX.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Practitioner Org Unit Identifier");
057                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(452) }, "Health Care Provider Type Code");
058                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(453) }, "Health Care Provider Classification Code");
059                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(454) }, "Health Care Provider Area of Specialization Code");
060                                      this.add(DR.class, false, 1, 52, new Object[]{ getMessage(), new Integer(0) }, "Effective Date Range");
061                                      this.add(CE.class, false, 1, 2, new Object[]{ getMessage(), new Integer(66) }, "Employment Status Code");
062                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Board Approval Indicator");
063                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Primary Care Physician Indicator");
064           } catch(HL7Exception e) {
065              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORG - this is probably a bug in the source code generator.", e);
066           }
067        }
068    
069    
070    
071        /**
072         * Returns
073         * ORG-1: "Set ID - ORG" - creates it if necessary
074         */
075        public SI getSetIDORG() { 
076            SI ret = null;
077            try {
078                Type t = this.getField(1, 0);
079                ret = (SI)t;
080            } catch (ClassCastException cce) {
081                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
082                throw new RuntimeException(cce);
083            } catch (HL7Exception he) {
084                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
085                throw new RuntimeException(he);
086            }
087            return ret;
088        }
089    
090    
091        /**
092         * Returns
093         * ORG-1: "Set ID - ORG" - creates it if necessary
094         */
095        public SI getOrg1_SetIDORG() { 
096            SI ret = null;
097            try {
098                Type t = this.getField(1, 0);
099                ret = (SI)t;
100            } catch (ClassCastException cce) {
101                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
102                throw new RuntimeException(cce);
103            } catch (HL7Exception he) {
104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
105                throw new RuntimeException(he);
106            }
107            return ret;
108        }
109    
110    
111    
112        /**
113         * Returns
114         * ORG-2: "Organization Unit Code" - creates it if necessary
115         */
116        public CE getOrganizationUnitCode() { 
117            CE ret = null;
118            try {
119                Type t = this.getField(2, 0);
120                ret = (CE)t;
121            } catch (ClassCastException cce) {
122                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
123                throw new RuntimeException(cce);
124            } catch (HL7Exception he) {
125                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
126                throw new RuntimeException(he);
127            }
128            return ret;
129        }
130    
131    
132        /**
133         * Returns
134         * ORG-2: "Organization Unit Code" - creates it if necessary
135         */
136        public CE getOrg2_OrganizationUnitCode() { 
137            CE ret = null;
138            try {
139                Type t = this.getField(2, 0);
140                ret = (CE)t;
141            } catch (ClassCastException cce) {
142                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
143                throw new RuntimeException(cce);
144            } catch (HL7Exception he) {
145                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
146                throw new RuntimeException(he);
147            }
148            return ret;
149        }
150    
151    
152    
153        /**
154         * Returns
155         * ORG-3: "Organization Unit Type Code - ORG" - creates it if necessary
156         */
157        public CE getOrganizationUnitTypeCodeORG() { 
158            CE ret = null;
159            try {
160                Type t = this.getField(3, 0);
161                ret = (CE)t;
162            } catch (ClassCastException cce) {
163                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
164                throw new RuntimeException(cce);
165            } catch (HL7Exception he) {
166                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
167                throw new RuntimeException(he);
168            }
169            return ret;
170        }
171    
172    
173        /**
174         * Returns
175         * ORG-3: "Organization Unit Type Code - ORG" - creates it if necessary
176         */
177        public CE getOrg3_OrganizationUnitTypeCodeORG() { 
178            CE ret = null;
179            try {
180                Type t = this.getField(3, 0);
181                ret = (CE)t;
182            } catch (ClassCastException cce) {
183                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
184                throw new RuntimeException(cce);
185            } catch (HL7Exception he) {
186                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
187                throw new RuntimeException(he);
188            }
189            return ret;
190        }
191    
192    
193    
194        /**
195         * Returns
196         * ORG-4: "Primary Org Unit Indicator" - creates it if necessary
197         */
198        public ID getPrimaryOrgUnitIndicator() { 
199            ID ret = null;
200            try {
201                Type t = this.getField(4, 0);
202                ret = (ID)t;
203            } catch (ClassCastException cce) {
204                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
205                throw new RuntimeException(cce);
206            } catch (HL7Exception he) {
207                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
208                throw new RuntimeException(he);
209            }
210            return ret;
211        }
212    
213    
214        /**
215         * Returns
216         * ORG-4: "Primary Org Unit Indicator" - creates it if necessary
217         */
218        public ID getOrg4_PrimaryOrgUnitIndicator() { 
219            ID ret = null;
220            try {
221                Type t = this.getField(4, 0);
222                ret = (ID)t;
223            } catch (ClassCastException cce) {
224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
225                throw new RuntimeException(cce);
226            } catch (HL7Exception he) {
227                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
228                throw new RuntimeException(he);
229            }
230            return ret;
231        }
232    
233    
234    
235        /**
236         * Returns
237         * ORG-5: "Practitioner Org Unit Identifier" - creates it if necessary
238         */
239        public CX getPractitionerOrgUnitIdentifier() { 
240            CX ret = null;
241            try {
242                Type t = this.getField(5, 0);
243                ret = (CX)t;
244            } catch (ClassCastException cce) {
245                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
246                throw new RuntimeException(cce);
247            } catch (HL7Exception he) {
248                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
249                throw new RuntimeException(he);
250            }
251            return ret;
252        }
253    
254    
255        /**
256         * Returns
257         * ORG-5: "Practitioner Org Unit Identifier" - creates it if necessary
258         */
259        public CX getOrg5_PractitionerOrgUnitIdentifier() { 
260            CX ret = null;
261            try {
262                Type t = this.getField(5, 0);
263                ret = (CX)t;
264            } catch (ClassCastException cce) {
265                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
266                throw new RuntimeException(cce);
267            } catch (HL7Exception he) {
268                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
269                throw new RuntimeException(he);
270            }
271            return ret;
272        }
273    
274    
275    
276        /**
277         * Returns
278         * ORG-6: "Health Care Provider Type Code" - creates it if necessary
279         */
280        public CE getHealthCareProviderTypeCode() { 
281            CE ret = null;
282            try {
283                Type t = this.getField(6, 0);
284                ret = (CE)t;
285            } catch (ClassCastException cce) {
286                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
287                throw new RuntimeException(cce);
288            } catch (HL7Exception he) {
289                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
290                throw new RuntimeException(he);
291            }
292            return ret;
293        }
294    
295    
296        /**
297         * Returns
298         * ORG-6: "Health Care Provider Type Code" - creates it if necessary
299         */
300        public CE getOrg6_HealthCareProviderTypeCode() { 
301            CE ret = null;
302            try {
303                Type t = this.getField(6, 0);
304                ret = (CE)t;
305            } catch (ClassCastException cce) {
306                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
307                throw new RuntimeException(cce);
308            } catch (HL7Exception he) {
309                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
310                throw new RuntimeException(he);
311            }
312            return ret;
313        }
314    
315    
316    
317        /**
318         * Returns
319         * ORG-7: "Health Care Provider Classification Code" - creates it if necessary
320         */
321        public CE getHealthCareProviderClassificationCode() { 
322            CE ret = null;
323            try {
324                Type t = this.getField(7, 0);
325                ret = (CE)t;
326            } catch (ClassCastException cce) {
327                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
328                throw new RuntimeException(cce);
329            } catch (HL7Exception he) {
330                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
331                throw new RuntimeException(he);
332            }
333            return ret;
334        }
335    
336    
337        /**
338         * Returns
339         * ORG-7: "Health Care Provider Classification Code" - creates it if necessary
340         */
341        public CE getOrg7_HealthCareProviderClassificationCode() { 
342            CE ret = null;
343            try {
344                Type t = this.getField(7, 0);
345                ret = (CE)t;
346            } catch (ClassCastException cce) {
347                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
348                throw new RuntimeException(cce);
349            } catch (HL7Exception he) {
350                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
351                throw new RuntimeException(he);
352            }
353            return ret;
354        }
355    
356    
357    
358        /**
359         * Returns
360         * ORG-8: "Health Care Provider Area of Specialization Code" - creates it if necessary
361         */
362        public CE getHealthCareProviderAreaOfSpecializationCode() { 
363            CE ret = null;
364            try {
365                Type t = this.getField(8, 0);
366                ret = (CE)t;
367            } catch (ClassCastException cce) {
368                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
369                throw new RuntimeException(cce);
370            } catch (HL7Exception he) {
371                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
372                throw new RuntimeException(he);
373            }
374            return ret;
375        }
376    
377    
378        /**
379         * Returns
380         * ORG-8: "Health Care Provider Area of Specialization Code" - creates it if necessary
381         */
382        public CE getOrg8_HealthCareProviderAreaOfSpecializationCode() { 
383            CE ret = null;
384            try {
385                Type t = this.getField(8, 0);
386                ret = (CE)t;
387            } catch (ClassCastException cce) {
388                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
389                throw new RuntimeException(cce);
390            } catch (HL7Exception he) {
391                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
392                throw new RuntimeException(he);
393            }
394            return ret;
395        }
396    
397    
398    
399        /**
400         * Returns
401         * ORG-9: "Effective Date Range" - creates it if necessary
402         */
403        public DR getEffectiveDateRange() { 
404            DR ret = null;
405            try {
406                Type t = this.getField(9, 0);
407                ret = (DR)t;
408            } catch (ClassCastException cce) {
409                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
410                throw new RuntimeException(cce);
411            } catch (HL7Exception he) {
412                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
413                throw new RuntimeException(he);
414            }
415            return ret;
416        }
417    
418    
419        /**
420         * Returns
421         * ORG-9: "Effective Date Range" - creates it if necessary
422         */
423        public DR getOrg9_EffectiveDateRange() { 
424            DR ret = null;
425            try {
426                Type t = this.getField(9, 0);
427                ret = (DR)t;
428            } catch (ClassCastException cce) {
429                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
430                throw new RuntimeException(cce);
431            } catch (HL7Exception he) {
432                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
433                throw new RuntimeException(he);
434            }
435            return ret;
436        }
437    
438    
439    
440        /**
441         * Returns
442         * ORG-10: "Employment Status Code" - creates it if necessary
443         */
444        public CE getEmploymentStatusCode() { 
445            CE ret = null;
446            try {
447                Type t = this.getField(10, 0);
448                ret = (CE)t;
449            } catch (ClassCastException cce) {
450                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
451                throw new RuntimeException(cce);
452            } catch (HL7Exception he) {
453                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
454                throw new RuntimeException(he);
455            }
456            return ret;
457        }
458    
459    
460        /**
461         * Returns
462         * ORG-10: "Employment Status Code" - creates it if necessary
463         */
464        public CE getOrg10_EmploymentStatusCode() { 
465            CE ret = null;
466            try {
467                Type t = this.getField(10, 0);
468                ret = (CE)t;
469            } catch (ClassCastException cce) {
470                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
471                throw new RuntimeException(cce);
472            } catch (HL7Exception he) {
473                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
474                throw new RuntimeException(he);
475            }
476            return ret;
477        }
478    
479    
480    
481        /**
482         * Returns
483         * ORG-11: "Board Approval Indicator" - creates it if necessary
484         */
485        public ID getBoardApprovalIndicator() { 
486            ID ret = null;
487            try {
488                Type t = this.getField(11, 0);
489                ret = (ID)t;
490            } catch (ClassCastException cce) {
491                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
492                throw new RuntimeException(cce);
493            } catch (HL7Exception he) {
494                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
495                throw new RuntimeException(he);
496            }
497            return ret;
498        }
499    
500    
501        /**
502         * Returns
503         * ORG-11: "Board Approval Indicator" - creates it if necessary
504         */
505        public ID getOrg11_BoardApprovalIndicator() { 
506            ID ret = null;
507            try {
508                Type t = this.getField(11, 0);
509                ret = (ID)t;
510            } catch (ClassCastException cce) {
511                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
512                throw new RuntimeException(cce);
513            } catch (HL7Exception he) {
514                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
515                throw new RuntimeException(he);
516            }
517            return ret;
518        }
519    
520    
521    
522        /**
523         * Returns
524         * ORG-12: "Primary Care Physician Indicator" - creates it if necessary
525         */
526        public ID getPrimaryCarePhysicianIndicator() { 
527            ID ret = null;
528            try {
529                Type t = this.getField(12, 0);
530                ret = (ID)t;
531            } catch (ClassCastException cce) {
532                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
533                throw new RuntimeException(cce);
534            } catch (HL7Exception he) {
535                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
536                throw new RuntimeException(he);
537            }
538            return ret;
539        }
540    
541    
542        /**
543         * Returns
544         * ORG-12: "Primary Care Physician Indicator" - creates it if necessary
545         */
546        public ID getOrg12_PrimaryCarePhysicianIndicator() { 
547            ID ret = null;
548            try {
549                Type t = this.getField(12, 0);
550                ret = (ID)t;
551            } catch (ClassCastException cce) {
552                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
553                throw new RuntimeException(cce);
554            } catch (HL7Exception he) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
556                throw new RuntimeException(he);
557            }
558            return ret;
559        }
560    
561    
562    
563    
564    
565        /** {@inheritDoc} */   
566        protected Type createNewTypeWithoutReflection(int field) {
567           switch (field) {
568              case 0: return new SI(getMessage());
569              case 1: return new CE(getMessage());
570              case 2: return new CE(getMessage());
571              case 3: return new ID(getMessage(), new Integer( 136 ));
572              case 4: return new CX(getMessage());
573              case 5: return new CE(getMessage());
574              case 6: return new CE(getMessage());
575              case 7: return new CE(getMessage());
576              case 8: return new DR(getMessage());
577              case 9: return new CE(getMessage());
578              case 10: return new ID(getMessage(), new Integer( 136 ));
579              case 11: return new ID(getMessage(), new Integer( 136 ));
580              default: return null;
581           }
582       }
583    
584    
585    }
586