Exemplo n.º 1
0
  @Override
  public void saveBundleSettings(Settings settings, long bundleId) throws IOException {
    Properties props = ParamParser.constructProperties(settings);

    configurationService.addOrUpdateProperties(
        getBundleSymbolicName(bundleId),
        getVersion(bundleId),
        settings.getSection(),
        props,
        getBundleDefaultProperties(bundleId).get(settings.getSection()));

    Map<String, Object> params = new HashMap<>();
    params.put(ConfigurationConstants.BUNDLE_ID, bundleId);
    params.put(ConfigurationConstants.BUNDLE_SYMBOLIC_NAME, getBundleSymbolicName(bundleId));
    params.put(ConfigurationConstants.BUNDLE_SECTION, settings.getSection());

    MotechEvent bundleSettingsChangedEvent =
        new MotechEvent(ConfigurationConstants.BUNDLE_SETTINGS_CHANGED_EVENT_SUBJECT, params);
    eventRelay.sendEventMessage(bundleSettingsChangedEvent);
  }
Exemplo n.º 2
0
  @Override
  public void savePlatformSettings(Settings settings) {
    for (SettingsOption option : settings.getSettings()) {
      Object val = option.getValue();
      configurationService.setPlatformSetting(
          option.getKey(), val == null ? null : String.valueOf(val));
    }

    Map<String, Object> params = new HashMap<>();
    params.put(ConfigurationConstants.SETTINGS, settings);

    MotechEvent platformSettingsChangedEvent =
        new MotechEvent(ConfigurationConstants.BUNDLE_SETTINGS_CHANGED_EVENT_SUBJECT, params);
    eventRelay.sendEventMessage(platformSettingsChangedEvent);
  }