Added API for search certificates #185
Open
nishan
wants to merge 1 commits from nishan/device-mgt-core:search-option
into master
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'nishan/device-mgt-core:search-option'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Fixes: https://roadmap.entgra.net/issues/10107
178cc1d3f4
tof7c4781baf
1 year agof7c4781baf
toee911860be
1 year agorequired = false,
defaultValue = "5")
@QueryParam("limit") int limit,
defaultValue = "0")
What is the reason for having default value here?
name = "username",
value = "User name of the certificate added user" ,
required = false,
defaultValue = "0")
What is the reason for having default value here?
@QueryParam("offset") int offset,
@QueryParam("limit") int limit,
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
@QueryParam("serialNumber") String serialNumber, @QueryParam("deviceIdentifier") String deviceIdentifier,
Format these lines
CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService();
CertificatePaginationRequest request = new CertificatePaginationRequest(offset, limit);
if (serialNumber != null && !serialNumber.isEmpty()) {
You can use StringUtils
serialNumber + "' has been removed").build();
}
} catch (CertificateManagementException e) {
String msg = "Error occurred while converting PEM file to X509Certificate";
Is this error message correct?
return Response.status(Response.Status.OK).entity(
"Certificate that carries the certificate id '" +
certificateId + "' has been removed").build();
return Response.status(Response.Status.NOT_FOUND).entity(
If this is permission related case, then this is not the correct status code. As per the error message it indicate this is like a permission issue, if it is not a permission issue then improve the message.
certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT");
}
}
StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?");
Format the query
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
Use try with resources
query += "ORDER BY ID LIMIT ?,?";
int resultCount = 0;
stmt = conn.prepareStatement(query);
use try with resources
int resultCount = 0;
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = conn.prepareStatement(query);
use try with resources
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
use try with resources
int resultCount = 0;
query += "ORDER BY ID LIMIT ? OFFSET ?";
stmt = conn.prepareStatement(query);
Add try with resources
queryBuilder.append(" AND USERNAME ILIKE ?");
}
String sql = queryBuilder.toString();
Use try with resources
int resultCount = 0;
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = conn.prepareStatement(query);
Use try with resources
certificateCount = rs.getInt("DEVICE_CERTIFICATE_COUNT");
}
}
StringBuilder queryBuilder = new StringBuilder("SELECT COUNT(*) AS DEVICE_CERTIFICATE_COUNT FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?");
Format the query
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
Use try with resources
*/
package io.entgra.device.mgt.core.certificate.mgt.core.service;
Remove unnecessary lines
metadata = CertificateManagerUtil.getMetadataManagementService().retrieveMetadata(CertificateManagementConstants.CERTIFICATE_DELETE);
if (metadata != null) {
String metaValue = metadata.getMetaValue();
if (metaValue != null && !metaValue.isEmpty()) {
Use StringUtils
Changes are added in #216
Close this