diff options
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java index 45035a25..b718d56a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java @@ -121,17 +121,18 @@ public class WidgetsController extends EPRestrictedBaseController { @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); FieldsValidator fieldsValidator = null; - if (onboardingWidget!=null){ - if(!dataValidator.isValid(onboardingWidget)){ + if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){ fieldsValidator = new FieldsValidator(); fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE); return fieldsValidator; - } } if (userHasPermissions(user, response, "putOnboardingWidget")) { - onboardingWidget.id = widgetId; // ! - onboardingWidget.normalize(); + if (onboardingWidget != null) { + onboardingWidget.id = widgetId; // ! + onboardingWidget.normalize(); + } + fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); response.setStatus(fieldsValidator.httpStatusCode.intValue()); } @@ -146,17 +147,18 @@ public class WidgetsController extends EPRestrictedBaseController { EPUser user = EPUserUtils.getUserSession(request); FieldsValidator fieldsValidator = null; - if (onboardingWidget!=null){ - if(!dataValidator.isValid(onboardingWidget)){ + if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){ fieldsValidator = new FieldsValidator(); fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE); return fieldsValidator; - } } if (userHasPermissions(user, response, "postOnboardingWidget")) { - onboardingWidget.id = null; // ! - onboardingWidget.normalize(); + + if (onboardingWidget != null) { + onboardingWidget.id = null; // ! + onboardingWidget.normalize(); + } fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); response.setStatus(fieldsValidator.httpStatusCode.intValue()); } |