From a68b9098c031bc4785d399215f5dcddf49146bed Mon Sep 17 00:00:00 2001 From: John-Wiens Date: Thu, 6 Jun 2024 13:08:44 -0600 Subject: [PATCH 01/32] Added Endpoint for getting map based upon long lat --- .../accessors/map/ProcessedMapRepository.java | 2 + .../map/ProcessedMapRepositoryImpl.java | 54 +++++++++++++++++++ .../controllers/IntersectionController.java | 23 ++++++++ .../ode/api/controllers/MapController.java | 2 - 4 files changed, 79 insertions(+), 2 deletions(-) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepository.java index 4afb891e..ad8f97b0 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepository.java @@ -22,4 +22,6 @@ public interface ProcessedMapRepository extends DataLoader getMapBroadcastRates(int intersectionID, Long startTime, Long endTime); List getMapBroadcastRateDistribution(int intersectionID, Long startTime, Long endTime); + + List getIntersectionsContainingPoint(double longitude, double latitude); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java index 78693f36..31d60cb5 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java @@ -2,12 +2,14 @@ import java.time.Instant; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import org.bson.Document; import org.bson.conversions.Bson; +import org.locationtech.jts.geom.CoordinateXY; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +41,8 @@ import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties; import us.dot.its.jpo.ode.api.models.IDCount; import us.dot.its.jpo.ode.api.models.IntersectionReferenceData; +import us.dot.its.jpo.conflictmonitor.monitor.models.map.MapBoundingBox; +import us.dot.its.jpo.conflictmonitor.monitor.models.map.MapIndex; import us.dot.its.jpo.geojsonconverter.DateJsonMapper; import us.dot.its.jpo.geojsonconverter.pojos.geojson.LineString; @@ -158,6 +162,54 @@ public List getIntersectionIDs() { return referenceDataList; } + public List getIntersectionsContainingPoint(double longitude, double latitude){ + MongoCollection collection = mongoTemplate.getCollection(collectionName); + DistinctIterable docs = collection.distinct("properties.intersectionId", Integer.class); + MongoCursor results = docs.iterator(); + MapIndex index = new MapIndex(); + Map> mapLookup = new HashMap<>(); + while (results.hasNext()) { + Integer intersectionId = results.next(); + if (intersectionId != null){ + + + Query query = getQuery(intersectionId, null, null, true, true); + + List> maps = findProcessedMaps(query); + + if(maps.size() > 0){ + MapBoundingBox box = new MapBoundingBox(maps.getFirst()); + index.insert(box); + mapLookup.put(intersectionId, maps.getFirst()); + } + } + } + + List mapsContainingPoints = index.mapsContainingPoint(new CoordinateXY(longitude, latitude)); + + List result = new ArrayList<>(); + for(MapBoundingBox box: mapsContainingPoints){ + ProcessedMap map = mapLookup.get(box.getIntersectionId()); + IntersectionReferenceData data = new IntersectionReferenceData(); + data.setIntersectionID(map.getProperties().getIntersectionId()); + data.setRoadRegulatorID("-1"); + data.setRsuIP(map.getProperties().getOriginIp()); + + if(map.getProperties().getIntersectionName() != null && map.getProperties().getIntersectionName().isEmpty()){ + data.setIntersectionName(map.getProperties().getIntersectionName()); + } + + if (map.getProperties().getRefPoint() != null) { + data.setLatitude(map.getProperties().getRefPoint().getLatitude().doubleValue()); + data.setLongitude(map.getProperties().getRefPoint().getLongitude().doubleValue()); + } + result.add(data); + } + + return result; + + } + public List getMapBroadcastRates(int intersectionID, Long startTime, Long endTime) { String startTimeString = Instant.ofEpochMilli(0).toString(); @@ -231,6 +283,8 @@ public List getMapBroadcastRateDistribution(int intersectionID, Long st return results; } + + @Override public void add(ProcessedMap item) { mongoTemplate.save(item, collectionName); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/IntersectionController.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/IntersectionController.java index 0f10046b..11b160be 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/IntersectionController.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/IntersectionController.java @@ -43,4 +43,27 @@ public ResponseEntity> getIntersections( } } + + @CrossOrigin(origins = "http://localhost:3000") + @RequestMapping(value = "/intersection/list/location", method = RequestMethod.GET, produces = "application/json") + @PreAuthorize("hasRole('USER') || hasRole('ADMIN')") + public ResponseEntity> getIntersectionsByLocation( + @RequestParam(name = "longitude", required = true, defaultValue = "false") Double longitude, + @RequestParam(name = "latitude", required = true, defaultValue = "false") Double latitude, + @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) { + + if (testData) { + IntersectionReferenceData ref = new IntersectionReferenceData(); + ref.setRsuIP("10.11.81.12"); + ref.setIntersectionID(12109); + ref.setRoadRegulatorID("0"); + + List refList = new ArrayList<>(); + refList.add(ref); + + return ResponseEntity.ok(refList); + } else { + return ResponseEntity.ok(processedMapRepo.getIntersectionsContainingPoint(longitude, latitude)); + } + } } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/MapController.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/MapController.java index 61168240..18a0bf90 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/MapController.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/MapController.java @@ -82,6 +82,4 @@ public ResponseEntity countMaps( } } - - } \ No newline at end of file From 56dcff0651483fb7f0e4be5710b939d30738e25f Mon Sep 17 00:00:00 2001 From: john-wiens Date: Mon, 10 Jun 2024 16:52:03 -0600 Subject: [PATCH 02/32] Cleaning up Environment Variables --- docker-compose.yml | 3 +++ sample.env | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5f7ffa1a..508685fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,6 +70,9 @@ services: ACM_LOG_TO_CONSOLE: true ACM_LOG_TO_FILE: false ACM_LOG_LEVEL: DEBUG + CM_MONGO_API_USERNAME: ${CM_MONGO_API_USERNAME} + CM_MONGO_API_PASSWORD: ${CM_MONGO_API_PASSWORD} + #KAFKA_BROKER_IP: ${KAFKA_BROKER_IP} #KAFKA_BROKER_PORT: ${KAFKA_BROKER_PORT} logging: diff --git a/sample.env b/sample.env index e5b256b3..494bfb27 100644 --- a/sample.env +++ b/sample.env @@ -6,11 +6,12 @@ KAFKA_BROKER_PORT=9092 # Set to the directory where the source code is. Generally the location of this file. DOCKER_HOST_DIR= +# Put anything you want for the NEXTAUTH_SECRET, and KEYCLOAK_CLIENT_SECRET NEXTAUTH_SECRET= NEXTAUTH_URL=http://${DOCKER_HOST_IP}:3000 -KEYCLOAK_CLIENT_ID= +KEYCLOAK_CLIENT_ID=conflictvisualizer-gui KEYCLOAK_CLIENT_SECRET= -KEYCLOAK_REALM= +KEYCLOAK_REALM=conflictvisualizer MAPBOX_TOKEN= MAPBOX_STYLE_URL= @@ -27,6 +28,6 @@ API_WS_URL=ws://${DOCKER_HOST_IP}:8081 DB_HOST_IP=${DOCKER_HOST_IP} DB_HOST_PORT=27017 - -CM_MONGO_API_PASSWORD=api CM_MONGO_API_USERNAME=api +CM_MONGO_API_PASSWORD=api + From 75262e9ba8661333d942f7a9dfa659e6a00143de Mon Sep 17 00:00:00 2001 From: john-wiens Date: Tue, 11 Jun 2024 15:17:15 -0600 Subject: [PATCH 03/32] Added Full Counts function calls --- .../ConnectionOfTravelAssessmentRepository.java | 4 ++++ .../ConnectionOfTravelAssessmentRepositoryImpl.java | 11 ++++++++++- .../LaneDirectionOfTravelAssessmentRepository.java | 2 ++ ...neDirectionOfTravelAssessmentRepositoryImpl.java | 13 ++++++++++++- .../StopLineStopAssessmentRepository.java | 2 ++ .../StopLineStopAssessmentRepositoryImpl.java | 10 +++++++++- .../SignalStateEventAssessmentRepository.java | 2 ++ .../SignalStateEventAssessmentRepositoryImpl.java | 9 ++++++++- .../events/BsmEvent/BsmEventRepository.java | 2 ++ .../events/BsmEvent/BsmEventRepositoryImpl.java | 9 ++++++++- .../ConnectionOfTravelEventRepository.java | 2 ++ .../ConnectionOfTravelEventRepositoryImpl.java | 10 +++++++++- ...tersectionReferenceAlignmentEventRepository.java | 2 ++ ...ectionReferenceAlignmentEventRepositoryImpl.java | 10 +++++++++- .../LaneDirectionOfTravelEventRepository.java | 2 ++ .../LaneDirectionOfTravelEventRepositoryImpl.java | 9 ++++++++- .../MapBroadcastRateEventRepository.java | 2 ++ .../MapBroadcastRateEventRepositoryImpl.java | 11 ++++++++++- .../MapMinimumDataEventRepository.java | 2 ++ .../MapMinimumDataEventRepositoryImpl.java | 9 ++++++++- .../SignalGroupAlignmentEventRepository.java | 2 ++ .../SignalGroupAlignmentEventRepositoryImpl.java | 10 +++++++++- .../SignalStateConflictEventRepository.java | 2 ++ .../SignalStateConflictEventRepositoryImpl.java | 10 +++++++++- .../SignalStateEventRepository.java | 2 ++ .../SignalStateEventRepositoryImpl.java | 10 +++++++++- .../SignalStateStopEventRepository.java | 2 ++ .../SignalStateStopEventRepositoryImpl.java | 10 +++++++++- .../SpatBroadcastRateEventRepository.java | 2 ++ .../SpatBroadcastRateEventRepositoryImpl.java | 9 ++++++++- .../SpatMinimumDataEventRepository.java | 2 ++ .../SpatMinimumDataEventRepositoryImpl.java | 9 ++++++++- .../TimeChangeDetailsEventRepository.java | 2 ++ .../TimeChangeDetailsEventRepositoryImpl.java | 9 ++++++++- .../api/accessors/map/OdeMapDataRepositoryImpl.java | 9 ++++++++- .../accessors/map/ProcessedMapRepositoryImpl.java | 9 ++++++++- .../ActiveNotificationRepository.java | 2 ++ .../ActiveNotificationRepositoryImpl.java | 9 ++++++++- .../ConnectionOfTravelNotificationRepository.java | 2 ++ ...onnectionOfTravelNotificationRepositoryImpl.java | 9 ++++++++- ...ionReferenceAlignmentNotificationRepository.java | 2 ++ ...eferenceAlignmentNotificationRepositoryImpl.java | 10 +++++++++- ...LaneDirectionOfTravelNotificationRepository.java | 2 ++ ...DirectionOfTravelNotificationRepositoryImpl.java | 10 +++++++++- .../MapBroadcastRateNotificationRepository.java | 2 ++ .../MapBroadcastRateNotificationRepositoryImpl.java | 10 +++++++++- .../SignalGroupAlignmentNotificationRepository.java | 2 ++ ...nalGroupAlignmentNotificationRepositoryImpl.java | 9 ++++++++- .../SignalStateConflictNotificationRepository.java | 2 ++ ...gnalStateConflictNotificationRepositoryImpl.java | 10 +++++++++- .../SpatBroadcastRateNotificationRepository.java | 2 ++ ...SpatBroadcastRateNotificationRepositoryImpl.java | 9 +++++++++ .../StopLinePassageNotificationRepository.java | 2 ++ .../StopLinePassageNotificationRepositoryImpl.java | 9 ++++++++- .../StopLineStopNotificationRepository.java | 2 ++ .../StopLineStopNotificationRepositoryImpl.java | 10 +++++++++- .../TimeChangeDetailsNotificationRepository.java | 2 ++ ...TimeChangeDetailsNotificationRepositoryImpl.java | 10 +++++++++- .../ode/api/accessors/reports/ReportRepository.java | 2 ++ .../api/accessors/reports/ReportRepositoryImpl.java | 8 ++++++++ .../api/accessors/spat/OdeSpatDataRepository.java | 2 ++ .../accessors/spat/OdeSpatDataRepositoryImpl.java | 9 ++++++++- .../api/accessors/spat/ProcessedSpatRepository.java | 2 ++ .../accessors/spat/ProcessedSpatRepositoryImpl.java | 10 +++++++++- .../jpo/ode/api/accessors/users/UserRepository.java | 2 ++ .../ode/api/accessors/users/UserRepositoryImpl.java | 8 ++++++++ 66 files changed, 361 insertions(+), 31 deletions(-) diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepository.java index 2b8403ec..e12550c2 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepository.java @@ -11,7 +11,11 @@ public interface ConnectionOfTravelAssessmentRepository extends DataLoader find(Query query); + + } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepositoryImpl.java index fc86954a..2fe0a0c4 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/ConnectionOfTravelAssessment/ConnectionOfTravelAssessmentRepositoryImpl.java @@ -51,11 +51,20 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool return query; } + public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, ConnectionOfTravelAssessment.class, collectionName); } + // Removes the result limit on a count query. + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, ConnectionOfTravelAssessment.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, ConnectionOfTravelAssessment.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepository.java index 4f74fe26..03636be3 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepository.java @@ -11,6 +11,8 @@ public interface LaneDirectionOfTravelAssessmentRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepositoryImpl.java index e70dee6f..bc1dd54c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/LaneDirectionOfTravelAssessment/LaneDirectionOfTravelAssessmentRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.assessments.LaneDirectionOfTravelAssessment; import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties; @@ -51,14 +52,24 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool }else{ query.limit(props.getMaximumResponseSize()); } + return query; } + + public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, LaneDirectionOfTravelAssessment.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, LaneDirectionOfTravelAssessment.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, LaneDirectionOfTravelAssessment.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepository.java index 1edea9d8..feb8afce 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepository.java @@ -11,6 +11,8 @@ public interface StopLineStopAssessmentRepository extends DataLoader find(Query query); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepositoryImpl.java index f1ebc584..576bda1f 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateAssessment/StopLineStopAssessmentRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.assessments.StopLineStopAssessment; import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties; @@ -52,10 +53,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, StopLineStopAssessment.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLineStopAssessment.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLineStopAssessment.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepository.java index e8868095..7bcff32b 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepository.java @@ -13,5 +13,7 @@ public interface SignalStateEventAssessmentRepository extends DataLoader find(Query query); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepositoryImpl.java index dbd2974e..907c4e00 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/assessments/SignalStateEventAssessment/SignalStateEventAssessmentRepositoryImpl.java @@ -53,10 +53,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, StopLinePassageAssessment.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLinePassageAssessment.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLinePassageAssessment.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepository.java index 8181847d..5bc10204 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepository.java @@ -12,6 +12,8 @@ public interface BsmEventRepository extends DataLoader{ Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest); long getQueryResultCount(Query query); + + long getQueryFullCount(Query query); List find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepositoryImpl.java index a0d5d54b..2a994244 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmEvent/BsmEventRepositoryImpl.java @@ -65,10 +65,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, BsmEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, BsmEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { List documents = mongoTemplate.find(query, Map.class, collectionName); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepository.java index acbff3cb..90e72c37 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepository.java @@ -13,6 +13,8 @@ public interface ConnectionOfTravelEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepositoryImpl.java index 1ad1e3ac..e7337a10 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/ConnectionOfTravelEvent/ConnectionOfTravelEventRepositoryImpl.java @@ -9,6 +9,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.events.ConnectionOfTravelEvent; import org.springframework.data.domain.Sort; @@ -59,10 +60,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, ConnectionOfTravelEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, ConnectionOfTravelEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, ConnectionOfTravelEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepository.java index abad84a5..84649419 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepository.java @@ -12,6 +12,8 @@ public interface IntersectionReferenceAlignmentEventRepository extends DataLoade Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest); long getQueryResultCount(Query query); + + long getQueryFullCount(Query query); List find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepositoryImpl.java index d7e39803..36245dd9 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/IntersectionReferenceAlignmentEvent/IntersectionReferenceAlignmentEventRepositoryImpl.java @@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.events.IntersectionReferenceAlignmentEvent; import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties; import us.dot.its.jpo.ode.api.models.IDCount; @@ -58,11 +59,18 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, IntersectionReferenceAlignmentEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, IntersectionReferenceAlignmentEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, IntersectionReferenceAlignmentEvent.class, collectionName); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepository.java index 5b7ae4cc..74ad3bb1 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepository.java @@ -13,6 +13,8 @@ public interface LaneDirectionOfTravelEventRepository extends DataLoader find(Query query); List getLaneDirectionOfTravelEventsByDay(int intersectionID, Long startTime, Long endTime); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepositoryImpl.java index c6c599d7..5a151da4 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/LaneDirectionOfTravelEvent/LaneDirectionOfTravelEventRepositoryImpl.java @@ -63,10 +63,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, LaneDirectionOfTravelEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, LaneDirectionOfTravelEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, LaneDirectionOfTravelEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepository.java index f688581c..bc782867 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepository.java @@ -11,6 +11,8 @@ public interface MapBroadcastRateEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepositoryImpl.java index 07dcd43c..cf7109b5 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapBroadcastRateEvents/MapBroadcastRateEventRepositoryImpl.java @@ -58,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, MapBroadcastRateEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, MapBroadcastRateEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, MapBroadcastRateEvent.class, collectionName); } @@ -91,6 +98,8 @@ public List getMapBroadcastRateEventsByDay(int intersectionID, Long sta return results; } + + @Override public void add(MapBroadcastRateEvent item) { mongoTemplate.save(item, collectionName); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepository.java index 4bca2440..56cd780b 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepository.java @@ -10,6 +10,8 @@ public interface MapMinimumDataEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepositoryImpl.java index 5e949ccf..ec512707 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMinimumDataEvent/MapMinimumDataEventRepositoryImpl.java @@ -58,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, MapMinimumDataEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, MapMinimumDataEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, MapMinimumDataEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepository.java index 8d4ab572..631f0be7 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepository.java @@ -12,6 +12,8 @@ public interface SignalGroupAlignmentEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepositoryImpl.java index 0c948220..6616b4dc 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalGroupAlignmentEvent/SignalGroupAlignmentEventRepositoryImpl.java @@ -11,6 +11,7 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalGroupAlignmentEvent; + import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.aggregation.Aggregation; @@ -59,10 +60,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, SignalGroupAlignmentEvent.class, "CmSignalGroupAlignmentEvents"); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SignalGroupAlignmentEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SignalGroupAlignmentEvent.class, "CmSignalGroupAlignmentEvents"); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepository.java index 67d72b1b..c8da23b8 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepository.java @@ -13,6 +13,8 @@ public interface SignalStateConflictEventRepository extends DataLoader find(Query query); List getSignalStateConflictEventsByDay(int intersectionID, Long startTime, Long endTime); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepositoryImpl.java index 430d6fba..25c25b7c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateConflictEvent/SignalStateConflictEventRepositoryImpl.java @@ -9,6 +9,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalStateConflictEvent; import org.springframework.data.domain.Sort; @@ -57,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, SignalStateConflictEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SignalStateConflictEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SignalStateConflictEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepository.java index 81a3ac44..74731943 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepository.java @@ -12,6 +12,8 @@ public interface SignalStateEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepositoryImpl.java index b9b8a15a..6b02ec19 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateEvent/SignalStateEventRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; import org.springframework.data.domain.Sort; + import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLinePassageEvent; import org.springframework.data.mongodb.core.aggregation.Aggregation; @@ -57,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, StopLinePassageEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLinePassageEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLinePassageEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepository.java index 3f004285..87c8d299 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepository.java @@ -12,6 +12,8 @@ public interface SignalStateStopEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepositoryImpl.java index 873b6fe2..ff6a9c5f 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SignalStateStopEvent/SignalStateStopEventRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; import org.springframework.data.domain.Sort; + import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLineStopEvent; import org.springframework.data.mongodb.core.aggregation.Aggregation; @@ -57,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, StopLineStopEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLinePassageEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLineStopEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepository.java index 3b4fc320..c00124b8 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepository.java @@ -11,6 +11,8 @@ public interface SpatBroadcastRateEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepositoryImpl.java index fcaac8bc..13903564 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatBroadcastRateEvent/SpatBroadcastRateEventRepositoryImpl.java @@ -59,10 +59,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, SpatBroadcastRateEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SpatBroadcastRateEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SpatBroadcastRateEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepository.java index bf723faf..b8880e2a 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepository.java @@ -11,6 +11,8 @@ public interface SpatMinimumDataEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepositoryImpl.java index c921cc29..86577978 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMinimumDataEvent/SpatMinimumDataEventRepositoryImpl.java @@ -59,10 +59,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, SpatMinimumDataEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SpatMinimumDataEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SpatMinimumDataEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepository.java index 95e11a02..2ddd1cd1 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepository.java @@ -12,6 +12,8 @@ public interface TimeChangeDetailsEventRepository extends DataLoader find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepositoryImpl.java index d968e4bb..b1e24edf 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/TimeChangeDetailsEvent/TimeChangeDetailsEventRepositoryImpl.java @@ -58,10 +58,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, TimeChangeDetailsEvent.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, TimeChangeDetailsEvent.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, TimeChangeDetailsEvent.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/OdeMapDataRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/OdeMapDataRepositoryImpl.java index 07631ee7..90395653 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/OdeMapDataRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/OdeMapDataRepositoryImpl.java @@ -53,10 +53,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, OdeMapData.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, OdeMapData.class, collectionName); + query.limit(limit); + return count; + } + public List findMaps(Query query) { return mongoTemplate.find(query, OdeMapData.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java index 78693f36..61748fd0 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java @@ -92,10 +92,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, ProcessedMap.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, ProcessedMap.class, collectionName); + query.limit(limit); + return count; + } + public List> findProcessedMaps(Query query) { List documents = mongoTemplate.find(query, Map.class, collectionName); List> convertedList = new ArrayList<>(); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepository.java index 4f823180..616098bf 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepository.java @@ -9,6 +9,8 @@ public interface ActiveNotificationRepository extends DataLoader{ Query getQuery(Integer intersectionID, Integer roadRegulatorID, String notificationType, String key); long getQueryResultCount(Query query); + + long getQueryFullCount(Query query); List find(Query query); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java index 54648a49..84b03a51 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java @@ -51,10 +51,17 @@ public Query getQuery(Integer intersectionID, Integer roadRegulatorID, String no } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, Notification.class, "CmNotification"); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, ProcessedMap.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { List dbObjects = mongoTemplate.find(query, Bson.class, collectionName); diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepository.java index 16754e3e..a88b7d2d 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepository.java @@ -11,6 +11,8 @@ public interface ConnectionOfTravelNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepositoryImpl.java index 89bbe990..dfdb74e3 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ConnectionOfTravelNotification/ConnectionOfTravelNotificationRepositoryImpl.java @@ -46,10 +46,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, ConnectionOfTravelNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, ConnectionOfTravelNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, ConnectionOfTravelNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepository.java index 3f2aa124..46872c34 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepository.java @@ -10,6 +10,8 @@ public interface IntersectionReferenceAlignmentNotificationRepository extends Da Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest); long getQueryResultCount(Query query); + + long getQueryFullCount(Query query); List find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepositoryImpl.java index 215f4dcd..7d40e3e8 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/IntersectionReferenceAlignmentNotification/IntersectionReferenceAlignmentNotificationRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.IntersectionReferenceAlignmentNotification; @Component @@ -45,10 +46,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, IntersectionReferenceAlignmentNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, IntersectionReferenceAlignmentNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, IntersectionReferenceAlignmentNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepository.java index 2800028d..ab55c99c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepository.java @@ -10,6 +10,8 @@ public interface LaneDirectionOfTravelNotificationRepository extends DataLoader< Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest); long getQueryResultCount(Query query); + + long getQueryFullCount(Query query); List find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepositoryImpl.java index ff3ba244..fd55b95d 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/LaneDirectionOfTravelNotificationRepo/LaneDirectionOfTravelNotificationRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.LaneDirectionOfTravelNotification; @Component @@ -47,10 +48,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, LaneDirectionOfTravelNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, LaneDirectionOfTravelNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, LaneDirectionOfTravelNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepository.java index 6d733ca0..ea77a350 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepository.java @@ -11,6 +11,8 @@ public interface MapBroadcastRateNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepositoryImpl.java index 4781ce6a..57c578fe 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/MapBroadcastRateNotification/MapBroadcastRateNotificationRepositoryImpl.java @@ -9,6 +9,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.broadcast_rate.MapBroadcastRateNotification; @Component @@ -46,10 +47,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, MapBroadcastRateNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, MapBroadcastRateNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, MapBroadcastRateNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepository.java index c00d4d07..6de3cd87 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepository.java @@ -10,6 +10,8 @@ public interface SignalGroupAlignmentNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepositoryImpl.java index 5e633837..7a50ffd0 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalGroupAlignmentNotificationRepo/SignalGroupAlignmentNotificationRepositoryImpl.java @@ -46,10 +46,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query) { - query.limit(-1); return mongoTemplate.count(query, SignalGroupAlignmentNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SignalGroupAlignmentNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SignalGroupAlignmentNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepository.java index 9a468453..10df7cc2 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepository.java @@ -11,6 +11,8 @@ public interface SignalStateConflictNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepositoryImpl.java index 9a9b5154..e47e1144 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SignalStateConflictNotification/SignalStateConflictNotificationRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.SignalStateConflictNotification; @@ -49,10 +50,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, SignalStateConflictNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SignalStateConflictNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SignalStateConflictNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepository.java index 16bdcd02..511a373f 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepository.java @@ -11,6 +11,8 @@ public interface SpatBroadcastRateNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepositoryImpl.java index f8ef9496..caaca97b 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/SpatBroadcastRateNotification/SpatBroadcastRateNotificationRepositoryImpl.java @@ -9,6 +9,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.broadcast_rate.SpatBroadcastRateNotification; @Component @@ -50,6 +51,14 @@ public long getQueryResultCount(Query query) { return mongoTemplate.count(query, SpatBroadcastRateNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, SpatBroadcastRateNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, SpatBroadcastRateNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepository.java index 0a1297e6..0ae36b10 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepository.java @@ -10,6 +10,8 @@ public interface StopLinePassageNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepositoryImpl.java index 70b4d392..7d1045ef 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLinePassageNotification/StopLinePassageNotificationRepositoryImpl.java @@ -47,10 +47,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, StopLinePassageNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLinePassageNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLinePassageNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepository.java index 73ccf6f8..e282800c 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepository.java @@ -10,6 +10,8 @@ public interface StopLineStopNotificationRepository extends DataLoader find(Query query); } \ No newline at end of file diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepositoryImpl.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepositoryImpl.java index 1c16fab6..980ee7a0 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepositoryImpl.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/StopLineStopNotification/StopLineStopNotificationRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Component; + import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.StopLineStopNotification; @Component @@ -47,10 +48,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool } public long getQueryResultCount(Query query){ - query.limit(-1); return mongoTemplate.count(query, StopLineStopNotification.class, collectionName); } + public long getQueryFullCount(Query query){ + int limit = query.getLimit(); + query.limit(-1); + long count = mongoTemplate.count(query, StopLineStopNotification.class, collectionName); + query.limit(limit); + return count; + } + public List find(Query query) { return mongoTemplate.find(query, StopLineStopNotification.class, collectionName); } diff --git a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/TimeChangeDetailsNotification/TimeChangeDetailsNotificationRepository.java b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/TimeChangeDetailsNotification/TimeChangeDetailsNotificationRepository.java index a742f7e4..47d6e029 100644 --- a/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/TimeChangeDetailsNotification/TimeChangeDetailsNotificationRepository.java +++ b/api/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/TimeChangeDetailsNotification/TimeChangeDetailsNotificationRepository.java @@ -10,6 +10,8 @@ public interface TimeChangeDetailsNotificationRepository extends DataLoader