private void loadFrom(HL7Application hl7app, Preferences prefs) { hl7app.setAcceptedSendingApplications( PreferencesUtils.stringArray(prefs, "hl7AcceptedSendingApplication")); hl7app.setAcceptedMessageTypes(PreferencesUtils.stringArray(prefs, "hl7AcceptedMessageType")); hl7app.setHL7DefaultCharacterSet(prefs.get("hl7DefaultCharacterSet", null)); hl7app.setInstalled(PreferencesUtils.booleanValue(prefs.get("dicomInstalled", null))); for (PreferencesHL7ConfigurationExtension ext : extensions) ext.loadFrom(hl7app, prefs); }
private void storeTo(HL7Application hl7App, Preferences prefs, List<Connection> devConns) { PreferencesUtils.storeNotEmpty( prefs, "hl7AcceptedSendingApplication", hl7App.getAcceptedSendingApplications()); PreferencesUtils.storeNotEmpty( prefs, "hl7AcceptedMessageType", hl7App.getAcceptedMessageTypes()); PreferencesUtils.storeNotNull( prefs, "hl7DefaultCharacterSet", hl7App.getHL7DefaultCharacterSet()); PreferencesUtils.storeNotNull(prefs, "dicomInstalled", hl7App.getInstalled()); PreferencesUtils.storeConnRefs(prefs, hl7App.getConnections(), devConns); for (PreferencesHL7ConfigurationExtension ext : extensions) ext.storeTo(hl7App, prefs); }
@Override public String[] listRegisteredHL7ApplicationNames() throws ConfigurationException { Preferences rootPrefs = config.getRootPrefs(); if (!PreferencesUtils.nodeExists(rootPrefs, HL7_UNIQUE_APPLICATION_NAMES_REGISTRY_ROOT)) return StringUtils.EMPTY_STRING; try { return rootPrefs.node(HL7_UNIQUE_APPLICATION_NAMES_REGISTRY_ROOT).childrenNames(); } catch (BackingStoreException e) { throw new ConfigurationException(e); } }
@Override public boolean registerHL7Application(String name) throws ConfigurationException { String pathName = applicationNameRegistryPathNameOf(name); Preferences rootPrefs = config.getRootPrefs(); if (PreferencesUtils.nodeExists(rootPrefs, pathName)) return false; try { rootPrefs.node(pathName).flush(); return true; } catch (BackingStoreException e) { throw new ConfigurationException(e); } }
private void storeDiffs(Preferences prefs, HL7Application a, HL7Application b) { PreferencesUtils.storeDiffConnRefs( prefs, a.getConnections(), a.getDevice().listConnections(), b.getConnections(), b.getDevice().listConnections()); PreferencesUtils.storeDiff( prefs, "hl7AcceptedSendingApplication", a.getAcceptedSendingApplications(), b.getAcceptedSendingApplications()); PreferencesUtils.storeDiff( prefs, "hl7AcceptedMessageType", a.getAcceptedMessageTypes(), b.getAcceptedMessageTypes()); PreferencesUtils.storeDiff( prefs, "hl7DefaultCharacterSet", a.getHL7DefaultCharacterSet(), b.getHL7DefaultCharacterSet()); PreferencesUtils.storeDiff(prefs, "dicomInstalled", a.getInstalled(), b.getInstalled()); for (PreferencesHL7ConfigurationExtension ext : extensions) ext.storeDiffs(a, b, prefs); }
@Override public void unregisterHL7Application(String name) throws ConfigurationException { PreferencesUtils.removeNode(config.getRootPrefs(), applicationNameRegistryPathNameOf(name)); }