@Override protected void markForUnregister(Device prev, Device device, List<String> dns) { HL7DeviceExtension prevHL7Ext = prev.getDeviceExtension(HL7DeviceExtension.class); if (prevHL7Ext == null) return; HL7DeviceExtension hl7Ext = device.getDeviceExtension(HL7DeviceExtension.class); for (String name : prevHL7Ext.getHL7ApplicationNames()) { if (!name.equals("*") && (hl7Ext == null || hl7Ext.getHL7Application(name) == null)) dns.add(hl7appDN(name, appNamesRegistryDN)); } }
@Override public HL7Application findHL7Application(String name) throws ConfigurationException { Device device = config.findDevice( "(&(objectclass=hl7Application)(hl7ApplicationName=" + name + "))", name); HL7DeviceExtension hl7Ext = device.getDeviceExtension(HL7DeviceExtension.class); return hl7Ext.getHL7Application(name); }
@Override protected void mergeChilds(ConfigurationChanges diffs, Device prev, Device device, String deviceDN) throws NamingException { HL7DeviceExtension prevHL7Ext = prev.getDeviceExtension(HL7DeviceExtension.class); HL7DeviceExtension hl7Ext = device.getDeviceExtension(HL7DeviceExtension.class); if (prevHL7Ext != null) for (String appName : prevHL7Ext.getHL7ApplicationNames()) { if (hl7Ext == null || !hl7Ext.containsHL7Application(appName)) { config.destroySubcontextWithChilds(hl7appDN(appName, deviceDN)); ConfigurationChanges.addModifiedObject(diffs, hl7appDN(appName, deviceDN), ConfigurationChanges.ChangeType.D); } } if (hl7Ext == null) return; for (HL7Application hl7app : hl7Ext.getHL7Applications()) { String appName = hl7app.getApplicationName(); if (prevHL7Ext == null || !prevHL7Ext.containsHL7Application(appName)) { store(diffs, hl7app, deviceDN); } else merge(diffs, prevHL7Ext.getHL7Application(appName), hl7app, deviceDN); } }
@Override protected void registerDiff(Device prev, Device device, List<String> dns) throws ConfigurationException { HL7DeviceExtension prevHL7Ext = prev.getDeviceExtension(HL7DeviceExtension.class); if (prevHL7Ext == null) { register(device, dns); return; } HL7DeviceExtension hl7Ext = device.getDeviceExtension(HL7DeviceExtension.class); if (hl7Ext == null) return; for (String name : hl7Ext.getHL7ApplicationNames()) { if (!name.equals("*") && prevHL7Ext.getHL7Application(name) == null) dns.add(registerHL7App(name)); } }
@Override public HL7Application findHL7Application(String name) throws ConfigurationException { String pathForDeviceName = DicomPath.DeviceNameByHL7AppName.set("hl7AppName", name).path(); try { Iterator search = lowLevelConfig.search(pathForDeviceName); String deviceName = (String) search.next(); Device device = findDevice(deviceName); return device.getDeviceExtension(HL7DeviceExtension.class).getHL7Application(name); } catch (NoSuchElementException e) { throw new ConfigurationException("HL7 app with name '" + name + "' not found", e); } catch (Exception e) { throw new ConfigurationException("Error while searching for HL7 app with name '" + name + "'", e); } }
UnparsedHL7Message onMessage(Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { HL7Application hl7App = getHL7Application(msg.msh().getReceivingApplicationWithFacility(), true); if (hl7App == null) throw new HL7Exception( new ERRSegment(msg.msh()) .setHL7ErrorCode(ERRSegment.TableValueNotFound) .setErrorLocation(ERRSegment.UnknownReceivingApplication) .setUserMessage("Receiving Application not recognized")); return hl7App.onMessage(conn, s, msg); }