ca.uhn.hl7v2.model.v23.message.ORU_R01 Maven / Gradle / Ivy
/*
* This class is an auto-generated source file for a HAPI
* HL7 v2.x standard structure class.
*
* For more information, visit: http://hl7api.sourceforge.net/
*/
package ca.uhn.hl7v2.model.v23.message;
import ca.uhn.hl7v2.model.v23.group.*;
import ca.uhn.hl7v2.model.v23.segment.*;
import ca.uhn.log.HapiLogFactory;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
import ca.uhn.hl7v2.model.AbstractMessage;
/**
* Represents a ORU_R01 message structure (see chapter ?). This structure contains the
* following elements:
*
* - 1: MSH (Message header segment)
* - 2: ORU_R01_RESPONSE (a Group object) repeating
* - 3: DSC (Continuation pointer segment) optional
*
*/
public class ORU_R01 extends AbstractMessage {
/**
* Creates a new ORU_R01 message with DefaultModelClassFactory.
*/
public ORU_R01() {
this(new DefaultModelClassFactory());
}
/**
* Creates a new ORU_R01 message with custom ModelClassFactory.
*/
public ORU_R01(ModelClassFactory factory) {
super(factory);
init(factory);
}
private void init(ModelClassFactory factory) {
try {
this.add(MSH.class, true, false);
this.add(ORU_R01_RESPONSE.class, true, true);
this.add(DSC.class, false, false);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORU_R01 - this is probably a bug in the source code generator.", e);
}
}
/**
* Returns "2.3"
*/
public String getVersion() {
return "2.3";
}
/**
* Returns
* MSH (Message header segment) - creates it if necessary
*/
public MSH getMSH() {
MSH ret = null;
try {
ret = (MSH)this.get("MSH");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new RuntimeException(e);
}
return ret;
}
/**
* Returns
* the first repetition of
* RESPONSE (a Group object) - creates it if necessary
*/
public ORU_R01_RESPONSE getRESPONSE() {
ORU_R01_RESPONSE ret = null;
try {
ret = (ORU_R01_RESPONSE)this.get("RESPONSE");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new RuntimeException(e);
}
return ret;
}
/**
* Returns a specific repetition of
* RESPONSE (a Group object) - creates it if necessary
*
* @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
* @throws HL7Exception if the repetition requested is more than one
* greater than the number of existing repetitions.
*/
public ORU_R01_RESPONSE getRESPONSE(int rep) {
ORU_R01_RESPONSE ret = null;
try {
ret = (ORU_R01_RESPONSE)this.get("RESPONSE", rep);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new RuntimeException(e);
}
return ret;
}
/**
* Returns the number of existing repetitions of RESPONSE
*/
public int getRESPONSEReps() {
int reps = -1;
try {
reps = this.getAll("RESPONSE").length;
} catch (HL7Exception e) {
String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
throw new RuntimeException(message);
}
return reps;
}
/**
* Inserts a specific repetition of RESPONSE (a Group object)
* @see AbstractGroup\#insertRepetition(Structure, int)
*/
public void insertRESPONSE(ORU_R01_RESPONSE structure, int rep) throws HL7Exception {
super.insertRepetition( "RESPONSE", structure, rep);
}
/**
* Inserts a specific repetition of RESPONSE (a Group object)
* @see AbstractGroup\#insertRepetition(Structure, int)
*/
public ORU_R01_RESPONSE insertRESPONSE(int rep) throws HL7Exception {
return (ORU_R01_RESPONSE)super.insertRepetition("RESPONSE", rep);
}
/**
* Removes a specific repetition of RESPONSE (a Group object)
* @see AbstractGroup\#removeRepetition(String, int)
*/
public ORU_R01_RESPONSE removeRESPONSE(int rep) throws HL7Exception {
return (ORU_R01_RESPONSE)super.removeRepetition("RESPONSE", rep);
}
/**
* Returns
* DSC (Continuation pointer segment) - creates it if necessary
*/
public DSC getDSC() {
DSC ret = null;
try {
ret = (DSC)this.get("DSC");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new RuntimeException(e);
}
return ret;
}
}