|
|
@ -35,9 +35,9 @@ import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyExistException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.GroupUser;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.GroupUser;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException;
|
|
|
|
import org.wso2.carbon.device.mgt.core.group.mgt.dao.GroupDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.GroupDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.core.group.mgt.dao.GroupManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.core.group.mgt.dao.GroupManagementDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
|
|
|
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
|
|
|
import org.wso2.carbon.user.api.Permission;
|
|
|
|
import org.wso2.carbon.user.api.Permission;
|
|
|
@ -185,10 +185,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GroupManagementDAOFactory.closeConnection();
|
|
|
|
GroupManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (deviceGroup != null) {
|
|
|
|
|
|
|
|
deviceGroup.setUsers(this.getUsers(groupId));
|
|
|
|
|
|
|
|
deviceGroup.setRoles(this.getRoles(groupId));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return deviceGroup;
|
|
|
|
return deviceGroup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -206,10 +202,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GroupManagementDAOFactory.closeConnection();
|
|
|
|
GroupManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
|
|
|
|
group.setUsers(this.getUsers(group.getGroupId()));
|
|
|
|
|
|
|
|
group.setRoles(this.getRoles(group.getGroupId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return deviceGroups;
|
|
|
|
return deviceGroups;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -217,10 +209,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
public PaginationResult getGroups(GroupPaginationRequest request) throws GroupManagementException {
|
|
|
|
public PaginationResult getGroups(GroupPaginationRequest request) throws GroupManagementException {
|
|
|
|
request = DeviceManagerUtil.validateGroupListPageSize(request);
|
|
|
|
request = DeviceManagerUtil.validateGroupListPageSize(request);
|
|
|
|
List<DeviceGroup> deviceGroups = getPlainDeviceGroups(request);
|
|
|
|
List<DeviceGroup> deviceGroups = getPlainDeviceGroups(request);
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
|
|
|
|
group.setUsers(this.getUsers(group.getGroupId()));
|
|
|
|
|
|
|
|
group.setRoles(this.getRoles(group.getGroupId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
PaginationResult groupResult = new PaginationResult();
|
|
|
|
PaginationResult groupResult = new PaginationResult();
|
|
|
|
groupResult.setData(deviceGroups);
|
|
|
|
groupResult.setData(deviceGroups);
|
|
|
|
groupResult.setRecordsTotal(getGroupCount(request));
|
|
|
|
groupResult.setRecordsTotal(getGroupCount(request));
|
|
|
@ -292,8 +280,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
int groupId = group.getGroupId();
|
|
|
|
int groupId = group.getGroupId();
|
|
|
|
if (groupIds.contains(groupId)) {
|
|
|
|
if (groupIds.contains(groupId)) {
|
|
|
|
if (startIndex <= index && index < count) {
|
|
|
|
if (startIndex <= index && index < count) {
|
|
|
|
group.setUsers(this.getUsers(groupId));
|
|
|
|
|
|
|
|
group.setRoles(this.getRoles(groupId));
|
|
|
|
|
|
|
|
deviceGroups.add(group);
|
|
|
|
deviceGroups.add(group);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
index++;
|
|
|
|