Completed the requested changes

pagination
Ruwin Dissanayake 2 months ago
parent 9107efb3a6
commit 230192f2d9

@ -490,5 +490,14 @@ public interface GroupDAO {
int getDeviceCount(String groupName, int tenantId) throws GroupManagementDAOException; int getDeviceCount(String groupName, int tenantId) throws GroupManagementDAOException;
/**
* Retrieves the count of devices for a specific group, device type, and tenant.
*
* @param groupName the name of the group
* @param deviceTypeId the ID of the device type (e.g., Android, iOS, Windows)
* @param tenantId the ID of the tenant
* @return the count of devices for the given group, device type, and tenant
* @throws GroupManagementDAOException if an error occurs during the retrieval of the device count
*/
int getDeviceCountWithGroup(String groupName, int deviceTypeId, int tenantId) throws GroupManagementDAOException; int getDeviceCountWithGroup(String groupName, int deviceTypeId, int tenantId) throws GroupManagementDAOException;
} }

@ -392,6 +392,13 @@ public interface GroupManagementProviderService {
int getDeviceCount(String groupName) throws GroupManagementException; int getDeviceCount(String groupName) throws GroupManagementException;
/**
* Retrieves the count of devices for a specific group and device type.
*
* @param groupName the name of the group
* @param deviceTypeId the ID of the device type (e.g., Android, iOS, Windows)
* @return the count of devices for the given group and device type
* @throws GroupManagementException if an error occurs during the retrieval of the device count
*/
int getDeviceCountWithGroup(String groupName, int deviceTypeId) throws GroupManagementException; int getDeviceCountWithGroup(String groupName, int deviceTypeId) throws GroupManagementException;
} }

@ -1753,8 +1753,12 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
try { try {
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
return groupDAO.getDeviceCountWithGroup(groupName,deviceTypeId, tenantId); return groupDAO.getDeviceCountWithGroup(groupName,deviceTypeId, tenantId);
} catch (SQLException | GroupManagementDAOException e) { } catch (SQLException e) {
String msg = "Error occurred while retrieving device count."; String msg = "SQL error occurred while retrieving device count.";
log.error(msg, e);
throw new GroupManagementException(msg, e);
} catch (GroupManagementDAOException e) {
String msg = "DAO error occurred while retrieving device count.";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
} finally { } finally {

Loading…
Cancel
Save