Bugfix - update vsp item 57/50657/2
authorayalaben <ayala.benzvi@amdocs.com>
Wed, 6 Jun 2018 11:23:36 +0000 (14:23 +0300)
committerOren Kleks <orenkle@amdocs.com>
Thu, 7 Jun 2018 05:55:55 +0000 (05:55 +0000)
Change-Id: I71f096fe14355f8137d67c6d374d91db2d5b3ac9
Issue-ID: SDC-1403
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
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 71e1888..d801f78 100644 (file)
@@ -16,6 +16,7 @@
 
 package org.openecomp.sdcrests.vsp.rest.services;
 
+import java.util.Date;
 import org.apache.commons.collections4.MapUtils;
 import org.openecomp.core.dao.UniqueValueDaoFactory;
 import org.openecomp.core.util.UniqueValueUtil;
@@ -273,6 +274,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
 
         vendorSoftwareProductManager.updateVsp(vspDetails);
 
+        updateVspItem(vspId,vspDescriptionDto);
+
         return Response.ok().build();
     }
 
@@ -505,6 +508,23 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
         return Response.ok(results).build();
     }
 
+
+    private void updateVspItem(String vspId, VspDescriptionDto vspDescriptionDto) {
+        Item retrievedItem = itemManager.get(vspId);
+        Item item = new MapVspDescriptionDtoToItem().applyMapping(vspDescriptionDto, Item.class);
+        item.setId(vspId);
+        item.setType(retrievedItem.getType());
+        item.setOwner(retrievedItem.getOwner());
+        item.setStatus(retrievedItem.getStatus());
+        item.setVersionStatusCounters(retrievedItem.getVersionStatusCounters());
+        item.setCreationTime(retrievedItem.getCreationTime());
+        item.setModificationTime(new Date());
+        item.addProperty(VspItemProperty.ONBOARDING_METHOD,
+                retrievedItem.getProperties().get(VspItemProperty.ONBOARDING_METHOD));
+
+        itemManager.update(item);
+    }
+
     private Optional<ValidationResponse> submit(String vspId, Version version, String message,
                                                 String user) throws IOException {