private void reconfigureHL7Applications(HL7DeviceExtension from) { hl7apps.keySet().retainAll(from.hl7apps.keySet()); for (HL7Application src : from.hl7apps.values()) { HL7Application hl7app = hl7apps.get(src.getApplicationName()); if (hl7app == null) addHL7Application(hl7app = new HL7Application(src.getApplicationName())); hl7app.reconfigure(src); } } }
public HL7Rcv() throws IOException { conn.setProtocol(Protocol.HL7); device.addDeviceExtension(hl7Ext); device.addConnection(conn); hl7Ext.addHL7Application(hl7App); hl7App.setAcceptedMessageTypes("*"); hl7App.addConnection(conn); hl7App.setHL7MessageListener(handler); }
private List<ModificationItem> storeDiffs(ConfigurationChanges.ModifiedObject ldapObj, HL7Application a, HL7Application b, String deviceDN, List<ModificationItem> mods) { LdapUtils.storeDiff(ldapObj, mods, "hl7AcceptedSendingApplication", a.getAcceptedSendingApplications(), b.getAcceptedSendingApplications()); LdapUtils.storeDiff(ldapObj, mods, "hl7OtherApplicationName", a.getOtherApplicationNames(), b.getOtherApplicationNames()); LdapUtils.storeDiff(ldapObj, mods, "hl7AcceptedMessageType", a.getAcceptedMessageTypes(), b.getAcceptedMessageTypes()); LdapUtils.storeDiffObject(ldapObj, mods, "hl7DefaultCharacterSet", a.getHL7DefaultCharacterSet(), b.getHL7DefaultCharacterSet(), "ASCII"); LdapUtils.storeDiffObject(ldapObj, mods, "hl7SendingCharacterSet", a.getHL7SendingCharacterSet(), b.getHL7SendingCharacterSet(), "ASCII"); LdapUtils.storeDiff(ldapObj, mods, "dicomNetworkConnectionReference", a.getConnections(), b.getConnections(), deviceDN); LdapUtils.storeDiffObject(ldapObj, mods, "dicomDescription", a.getDescription(), b.getDescription(), null); LdapUtils.storeDiff(ldapObj, mods, "dicomApplicationCluster", a.getApplicationClusters(), b.getApplicationClusters()); LdapUtils.storeDiffObject(ldapObj, mods, "dicomInstalled", a.getInstalled(), b.getInstalled(), null);
public void addHL7Application(HL7Application hl7App) { hl7App.setDevice(device); hl7apps.put(hl7App.getApplicationName(), hl7App); }
@Override public void verifyNotUsed(Connection conn) { for (HL7Application app : hl7apps.values()) if (app.getConnections().contains(conn)) throw new IllegalStateException(conn + " used by HL7 Application: " + app.getApplicationName()); }
private void loadFrom(HL7Application hl7app, Attributes attrs) throws NamingException { hl7app.setAcceptedSendingApplications(LdapUtils.stringArray(attrs.get("hl7AcceptedSendingApplication"))); hl7app.setOtherApplicationNames(LdapUtils.stringArray(attrs.get("hl7OtherApplicationName"))); hl7app.setAcceptedMessageTypes(LdapUtils.stringArray(attrs.get("hl7AcceptedMessageType"))); hl7app.setHL7DefaultCharacterSet(LdapUtils.stringValue(attrs.get("hl7DefaultCharacterSet"), "ASCII")); hl7app.setHL7SendingCharacterSet(LdapUtils.stringValue(attrs.get("hl7SendingCharacterSet"), "ASCII")); hl7app.setDescription(LdapUtils.stringValue(attrs.get("dicomDescription"), null)); hl7app.setApplicationClusters(LdapUtils.stringArray(attrs.get("dicomApplicationCluster"))); hl7app.setInstalled(LdapUtils.booleanValue(attrs.get("dicomInstalled"), null)); for (LdapHL7ConfigurationExtension ext : extensions) ext.loadFrom(hl7app, attrs); }
void setHL7Application(HL7Application hl7App) { if (hl7App != null && this.hl7App != null) throw new IllegalStateException( "already owned by HL7 Application: " + hl7App.getApplicationName()); this.hl7App = hl7App; }
private HL7Application loadHL7Application(SearchResult sr, String deviceDN, Device device) throws NamingException, ConfigurationException { Attributes attrs = sr.getAttributes(); HL7Application hl7app = new HL7Application(LdapUtils.stringValue(attrs.get("hl7ApplicationName"), null)); loadFrom(hl7app, attrs); for (String connDN : LdapUtils.stringArray(attrs.get("dicomNetworkConnectionReference"))) hl7app.addConnection(LdapUtils.findConnection(connDN, deviceDN, device)); for (LdapHL7ConfigurationExtension ext : extensions) ext.loadChilds(hl7app, sr.getNameInNamespace()); return hl7app; }
private void loadFrom(HL7DeviceExtension ext, JsonReader reader, Device device, ConfigurationDelegate config) throws ConfigurationException { List<Connection> conns = device.listConnections(); reader.next(); reader.expect(JsonParser.Event.START_ARRAY); while (reader.next() == JsonParser.Event.START_OBJECT) { HL7Application hl7App = new HL7Application(); loadFrom(hl7App, reader, device, conns, config); reader.expect(JsonParser.Event.END_OBJECT); ext.addHL7Application(hl7App); } reader.expect(JsonParser.Event.END_ARRAY); }
switch (reader.getString()) { case "hl7ApplicationName": hl7App.setApplicationName(reader.stringValue()); break; case "dicomInstalled": hl7App.setInstalled(reader.booleanValue()); break; case "dicomNetworkConnectionReference": for (String connRef : reader.stringArray()) hl7App.addConnection(conns.get(JsonReader.toConnectionIndex(connRef))); break; case "hl7AcceptedSendingApplication": hl7App.setAcceptedSendingApplications(reader.stringArray()); break; case "hl7OtherApplicationName": hl7App.setOtherApplicationNames(reader.stringArray()); break; case "hl7AcceptedMessageType": hl7App.setAcceptedMessageTypes(reader.stringArray()); break; case "hl7DefaultCharacterSet": hl7App.setHL7DefaultCharacterSet(reader.stringValue()); break; case "hl7SendingCharacterSet": hl7App.setHL7SendingCharacterSet(reader.stringValue()); break; case "dicomDescription": hl7App.setDescription(reader.stringValue()); break;
public boolean removeHL7Application(HL7Application hl7App) { return removeHL7Application(hl7App.getApplicationName()) != null; }
private void loadFrom(HL7DeviceExtension ext, JsonReader reader, Device device, ConfigurationDelegate config) throws ConfigurationException { List<Connection> conns = device.listConnections(); reader.next(); reader.expect(JsonParser.Event.START_ARRAY); while (reader.next() == JsonParser.Event.START_OBJECT) { HL7Application hl7App = new HL7Application(); loadFrom(hl7App, reader, device, conns, config); reader.expect(JsonParser.Event.END_OBJECT); ext.addHL7Application(hl7App); } reader.expect(JsonParser.Event.END_ARRAY); }
private void writeTo(Device device, HL7Application hl7App, JsonWriter writer) { writer.writeStartObject(); writer.writeNotNullOrDef("hl7ApplicationName", hl7App.getApplicationName(), null); writer.writeNotNull("dicomInstalled", hl7App.getInstalled()); writer.writeConnRefs(device.listConnections(), hl7App.getConnections()); writer.writeNotEmpty("hl7AcceptedSendingApplication", hl7App.getAcceptedSendingApplications()); writer.writeNotEmpty("hl7OtherApplicationName", hl7App.getOtherApplicationNames()); writer.writeNotEmpty("hl7AcceptedMessageType", hl7App.getAcceptedMessageTypes()); writer.writeNotNullOrDef("hl7DefaultCharacterSet", hl7App.getHL7DefaultCharacterSet(), "ASCII"); writer.writeNotNullOrDef("hl7SendingCharacterSet", hl7App.getHL7SendingCharacterSet(), "ASCII"); writer.writeNotNullOrDef("dicomDescription", hl7App.getDescription(), null); writer.writeNotEmpty("dicomApplicationCluster", hl7App.getApplicationClusters()); for (JsonHL7ConfigurationExtension ext : extensions) ext.storeTo(hl7App, device, writer); writer.writeEnd(); }
switch (reader.getString()) { case "hl7ApplicationName": hl7App.setApplicationName(reader.stringValue()); break; case "dicomInstalled": hl7App.setInstalled(reader.booleanValue()); break; case "dicomNetworkConnectionReference": for (String connRef : reader.stringArray()) hl7App.addConnection(conns.get(JsonReader.toConnectionIndex(connRef))); break; case "hl7AcceptedSendingApplication": hl7App.setAcceptedSendingApplications(reader.stringArray()); break; case "hl7OtherApplicationName": hl7App.setOtherApplicationNames(reader.stringArray()); break; case "hl7AcceptedMessageType": hl7App.setAcceptedMessageTypes(reader.stringArray()); break; case "hl7DefaultCharacterSet": hl7App.setHL7DefaultCharacterSet(reader.stringValue()); break; case "hl7SendingCharacterSet": hl7App.setHL7SendingCharacterSet(reader.stringValue()); break; case "dicomDescription": hl7App.setDescription(reader.stringValue()); break;
public HL7Rcv() throws IOException { conn.setProtocol(Protocol.HL7); device.addDeviceExtension(hl7Ext); device.addConnection(conn); hl7Ext.addHL7Application(hl7App); hl7App.setAcceptedMessageTypes("*"); hl7App.addConnection(conn); hl7App.setHL7MessageListener(handler); }
private void merge(ConfigurationChanges diffs, HL7Application prev, HL7Application app, String deviceDN) throws NamingException { String appDN = hl7appDN(app.getApplicationName(), deviceDN); ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, appDN, ConfigurationChanges.ChangeType.U); config.modifyAttributes(appDN, storeDiffs(ldapObj, prev, app, deviceDN, new ArrayList<ModificationItem>())); ConfigurationChanges.removeLastIfEmpty(diffs, ldapObj); for (LdapHL7ConfigurationExtension ext : extensions) ext.mergeChilds(diffs, prev, app, appDN); }
private Attributes storeTo(ConfigurationChanges.ModifiedObject ldapObj, HL7Application hl7App, String deviceDN, Attributes attrs) { attrs.put(new BasicAttribute("objectclass", "hl7Application")); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7ApplicationName", hl7App.getApplicationName(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7AcceptedSendingApplication", hl7App.getAcceptedSendingApplications()); LdapUtils.storeNotEmpty(ldapObj, attrs, "dcmOtherApplicationNames", hl7App.getOtherApplicationNames()); LdapUtils.storeNotEmpty(ldapObj, attrs, "hl7AcceptedMessageType", hl7App.getAcceptedMessageTypes()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7DefaultCharacterSet", hl7App.getHL7DefaultCharacterSet(), "ASCII"); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "hl7SendingCharacterSet", hl7App.getHL7SendingCharacterSet(), "ASCII"); LdapUtils.storeConnRefs(ldapObj, attrs, hl7App.getConnections(), deviceDN); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomDescription", hl7App.getDescription(), null); LdapUtils.storeNotEmpty(ldapObj, attrs, "dicomApplicationCluster", hl7App.getApplicationClusters()); LdapUtils.storeNotNullOrDef(ldapObj, attrs, "dicomInstalled", hl7App.getInstalled(), null); for (LdapHL7ConfigurationExtension ext : extensions) ext.storeTo(ldapObj, hl7App, deviceDN, attrs); return attrs; }
public CompatibleConnection findCompatibleConnection(HL7Application remote) throws IncompatibleConnectionException { for (Connection remoteConn : remote.conns) if (remoteConn.isInstalled() && remoteConn.isServer()) for (Connection conn : conns) if (conn.isInstalled() && conn.isCompatible(remoteConn)) return new CompatibleConnection(conn, remoteConn); throw new IncompatibleConnectionException( "No compatible connection to " + remote.getApplicationName() + " available on " + name); }
private void writeTo(Device device, HL7Application hl7App, JsonWriter writer) { writer.writeStartObject(); writer.writeNotNullOrDef("hl7ApplicationName", hl7App.getApplicationName(), null); writer.writeNotNull("dicomInstalled", hl7App.getInstalled()); writer.writeConnRefs(device.listConnections(), hl7App.getConnections()); writer.writeNotEmpty("hl7AcceptedSendingApplication", hl7App.getAcceptedSendingApplications()); writer.writeNotEmpty("hl7OtherApplicationName", hl7App.getOtherApplicationNames()); writer.writeNotEmpty("hl7AcceptedMessageType", hl7App.getAcceptedMessageTypes()); writer.writeNotNullOrDef("hl7DefaultCharacterSet", hl7App.getHL7DefaultCharacterSet(), "ASCII"); writer.writeNotNullOrDef("hl7SendingCharacterSet", hl7App.getHL7SendingCharacterSet(), "ASCII"); writer.writeNotNullOrDef("dicomDescription", hl7App.getDescription(), null); writer.writeNotEmpty("dicomApplicationCluster", hl7App.getApplicationClusters()); for (JsonHL7ConfigurationExtension ext : extensions) ext.storeTo(hl7App, device, writer); writer.writeEnd(); }
private void store(ConfigurationChanges diffs, HL7Application hl7App, String deviceDN) throws NamingException { String appDN = hl7appDN(hl7App.getApplicationName(), deviceDN); ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, appDN, ConfigurationChanges.ChangeType.C); config.createSubcontext(appDN, storeTo(ConfigurationChanges.nullifyIfNotVerbose(diffs, ldapObj), hl7App, deviceDN, new BasicAttributes(true))); for (LdapHL7ConfigurationExtension ext : extensions) ext.storeChilds(ConfigurationChanges.nullifyIfNotVerbose(diffs, diffs), appDN, hl7App); }