|
|
|
@ -1185,6 +1185,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
String user = request.getOwner();
|
|
|
|
|
String ownership = request.getOwnership();
|
|
|
|
|
String serial = request.getSerialNumber();
|
|
|
|
|
String firmawareVersion = request.getFirmawareVersion();
|
|
|
|
|
String query = null;
|
|
|
|
|
try {
|
|
|
|
|
List<Device> devices = new ArrayList<>();
|
|
|
|
@ -1199,6 +1200,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
boolean isOwnerProvided = false;
|
|
|
|
|
boolean isOwnershipProvided = false;
|
|
|
|
|
boolean isSerialProvided = false;
|
|
|
|
|
boolean isFirmawareVersionProvided = false;
|
|
|
|
|
|
|
|
|
|
StringJoiner joiner = new StringJoiner(",",
|
|
|
|
|
"SELECT "
|
|
|
|
@ -1224,6 +1226,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
+ "INNER JOIN DM_DEVICE_INFO i ON "
|
|
|
|
|
+ "DM_DEVICE.ID = i.DEVICE_ID "
|
|
|
|
|
+ "AND i.KEY_FIELD = 'serial' "
|
|
|
|
|
+ "OR i.KEY_FIELD = 'FIRMWARE_VERSION' "
|
|
|
|
|
+ "WHERE DM_DEVICE.ID IN (",
|
|
|
|
|
") AND DM_DEVICE.TENANT_ID = ? AND e.STATUS != ?");
|
|
|
|
|
|
|
|
|
@ -1242,6 +1245,10 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
query += " AND i.VALUE_FIELD LIKE ?" ;
|
|
|
|
|
isSerialProvided = true;
|
|
|
|
|
}
|
|
|
|
|
if (firmawareVersion != null && !firmawareVersion.isEmpty()) {
|
|
|
|
|
query += " OR i.VALUE_FIELD LIKE ?" ;
|
|
|
|
|
isFirmawareVersionProvided = true;
|
|
|
|
|
}
|
|
|
|
|
if (user != null && !user.isEmpty()) {
|
|
|
|
|
query += " AND e.OWNER = ?";
|
|
|
|
|
isOwnerProvided = true;
|
|
|
|
@ -1269,6 +1276,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
if (isSerialProvided) {
|
|
|
|
|
ps.setString(index++, "%" + serial + "%");
|
|
|
|
|
}
|
|
|
|
|
if (isFirmawareVersionProvided) {
|
|
|
|
|
ps.setString(index++, "%" + firmawareVersion + "%");
|
|
|
|
|
}
|
|
|
|
|
if (isOwnerProvided) {
|
|
|
|
|
ps.setString(index++, user);
|
|
|
|
|
}
|
|
|
|
@ -1291,6 +1301,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
|
|
|
|
|
String msg = "Error occurred while retrieving information of all registered devices " +
|
|
|
|
|
"according to device ids and the limit area. Executed query " + query;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
System.out.println(msg);
|
|
|
|
|
throw new DeviceManagementDAOException(msg, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|