|
|
@ -213,8 +213,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
deviceGroup = this.groupDAO.getGroup(groupId, CarbonContext.getThreadLocalCarbonContext().getTenantId());
|
|
|
|
deviceGroup = this.groupDAO.getGroup(groupId, CarbonContext.getThreadLocalCarbonContext().getTenantId());
|
|
|
|
|
|
|
|
if(deviceGroup != null && deviceGroup.getGroupId() > 0) {
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(),
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(),
|
|
|
|
CarbonContext.getThreadLocalCarbonContext().getTenantId()));
|
|
|
|
CarbonContext.getThreadLocalCarbonContext().getTenantId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
String msg = "Error occurred while obtaining group '" + groupId + "'";
|
|
|
|
String msg = "Error occurred while obtaining group '" + groupId + "'";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -250,8 +252,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
deviceGroup = this.groupDAO.getGroup(groupName, CarbonContext.getThreadLocalCarbonContext().getTenantId());
|
|
|
|
deviceGroup = this.groupDAO.getGroup(groupName, CarbonContext.getThreadLocalCarbonContext().getTenantId());
|
|
|
|
|
|
|
|
if(deviceGroup != null && deviceGroup.getGroupId() > 0) {
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(),
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(),
|
|
|
|
CarbonContext.getThreadLocalCarbonContext().getTenantId()));
|
|
|
|
CarbonContext.getThreadLocalCarbonContext().getTenantId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
String msg = "Error occurred while obtaining group with name: '" + groupName + "'";
|
|
|
|
String msg = "Error occurred while obtaining group with name: '" + groupName + "'";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -280,9 +284,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
deviceGroups = this.groupDAO.getGroups(tenantId);
|
|
|
|
deviceGroups = this.groupDAO.getGroups(tenantId);
|
|
|
|
|
|
|
|
if(deviceGroups != null && !deviceGroups.isEmpty()) {
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -317,9 +323,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
deviceGroups = this.groupDAO.getGroups(request, tenantId);
|
|
|
|
deviceGroups = this.groupDAO.getGroups(request, tenantId);
|
|
|
|
|
|
|
|
if(deviceGroups != null && !deviceGroups.isEmpty()) {
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
for (DeviceGroup group : deviceGroups) {
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
} catch (GroupManagementDAOException e) {
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -365,7 +373,9 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
deviceGroups = this.groupDAO.getGroups(roleList, tenantId);
|
|
|
|
deviceGroups = this.groupDAO.getGroups(roleList, tenantId);
|
|
|
|
for (DeviceGroup deviceGroup : deviceGroups) {
|
|
|
|
for (DeviceGroup deviceGroup : deviceGroups) {
|
|
|
|
|
|
|
|
if(deviceGroup != null && deviceGroup.getGroupId() > 0) {
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(), tenantId));
|
|
|
|
deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(), tenantId));
|
|
|
|
|
|
|
|
}
|
|
|
|
groups.put(deviceGroup.getGroupId(), deviceGroup);
|
|
|
|
groups.put(deviceGroup.getGroupId(), deviceGroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (UserStoreException | SQLException | GroupManagementDAOException e) {
|
|
|
|
} catch (UserStoreException | SQLException | GroupManagementDAOException e) {
|
|
|
@ -428,9 +438,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
GroupManagementDAOFactory.openConnection();
|
|
|
|
allMatchingGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId);
|
|
|
|
allMatchingGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId);
|
|
|
|
|
|
|
|
if(allMatchingGroups != null && !allMatchingGroups.isEmpty()) {
|
|
|
|
for (DeviceGroup group : allMatchingGroups) {
|
|
|
|
for (DeviceGroup group : allMatchingGroups) {
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (GroupManagementDAOException | SQLException e) {
|
|
|
|
} catch (GroupManagementDAOException | SQLException e) {
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
String msg = "Error occurred while retrieving all groups in tenant";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|