|
|
@ -31,6 +31,7 @@ import java.util.Map;
|
|
|
|
* This interface represents the key operations associated with persisting group related information.
|
|
|
|
* This interface represents the key operations associated with persisting group related information.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public interface GroupDAO {
|
|
|
|
public interface GroupDAO {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add new Device Group.
|
|
|
|
* Add new Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -41,21 +42,18 @@ public interface GroupDAO {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException;
|
|
|
|
int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add properties for device group.
|
|
|
|
* Add properties for device group.
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
|
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
|
|
|
|
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groups to be added.
|
|
|
|
* @param groups to be added.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException;
|
|
|
|
int addGroupWithRoles(DeviceGroupRoleWrapper groups, int tenantId) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add properties for device group.
|
|
|
|
* Add properties for device group.
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
@ -66,7 +64,6 @@ public interface GroupDAO {
|
|
|
|
* @return sql execution result.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -74,12 +71,11 @@ public interface GroupDAO {
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
|
* Note that groupId parameter is considered seperately due to the groupId parameter passed with
|
|
|
|
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
|
|
|
|
* device group Payload is ignored in the add/update logic instead the internal groupId reference is used.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groups to be updated.
|
|
|
|
* @param groups to be updated.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
boolean addGroupPropertiesWithRoles(DeviceGroupRoleWrapper groups, int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -97,8 +93,8 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Remove properties for device group.
|
|
|
|
* Remove properties for device group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId to be deleted.
|
|
|
|
* @param groupId to be deleted.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void deleteAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
void deleteAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
@ -115,19 +111,19 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Retrives all properties stored against a group.
|
|
|
|
* Retrives all properties stored against a group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId to be deleted.
|
|
|
|
* @param groupId to be deleted.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @return sql execution result.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
Map<String,String> getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
Map<String, String> getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update an existing Device Group.
|
|
|
|
* Update an existing Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param deviceGroup group to update.
|
|
|
|
* @param deviceGroup group to update.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void updateGroup(DeviceGroup deviceGroup, int groupId, int tenantId)
|
|
|
|
void updateGroup(DeviceGroup deviceGroup, int groupId, int tenantId)
|
|
|
@ -137,7 +133,7 @@ public interface GroupDAO {
|
|
|
|
* Update existing Device Groups.
|
|
|
|
* Update existing Device Groups.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param deviceGroups groups to update.
|
|
|
|
* @param deviceGroups groups to update.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException on error during updating of groups
|
|
|
|
* @throws GroupManagementDAOException on error during updating of groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void updateGroups(List<DeviceGroup> deviceGroups, int tenantId) throws GroupManagementDAOException;
|
|
|
|
void updateGroups(List<DeviceGroup> deviceGroups, int tenantId) throws GroupManagementDAOException;
|
|
|
@ -145,8 +141,8 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Delete an existing Device Group.
|
|
|
|
* Delete an existing Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void deleteGroup(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
|
void deleteGroup(int groupId, int tenantId) throws GroupManagementDAOException;
|
|
|
@ -155,7 +151,7 @@ public interface GroupDAO {
|
|
|
|
* Delete mappings of Device Groups.
|
|
|
|
* Delete mappings of Device Groups.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupIds of Device Groups.
|
|
|
|
* @param groupIds of Device Groups.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException on error during deletion of mappings of groups
|
|
|
|
* @throws GroupManagementDAOException on error during deletion of mappings of groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void deleteGroupsMapping(List<Integer> groupIds, int tenantId) throws GroupManagementDAOException;
|
|
|
|
void deleteGroupsMapping(List<Integer> groupIds, int tenantId) throws GroupManagementDAOException;
|
|
|
@ -164,7 +160,7 @@ public interface GroupDAO {
|
|
|
|
* Delete existing Device Groups.
|
|
|
|
* Delete existing Device Groups.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupIds of Device Groups.
|
|
|
|
* @param groupIds of Device Groups.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @throws GroupManagementDAOException on error during deletion of groups
|
|
|
|
* @throws GroupManagementDAOException on error during deletion of groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void deleteGroups(List<Integer> groupIds, int tenantId) throws GroupManagementDAOException;
|
|
|
|
void deleteGroups(List<Integer> groupIds, int tenantId) throws GroupManagementDAOException;
|
|
|
@ -172,8 +168,8 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get device group by id.
|
|
|
|
* Get device group by id.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return Device Group in tenant with specified name.
|
|
|
|
* @return Device Group in tenant with specified name.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -183,7 +179,7 @@ public interface GroupDAO {
|
|
|
|
* Get children groups by parent path.
|
|
|
|
* Get children groups by parent path.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param parentPath of parent group.
|
|
|
|
* @param parentPath of parent group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return {@link List<DeviceGroup>} list of children device groups
|
|
|
|
* @return {@link List<DeviceGroup>} list of children device groups
|
|
|
|
* @throws GroupManagementDAOException on error during retrieval of children groups
|
|
|
|
* @throws GroupManagementDAOException on error during retrieval of children groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -192,7 +188,7 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get root groups.
|
|
|
|
* Get root groups.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @param tenantId of the group.
|
|
|
|
* @return {@link List<DeviceGroup>} list of root device groups
|
|
|
|
* @return {@link List<DeviceGroup>} list of root device groups
|
|
|
|
* @throws GroupManagementDAOException on error during retrieval of root groups
|
|
|
|
* @throws GroupManagementDAOException on error during retrieval of root groups
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -200,6 +196,7 @@ public interface GroupDAO {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the groups of device with device id provided
|
|
|
|
* Get the groups of device with device id provided
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param deviceId
|
|
|
|
* @param deviceId
|
|
|
|
* @return groups which has the device.
|
|
|
|
* @return groups which has the device.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -210,7 +207,7 @@ public interface GroupDAO {
|
|
|
|
* Get paginated list of Device Groups in tenant.
|
|
|
|
* Get paginated list of Device Groups in tenant.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param paginationRequest to filter results.
|
|
|
|
* @param paginationRequest to filter results.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @return List of all Device Groups in tenant.
|
|
|
|
* @return List of all Device Groups in tenant.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -250,7 +247,7 @@ public interface GroupDAO {
|
|
|
|
* Get paginated count of Device Groups in tenant.
|
|
|
|
* Get paginated count of Device Groups in tenant.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param paginationRequest to filter results.
|
|
|
|
* @param paginationRequest to filter results.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @return List of all Device Groups in tenant.
|
|
|
|
* @return List of all Device Groups in tenant.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -260,7 +257,7 @@ public interface GroupDAO {
|
|
|
|
* Check group already existed with given name.
|
|
|
|
* Check group already existed with given name.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupName of the Device Group.
|
|
|
|
* @param groupName of the Device Group.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @return existence of group with name
|
|
|
|
* @return existence of group with name
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -269,7 +266,7 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add device to a given Device Group.
|
|
|
|
* Add device to a given Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -279,7 +276,7 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Remove device from the Device Group.
|
|
|
|
* Remove device from the Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -289,7 +286,7 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Check device is belonging to a Device Group.
|
|
|
|
* Check device is belonging to a Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param deviceId of the device.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -300,7 +297,7 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get count of devices in a Device Group.
|
|
|
|
* Get count of devices in a Device Group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @return device count.
|
|
|
|
* @return device count.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -310,10 +307,10 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get paginated result of devices of a given tenant and device group.
|
|
|
|
* Get paginated result of devices of a given tenant and device group.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param groupId of Device Group.
|
|
|
|
* @param startIndex for pagination.
|
|
|
|
* @param startIndex for pagination.
|
|
|
|
* @param rowCount for pagination.
|
|
|
|
* @param rowCount for pagination.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @return list of device in group
|
|
|
|
* @return list of device in group
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -323,9 +320,9 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get All the devices that are in one of the given device status and belongs to given group
|
|
|
|
* Get All the devices that are in one of the given device status and belongs to given group
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param groupName Group name
|
|
|
|
* @param groupName Group name
|
|
|
|
* @param deviceStatuses Device Statuses
|
|
|
|
* @param deviceStatuses Device Statuses
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @param tenantId Tenant Id
|
|
|
|
* @return List of devices
|
|
|
|
* @return List of devices
|
|
|
|
* @throws GroupManagementDAOException if error occurred while retreving list of devices that are in one of the
|
|
|
|
* @throws GroupManagementDAOException if error occurred while retreving list of devices that are in one of the
|
|
|
|
* given device status and belongs to the given group
|
|
|
|
* given device status and belongs to the given group
|
|
|
@ -388,8 +385,8 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get count of all device groups which shared with a user role.
|
|
|
|
* Get count of all device groups which shared with a user role.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param roles of the group.
|
|
|
|
* @param roles of the group.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param parentPath of the group.
|
|
|
|
* @param parentPath of the group.
|
|
|
|
* @return count of device groups.
|
|
|
|
* @return count of device groups.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
@ -419,27 +416,26 @@ public interface GroupDAO {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get count of device groups which owned by user.
|
|
|
|
* Get count of device groups which owned by user.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param username of the owner.
|
|
|
|
* @param username of the owner.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param tenantId of user's tenant.
|
|
|
|
* @param parentPath of the group.
|
|
|
|
* @param parentPath of the group.
|
|
|
|
* @return count of device groups.
|
|
|
|
* @return count of device groups.
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
* @throws GroupManagementDAOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int getOwnGroupsCount(String username, int tenantId, String parentPath) throws GroupManagementDAOException;
|
|
|
|
int getOwnGroupsCount(String username, int tenantId, String parentPath) throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get device Ids of devices which are assigned to groups.
|
|
|
|
components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java * Get device Ids of devices which are assigned to groups.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param paginationRequest Request object with offset and limit.
|
|
|
|
* @param paginationRequest Request object with offset and limit.
|
|
|
|
* @param groupNames default group names that should be omitted when checking the device
|
|
|
|
* @param groupNames default group names that should be omitted when checking the device
|
|
|
|
* whether they have been assigned to groups
|
|
|
|
* whether they have been assigned to groups
|
|
|
|
* @throws GroupManagementDAOException Might occur while retrieving information of group
|
|
|
|
|
|
|
|
* unassigned devices
|
|
|
|
|
|
|
|
* @return details of devices that are unassigned to groups.
|
|
|
|
* @return details of devices that are unassigned to groups.
|
|
|
|
|
|
|
|
* @throws GroupManagementDAOException Might occur while retrieving information of group
|
|
|
|
|
|
|
|
* unassigned devices
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
List<Device> getGroupUnassignedDevices(PaginationRequest paginationRequest,
|
|
|
|
List<Device> getGroupUnassignedDevices(PaginationRequest paginationRequest,
|
|
|
|
List<String> groupNames)
|
|
|
|
List<String> groupNames)
|
|
|
|
throws GroupManagementDAOException;
|
|
|
|
throws GroupManagementDAOException;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|