|
|
|
@ -575,7 +575,6 @@ public abstract class AbstractEnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
|
"FROM DM_ENROLMENT e " +
|
|
|
|
|
"JOIN DM_DEVICE d ON e.DEVICE_ID = d.ID " +
|
|
|
|
|
"WHERE e.OWNER = ? AND e.TENANT_ID = ?";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getConnection();
|
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
@ -609,14 +608,14 @@ public abstract class AbstractEnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
|
public OwnerWithDeviceDTO getOwnerWithDeviceByDeviceId(int deviceId, int tenantId)
|
|
|
|
|
throws DeviceManagementDAOException {
|
|
|
|
|
OwnerWithDeviceDTO deviceOwnerWithStatus = new OwnerWithDeviceDTO();
|
|
|
|
|
|
|
|
|
|
Connection conn = null;
|
|
|
|
|
String sql = "SELECT e.DEVICE_ID, e.OWNER, e.STATUS AS DEVICE_STATUS, d.NAME AS DEVICE_NAME " +
|
|
|
|
|
"FROM DM_ENROLMENT e " +
|
|
|
|
|
"JOIN DM_DEVICE d ON e.DEVICE_ID = d.ID " +
|
|
|
|
|
"WHERE e.DEVICE_ID = ? AND e.TENANT_ID = ?";
|
|
|
|
|
|
|
|
|
|
try (Connection conn = this.getConnection();
|
|
|
|
|
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
|
try {
|
|
|
|
|
conn = this.getConnection();
|
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
|
stmt.setInt(1, deviceId);
|
|
|
|
|
stmt.setInt(2, tenantId);
|
|
|
|
|
|
|
|
|
@ -630,6 +629,7 @@ public abstract class AbstractEnrollmentDAOImpl implements EnrollmentDAO {
|
|
|
|
|
deviceOwnerWithStatus.setDeviceNames(rs.getString("DEVICE_NAME"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
String msg = "Error occurred while retrieving owner and status for device ID: " + deviceId;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|