import org.openecomp.portalapp.portal.service.ConsulHealthService;
import org.openecomp.portalapp.portal.service.MicroserviceService;
import org.openecomp.portalapp.portal.service.WidgetParameterService;
+import org.openecomp.portalapp.portal.utils.CustomLoggingFilter;
+import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalapp.util.EPUserUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.util.SystemProperties;
@EPAuditLog
public class WidgetsCatalogController extends EPRestrictedBaseController {
- private static final String HTTPS = "https://";
-
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
RestTemplate template = new RestTemplate();
String whatService = "widgets-service";
}
return false;
}
- });
+ });
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET)
public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
@PathVariable("loginName") String loginName) throws RestClientException, Exception {
List<WidgetCatalog> widgets = new ArrayList<>();
- try {
+ try {CustomLoggingFilter d;
ResponseEntity<ArrayList> ans = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + loginName,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
public List<WidgetCatalog> getWidgetCatalog(HttpServletRequest request, HttpServletResponse response)
throws RestClientException, Exception {
List<WidgetCatalog> widgets = new ArrayList<>();
+
+ String p = EcompPortalUtils.widgetMsProtocol();
try {
ResponseEntity<ArrayList> ans = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog",
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId)
throws RestClientException, Exception {
template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
HttpMethod.PUT, new HttpEntity(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class);
public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
HttpMethod.DELETE, new HttpEntity(WidgetServiceHeaders.getInstance()), String.class);
multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName));
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/" + widgetId,
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog",
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
@RequestMapping(value = "/portalApi/microservices/{widgetId}/framework.js", method = RequestMethod.GET)
public String getWidgetFramework(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/framework.js", String.class,
@RequestMapping(value = "/portalApi/microservices/{widgetId}/controller.js", method = RequestMethod.GET)
public String getWidgetController(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/controller.js", String.class,
@RequestMapping(value = "/portalApi/microservices/{widgetId}/style.css", method = RequestMethod.GET)
public String getWidgetCSS(HttpServletRequest request, HttpServletResponse response,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
- return template.getForObject(HTTPS
+ return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/" + widgetId + "/styles.css", String.class,
List<WidgetParameterResult> list = new ArrayList<>();
Long serviceId = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/widgetCatalog/parameters/" + widgetId,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), Long.class).getBody();
ServletContext context = request.getServletContext();
byte[] byteFile = template.exchange(
- HTTPS + consulHealthService.getServiceLocation(whatService,
+ EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
SystemProperties.getProperty("microservices.widget.local.port"))
+ "/widget/microservices/download/" + widgetId,
HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), byte[].class).getBody();
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "SUCCESS", "");
}
-
}