/** * Looks up its own event map. If no structure was found, the call is delegated to * the default ModelClassFactory. If nothing can be found, the eventName is returned * as structure. * * @see ca.uhn.hl7v2.parser.AbstractModelClassFactory#getMessageStructureForEvent(java.lang.String, ca.uhn.hl7v2.Version) */ @Override public String getMessageStructureForEvent(String eventName, Version version) throws HL7Exception { String structure = super.getMessageStructureForEvent(eventName, version); if (structure != null) return structure; structure = delegate.getMessageStructureForEvent(eventName, version); return structure != null ? structure : eventName; }
/** * {@inheritDoc } */ public Class<? extends Group> getGroupClass(String name, String version) throws HL7Exception { String key = "group" + name + version; Class<? extends Group> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("group", name, version); if (retVal == null) { retVal = delegate.getGroupClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * Delegates calls to {@link DefaultModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String)} */ public Class<? extends Message> getMessageClassInASpecificPackage(String theName, String theVersion, boolean theIsExplicit, String thePackageName) throws HL7Exception { return delegate.getMessageClassInASpecificPackage(theName, theVersion, theIsExplicit, thePackageName); }
public Message newMessage(String eventType, String triggerEvent, Version version) throws HL7Exception { try { String structure = getModelClassFactory().getMessageStructureForEvent(eventType + "_" + triggerEvent, version); Class<? extends Message> messageClass = getModelClassFactory().getMessageClass(structure, version.getVersion(), false); Message msg = newMessage(messageClass); ((AbstractMessage) msg).initQuickstart(eventType, triggerEvent, "P"); return msg; } catch (IOException e) { throw new HL7Exception(e); } }
/** * {@inheritDoc } */ public Class<? extends Segment> getSegmentClass(String name, String version) throws HL7Exception { String key = "segment" + name + version; Class<? extends Segment> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("segment", name, version); if (retVal == null) { retVal = delegate.getSegmentClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * {@inheritDoc } */ public Class<? extends Message> getMessageClass(String name, String version, boolean isExplicit) throws HL7Exception { if (!isExplicit) { name = getMessageStructureForEvent(name, Version.versionOf(version)); } String key = "message" + name + version; Class<? extends Message> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("message", name, version); if (retVal == null) { retVal = delegate.getMessageClass(name, version, isExplicit); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * {@inheritDoc } */ public Class<? extends Type> getTypeClass(String name, String version) throws HL7Exception { String key = "datatype" + name + version; Class<? extends Type> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("datatype", name, version); if (retVal == null) { retVal = delegate.getTypeClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
public Message newMessage(String eventType, String triggerEvent, Version version) throws HL7Exception { try { String structure = getModelClassFactory().getMessageStructureForEvent(eventType + "_" + triggerEvent, version); Class<? extends Message> messageClass = getModelClassFactory().getMessageClass(structure, version.getVersion(), false); Message msg = newMessage(messageClass); ((AbstractMessage) msg).initQuickstart(eventType, triggerEvent, "P"); return msg; } catch (IOException e) { throw new HL7Exception(e); } }
/** * {@inheritDoc } */ public Class<? extends Segment> getSegmentClass(String name, String version) throws HL7Exception { String key = "segment" + name + version; Class<? extends Segment> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("segment", name, version); if (retVal == null) { retVal = delegate.getSegmentClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * {@inheritDoc } */ public Class<? extends Message> getMessageClass(String name, String version, boolean isExplicit) throws HL7Exception { if (!isExplicit) { name = getMessageStructureForEvent(name, Version.versionOf(version)); } String key = "message" + name + version; Class<? extends Message> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("message", name, version); if (retVal == null) { retVal = delegate.getMessageClass(name, version, isExplicit); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * {@inheritDoc } */ public Class<? extends Type> getTypeClass(String name, String version) throws HL7Exception { String key = "datatype" + name + version; Class<? extends Type> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("datatype", name, version); if (retVal == null) { retVal = delegate.getTypeClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * Looks up its own event map. If no structure was found, the call is delegated to * the default ModelClassFactory. If nothing can be found, the eventName is returned * as structure. * * @see ca.uhn.hl7v2.parser.AbstractModelClassFactory#getMessageStructureForEvent(java.lang.String, ca.uhn.hl7v2.Version) */ @Override public String getMessageStructureForEvent(String eventName, Version version) throws HL7Exception { String structure = super.getMessageStructureForEvent(eventName, version); if (structure != null) return structure; structure = delegate.getMessageStructureForEvent(eventName, version); return structure != null ? structure : eventName; }
c = factory.getSegmentClass("MSH", version);
/** * 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()); }
/** * Delegates calls to {@link DefaultModelClassFactory#getMessageClassInASpecificPackage(String, String, boolean, String)} */ public Class<? extends Message> getMessageClassInASpecificPackage(String theName, String theVersion, boolean theIsExplicit, String thePackageName) throws HL7Exception { return delegate.getMessageClassInASpecificPackage(theName, theVersion, theIsExplicit, thePackageName); }
Class<? extends Type> c = factory.getTypeClass(typeValue, version); if (c == null) { if (invalidType != null) { c = factory.getTypeClass(invalidType, version);
/** * {@inheritDoc } */ public Class<? extends Group> getGroupClass(String name, String version) throws HL7Exception { String key = "group" + name + version; Class<? extends Group> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("group", name, version); if (retVal == null) { retVal = delegate.getGroupClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * Given a concatenation of message type and event (e.g. ADT_A04), and the version, finds the * corresponding message structure (e.g. ADT_A01). This is needed because some events share * message structures, although it is not needed when the message structure is explicitly valued * in MSH-9-3. If no mapping is found, returns the original name. * * @throws HL7Exception if there is an error retrieving the map, or if the given version is * invalid * * @deprecated use {@link ModelClassFactory#getMessageStructureForEvent(String, Version)} */ public String getMessageStructureForEvent(String name, String version) throws HL7Exception { assertVersionExists(version); return getHapiContext().getModelClassFactory(). getMessageStructureForEvent(name, Version.versionOf(version)); }
c = factory.getSegmentClass("MSH", version);
/** * 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()); }