/** * Instantiate a message type using a specific package name * * @see ModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String) */ protected Message instantiateMessageInASpecificPackage(String theName, String theVersion, boolean isExplicit, String packageName) throws HL7Exception { Class<? extends Message> messageClass = getFactory().getMessageClassInASpecificPackage( theName, theVersion, isExplicit, packageName); if (messageClass == null) { throw new HL7Exception("Can't find message class in current package list: " + theName); } return ReflectionUtil.instantiateMessage(messageClass, getFactory()); }
/** * Instantiate a message type using a specific package name * * @see ModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String) */ protected Message instantiateMessageInASpecificPackage(String theName, String theVersion, boolean isExplicit, String packageName) throws HL7Exception { Class<? extends Message> messageClass = getFactory().getMessageClassInASpecificPackage( theName, theVersion, isExplicit, packageName); if (messageClass == null) { throw new HL7Exception("Can't find message class in current package list: " + theName); } return ReflectionUtil.instantiateMessage(messageClass, getFactory()); }
/** * Note that the validation context of the resulting message is set to this parser's validation * context. The validation context is used within Primitive.setValue(). * * @param theName name of the desired structure in the form XXX_YYY * @param theVersion HL7 version (e.g. "2.3") * @param isExplicit true if the structure was specified explicitly in MSH-9-3, false if it was * inferred from MSH-9-1 and MSH-9-2. If false, a lookup may be performed to find an * alternate structure corresponding to that message type and event. * @return a Message instance * @throws HL7Exception if the version is not recognized or no appropriate class can be found or * the Message class throws an exception on instantiation (e.g. if args are not as * expected) */ protected Message instantiateMessage(String theName, String theVersion, boolean isExplicit) throws HL7Exception { Class<? extends Message> messageClass = getFactory().getMessageClass(theName, theVersion, isExplicit); if (messageClass == null) throw new HL7Exception("Can't find message class in current package list: " + theName); return ReflectionUtil.instantiateMessage(messageClass, getFactory()); }
/** * Note that the validation context of the resulting message is set to this parser's validation * context. The validation context is used within Primitive.setValue(). * * @param theName name of the desired structure in the form XXX_YYY * @param theVersion HL7 version (e.g. "2.3") * @param isExplicit true if the structure was specified explicitly in MSH-9-3, false if it was * inferred from MSH-9-1 and MSH-9-2. If false, a lookup may be performed to find an * alternate structure corresponding to that message type and event. * @return a Message instance * @throws HL7Exception if the version is not recognized or no appropriate class can be found or * the Message class throws an exception on instantiation (e.g. if args are not as * expected) */ protected Message instantiateMessage(String theName, String theVersion, boolean isExplicit) throws HL7Exception { Class<? extends Message> messageClass = getFactory().getMessageClass(theName, theVersion, isExplicit); if (messageClass == null) throw new HL7Exception("Can't find message class in current package list: " + theName); return ReflectionUtil.instantiateMessage(messageClass, getFactory()); }
private Message getInMessage(Segment inHeader) throws HL7Exception, IOException { Message in; if (inHeader != null) { in = inHeader.getMessage(); // the message may be a dummy message, whose MSH segment is incomplete DeepCopy.copy(inHeader, (Segment) in.get("MSH")); } else { in = Version.highestAvailableVersionOrDefault().newGenericMessage(myParser.getFactory()); ((GenericMessage) in).initQuickstart("ACK", "", ""); } return in; }
private Message getInMessage(Segment inHeader) throws HL7Exception, IOException { Message in; if (inHeader != null) { in = inHeader.getMessage(); // the message may be a dummy message, whose MSH segment is incomplete DeepCopy.copy(inHeader, (Segment) in.get("MSH")); } else { in = Version.highestAvailableVersionOrDefault().newGenericMessage(myParser.getFactory()); ((GenericMessage) in).initQuickstart("ACK", "", ""); } return in; }
private Message instantiateACK() throws HL7Exception { ModelClassFactory mcf = getParser() != null ? getParser().getFactory() : new DefaultModelClassFactory(); Version version = Version.versionOf(getVersion()); Message out = null; if (version != null && version.available()) { Class<? extends Message> clazz = mcf.getMessageClass("ACK", version.getVersion(), false); if (clazz != null) { out = ReflectionUtil.instantiateMessage(clazz, mcf); } } if (out == null) { out = new GenericMessage.UnknownVersion(mcf); } if (out instanceof GenericMessage) { if (!ArrayUtil.contains(out.getNames(), "MSA")) { out.addNonstandardSegment("MSA"); } if (!ArrayUtil.contains(out.getNames(), "ERR")) { out.addNonstandardSegment("ERR"); } } return out; }
private Message instantiateACK() throws HL7Exception { ModelClassFactory mcf = getParser() != null ? getParser().getFactory() : new DefaultModelClassFactory(); Version version = Version.versionOf(getVersion()); Message out = null; if (version != null && version.available()) { Class<? extends Message> clazz = mcf.getMessageClass("ACK", version.getVersion(), false); if (clazz != null) { out = ReflectionUtil.instantiateMessage(clazz, mcf); } } if (out == null) { out = new GenericMessage.UnknownVersion(mcf); } if (out instanceof GenericMessage) { if (!ArrayUtil.contains(out.getNames(), "MSA")) { out.addNonstandardSegment("MSA"); } if (!ArrayUtil.contains(out.getNames(), "ERR")) { out.addNonstandardSegment("ERR"); } } return out; }