Add certificate search by partial serial number

Bug#10494
prathabanKavin 1 year ago
parent ae5bcf4f8a
commit 3cd6b01f4a

@ -63,7 +63,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl {
"WHERE TENANT_ID = ?";
if (StringUtils.isNotEmpty(serialNumber)) {
sql += " AND SERIAL_NUMBER = ?";
sql += " AND SERIAL_NUMBER LIKE ?";
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {
@ -79,7 +79,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 2;
if (StringUtils.isNotEmpty(serialNumber)) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {
@ -124,7 +124,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl {
"WHERE TENANT_ID = ? ";
if (StringUtils.isNotEmpty(serialNumber)) {
query += "AND SERIAL_NUMBER = ? ";
query += "AND SERIAL_NUMBER LIKE ? ";
isCertificateSerialNumberProvided = true;
}
@ -144,7 +144,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 1;
stmt.setInt(paramIdx++, tenantId);
if (isCertificateSerialNumberProvided) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (isCertificateDeviceIdentifierProvided) {
stmt.setString(paramIdx++, deviceIdentifier);

@ -63,7 +63,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl {
"FROM DM_DEVICE_CERTIFICATE " +
"WHERE TENANT_ID = ? ";
if (StringUtils.isNotEmpty(serialNumber)) {
query += "AND SERIAL_NUMBER = ? ";
query += "AND SERIAL_NUMBER LIKE ? ";
isCertificateSerialNumberProvided = true;
}
@ -83,7 +83,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 1;
stmt.setInt(paramIdx++, tenantId);
if (isCertificateSerialNumberProvided) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber+ "%");
}
if (isCertificateDeviceIdentifierProvided) {
stmt.setString(paramIdx++, deviceIdentifier);
@ -136,7 +136,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl {
"WHERE TENANT_ID = ?";
if (StringUtils.isNotEmpty(serialNumber)) {
sql += " AND SERIAL_NUMBER = ?";
sql += " AND SERIAL_NUMBER LIKE ?";
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {
@ -152,7 +152,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 2;
if (StringUtils.isNotEmpty(serialNumber)) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {

@ -63,7 +63,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
"FROM DM_DEVICE_CERTIFICATE " +
"WHERE TENANT_ID = ? ";
if (StringUtils.isNotEmpty(serialNumber)) {
query += "AND SERIAL_NUMBER = ? ";
query += "AND SERIAL_NUMBER LIKE ? ";
isCertificateSerialNumberProvided = true;
}
@ -83,7 +83,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 1;
stmt.setInt(paramIdx++, tenantId);
if (isCertificateSerialNumberProvided) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (isCertificateDeviceIdentifierProvided) {
stmt.setString(paramIdx++, deviceIdentifier);
@ -136,7 +136,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
"WHERE TENANT_ID = ?";
if (StringUtils.isNotEmpty(serialNumber)) {
sql += " AND SERIAL_NUMBER = ?";
sql += " AND SERIAL_NUMBER LIKE ?";
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {
@ -144,7 +144,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
}
if (StringUtils.isNotEmpty(username)) {
sql += " AND USERNAME ILIKE ?";
sql += " AND USERNAME LIKE ?";
}
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -152,7 +152,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 2;
if (StringUtils.isNotEmpty(serialNumber)) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {

@ -63,7 +63,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl {
"FROM DM_DEVICE_CERTIFICATE " +
"WHERE TENANT_ID = ? ";
if (StringUtils.isNotEmpty(serialNumber)) {
query += "AND SERIAL_NUMBER = ? ";
query += "AND SERIAL_NUMBER LIKE ? ";
isCertificateSerialNumberProvided = true;
}
@ -83,7 +83,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 1;
stmt.setInt(paramIdx++, tenantId);
if (isCertificateSerialNumberProvided) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (isCertificateDeviceIdentifierProvided) {
stmt.setString(paramIdx++, deviceIdentifier);
@ -136,7 +136,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl {
"WHERE TENANT_ID = ?";
if (StringUtils.isNotEmpty(serialNumber)) {
sql += " AND SERIAL_NUMBER = ?";
sql += " AND SERIAL_NUMBER LIKE ?";
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {
@ -152,7 +152,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl {
int paramIdx = 2;
if (StringUtils.isNotEmpty(serialNumber)) {
stmt.setString(paramIdx++, serialNumber);
stmt.setString(paramIdx++, "%" + serialNumber + "%");
}
if (StringUtils.isNotEmpty(deviceIdentifier)) {

Loading…
Cancel
Save