Delete records from DM_APPLICATION

feature/appm-store/pbac
Amanda 5 years ago
parent 5d8881ad89
commit 2c04ed347b

@ -1873,6 +1873,10 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Successfully removed device policy data of devices: " + deviceIdentifiers); log.debug("Successfully removed device policy data of devices: " + deviceIdentifiers);
} }
removeDeviceApplication(conn, deviceIds);
if (log.isDebugEnabled()) {
log.debug("Successfully removed device application data of devices: " + deviceIdentifiers);
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Starting to remove " + enrollmentIds.size() + " enrollment data of devices with " + log.debug("Starting to remove " + enrollmentIds.size() + " enrollment data of devices with " +
"identifiers: " + deviceIdentifiers); "identifiers: " + deviceIdentifiers);
@ -2260,6 +2264,29 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} }
/***
* This method removes records of a given list of devices from the DM_APPLICATION table
* @param conn Connection object
* @param deviceIds list of device ids (primary keys)
* @throws DeviceManagementDAOException if deletion fails
*/
private void removeDeviceApplication(Connection conn, List<Integer> deviceIds)
throws DeviceManagementDAOException {
String sql = "DELETE FROM DM_APPLICATION WHERE DEVICE_ID = ?";
try {
if (!executeBatchOperation(conn, sql, deviceIds)) {
String msg = "Failed to remove applications of devices with deviceIds : " + deviceIds +
" while executing batch operation";
log.error(msg);
throw new DeviceManagementDAOException(msg);
}
} catch (SQLException e) {
String msg = "SQL error occurred while removing applications of devices devices with deviceIds : " + deviceIds;
log.error(msg, e);
throw new DeviceManagementDAOException(msg, e);
}
}
/*** /***
* This method removes records of a given list of enrollments from the DM_DEVICE_DETAIL table * This method removes records of a given list of enrollments from the DM_DEVICE_DETAIL table
* @param conn Connection object * @param conn Connection object

Loading…
Cancel
Save