Added API for search certificates #185

Open
nishan wants to merge 1 commits from nishan/device-mgt-core:search-option into master
nishan commented 1 year ago
Fixes: [https://roadmap.entgra.net/issues/10107](https://roadmap.entgra.net/issues/10107)
nishan added 1 commit 1 year ago
nishan force-pushed search-option from 178cc1d3f4 to f7c4781baf 1 year ago
nishan force-pushed search-option from f7c4781baf to ee911860be 1 year ago
tcdlpds requested changes 1 year ago
Dismissed
required = false,
defaultValue = "5")
@QueryParam("limit") int limit,
defaultValue = "0")
Owner

What is the reason for having default value here?

What is the reason for having default value here?
name = "username",
value = "User name of the certificate added user" ,
required = false,
defaultValue = "0")
Owner

What is the reason for having default value here?

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,
Owner

Format these lines

Format these lines
CertificateManagementService certificateService = CertificateMgtAPIUtils.getCertificateManagementService();
CertificatePaginationRequest request = new CertificatePaginationRequest(offset, limit);
if (serialNumber != null && !serialNumber.isEmpty()) {
Owner

You can use StringUtils

You can use StringUtils
serialNumber + "' has been removed").build();
}
} catch (CertificateManagementException e) {
String msg = "Error occurred while converting PEM file to X509Certificate";
Owner

Is this error message correct?

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(
Owner

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.

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 = ?");
Owner

Format the query

Format the query
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
Owner

Use try with resources

Use try with resources
query += "ORDER BY ID LIMIT ?,?";
int resultCount = 0;
stmt = conn.prepareStatement(query);
Owner

use try with resources

use try with resources
int resultCount = 0;
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = conn.prepareStatement(query);
Owner

use try with resources

use try with resources
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
Owner

use try with resources

use try with resources
int resultCount = 0;
query += "ORDER BY ID LIMIT ? OFFSET ?";
stmt = conn.prepareStatement(query);
Owner

Add try with resources

Add try with resources
queryBuilder.append(" AND USERNAME ILIKE ?");
}
String sql = queryBuilder.toString();
Owner

Use try with resources

Use try with resources
int resultCount = 0;
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = conn.prepareStatement(query);
Owner

Use try with resources

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 = ?");
Owner

Format the query

Format the query
String sql = queryBuilder.toString();
stmt = conn.prepareStatement(sql);
Owner

Use try with resources

Use try with resources
*/
package io.entgra.device.mgt.core.certificate.mgt.core.service;
Owner

Remove unnecessary lines

Remove unnecessary lines
metadata = CertificateManagerUtil.getMetadataManagementService().retrieveMetadata(CertificateManagementConstants.CERTIFICATE_DELETE);
if (metadata != null) {
String metaValue = metadata.getMetaValue();
if (metaValue != null && !metaValue.isEmpty()) {
Owner

Use StringUtils

Use StringUtils

Changes are added in #216
Close this

Changes are added in https://repository.entgra.net/community/device-mgt-core/pulls/216 Close this
tcdlpds dismissed tcdlpds’s review 10 months ago
This pull request has changes conflicting with the target branch.
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/service/CertificateManagementServiceImpl.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/CertificateManagementAdminService.java
components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#185
Loading…
There is no content yet.