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