From 18f08b6ac8d9135a22821932b02e16085fd27600 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Mon, 23 Oct 2017 09:57:31 +0530 Subject: [PATCH] Fixing code formatting issues. --- .../ArduinoPermissionUpdateListener.java | 15 +++++++-------- .../RaspberryPIPermissionUpdateListener.java | 16 +++++++--------- ...VirtualFireAlarmPermissionUpdateListener.java | 16 +++++++--------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/listener/ArduinoPermissionUpdateListener.java b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/listener/ArduinoPermissionUpdateListener.java index 353cdde5d4..d45bc1a16c 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/listener/ArduinoPermissionUpdateListener.java +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/listener/ArduinoPermissionUpdateListener.java @@ -35,7 +35,6 @@ public class ArduinoPermissionUpdateListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent servletContextEvent) { - UserStoreManager userStoreManager = getUserStoreManager(); try { if (userStoreManager != null) { @@ -47,7 +46,8 @@ public class ArduinoPermissionUpdateListener implements ServletContextListener { getAuthorizationManager().authorizeRole(ArduinoConstants.ROLE_NAME, ArduinoConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants.UI_PERMISSION_ACTION); } - } } catch (UserStoreException e) { + } + } catch (UserStoreException e) { log.error("Error while creating a role and adding a user for Arduino.", e); } } @@ -101,13 +101,12 @@ public class ArduinoPermissionUpdateListener implements ServletContextListener { } private Permission[] getPermissions() { + Permission androidSense = new Permission(ArduinoConstants.PERM_ENROLL_ARDUINO, + CarbonConstants.UI_PERMISSION_ACTION); + Permission view = new Permission(ArduinoConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants + .UI_PERMISSION_ACTION); - Permission androidSense = new Permission(ArduinoConstants.PERM_ENROLL_ARDUINO, - CarbonConstants.UI_PERMISSION_ACTION); - Permission view = new Permission(ArduinoConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants - .UI_PERMISSION_ACTION); - - return new Permission[]{androidSense, view}; + return new Permission[]{androidSense, view}; } } diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/listener/RaspberryPIPermissionUpdateListener.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/listener/RaspberryPIPermissionUpdateListener.java index 20b8daee85..5404d0e393 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/listener/RaspberryPIPermissionUpdateListener.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/listener/RaspberryPIPermissionUpdateListener.java @@ -35,7 +35,6 @@ public class RaspberryPIPermissionUpdateListener implements ServletContextListen @Override public void contextInitialized(ServletContextEvent servletContextEvent) { - UserStoreManager userStoreManager = getUserStoreManager(); try { if (userStoreManager != null) { @@ -47,7 +46,8 @@ public class RaspberryPIPermissionUpdateListener implements ServletContextListen getAuthorizationManager().authorizeRole(RaspberrypiConstants.ROLE_NAME, RaspberrypiConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants.UI_PERMISSION_ACTION); } - } } catch (UserStoreException e) { + } + } catch (UserStoreException e) { log.error("Error while creating a role and adding a user for Raspberry PI.", e); } } @@ -101,13 +101,11 @@ public class RaspberryPIPermissionUpdateListener implements ServletContextListen } private Permission[] getPermissions() { - - Permission androidSense = new Permission(RaspberrypiConstants.PERM_ENROLL_RASPBERRYPI, - CarbonConstants.UI_PERMISSION_ACTION); - Permission view = new Permission(RaspberrypiConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants - .UI_PERMISSION_ACTION); - - return new Permission[]{androidSense, view}; + Permission androidSense = new Permission(RaspberrypiConstants.PERM_ENROLL_RASPBERRYPI, + CarbonConstants.UI_PERMISSION_ACTION); + Permission view = new Permission(RaspberrypiConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants + .UI_PERMISSION_ACTION); + return new Permission[]{androidSense, view}; } } diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/listener/VirtualFireAlarmPermissionUpdateListener.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/listener/VirtualFireAlarmPermissionUpdateListener.java index 8298680108..92000ad000 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/listener/VirtualFireAlarmPermissionUpdateListener.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/listener/VirtualFireAlarmPermissionUpdateListener.java @@ -35,7 +35,6 @@ public class VirtualFireAlarmPermissionUpdateListener implements ServletContextL @Override public void contextInitialized(ServletContextEvent servletContextEvent) { - UserStoreManager userStoreManager = getUserStoreManager(); try { if (userStoreManager != null) { @@ -47,7 +46,8 @@ public class VirtualFireAlarmPermissionUpdateListener implements ServletContextL getAuthorizationManager().authorizeRole(VirtualFireAlarmConstants.ROLE_NAME, VirtualFireAlarmConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants.UI_PERMISSION_ACTION); } - } } catch (UserStoreException e) { + } + } catch (UserStoreException e) { log.error("Error while creating a role and adding a user for Raspberry PI.", e); } } @@ -101,13 +101,11 @@ public class VirtualFireAlarmPermissionUpdateListener implements ServletContextL } private Permission[] getPermissions() { - - Permission androidSense = new Permission(VirtualFireAlarmConstants.PERM_ENROLL_FIRE_ALARM, - CarbonConstants.UI_PERMISSION_ACTION); - Permission view = new Permission(VirtualFireAlarmConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants - .UI_PERMISSION_ACTION); - - return new Permission[]{androidSense, view}; + Permission androidSense = new Permission(VirtualFireAlarmConstants.PERM_ENROLL_FIRE_ALARM, + CarbonConstants.UI_PERMISSION_ACTION); + Permission view = new Permission(VirtualFireAlarmConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants + .UI_PERMISSION_ACTION); + return new Permission[]{androidSense, view}; } }