Revert "Fix api errors in Lifecycle methods"

This reverts commit d69619bf65.
pull/54/head
Pahansith Gunathilake 2 years ago
parent a7cf4fa86c
commit 86f709a74a

@ -321,7 +321,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
new ErrorResponse.ErrorResponseBuilder().setMessage(message).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(message).build()).build();
} }
LifecycleStateDevice updatedInfo = DeviceMgtAPIUtils.getDeviceStateManagementService() LifecycleStateDevice updatedInfo = DeviceMgtAPIUtils.getDeviceStateManagementService()
.changeDeviceStatus(device.getEnrolmentInfo(), nextStatus); .changeDeviceStatus(device, nextStatus);
return Response.status(Response.Status.OK).entity(updatedInfo).build(); return Response.status(Response.Status.OK).entity(updatedInfo).build();
} catch (InvalidStatusException e) { } catch (InvalidStatusException e) {
String msg = "Error occured while changing status: Invalid status or invalid status change"; 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(); return Response.status(Response.Status.NOT_FOUND).build();
} }
LifecycleStateDeviceList states = new LifecycleStateDeviceList(); LifecycleStateDeviceList states = new LifecycleStateDeviceList();
result = (PaginationResult) DeviceMgtAPIUtils.getDeviceStateManagementService() result = DeviceMgtAPIUtils.getDeviceStateManagementService()
.getDeviceLifecycleHistory(device); .getDeviceLifecycleHistory(request, device);
states.setLifecycleStates((List<LifecycleStateDevice>) result.getData()); states.setLifecycleStates((List<LifecycleStateDevice>) result.getData());
states.setCount(result.getRecordsTotal()); states.setCount(result.getRecordsTotal());
return Response.status(Response.Status.OK).entity(states).build(); return Response.status(Response.Status.OK).entity(states).build();

@ -124,7 +124,7 @@ public class DeviceStateManagementServiceImpl implements DeviceStateManagementSe
List<LifecycleStateDevice> listLifecycle = deviceLifecycleDAO.getDeviceLifecycle(id); List<LifecycleStateDevice> listLifecycle = deviceLifecycleDAO.getDeviceLifecycle(id);
return listLifecycle; return listLifecycle;
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
String msg = "Error occurred while getting lifecycle history"; String msg = "Error occurred while getting lifrcycle history";
log.error(msg, e); log.error(msg, e);
throw new DeviceStatusException(msg, e); throw new DeviceStatusException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {

Loading…
Cancel
Save