mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request 'Fix ownership issue in device deletion' (#234) from osh.silva/device-mgt-core:billing-delete-fix-9713 into master
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/234
This commit is contained in:
commit
bf5ce17bdc
@ -2811,18 +2811,16 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
|
|||||||
* @throws DeviceManagementDAOException if refactoring fails
|
* @throws DeviceManagementDAOException if refactoring fails
|
||||||
*/
|
*/
|
||||||
public void refactorEnrolment(Connection conn, List<Integer> deviceIds) throws DeviceManagementDAOException {
|
public void refactorEnrolment(Connection conn, List<Integer> deviceIds) throws DeviceManagementDAOException {
|
||||||
String updateQuery = "UPDATE DM_ENROLMENT SET OWNER = ?, OWNERSHIP = ?, STATUS = ? WHERE DEVICE_ID = ?";
|
String updateQuery = "UPDATE DM_ENROLMENT SET OWNER = ?, STATUS = ? WHERE DEVICE_ID = ?";
|
||||||
|
|
||||||
try (PreparedStatement preparedStatement = conn.prepareStatement(updateQuery)) {
|
try (PreparedStatement preparedStatement = conn.prepareStatement(updateQuery)) {
|
||||||
for (int deviceId : deviceIds) {
|
for (int deviceId : deviceIds) {
|
||||||
|
|
||||||
String randomOwner = generateRandomString(4);
|
String randomOwner = generateRandomString(4);
|
||||||
String randomOwnership = generateRandomString(6);
|
|
||||||
|
|
||||||
preparedStatement.setString(1, randomOwner);
|
preparedStatement.setString(1, randomOwner);
|
||||||
preparedStatement.setString(2, randomOwnership);
|
preparedStatement.setString(2, String.valueOf(Status.DELETED));
|
||||||
preparedStatement.setString(3, String.valueOf(Status.DELETED));
|
preparedStatement.setInt(3, deviceId);
|
||||||
preparedStatement.setInt(4, deviceId);
|
|
||||||
|
|
||||||
preparedStatement.executeUpdate();
|
preparedStatement.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user