Move this part out of the try block and use the constructed query to log in the error log. Do this for all the methods.
Further, format the query to improve the readability of it.
Move this part out of the try block and use the constructed query to log in the error log. Do this for all the methods.
Further, format the query to improve the readability of it.
In these
UserBasedSubscriptionManagementHelperServiceImpl.java, GroupBasedSubscriptionManagementHelperServiceImpl.java, RoleBasedSubscriptionManagementHelperServiceImpl.java, DeviceBasedSubscriptionManagementHelperServiceImpl.java
Files contain repeating code blocks, so think a better approach to have reusable source. Either you can have service methods or common util methods to reuse in these classes.
In these
UserBasedSubscriptionManagementHelperServiceImpl.java, GroupBasedSubscriptionManagementHelperServiceImpl.java, RoleBasedSubscriptionManagementHelperServiceImpl.java, DeviceBasedSubscriptionManagementHelperServiceImpl.java
Files contain repeating code blocks, so think a better approach to have reusable source. Either you can have service methods or common util methods to reuse in these classes.
Purpose
append(" DESC ");
if (offset >= 0 && limit >= 0) {
sql.append("LIMIT ? OFFSET ?");
Have we added the query for Oracle database? Please check all other queries that we have used offset and limit and do the modification.
try {
Connection conn = this.getDBConnection();
StringBuilder sql = new StringBuilder("SELECT COUNT(DISTINCT DS.DM_DEVICE_ID) AS COUNT "
Move this part out of the try block and use the constructed query to log in the error log. Do this for all the methods.
Further, format the query to improve the readability of it.
}
// @Override
// public List<DeviceSubscriptionDTO> getSubscriptionDetailsByDeviceIds(int appReleaseId, boolean unsubscribe, int tenantId,
Remove commented code blocks.
public int getAllSubscriptionsCount(int appReleaseId, boolean unsubscribe, int tenantId,
List<String> actionStatus, String actionType, String actionTriggeredBy)
throws ApplicationManagementDAOException {
int deviceCount = 0;
This can be removed if we improve the code more.
+ appReleaseId);
}
if (rs.next()) {
deviceCount = rs.getInt("COUNT");
This can be replaced with return rs.getInt("COUNT");
deviceCount = rs.getInt("COUNT");
}
}
return deviceCount;
This can be replaced with return 0;
return HelperUtil.getDeviceManagementProviderService().getDeviceCountByDeviceIds(paginationRequest, deviceIds);
}
private static List<DeviceSubscription> populateDeviceData(List<DeviceSubscriptionDTO> deviceSubscriptionDTOS,
Add Java Doc comment
return deviceSubscriptions;
}
private static SubscriptionData getSubscriptionData(boolean isUnsubscribed, DeviceSubscriptionDTO deviceSubscriptionDTO) {
Add Java Doc comment
return subscriptionData;
}
public static String getDeviceSubscriptionStatus(SubscriptionInfo subscriptionInfo) {
Add Java Doc comment
getFilteringDeviceSubscriptionStatus(), subscriptionInfo.getDeviceSubscriptionStatus());
}
public static String getDeviceSubscriptionStatus(String deviceSubscriptionStatusFilter, String deviceSubscriptionStatus) {
Add Java Doc comment
deviceSubscriptionStatusFilter : deviceSubscriptionStatus;
}
public static SubscriptionStatistics getSubscriptionStatistics(SubscriptionStatisticDTO subscriptionStatisticDTO, int allDeviceCount) {
Add Java Doc comment
return subscriptionStatistics;
}
public static float getPercentage(int numerator, int denominator) {
Add Java Doc comment
return ((float) numerator / (float) denominator) * 100;
}
public static List<String> getDBSubscriptionStatus(String deviceSubscriptionStatus) {
Add Java Doc comment
private SubscriptionManagementServiceProvider() {
}
public static SubscriptionManagementServiceProvider getInstance() {
This is not required, check all the placed and do the required improvement.
}
// @Override
// public OwnerWithDeviceDTO getOwnersWithDevices(String owner, List<String> allowingDeviceStatuses, int tenantId,
Remove commented code
import java.util.Map;
public class SubscriptionMetadata {
public static final class DeviceSubscriptionStatus {
Don't we have a constant file to have this?
import java.util.Objects;
import java.util.stream.Collectors;
public class UserBasedSubscriptionManagementHelperServiceImpl implements SubscriptionManagementHelperService {
In these
UserBasedSubscriptionManagementHelperServiceImpl.java, GroupBasedSubscriptionManagementHelperServiceImpl.java, RoleBasedSubscriptionManagementHelperServiceImpl.java, DeviceBasedSubscriptionManagementHelperServiceImpl.java
Files contain repeating code blocks, so think a better approach to have reusable source. Either you can have service methods or common util methods to reuse in these classes.
public int getDeviceSubscriptionCount(int appReleaseId, boolean unsubscribe, int tenantId,
List<Integer> deviceIds, List<String> actionStatus, String actionType,
String actionTriggeredBy) throws ApplicationManagementDAOException {
int deviceCount = 0;
This line can be removed if we improve the method.
+ appReleaseId + " and device ids " + deviceIds);
}
if (rs.next()) {
deviceCount = rs.getInt("COUNT");
This line can replace with
return rs.getInt("COUNT");
if (rs.next()) {
deviceCount = rs.getInt("COUNT");
}
return deviceCount;
This line can replace with
return 0;
package io.entgra.device.mgt.core.application.mgt.core.util;
public class SubscriptionManagementUtil {
public static final class DeviceSubscriptionStatus {
Can't we remove this file.
return HelperUtil.getDeviceManagementProviderService().getDeviceCountByDeviceIds(paginationRequest, deviceIds);
}
private static List<DeviceSubscription> populateDeviceData(List<DeviceSubscriptionDTO> deviceSubscriptionDTOS,
Add Java Doc comment
return deviceSubscriptions;
}
private static SubscriptionData getSubscriptionData(boolean isUnsubscribed, DeviceSubscriptionDTO deviceSubscriptionDTO) {
Add Java Doc comment.
40c12875ac
into master 4 months agoReviewers
40c12875ac
.