/** * Always returns true, assuming that the router calling this handler will only call this * handler with ADT_A28 messages. * * @return true */ @Override public boolean canProcess(Message message) { return message != null && "ADT_A28".equals(message.getName()); }
/** * Always returns true, assuming that the router calling this handler will only call this * handler with ORU_R01 messages. * * @return true */ @Override public boolean canProcess(Message message) { return message != null && "ORU_R01".equals(message.getName()); }
/** * @see org.openmrs.hl7.HL7Service#processHL7Message(ca.uhn.hl7v2.model.Message) */ @Override public Message processHL7Message(Message message) throws HL7Exception { // Any post-parsing (pre-routing) processing would go here // or a module can use AOP to do the post-parsing Message response; try { if (!router.canProcess(message)) { throw new HL7Exception("No route for hl7 message: " + message.getName() + ". Make sure you have a module installed that registers a hl7handler for this type"); } response = router.processMessage(message); } catch (ApplicationException e) { throw new HL7Exception("Error while processing HL7 message: " + message.getName(), e); } return response; }
retVal = definitions.get(theMessage.getName()); if (retVal != null) { return retVal; if (!appliesTo.contains(theMessage.getName())) { throw new HL7Exception("Superstructure " + theMessage.getClass().getSimpleName() + " does not apply to message " + theMessage.getName() + ", can not parse."); retVal = createStructureDefinition(theMessage, previousLeaf, theMessage.getName()); } else { Message message = ReflectionUtil.instantiateMessage(clazz, getFactory()); Holder<StructureDefinition> previousLeaf = new Holder<StructureDefinition>(); retVal = createStructureDefinition(message, previousLeaf, theMessage.getName()); myStructureDefinitions.get(clazz).put(theMessage.getName(), retVal);
retVal = definitions.get(theMessage.getName()); if (retVal != null) { return retVal; if (!appliesTo.contains(theMessage.getName())) { throw new HL7Exception("Superstructure " + theMessage.getClass().getSimpleName() + " does not apply to message " + theMessage.getName() + ", can not parse."); retVal = createStructureDefinition(theMessage, previousLeaf, theMessage.getName()); } else { Message message = ReflectionUtil.instantiateMessage(clazz, getFactory()); Holder<StructureDefinition> previousLeaf = new Holder<StructureDefinition>(); retVal = createStructureDefinition(message, previousLeaf, theMessage.getName()); myStructureDefinitions.get(clazz).put(theMessage.getName(), retVal);
String messageName = groupObject.getMessage().getName();
private void checkStructure(SuperStructure theMsg, List<ValidationException> theExceptions) { String messageStructure = theMsg.getMessage().getName(); Set<String> nonStandardNames = theMsg.getNonStandardNames(); FORNAME: for (String name : theMsg.getNames()) { if (nonStandardNames != null && nonStandardNames.contains(name)) { continue; } try { for (Structure rep : theMsg.getAll(name)) { if (!rep.isEmpty()) { Set<String> structuresWhichChildAppliesTo = theMsg.getStructuresWhichChildAppliesTo(name); if (!structuresWhichChildAppliesTo.contains(messageStructure)) { String msgSimpleName = theMsg.getMessage().getClass().getSimpleName(); theExceptions.add(new ValidationException("Message (superstructure " + msgSimpleName + ") of type " + messageStructure + " must not have content in " + name)); } continue FORNAME; } } } catch (HL7Exception e) { // should not happen throw new Error("Can't get rep of structure " + name + ". This is probably a HAPI bug"); } } }
private void checkStructure(SuperStructure theMsg, List<ValidationException> theExceptions) { String messageStructure = theMsg.getMessage().getName(); Set<String> nonStandardNames = theMsg.getNonStandardNames(); FORNAME: for (String name : theMsg.getNames()) { if (nonStandardNames != null && nonStandardNames.contains(name)) { continue; } try { for (Structure rep : theMsg.getAll(name)) { if (!rep.isEmpty()) { Set<String> structuresWhichChildAppliesTo = theMsg.getStructuresWhichChildAppliesTo(name); if (!structuresWhichChildAppliesTo.contains(messageStructure)) { String msgSimpleName = theMsg.getMessage().getClass().getSimpleName(); theExceptions.add(new ValidationException("Message (superstructure " + msgSimpleName + ") of type " + messageStructure + " must not have content in " + name)); } continue FORNAME; } } } catch (HL7Exception e) { // should not happen throw new Error("Can't get rep of structure " + name + ". This is probably a HAPI bug"); } } }
String messageName = groupObject.getMessage().getName();
@Override public void parse(Message message, String string) throws HL7Exception { if (message instanceof AbstractSuperMessage && message.getName() == null) { String structure = getStructure(string).messageStructure; ((AbstractSuperMessage) message).setName(structure);
@Override public void parse(Message message, String string) throws HL7Exception { if (message instanceof AbstractSuperMessage && message.getName() == null) { String structure = getStructure(string).messageStructure; ((AbstractSuperMessage) message).setName(structure);
protected void applySuperStructureName(Message theMessage) throws HL7Exception { if (theMessage instanceof AbstractSuperMessage) { if (theMessage.getName() == null) { Terser t = new Terser(theMessage); String name = null; try { name = t.get("/MSH-9-3"); } catch (HL7Exception e) { // ignore } if (StringUtil.isBlank(name)) { name = t.get("/MSH-9-1") + "_" + t.get("/MSH-9-2"); } ((AbstractSuperMessage)theMessage).setName(name); } } }
protected void applySuperStructureName(Message theMessage) throws HL7Exception { if (theMessage instanceof AbstractSuperMessage) { if (theMessage.getName() == null) { Terser t = new Terser(theMessage); String name = null; try { name = t.get("/MSH-9-3"); } catch (HL7Exception e) { // ignore } if (StringUtil.isBlank(name)) { name = t.get("/MSH-9-1") + "_" + t.get("/MSH-9-2"); } ((AbstractSuperMessage)theMessage).setName(name); } } }