From d69619bf65d27be5b184c516544f52d3f4744425 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Thu, 26 Jan 2023 14:49:12 +0530 Subject: [PATCH] Fix api errors in Lifecycle methods --- .../impl/admin/DeviceManagementAdminServiceImpl.java | 6 +++--- .../mgt/core/service/DeviceStateManagementServiceImpl.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index 0351e629fd..6407ada6f1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -321,7 +321,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe new ErrorResponse.ErrorResponseBuilder().setMessage(message).build()).build(); } LifecycleStateDevice updatedInfo = DeviceMgtAPIUtils.getDeviceStateManagementService() - .changeDeviceStatus(device, nextStatus); + .changeDeviceStatus(device.getEnrolmentInfo(), nextStatus); return Response.status(Response.Status.OK).entity(updatedInfo).build(); } catch (InvalidStatusException e) { String msg = "Error occured while changing status: Invalid status or invalid status change"; @@ -373,8 +373,8 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe return Response.status(Response.Status.NOT_FOUND).build(); } LifecycleStateDeviceList states = new LifecycleStateDeviceList(); - result = DeviceMgtAPIUtils.getDeviceStateManagementService() - .getDeviceLifecycleHistory(request, device); + result = (PaginationResult) DeviceMgtAPIUtils.getDeviceStateManagementService() + .getDeviceLifecycleHistory(device); states.setLifecycleStates((List) result.getData()); states.setCount(result.getRecordsTotal()); return Response.status(Response.Status.OK).entity(states).build(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceStateManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceStateManagementServiceImpl.java index 742388b0b6..863e27b456 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceStateManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceStateManagementServiceImpl.java @@ -124,7 +124,7 @@ public class DeviceStateManagementServiceImpl implements DeviceStateManagementSe List listLifecycle = deviceLifecycleDAO.getDeviceLifecycle(id); return listLifecycle; } catch (DeviceManagementDAOException e) { - String msg = "Error occurred while getting lifrcycle history"; + String msg = "Error occurred while getting lifecycle history"; log.error(msg, e); throw new DeviceStatusException(msg, e); } catch (SQLException e) {