use of ca.uhn.hl7v2.model.DataTypeException in project tdi-studio-se by Talend.
the class TypeModel method getComponent.
private Type getComponent(Type type, int comp) {
Type ret = null;
if (Varies.class.isAssignableFrom(type.getClass())) {
Varies v = (Varies) type;
try {
if (comp > 1 && GenericPrimitive.class.isAssignableFrom(v.getData().getClass())) {
v.setData(new GenericComposite(v.getMessage()));
}
} catch (DataTypeException de) {
String message = "Unexpected exception copying data to generic composite: " + de.getMessage();
throw new Error(message);
}
ret = getComponent(v.getData(), comp);
} else {
if (Primitive.class.isAssignableFrom(type.getClass()) && comp == 1) {
ret = type;
} else if (GenericComposite.class.isAssignableFrom(type.getClass()) || (Composite.class.isAssignableFrom(type.getClass()) && comp <= numStandardComponents(type))) {
try {
ret = ((Composite) type).getComponent(comp - 1);
} catch (Exception e) {
throw new Error("Internal error: HL7Exception thrown on getComponent(x) where x < # standard components.", e);
}
} else {
ret = type.getExtraComponents().getComponent(comp - numStandardComponents(type) - 1);
}
}
return ret;
}
use of ca.uhn.hl7v2.model.DataTypeException in project openmrs-core by openmrs.
the class ORUR01Handler method getDatetime.
/**
* Return a java date object for the given TS
*
* @param ts TS to parse
* @return date object or null
* @throws HL7Exception
*/
private Date getDatetime(TS ts) throws HL7Exception {
Date datetime = null;
DTM value = ts.getTime();
if (value.getYear() == 0 || value.getValue() == null) {
return null;
}
try {
datetime = getDate(value.getYear(), value.getMonth(), value.getDay(), value.getHour(), value.getMinute(), value.getSecond());
} catch (DataTypeException e) {
}
return datetime;
}
Aggregations