import org.onap.portal.domain.dto.transport.FieldsValidator;
import org.onap.portal.domain.dto.transport.OnboardingWidget;
import org.onap.portal.domain.dto.transport.WidgetCatalogPersonalization;
+import org.onap.portal.logging.aop.EPAuditLog;
import org.onap.portal.service.AdminRolesService;
import org.onap.portal.service.PersUserWidgetService;
import org.onap.portal.service.WidgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
+@EPAuditLog
@RestController
-@Configuration
@EnableAspectJAutoProxy
public class WidgetsController {
this.persUserWidgetService = persUserWidgetService;
}
- @RequestMapping(value = {"/portalApi/widgets"}, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = {"/portalApi/widgets"}, produces = MediaType.APPLICATION_JSON_VALUE)
public List<OnboardingWidget> getOnboardingWidgets(Principal principal, HttpServletRequest request,
HttpServletResponse response) {
FnUser user = fnUserService.loadUserByUsername(principal.getName());
return onboardingWidgets;
}
- @RequestMapping(value = {"/portalApi/widgets/{widgetId}"}, method = {
- RequestMethod.PUT}, produces = "application/json")
+ @PutMapping(value = {"/portalApi/widgets/{widgetId}"}, produces = MediaType.APPLICATION_JSON_VALUE)
public FieldsValidator putOnboardingWidget(Principal principal, HttpServletRequest request,
@PathVariable("widgetId") Long widgetId,
@RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
return true;
}
- @RequestMapping(value = {"/portalApi/widgets"}, method = {RequestMethod.POST}, produces = "application/json")
+ @PostMapping(value = {"/portalApi/widgets"}, produces = MediaType.APPLICATION_JSON_VALUE)
public FieldsValidator postOnboardingWidget(Principal principal, HttpServletRequest request,
@RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
FnUser user = fnUserService.loadUserByUsername(principal.getName());
return fieldsValidator;
}
- @RequestMapping(value = {"/portalApi/widgets/{widgetId}"}, method = {
- RequestMethod.DELETE}, produces = "application/json")
+ @DeleteMapping(value = {"/portalApi/widgets/{widgetId}"}, produces = MediaType.APPLICATION_JSON_VALUE)
public FieldsValidator deleteOnboardingWidget(Principal principal, HttpServletRequest request,
@PathVariable("widgetId") Long widgetId, HttpServletResponse response) {
FnUser user = fnUserService.loadUserByUsername(principal.getName());
return fieldsValidator;
}
- @RequestMapping(value = {
- "portalApi/widgetCatalogSelection"}, method = RequestMethod.PUT, produces = "application/json")
+ @PutMapping(value = {"portalApi/widgetCatalogSelection"}, produces = MediaType.APPLICATION_JSON_VALUE)
public FieldsValidator putWidgetCatalogSelection(Principal principal, HttpServletRequest request,
@RequestBody WidgetCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
FieldsValidator result = new FieldsValidator();
return result;
}
}
-
try {
if (persRequest.getWidgetId() == null || user == null) {
EcompPortalUtils.setBadPermissions(user, response, "putWidgetCatalogSelection");