Remove vsp and vlm redundant properties 61/45261/3
authortalig <talig@amdocs.com>
Tue, 1 May 2018 07:10:09 +0000 (10:10 +0300)
committerAvi Gaffa <avi.gaffa@amdocs.com>
Tue, 1 May 2018 07:50:22 +0000 (07:50 +0000)
Change-Id: I1faf9af304c7c97303e98744b036f9b1c0db8f0c
Issue-ID: SDC-343
Signed-off-by: talig <talig@amdocs.com>
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
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
openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java
openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java

index 0e645dd..f596a8d 100644 (file)
@@ -28,7 +28,6 @@ import static org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActio
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.function.Predicate;
 import javax.inject.Named;
 import javax.ws.rs.core.Response;
@@ -163,19 +162,16 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
     public Response getLicenseModel(String vlmId, String versionId, String user) {
         Version version = versioningManager.get(vlmId, new Version(versionId));
         VendorLicenseModelEntity vlm = vendorLicenseManager.getVendorLicenseModel(vlmId, version);
-        vlm.setWritetimeMicroSeconds(version.getModificationTime().getTime());
 
         try {
-            Optional<Version> healedVersion = HealingManagerFactory.getInstance().createInterface()
-                                                                   .healItemVersion(vlmId, version, ItemType.vlm,
-                                                                           false);
-
-            if (healedVersion.isPresent()) {
-                vlm.setVersion(healedVersion.get());
-                if (version.getStatus() == VersionStatus.Certified) {
-                    submitHealedVersion(vlmId, healedVersion.get(), versionId, user);
-                }
-            }
+            HealingManagerFactory.getInstance().createInterface()
+                                 .healItemVersion(vlmId, version, ItemType.vlm, false)
+                                 .ifPresent(healedVersion -> {
+                                     vlm.setVersion(healedVersion);
+                                     if (version.getStatus() == VersionStatus.Certified) {
+                                         submitHealedVersion(vlmId, healedVersion, versionId, user);
+                                     }
+                                 });
         } catch (Exception e) {
             LOGGER.error(String.format("Error while auto healing VLM with Id %s and version %s", vlmId, versionId), e);
         }
index 16ef8c5..9610da8 100644 (file)
@@ -224,7 +224,6 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
     public Response getVsp(String vspId, String versionId, String user) {
         Version version = versioningManager.get(vspId, new Version(versionId));
         VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version);
-        vspDetails.setWritetimeMicroSeconds(version.getModificationTime().getTime());
 
         try {
             HealingManagerFactory.getInstance().createInterface()
@@ -252,13 +251,10 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
                 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");
-            });
+            submit(vspDetails.getId(), vspDetails.getVersion(), "Submit healed Vsp", user)
+                    .ifPresent(validationResponse -> {
+                        throw new IllegalStateException("Certified vsp after healing failed on validation");
+                    });
             vendorSoftwareProductManager.createPackage(vspDetails.getId(), vspDetails.getVersion());
         } catch (Exception ex) {
             LOGGER.error(String.format(SUBMIT_HEALED_VERSION_ERROR, vspDetails.getId(), vspDetails.getVersion().getId(),
index 8ef9c5a..410f7c6 100644 (file)
@@ -120,8 +120,6 @@ public class VendorLicenseModelTest {
         .updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME,
             existingVlm.getVendorName(), updatedVlm.getVendorName());
 
-    existingVlm.setWritetimeMicroSeconds(8L);
-
     doReturn(existingVlm).when(vendorLicenseModelDaoMcok).get(any(VendorLicenseModelEntity.class));
 
     vendorLicenseManager.updateVendorLicenseModel(updatedVlm);
index 299affe..f5c7fb2 100644 (file)
@@ -215,7 +215,6 @@ public class VendorSoftwareProductManagerImplTest {
         createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
             "category_updated",
             "subCategory", "456", null);
-    existingVsp.setWritetimeMicroSeconds(8L);
     doReturn(existingVsp).when(vspInfoDaoMock)
         .get(any(VspDetails.class));
     doNothing().when(vendorSoftwareProductManager)
@@ -247,7 +246,6 @@ public class VendorSoftwareProductManagerImplTest {
         createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
             "category_updated",
             "subCategory", "456", updFgs);
-    existingVsp.setWritetimeMicroSeconds(8L);
     doReturn(existingVsp).when(vspInfoDaoMock)
         .get(any(VspDetails.class));
     doNothing().when(vendorSoftwareProductManager)
@@ -292,7 +290,6 @@ public class VendorSoftwareProductManagerImplTest {
         createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
             "category",
             "subCategory", "456", null);
-    existingVsp.setWritetimeMicroSeconds(8L);
     doReturn(existingVsp).when(vspInfoDaoMock).get(any(VspDetails.class));
 
     VspDetails actualVsp =
@@ -316,7 +313,6 @@ public class VendorSoftwareProductManagerImplTest {
         createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
             "category",
             "subCategory", "456", null);
-    existingVsp.setWritetimeMicroSeconds(8L);
     doReturn(existingVsp)
         .when(vspInfoDaoMock).get(any(VspDetails.class));
 
index 0d43d7e..aab2e61 100644 (file)
@@ -147,12 +147,4 @@ public class VendorLicenseModelEntity implements VersionableEntity {
         && Objects.equals(description, that.description)
         && Objects.equals(iconRef, that.iconRef);
   }
-
-  public Long getWritetimeMicroSeconds() {
-    return writetimeMicroSeconds;
-  }
-
-  public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) {
-    this.writetimeMicroSeconds = writetimeMicroSeconds;
-  }
 }
index 78b31f8..e4a078d 100644 (file)
@@ -134,10 +134,9 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
 
   @Override
   public void delete(VendorLicenseModelEntity entity) {
-
+    throw new UnsupportedOperationException("Delete vlm version is done using versioning manager");
   }
 
-
   private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel,
                                                   Action action) {
     ZusammenElement generalElement =
@@ -150,14 +149,11 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
     info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
     info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
     info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
-    info.addProperty(InfoPropertyName.oldVersion.name(), vendorLicenseModel.getOldVersion());
   }
 
-
   public enum InfoPropertyName {
     name,
     description,
     iconRef,
-    oldVersion
   }
 }
index c2ef5a6..10a532c 100644 (file)
@@ -30,7 +30,6 @@ public class ElementToVLMGeneralConvertor extends ElementConvertor {
 
   }
 
-
   private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
 
     VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
@@ -41,12 +40,7 @@ public class ElementToVLMGeneralConvertor extends ElementConvertor {
         VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
     vendorLicenseModelEntity.setIconRef(info.getProperty(
         VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
-    vendorLicenseModelEntity.setOldVersion(info.getProperty(
-        VendorLicenseModelDaoZusammenImpl.InfoPropertyName.oldVersion.name()));
-
 
     return vendorLicenseModelEntity;
   }
-
-
 }
index 3ba77ad..9f82b73 100644 (file)
@@ -52,8 +52,6 @@ public class VspDetails implements VersionableEntity {
 
   private List<String> featureGroups;
 
-  private Long writetimeMicroSeconds;
-
   private String onboardingMethod;
 
   public VspDetails() {
@@ -172,18 +170,6 @@ public class VspDetails implements VersionableEntity {
     this.featureGroups = featureGroups;
   }
 
-  public Long getWritetimeMicroSeconds() {
-    return this.writetimeMicroSeconds;
-  }
-
-  public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) {
-    this.writetimeMicroSeconds = writetimeMicroSeconds;
-  }
-
-  /*public boolean isOldVersion() {
-    return this.oldVersion;
-  }*/
-
   public String getOnboardingMethod() {
     return onboardingMethod;
   }
@@ -192,7 +178,6 @@ public class VspDetails implements VersionableEntity {
     this.onboardingMethod = onboardingMethod;
   }
 
-
   @Override
   public String toString() {
     return String.format(