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 NMD_N02 message structure (see chapter 14). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (Message Header) <b> </b></li>
024 * <li>2: NMD_N02_CLOCK_AND_STATS_WITH_NOTES (a Group object) <b> repeating</b></li>
025 * </ul>
026 */
027 public class NMD_N02 extends AbstractMessage {
028
029 /**
030 * Creates a new NMD_N02 message with DefaultModelClassFactory.
031 */
032 public NMD_N02() {
033 this(new DefaultModelClassFactory());
034 }
035
036 /**
037 * Creates a new NMD_N02 message with custom ModelClassFactory.
038 */
039 public NMD_N02(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(NMD_N02_CLOCK_AND_STATS_WITH_NOTES.class, true, true);
048 } catch(HL7Exception e) {
049 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating NMD_N02 - 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 * the first repetition of
083 * CLOCK_AND_STATS_WITH_NOTES (a Group object) - creates it if necessary
084 */
085 public NMD_N02_CLOCK_AND_STATS_WITH_NOTES getCLOCK_AND_STATS_WITH_NOTES() {
086 NMD_N02_CLOCK_AND_STATS_WITH_NOTES ret = null;
087 try {
088 ret = (NMD_N02_CLOCK_AND_STATS_WITH_NOTES)this.get("CLOCK_AND_STATS_WITH_NOTES");
089 } catch(HL7Exception e) {
090 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
091 throw new RuntimeException(e);
092 }
093 return ret;
094 }
095
096
097 /**
098 * Returns a specific repetition of
099 * CLOCK_AND_STATS_WITH_NOTES (a Group object) - creates it if necessary
100 *
101 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
102 * @throws HL7Exception if the repetition requested is more than one
103 * greater than the number of existing repetitions.
104 */
105 public NMD_N02_CLOCK_AND_STATS_WITH_NOTES getCLOCK_AND_STATS_WITH_NOTES(int rep) {
106 NMD_N02_CLOCK_AND_STATS_WITH_NOTES ret = null;
107 try {
108 ret = (NMD_N02_CLOCK_AND_STATS_WITH_NOTES)this.get("CLOCK_AND_STATS_WITH_NOTES", rep);
109 } catch(HL7Exception e) {
110 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
111 throw new RuntimeException(e);
112 }
113 return ret;
114 }
115
116 /**
117 * Returns the number of existing repetitions of CLOCK_AND_STATS_WITH_NOTES
118 */
119 public int getCLOCK_AND_STATS_WITH_NOTESReps() {
120 int reps = -1;
121 try {
122 reps = this.getAll("CLOCK_AND_STATS_WITH_NOTES").length;
123 } catch (HL7Exception e) {
124 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
125 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
126 throw new RuntimeException(message);
127 }
128 return reps;
129 }
130
131 /**
132 * Inserts a specific repetition of CLOCK_AND_STATS_WITH_NOTES (a Group object)
133 * @see AbstractGroup\#insertRepetition(Structure, int)
134 */
135 public void insertCLOCK_AND_STATS_WITH_NOTES(NMD_N02_CLOCK_AND_STATS_WITH_NOTES structure, int rep) throws HL7Exception {
136 super.insertRepetition( "CLOCK_AND_STATS_WITH_NOTES", structure, rep);
137 }
138
139
140 /**
141 * Inserts a specific repetition of CLOCK_AND_STATS_WITH_NOTES (a Group object)
142 * @see AbstractGroup\#insertRepetition(Structure, int)
143 */
144 public NMD_N02_CLOCK_AND_STATS_WITH_NOTES insertCLOCK_AND_STATS_WITH_NOTES(int rep) throws HL7Exception {
145 return (NMD_N02_CLOCK_AND_STATS_WITH_NOTES)super.insertRepetition("CLOCK_AND_STATS_WITH_NOTES", rep);
146 }
147
148
149 /**
150 * Removes a specific repetition of CLOCK_AND_STATS_WITH_NOTES (a Group object)
151 * @see AbstractGroup\#removeRepetition(String, int)
152 */
153 public NMD_N02_CLOCK_AND_STATS_WITH_NOTES removeCLOCK_AND_STATS_WITH_NOTES(int rep) throws HL7Exception {
154 return (NMD_N02_CLOCK_AND_STATS_WITH_NOTES)super.removeRepetition("CLOCK_AND_STATS_WITH_NOTES", rep);
155 }
156
157
158
159 }
160