mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Add EVENT REVOKE operation for groupIds to delete
This commit is contained in:
parent
8b6eee0a97
commit
7be828a556
@ -1528,7 +1528,11 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|||||||
@Override
|
@Override
|
||||||
public boolean updateGeofence(GeofenceData geofenceData, int fenceId)
|
public boolean updateGeofence(GeofenceData geofenceData, int fenceId)
|
||||||
throws GeoLocationBasedServiceException, EventConfigurationException {
|
throws GeoLocationBasedServiceException, EventConfigurationException {
|
||||||
|
EventConfigurationProviderService eventConfigService;
|
||||||
|
eventConfigService = DeviceManagementDataHolder.getInstance().getEventConfigurationService();
|
||||||
int tenantId;
|
int tenantId;
|
||||||
|
List<Integer> groupIdsToDelete = new ArrayList<>();
|
||||||
|
List<Integer> groupIdsToAdd = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
tenantId = DeviceManagementDAOUtil.getTenantId();
|
tenantId = DeviceManagementDAOUtil.getTenantId();
|
||||||
} catch (DeviceManagementDAOException e) {
|
} catch (DeviceManagementDAOException e) {
|
||||||
@ -1543,8 +1547,6 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|||||||
int updatedRowCount = geofenceDAO.updateGeofence(geofenceData, fenceId);
|
int updatedRowCount = geofenceDAO.updateGeofence(geofenceData, fenceId);
|
||||||
savedGroupIds = geofenceDAO.getGroupIdsOfGeoFence(fenceId);
|
savedGroupIds = geofenceDAO.getGroupIdsOfGeoFence(fenceId);
|
||||||
geofenceData.setId(fenceId);
|
geofenceData.setId(fenceId);
|
||||||
List<Integer> groupIdsToDelete = new ArrayList<>();
|
|
||||||
List<Integer> groupIdsToAdd = new ArrayList<>();
|
|
||||||
for (Integer savedGroupId : savedGroupIds) {
|
for (Integer savedGroupId : savedGroupIds) {
|
||||||
if (!geofenceData.getGroupIds().contains(savedGroupId)) {
|
if (!geofenceData.getGroupIds().contains(savedGroupId)) {
|
||||||
groupIdsToDelete.add(savedGroupId);
|
groupIdsToDelete.add(savedGroupId);
|
||||||
@ -1558,6 +1560,18 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|||||||
geofenceDAO.deleteGeofenceGroupMapping(groupIdsToDelete, fenceId);
|
geofenceDAO.deleteGeofenceGroupMapping(groupIdsToDelete, fenceId);
|
||||||
geofenceDAO.createGeofenceGroupMapping(geofenceData, groupIdsToAdd);
|
geofenceDAO.createGeofenceGroupMapping(geofenceData, groupIdsToAdd);
|
||||||
EventManagementDAOFactory.commitTransaction();
|
EventManagementDAOFactory.commitTransaction();
|
||||||
|
try {
|
||||||
|
if (!groupIdsToDelete.isEmpty()) {
|
||||||
|
eventConfigService.createEventOperationTask(OperationMgtConstants.OperationCodes.EVENT_REVOKE,
|
||||||
|
DeviceManagementConstants.EventServices.GEOFENCE,
|
||||||
|
new GeoFenceEventMeta(geofenceData), tenantId, groupIdsToDelete);
|
||||||
|
}
|
||||||
|
} catch (EventConfigurationException e) {
|
||||||
|
String msg = "Failed while creating EVENT_REVOKE operation creation task entry while updating geo fence "
|
||||||
|
+ geofenceData.getFenceName() + " of the tenant " + tenantId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GeoLocationBasedServiceException(msg, e);
|
||||||
|
}
|
||||||
if (updatedRowCount > 0) {
|
if (updatedRowCount > 0) {
|
||||||
GeoCacheManagerImpl.getInstance().updateGeoFenceInCache(geofenceData, fenceId, tenantId);
|
GeoCacheManagerImpl.getInstance().updateGeoFenceInCache(geofenceData, fenceId, tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user