From baeb34e1da709bd1040ad545ce8aae691086d2c9 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Fri, 18 Dec 2020 20:37:04 +0530 Subject: [PATCH] Fix review issues and format code --- .../device/mgt/core/dao/impl/AbstractEventConfigDAO.java | 6 +++--- .../core/geo/service/GeoLocationProviderServiceImpl.java | 7 +++++++ .../mgt/core/geo/task/EventOperationTaskManagerImpl.java | 4 +++- .../core/internal/DeviceTaskManagerServiceComponent.java | 7 +++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractEventConfigDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractEventConfigDAO.java index 0970bc35d6..d883f4f157 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractEventConfigDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractEventConfigDAO.java @@ -360,7 +360,7 @@ public abstract class AbstractEventConfigDAO implements EventConfigDAO { } catch (SQLException e) { String msg = "Failed while creating event task entry for event operation " + eventTaskEntry.getOperationCode() + " of the tenant " + eventTaskEntry.getTenantId(); - log.error(msg); + log.error(msg, e); throw new EventManagementDAOException(msg, e); } } @@ -404,7 +404,7 @@ public abstract class AbstractEventConfigDAO implements EventConfigDAO { } } catch (SQLException e) { String msg = "Failed while retrieving event task entries"; - log.error(msg); + log.error(msg, e); throw new EventManagementDAOException(msg, e); } } @@ -433,7 +433,7 @@ public abstract class AbstractEventConfigDAO implements EventConfigDAO { } } catch (SQLException e) { String msg = "Failed while retrieving event task entries"; - log.error(msg); + log.error(msg, e); throw new EventManagementDAOException(msg, e); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index 00985a53c0..ad78e3080a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -1779,6 +1779,13 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } } + /** + * Build and retrieve the EventTaskEntry object + * @param operationCode operationCode of the requesting EventTask + * @param geoFenceId id of the geofence which the task creating + * @param tenantId id of the tenant owns the geofence + * @return built EventTaskEntry object + */ private EventTaskEntry getEventOperationTask(String operationCode, int geoFenceId, int tenantId) { EventTaskEntry eventTaskEntry = new EventTaskEntry(); eventTaskEntry.setEventSource(DeviceManagementConstants.EventServices.GEOFENCE); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/task/EventOperationTaskManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/task/EventOperationTaskManagerImpl.java index 51511ecc54..f66ffdf6e5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/task/EventOperationTaskManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/task/EventOperationTaskManagerImpl.java @@ -76,7 +76,9 @@ public class EventOperationTaskManagerImpl { taskManager.deleteTask(TASK_NAME); } } catch (TaskException e) { - throw new EventOperationTaskException("Error occurred while stopping the group event operation task"); + String msg = "Error occurred while stopping the group event operation task"; + log.error(msg, e); + throw new EventOperationTaskException(msg, e); } } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java index 46cf81c5d7..c88a2d5454 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java @@ -150,6 +150,10 @@ public class DeviceTaskManagerServiceComponent { } } + /** + * Start event operation creation task + * @param bundleContext OsgiBundle context + */ private void startGroupEventCreationTask(BundleContext bundleContext) { DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); EventOperationTaskConfiguration eventTaskConfig = deviceManagementConfig.getEventOperationTaskConfiguration(); @@ -165,6 +169,9 @@ public class DeviceTaskManagerServiceComponent { } } + /** + * Stop event operation creation task + */ private void stopGroupEventCreationTask() { EventOperationTaskManagerImpl eventOperationTaskManager = DeviceManagementDataHolder.getInstance() .getEventOperationTaskManager();