void setHL7Application(HL7Application hl7App) { if (hl7App != null && this.hl7App != null) throw new IllegalStateException( "already owned by HL7 Application: " + hl7App.getApplicationName()); this.hl7App = 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()); }
public boolean removeHL7Application(HL7Application hl7App) { return removeHL7Application(hl7App.getApplicationName()) != null; }
public void addHL7Application(HL7Application hl7App) { hl7App.setDevice(device); hl7apps.put(hl7App.getApplicationName(), hl7App); }
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); } } }
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); }
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 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); }
@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); } }
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 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; }
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(); }