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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v27.segment;
035
036// import ca.uhn.hl7v2.model.v27.group.*;
037import ca.uhn.hl7v2.model.v27.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 NTE message segment (Notes and Comments). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>NTE-1: Set ID - NTE (SI) <b>optional </b>
053     * <li>NTE-2: Source of Comment (ID) <b>optional </b>
054     * <li>NTE-3: Comment (FT) <b>optional repeating</b>
055     * <li>NTE-4: Comment Type (CWE) <b>optional </b>
056     * <li>NTE-5: Entered By (XCN) <b>optional </b>
057     * <li>NTE-6: Entered Date/Time (DTM) <b>optional </b>
058     * <li>NTE-7: Effective Start Date (DTM) <b>optional </b>
059     * <li>NTE-8: Expiration Date (DTM) <b>optional </b>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class NTE extends AbstractSegment {
064
065    /** 
066     * Creates a new NTE segment
067     */
068    public NTE(Group parent, ModelClassFactory factory) {
069       super(parent, factory);
070       init(factory);
071    }
072
073    private void init(ModelClassFactory factory) {
074       try {
075                                  this.add(SI.class, false, 1, 0, new Object[]{ getMessage() }, "Set ID - NTE");
076                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(105) }, "Source of Comment");
077                                  this.add(FT.class, false, 0, 0, new Object[]{ getMessage() }, "Comment");
078                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Comment Type");
079                                  this.add(XCN.class, false, 1, 0, new Object[]{ getMessage() }, "Entered By");
080                                  this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Entered Date/Time");
081                                  this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Effective Start Date");
082                                  this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Expiration Date");
083       } catch(HL7Exception e) {
084          log.error("Unexpected error creating NTE - this is probably a bug in the source code generator.", e);
085       }
086    }
087
088
089
090    /**
091     * Returns
092     * NTE-1: "Set ID - NTE" - creates it if necessary
093     */
094    public SI getSetIDNTE() { 
095                SI retVal = this.getTypedField(1, 0);
096                return retVal;
097    }
098    
099    /**
100     * Returns
101     * NTE-1: "Set ID - NTE" - creates it if necessary
102     */
103    public SI getNte1_SetIDNTE() { 
104                SI retVal = this.getTypedField(1, 0);
105                return retVal;
106    }
107
108
109
110    /**
111     * Returns
112     * NTE-2: "Source of Comment" - creates it if necessary
113     */
114    public ID getSourceOfComment() { 
115                ID retVal = this.getTypedField(2, 0);
116                return retVal;
117    }
118    
119    /**
120     * Returns
121     * NTE-2: "Source of Comment" - creates it if necessary
122     */
123    public ID getNte2_SourceOfComment() { 
124                ID retVal = this.getTypedField(2, 0);
125                return retVal;
126    }
127
128
129    /**
130     * Returns all repetitions of Comment (NTE-3).
131     */
132    public FT[] getComment() {
133        FT[] retVal = this.getTypedField(3, new FT[0]);
134        return retVal;
135    }
136
137
138    /**
139     * Returns all repetitions of Comment (NTE-3).
140     */
141    public FT[] getNte3_Comment() {
142        FT[] retVal = this.getTypedField(3, new FT[0]);
143        return retVal;
144    }
145
146
147    /**
148     * Returns a count of the current number of repetitions of Comment (NTE-3).
149     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
150     * it will return zero.
151     */
152    public int getCommentReps() {
153        return this.getReps(3);
154    }
155
156
157    /**
158     * Returns a specific repetition of
159     * NTE-3: "Comment" - creates it if necessary
160     *
161     * @param rep The repetition index (0-indexed)
162     */
163    public FT getComment(int rep) { 
164                FT retVal = this.getTypedField(3, rep);
165                return retVal;
166    }
167
168    /**
169     * Returns a specific repetition of
170     * NTE-3: "Comment" - creates it if necessary
171     *
172     * @param rep The repetition index (0-indexed)
173     */
174    public FT getNte3_Comment(int rep) { 
175                FT retVal = this.getTypedField(3, rep);
176                return retVal;
177    }
178
179    /**
180     * Returns a count of the current number of repetitions of Comment (NTE-3).
181     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
182     * it will return zero.
183     */
184    public int getNte3_CommentReps() {
185        return this.getReps(3);
186    }
187
188
189    /**
190     * Inserts a repetition of
191     * NTE-3: "Comment" at a specific index
192     *
193     * @param rep The repetition index (0-indexed)
194     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
195     */
196    public FT insertComment(int rep) throws HL7Exception { 
197        return (FT) super.insertRepetition(3, rep);
198    }
199
200
201    /**
202     * Inserts a repetition of
203     * NTE-3: "Comment" at a specific index
204     *
205     * @param rep The repetition index (0-indexed)
206     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
207     */
208    public FT insertNte3_Comment(int rep) throws HL7Exception { 
209        return (FT) super.insertRepetition(3, rep);
210    }
211
212
213    /**
214     * Removes a repetition of
215     * NTE-3: "Comment" at a specific index
216     *
217     * @param rep The repetition index (0-indexed)
218     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
219     */
220    public FT removeComment(int rep) throws HL7Exception { 
221        return (FT) super.removeRepetition(3, rep);
222    }
223
224
225    /**
226     * Removes a repetition of
227     * NTE-3: "Comment" at a specific index
228     *
229     * @param rep The repetition index (0-indexed)
230     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
231     */
232    public FT removeNte3_Comment(int rep) throws HL7Exception { 
233        return (FT) super.removeRepetition(3, rep);
234    }
235
236
237
238
239    /**
240     * Returns
241     * NTE-4: "Comment Type" - creates it if necessary
242     */
243    public CWE getCommentType() { 
244                CWE retVal = this.getTypedField(4, 0);
245                return retVal;
246    }
247    
248    /**
249     * Returns
250     * NTE-4: "Comment Type" - creates it if necessary
251     */
252    public CWE getNte4_CommentType() { 
253                CWE retVal = this.getTypedField(4, 0);
254                return retVal;
255    }
256
257
258
259    /**
260     * Returns
261     * NTE-5: "Entered By" - creates it if necessary
262     */
263    public XCN getEnteredBy() { 
264                XCN retVal = this.getTypedField(5, 0);
265                return retVal;
266    }
267    
268    /**
269     * Returns
270     * NTE-5: "Entered By" - creates it if necessary
271     */
272    public XCN getNte5_EnteredBy() { 
273                XCN retVal = this.getTypedField(5, 0);
274                return retVal;
275    }
276
277
278
279    /**
280     * Returns
281     * NTE-6: "Entered Date/Time" - creates it if necessary
282     */
283    public DTM getEnteredDateTime() { 
284                DTM retVal = this.getTypedField(6, 0);
285                return retVal;
286    }
287    
288    /**
289     * Returns
290     * NTE-6: "Entered Date/Time" - creates it if necessary
291     */
292    public DTM getNte6_EnteredDateTime() { 
293                DTM retVal = this.getTypedField(6, 0);
294                return retVal;
295    }
296
297
298
299    /**
300     * Returns
301     * NTE-7: "Effective Start Date" - creates it if necessary
302     */
303    public DTM getEffectiveStartDate() { 
304                DTM retVal = this.getTypedField(7, 0);
305                return retVal;
306    }
307    
308    /**
309     * Returns
310     * NTE-7: "Effective Start Date" - creates it if necessary
311     */
312    public DTM getNte7_EffectiveStartDate() { 
313                DTM retVal = this.getTypedField(7, 0);
314                return retVal;
315    }
316
317
318
319    /**
320     * Returns
321     * NTE-8: "Expiration Date" - creates it if necessary
322     */
323    public DTM getExpirationDate() { 
324                DTM retVal = this.getTypedField(8, 0);
325                return retVal;
326    }
327    
328    /**
329     * Returns
330     * NTE-8: "Expiration Date" - creates it if necessary
331     */
332    public DTM getNte8_ExpirationDate() { 
333                DTM retVal = this.getTypedField(8, 0);
334                return retVal;
335    }
336
337
338
339
340
341    /** {@inheritDoc} */   
342    protected Type createNewTypeWithoutReflection(int field) {
343       switch (field) {
344          case 0: return new SI(getMessage());
345          case 1: return new ID(getMessage(), new Integer( 105 ));
346          case 2: return new FT(getMessage());
347          case 3: return new CWE(getMessage());
348          case 4: return new XCN(getMessage());
349          case 5: return new DTM(getMessage());
350          case 6: return new DTM(getMessage());
351          case 7: return new DTM(getMessage());
352          default: return null;
353       }
354   }
355
356
357}
358