diff options
author | 2020-07-10 18:05:46 +0800 | |
---|---|---|
committer | 2020-07-15 10:03:34 +0800 | |
commit | 0688c66229fe1bfb1d7d8920705b019d5cfeb17f (patch) | |
tree | 717656f8ceae006223a395da3737400627e19de9 /dcae-analytics/dcae-analytics-web/src | |
parent | ddb9b0f7e578aefd06ee9e3f01d810b0b9034f3a (diff) |
TCAGen2 java upgrade
Issue-ID: DCAEGEN2-2285
Signed-off-by: Kai Lu <lukai@chinamobile.com>
Change-Id: I1a7b3db68141ed8648fe47865f39dea22f0d999c
Diffstat (limited to 'dcae-analytics/dcae-analytics-web/src')
-rw-r--r-- | dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java index d286d10..8798b4e 100644 --- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java +++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java @@ -229,8 +229,13 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment Optional<String> configServiceJsonOptional; JsonElement jsonConfig = jsonObject.get(ConfigBindingServiceConstants.CONFIG); + String policies = null; if (jsonConfig.getAsJsonObject().get(ConfigBindingServiceConstants.CONFIG) != null) { configServiceJsonOptional = Optional.of(jsonConfig.toString()); + policies = jsonConfig.getAsJsonObject().get(ConfigBindingServiceConstants.POLICIES) + .getAsJsonObject().getAsJsonArray(ConfigBindingServiceConstants.ITEMS).get(0) + .getAsJsonObject().get(ConfigBindingServiceConstants.CONFIG) + .getAsJsonObject().get(ConfigBindingServiceConstants.TCAPOLICY).toString(); } else { configServiceJsonOptional = Optional.of(jsonObject.toString()); } @@ -239,7 +244,9 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment // values Map<String, Object> configPropertiesMap = configServiceJsonOptional .map(new JsonStringToMapFunction(configServicePropertiesKey)).orElse(Collections.emptyMap()); - + if (policies != null) { + configPropertiesMap.put(ConfigBindingServiceConstants.CONFIG_POLICIES, policies); + } if (configPropertiesMap.isEmpty()) { logger.warn("No properties found in config binding service"); @@ -264,7 +271,7 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment .info("Adding property from config service in spring context: {} -> {}", key, value)); MutablePropertySources sources = env.getPropertySources(); addJsonPropertySource(sources, new MapPropertySource(configServicePropertiesKey, filterKeyMap)); - + } return configServiceJsonOptional.get(); } |