|
|
|
@ -1606,6 +1606,8 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|
|
|
|
|
|
|
|
|
List<Integer> createdEventIds;
|
|
|
|
|
int tenantId;
|
|
|
|
|
List<Integer> groupIdsToDelete = new ArrayList<>();
|
|
|
|
|
List<Integer> savedGroupIds;
|
|
|
|
|
try {
|
|
|
|
|
tenantId = DeviceManagementDAOUtil.getTenantId();
|
|
|
|
|
setEventSource(geofenceData.getEventConfig());
|
|
|
|
@ -1616,6 +1618,15 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|
|
|
|
throw new GeoLocationBasedServiceException(msg);
|
|
|
|
|
}
|
|
|
|
|
createdEventIds = eventConfigService.updateEventsOfDeviceGroup(geofenceData.getEventConfig(), removedEventIdList, groupIds);
|
|
|
|
|
EventManagementDAOFactory.openConnection();
|
|
|
|
|
savedGroupIds = geofenceDAO.getGroupIdsOfGeoFence(fenceId);
|
|
|
|
|
geofenceData.setId(fenceId);
|
|
|
|
|
for (Integer savedGroupId : savedGroupIds) {
|
|
|
|
|
if (!geofenceData.getGroupIds().contains(savedGroupId)) {
|
|
|
|
|
groupIdsToDelete.add(savedGroupId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
EventManagementDAOFactory.commitTransaction();
|
|
|
|
|
} catch (EventConfigurationException e) {
|
|
|
|
|
String msg = "Error occurred while updating event configuration data";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
@ -1624,6 +1635,11 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|
|
|
|
String msg = "Error occurred while retrieving tenant id while update geofence data";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
throw new GeoLocationBasedServiceException(msg, e);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
EventManagementDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
@ -1650,6 +1666,11 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
|
|
|
|
|
log.debug("Update geofence event completed.");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
if (!groupIdsToDelete.isEmpty()) {
|
|
|
|
|
eventConfigService.createEventOperationTask(OperationMgtConstants.OperationCodes.EVENT_REVOKE,
|
|
|
|
|
DeviceManagementConstants.EventServices.GEOFENCE, new GeoFenceEventMeta(geofenceData),
|
|
|
|
|
tenantId, groupIdsToDelete);
|
|
|
|
|
}
|
|
|
|
|
eventConfigService.createEventOperationTask(OperationMgtConstants.OperationCodes.EVENT_UPDATE,
|
|
|
|
|
DeviceManagementConstants.EventServices.GEOFENCE,
|
|
|
|
|
new GeoFenceEventMeta(geofenceData), tenantId, geofenceData.getGroupIds());
|
|
|
|
|