Source:
protected void updateDiscoveredSessionConfig(VDSGroup cluster, GlusterGeoRepSession session) { List<GlusterGeoRepSessionConfiguration> sessionConfigList = getSessionConfigFromCLI(cluster, session); if (sessionConfigList == null) { log.info("No configuration information returned from VDS for session '{}'", session.getSessionKey()); return; } List<GlusterGeoRepSessionConfiguration> existingSessionConfigs = getGeoRepDao().getGeoRepSessionConfig(session.getId()); Map<String, GlusterGeoRepSessionConfiguration> existingKeyConfigMap = prepareMapOfExistingConfigs(existingSessionConfigs); for (GlusterGeoRepSessionConfiguration sessionConfig : sessionConfigList) { sessionConfig.setId(session.getId()); if (!existingSessionConfigs.contains(sessionConfig)) { if (existingKeyConfigMap.containsKey(sessionConfig.getKey())) { getGeoRepDao().updateConfig(sessionConfig); String oldValue = existingKeyConfigMap.get(sessionConfig.getKey()).getValue(); logGeoRepMessage(AuditLogType.GEOREP_OPTION_CHANGED_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), oldValue)); } else { getGeoRepDao().saveConfig(sessionConfig); logGeoRepMessage(AuditLogType.GEOREP_OPTION_SET_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), null)); } } } existingSessionConfigs.removeAll(sessionConfigList); for (GlusterGeoRepSessionConfiguration config : existingSessionConfigs) { config.setValue(null); getGeoRepDao().updateConfig(config); } }

Target:
protected void updateDiscoveredSessionConfig(VDSGroup cluster, GlusterGeoRepSession session) { List<GlusterGeoRepSessionConfiguration> sessionConfigList = getSessionConfigFromCLI(cluster, session); if (sessionConfigList == null) { log.info("No configuration information returned from VDS for session '{}'", session.getSessionKey()); return; } List<GlusterGeoRepSessionConfiguration> existingSessionConfigs = getGeoRepDao().getGeoRepSessionConfig(session.getId()); Map<String, GlusterGeoRepSessionConfiguration> existingKeyConfigMap = prepareMapOfExistingConfigs(existingSessionConfigs); for (GlusterGeoRepSessionConfiguration sessionConfig : sessionConfigList) { sessionConfig.setId(session.getId()); if (!existingSessionConfigs.contains(sessionConfig)) { if (existingKeyConfigMap.containsKey(sessionConfig.getKey())) { getGeoRepDao().updateConfig(sessionConfig); String oldValue = existingKeyConfigMap.get(sessionConfig.getKey()).getValue(); logGeoRepMessage(AuditLogType.GEOREP_OPTION_CHANGED_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), oldValue)); } else { getGeoRepDao().saveConfig(sessionConfig); logGeoRepMessage(AuditLogType.GEOREP_OPTION_SET_FROM_CLI, cluster.getId(), getOptionChangedCustomVars(session, sessionConfig.getKey(), sessionConfig.getValue(), null)); } } } Map<String, GlusterGeoRepSessionConfiguration> sessionKeyConfigMap = prepareMapOfExistingConfigs(sessionConfigList); existingKeyConfigMap.keySet().removeAll(sessionKeyConfigMap.keySet()); Iterator<Map.Entry<String, GlusterGeoRepSessionConfiguration>> mapIterator = sessionKeyConfigMap.entrySet().iterator(); while (mapIterator.hasNext()) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setId(session.getId()); config.setKey(mapIterator.next().getKey()); getGeoRepDao().updateConfig(config); } }