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