widget changes to upload single JS file
[portal.git] / ecomp-portal-widget-ms / widget-ms / src / main / java / org / onap / portalapp / widget / controller / WidgetsCatalogController.java
index 2bea235..e6c1c0a 100644 (file)
@@ -21,12 +21,10 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.client.RestTemplate;
@@ -165,13 +163,14 @@ public class WidgetsCatalogController {
                try {
                        //check the zip file structure first
                        respond = storageService.checkZipFile(file);
+                       logger.debug("Check file validity"+respond.isValid()+respond.getError());
                        if(respond.isValid()){
                                //update the widget catalog
                                WidgetCatalog newWidget = new ObjectMapper().readValue(widget, WidgetCatalog.class);
                                widgetCatalogService.updateWidgetCatalog(widgetId, newWidget);
                                logger.debug("WidgetsCatalogController.saveWidgetCatalog: updating widget with widgetId={}", widgetId);
                                //update the widget zip file
-                               storageService.update(file, newWidget, widgetId);
+                               storageService.updateJsFile(file, newWidget, widgetId);
                        }
                } catch (Exception e) {
                        logger.error("Exception occurred while performing WidgetsCatalogController.saveWidgetCatalog in widget microservices. Details:", e);