aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-05-26 19:21:47 +0300
committerIttay Stern <ittay.stern@att.com>2019-06-03 10:51:50 +0300
commit87bb08875e573f84c880ba26e7f74f8724e24177 (patch)
treee9879bc2e23f08a0789d2e38d7134eeab2b04c39 /vid-app-common/src/main/java/org
parent2bc8ebda0282cf3a3941815eb2b29dc08d8772f9 (diff)
Differentiate cloudRegions with same name and different owner
Replaces change I22c0b07173950c253a9272b8a96ab63e006efa49 Resolves defect: Issue-ID: VID-482 Cherry-picked from change: I38c2f6a86a044297b1b76c1316e50cacb0264da9 Signed-off-by: Ittay Stern <ittay.stern@att.com> Change-Id: I2ecf07aa5614e94fce49eeaa7fef71b683f6c3c8
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/CloudOwnerServiceImpl.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/CloudOwnerServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/CloudOwnerServiceImpl.java
index d885f205e..4213255e1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/CloudOwnerServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/CloudOwnerServiceImpl.java
@@ -73,22 +73,24 @@ public class CloudOwnerServiceImpl implements CloudOwnerService {
}
}
- protected void enrichRequestWithCloudOwnerByAdditionalProperties(RequestDetails msoRequest) {
- String lcpCloudRegionId = null;
+ private void enrichRequestWithCloudOwnerByAdditionalProperties(RequestDetails msoRequest) {
+ final Map cloudConfiguration;
+ final String lcpCloudRegionId;
try {
+ cloudConfiguration = msoRequest.extractValueByPathUsingAdditionalProperties(CLOUD_CONFIGURATION_PATH, Map.class);
lcpCloudRegionId = msoRequest.extractValueByPathUsingAdditionalProperties(LCP_CLOUD_REGION_ID_PATH, String.class);
}
catch (NotFoundException exception) {
LOGGER.debug("Can't find lcp region in RequestDetails. Assume no cloudOwner enrichment is needed. Reason: ", exception);
return;
}
- String cloudOwner = aaiClient.getCloudOwnerByCloudRegionId(lcpCloudRegionId);
- msoRequest.extractValueByPathUsingAdditionalProperties(CLOUD_CONFIGURATION_PATH, Map.class).put("cloudOwner", cloudOwner);
+
+ cloudConfiguration.computeIfAbsent("cloudOwner", k -> aaiClient.getCloudOwnerByCloudRegionId(lcpCloudRegionId));
}
@Override
public void enrichCloudConfigurationWithCloudOwner(CloudConfiguration cloudConfiguration, String lcpCloudRegionId) {
- if (featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)) {
+ if (StringUtils.isEmpty(cloudConfiguration.getCloudOwner()) && featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)) {
String cloudOwner = aaiClient.getCloudOwnerByCloudRegionId(lcpCloudRegionId);
cloudConfiguration.setCloudOwner(cloudOwner);
}