|
|
@ -1725,7 +1725,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
List<SubscriptionsDTO> groupDetailsWithDevices = new ArrayList<>();
|
|
|
|
List<SubscriptionsDTO> groupDetailsWithDevices = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
List<GroupSubscriptionDTO> groupDetails =
|
|
|
|
List<GroupSubscriptionDTO> groupDetails =
|
|
|
|
subscriptionDAO.getGroupsSubscriptionDetailsByAppReleaseID(appReleaseId, unsubscribe, tenantId, offset, limit);
|
|
|
|
subscriptionDAO.getGroupsSubscriptionDetailsByAppReleaseID(appReleaseId, unsubscribe, tenantId, offset, -1);
|
|
|
|
if (groupDetails == null) {
|
|
|
|
if (groupDetails == null) {
|
|
|
|
throw new ApplicationManagementException("Group details not found for appReleaseId: " + appReleaseId);
|
|
|
|
throw new ApplicationManagementException("Group details not found for appReleaseId: " + appReleaseId);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1744,7 +1744,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
GroupDetailsDTO groupDetailWithDevices =
|
|
|
|
GroupDetailsDTO groupDetailWithDevices =
|
|
|
|
groupManagementProviderService.getGroupDetailsWithDevices(
|
|
|
|
groupManagementProviderService.getGroupDetailsWithDevices(
|
|
|
|
groupName, applicationDTO.getDeviceTypeId(), request.getOwner(),
|
|
|
|
groupName, applicationDTO.getDeviceTypeId(), request.getOwner(),
|
|
|
|
request.getDeviceName(), request.getDeviceStatus(), offset, limit);
|
|
|
|
request.getDeviceName(), request.getDeviceStatus(), offset, -1);
|
|
|
|
|
|
|
|
|
|
|
|
SubscriptionsDTO groupDetailDTO = new SubscriptionsDTO();
|
|
|
|
SubscriptionsDTO groupDetailDTO = new SubscriptionsDTO();
|
|
|
|
groupDetailDTO.setId(groupDetailWithDevices.getGroupId());
|
|
|
|
groupDetailDTO.setId(groupDetailWithDevices.getGroupId());
|
|
|
@ -1878,33 +1878,73 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> requestedDevices = new ArrayList<>();
|
|
|
|
List<DeviceSubscriptionData> requestedDevices = new ArrayList<>();
|
|
|
|
|
|
|
|
int installedCount;
|
|
|
|
|
|
|
|
int pendingCount;
|
|
|
|
|
|
|
|
int errorCount;
|
|
|
|
|
|
|
|
int newCount;
|
|
|
|
|
|
|
|
int subscribedCount;
|
|
|
|
|
|
|
|
int totalDeviceCount =
|
|
|
|
|
|
|
|
groupManagementProviderService.getDeviceCount(groupDetailWithDevices.getGroupId());
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(request.getTabActionStatus())) {
|
|
|
|
if (StringUtils.isNotBlank(request.getTabActionStatus())) {
|
|
|
|
switch (request.getTabActionStatus()) {
|
|
|
|
switch (request.getTabActionStatus()) {
|
|
|
|
case "COMPLETED":
|
|
|
|
case "COMPLETED":
|
|
|
|
requestedDevices = installedDevices;
|
|
|
|
requestedDevices = installedDevices;
|
|
|
|
|
|
|
|
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "PENDING":
|
|
|
|
case "PENDING":
|
|
|
|
requestedDevices = pendingDevices;
|
|
|
|
requestedDevices = pendingDevices;
|
|
|
|
|
|
|
|
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "ERROR":
|
|
|
|
case "ERROR":
|
|
|
|
requestedDevices = errorDevices;
|
|
|
|
requestedDevices = errorDevices;
|
|
|
|
|
|
|
|
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "NEW":
|
|
|
|
case "NEW":
|
|
|
|
requestedDevices = newDevices;
|
|
|
|
requestedDevices = newDevices;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "SUBSCRIBED":
|
|
|
|
case "SUBSCRIBED":
|
|
|
|
requestedDevices = subscribedDevices;
|
|
|
|
requestedDevices = subscribedDevices;
|
|
|
|
|
|
|
|
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
groupDetailDTO.setDevices(new CategorizedSubscriptionResult(requestedDevices, request.getTabActionStatus()));
|
|
|
|
groupDetailDTO.setDevices(new CategorizedSubscriptionResult(requestedDevices, request.getTabActionStatus()));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
CategorizedSubscriptionResult categorizedSubscriptionResult;
|
|
|
|
CategorizedSubscriptionResult categorizedSubscriptionResult;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "COMPLETED", request.getActionType());
|
|
|
|
|
|
|
|
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "PENDING", request.getActionType());
|
|
|
|
|
|
|
|
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "ERROR", request.getActionType());
|
|
|
|
|
|
|
|
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "SUBSCRIBED", request.getActionType());
|
|
|
|
|
|
|
|
newCount = totalDeviceCount - (installedCount + pendingCount + errorCount + subscribedCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> paginatedInstalledDevices = installedDevices.stream()
|
|
|
|
|
|
|
|
.skip(offset)
|
|
|
|
|
|
|
|
.limit(limit)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> paginatedPendingDevices = pendingDevices.stream()
|
|
|
|
|
|
|
|
.skip(offset)
|
|
|
|
|
|
|
|
.limit(limit)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> paginatedErrorDevices = errorDevices.stream()
|
|
|
|
|
|
|
|
.skip(offset)
|
|
|
|
|
|
|
|
.limit(limit)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> paginatedNewDevices = newDevices.stream()
|
|
|
|
|
|
|
|
.skip(offset)
|
|
|
|
|
|
|
|
.limit(limit)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<DeviceSubscriptionData> paginatedSubscribedDevices = subscribedDevices.stream()
|
|
|
|
|
|
|
|
.skip(offset)
|
|
|
|
|
|
|
|
.limit(limit)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
if (subscribedDevices.isEmpty()) {
|
|
|
|
if (subscribedDevices.isEmpty()) {
|
|
|
|
categorizedSubscriptionResult =
|
|
|
|
categorizedSubscriptionResult =
|
|
|
|
new CategorizedSubscriptionResult(installedDevices, pendingDevices, errorDevices, newDevices);
|
|
|
|
new CategorizedSubscriptionResult(paginatedInstalledDevices, paginatedPendingDevices, paginatedErrorDevices, paginatedNewDevices, installedCount, pendingCount, errorCount, newCount);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
categorizedSubscriptionResult =
|
|
|
|
categorizedSubscriptionResult =
|
|
|
|
new CategorizedSubscriptionResult(installedDevices, pendingDevices, errorDevices, newDevices, subscribedDevices);
|
|
|
|
new CategorizedSubscriptionResult(paginatedInstalledDevices, paginatedPendingDevices, paginatedErrorDevices, paginatedNewDevices, paginatedSubscribedDevices, installedCount, pendingCount, errorCount, newCount, subscribedCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
groupDetailDTO.setDevices(categorizedSubscriptionResult);
|
|
|
|
groupDetailDTO.setDevices(categorizedSubscriptionResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|