aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-04-16 15:14:20 +0300
committerOren Kleks <orenkle@amdocs.com>2018-04-17 06:44:01 +0000
commit60969e02c6c8a78d8ffe9e597727c552c8be4e64 (patch)
tree046a285dab8243e38eae6bc1ac526bca31b6a07a /openecomp-be
parent09a41f5bfa6008ce545f8745306145ad9264103b (diff)
Sync vlm (if needed) before submitting healed vsp
Change-Id: I1d682d7a6d78e17d9bca2888d7f89ee9649d6427 Issue-ID: SDC-1234 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java41
1 files changed, 19 insertions, 22 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index 3baf95cbd9..bb7e847ddf 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -227,43 +227,40 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
vspDetails.setWritetimeMicroSeconds(version.getModificationTime().getTime());
try {
- Optional<Version> healedVersion = HealingManagerFactory.getInstance().createInterface()
- .healItemVersion(vspId, version, ItemType.vsp, false);
-
- healedVersion.ifPresent(version1 -> {
- vspDetails.setVersion(version1);
- if (version.getStatus() == VersionStatus.Certified) {
- submitHealedVersion(vspId, version1, versionId, user);
- }
- });
+ HealingManagerFactory.getInstance().createInterface()
+ .healItemVersion(vspId, version, ItemType.vsp, false)
+ .ifPresent(healedVersion -> {
+ vspDetails.setVersion(healedVersion);
+ if (version.getStatus() == VersionStatus.Certified) {
+ submitHealedVersion(vspDetails, versionId, user);
+ }
+ });
} catch (Exception e) {
- LOGGER.error(
- String.format("Error while auto healing VSP with Id %s and version %s", vspId, versionId),
- e);
+ LOGGER.error(String.format("Error while auto healing VSP with Id %s and version %s", vspId, versionId), e);
}
- VspDetailsDto vspDetailsDto =
- new MapVspDetailsToDto().applyMapping(vspDetails, VspDetailsDto.class);
+ VspDetailsDto vspDetailsDto = new MapVspDetailsToDto().applyMapping(vspDetails, VspDetailsDto.class);
addNetworkPackageInfo(vspId, vspDetails.getVersion(), vspDetailsDto);
return Response.ok(vspDetailsDto).build();
}
- private void submitHealedVersion(String vspId, Version healedVersion, String baseVersionId,
- String user) {
+ private void submitHealedVersion(VspDetails vspDetails, String baseVersionId, String user) {
try {
- Optional<ValidationResponse>
- validationResponse = submit(vspId, healedVersion, "Submit healed Vsp", user);
+ // sync vlm if not exists on user space
+ versioningManager.get(vspDetails.getVendorId(), vspDetails.getVlmVersion());
+
+ Optional<ValidationResponse> validationResponse =
+ submit(vspDetails.getId(), vspDetails.getVersion(), "Submit healed Vsp", user);
// TODO: 8/9/2017 before collaboration checkout was done at this scenario (equivalent
// to new version in collaboration). need to decide what should be done now.
validationResponse.ifPresent(validationResponse1 -> {
throw new IllegalStateException("Certified vsp after healing failed on validation");
});
- vendorSoftwareProductManager.createPackage(vspId, healedVersion);
+ vendorSoftwareProductManager.createPackage(vspDetails.getId(), vspDetails.getVersion());
} catch (Exception ex) {
- LOGGER.error(
- String.format(SUBMIT_HEALED_VERSION_ERROR, vspId, healedVersion.getId(), baseVersionId),
- ex);
+ LOGGER.error(String.format(SUBMIT_HEALED_VERSION_ERROR, vspDetails.getId(), vspDetails.getVersion().getId(),
+ baseVersionId), ex);
}
}