ca.uhn.hl7v2.model.v26.segment.QAK 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.v26.segment;
// import ca.uhn.hl7v2.model.v26.group.*;
import ca.uhn.hl7v2.model.v26.datatype.*;
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;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Varies;
/**
*Represents an HL7 QAK message segment (Query Acknowledgment).
* This segment has the following fields:
*
* - QAK-1: Query Tag (ST) optional
*
- QAK-2: Query Response Status (ID) optional
*
- QAK-3: Message Query Name (CWE) optional
*
- QAK-4: Hit Count Total (NM) optional
*
- QAK-5: This payload (NM) optional
*
- QAK-6: Hits remaining (NM) optional
*
*/
public class QAK extends AbstractSegment {
/**
* Creates a new QAK segment
*/
public QAK(Group parent, ModelClassFactory factory) {
super(parent, factory);
init(factory);
}
private void init(ModelClassFactory factory) {
try {
this.add(ST.class, false, 1, 32, new Object[]{ getMessage(), new Integer(0) }, "Query Tag");
this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Query Response Status");
this.add(CWE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(471) }, "Message Query Name");
this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Hit Count Total");
this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "This payload");
this.add(NM.class, false, 1, 10, new Object[]{ getMessage(), new Integer(0) }, "Hits remaining");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating QAK - this is probably a bug in the source code generator.", e);
}
}
/**
* Returns
* QAK-1: "Query Tag" - creates it if necessary
*/
public ST getQueryTag() {
ST ret = null;
try {
Type t = this.getField(1, 0);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-1: "Query Tag" - creates it if necessary
*/
public ST getQak1_QueryTag() {
ST ret = null;
try {
Type t = this.getField(1, 0);
ret = (ST)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-2: "Query Response Status" - creates it if necessary
*/
public ID getQueryResponseStatus() {
ID ret = null;
try {
Type t = this.getField(2, 0);
ret = (ID)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-2: "Query Response Status" - creates it if necessary
*/
public ID getQak2_QueryResponseStatus() {
ID ret = null;
try {
Type t = this.getField(2, 0);
ret = (ID)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-3: "Message Query Name" - creates it if necessary
*/
public CWE getMessageQueryName() {
CWE ret = null;
try {
Type t = this.getField(3, 0);
ret = (CWE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-3: "Message Query Name" - creates it if necessary
*/
public CWE getQak3_MessageQueryName() {
CWE ret = null;
try {
Type t = this.getField(3, 0);
ret = (CWE)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-4: "Hit Count Total" - creates it if necessary
*/
public NM getHitCountTotal() {
NM ret = null;
try {
Type t = this.getField(4, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-4: "Hit Count Total" - creates it if necessary
*/
public NM getQak4_HitCountTotal() {
NM ret = null;
try {
Type t = this.getField(4, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-5: "This payload" - creates it if necessary
*/
public NM getThisPayload() {
NM ret = null;
try {
Type t = this.getField(5, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-5: "This payload" - creates it if necessary
*/
public NM getQak5_ThisPayload() {
NM ret = null;
try {
Type t = this.getField(5, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-6: "Hits remaining" - creates it if necessary
*/
public NM getHitsRemaining() {
NM ret = null;
try {
Type t = this.getField(6, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/**
* Returns
* QAK-6: "Hits remaining" - creates it if necessary
*/
public NM getQak6_HitsRemaining() {
NM ret = null;
try {
Type t = this.getField(6, 0);
ret = (NM)t;
} catch (ClassCastException cce) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new RuntimeException(cce);
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new RuntimeException(he);
}
return ret;
}
/** {@inheritDoc} */
protected Type createNewTypeWithoutReflection(int field) {
switch (field) {
case 0: return new ST(getMessage());
case 1: return new ID(getMessage(), new Integer( 208 ));
case 2: return new CWE(getMessage());
case 3: return new NM(getMessage());
case 4: return new NM(getMessage());
case 5: return new NM(getMessage());
default: return null;
}
}
}