From 86f709a74a50172491f4d82199502078a436b503 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Thu, 26 Jan 2023 22:21:24 +0530 Subject: [PATCH] Revert "Fix api errors in Lifecycle methods" This reverts commit d69619bf65d27be5b184c516544f52d3f4744425. --- .../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 6407ada6f1..0351e629fd 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.getEnrolmentInfo(), nextStatus); + .changeDeviceStatus(device, 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 = (PaginationResult) DeviceMgtAPIUtils.getDeviceStateManagementService() - .getDeviceLifecycleHistory(device); + result = DeviceMgtAPIUtils.getDeviceStateManagementService() + .getDeviceLifecycleHistory(request, 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 863e27b456..742388b0b6 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 lifecycle history"; + String msg = "Error occurred while getting lifrcycle history"; log.error(msg, e); throw new DeviceStatusException(msg, e); } catch (SQLException e) {