From 6ccddf3f4b5bfb09bd7a12fe899fcad3188d5dfd Mon Sep 17 00:00:00 2001 From: Rushdi Date: Sun, 15 May 2022 19:42:23 +0530 Subject: [PATCH] Update remove permission --- .../api/service/addons/TraccarClientImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java index b88eca6f05..1beba4a859 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java @@ -425,12 +425,15 @@ public class TraccarClientImpl implements TraccarClient { try { TrackerManagementDAOFactory.beginTransaction(); trackerDeviceInfo = trackerDAO.getTrackerDevice(deviceId, tenantId); - trackerPermissionInfo = trackerDAO.getUserIdofPermissionByDeviceId(deviceId); if(trackerDeviceInfo!=null){ trackerDevice = new JSONObject(trackerDeviceInfo); trackerDAO.removeTrackerDevice(deviceId, tenantId); TrackerManagementDAOFactory.commitTransaction(); + log.error(trackerDevice.getInt("traccarDeviceId")); + trackerPermissionInfo = trackerDAO.getUserIdofPermissionByDeviceId(trackerDevice.getInt("traccarDeviceId")); + log.error(trackerPermissionInfo); + log.error(new Gson().toJson(trackerPermissionInfo)); } } catch (TransactionManagementException e) { TrackerManagementDAOFactory.rollbackTransaction(); @@ -456,11 +459,13 @@ public class TraccarClientImpl implements TraccarClient { if(trackerPermissionInfo!=null){ try { - removePermission(trackerPermissionInfo.getTraccarUserId(),deviceId); + removePermission(trackerPermissionInfo.getTraccarUserId(),trackerDevice.getInt("traccarDeviceId")); } catch (ExecutionException e) { - throw new RuntimeException(e); + log.error("ExecutionException : " + e); + //throw new RuntimeException(e); } catch (InterruptedException e) { - throw new RuntimeException(e); + log.error("InterruptedException : " + e); + //throw new RuntimeException(e); } } }