Skip to content

Commit

Permalink
Removed Latest Tag from Counts Endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Wiens committed Apr 30, 2024
1 parent ec94c82 commit a0d830a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
Expand Down Expand Up @@ -86,13 +85,12 @@ public ResponseEntity<Long> countConnectionOfTravelAssessment(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = connectionOfTravelAssessmentRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = connectionOfTravelAssessmentRepo.getQuery(intersectionID, startTime, endTime, false);
long count = connectionOfTravelAssessmentRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Connection of Travel Assessments");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -131,13 +129,12 @@ public ResponseEntity<Long> countLaneDirectionOfTravelAssessment(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = laneDirectionOfTravelAssessmentRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = laneDirectionOfTravelAssessmentRepo.getQuery(intersectionID, startTime, endTime, false);
long count = laneDirectionOfTravelAssessmentRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Lane Direction of Travel Assessments");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -177,14 +174,13 @@ public ResponseEntity<Long> countSignalStateAssessment(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {

Query query = stopLineStopAssessmentRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = stopLineStopAssessmentRepo.getQuery(intersectionID, startTime, endTime, false);
long count = stopLineStopAssessmentRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Lane Direction of Travel Assessments");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -222,13 +218,12 @@ public ResponseEntity<Long> countSignalStateEventAssessment(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = signalStateEventAssessmentRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = signalStateEventAssessmentRepo.getQuery(intersectionID, startTime, endTime, false);
long count = signalStateEventAssessmentRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Signal State Event Assessments");
return ResponseEntity.ok(count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ public ResponseEntity<Long> countIntersectionReferenceAlignmentEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = intersectionReferenceAlignmentEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = intersectionReferenceAlignmentEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = intersectionReferenceAlignmentEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Intersection Reference Alignment Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -185,13 +184,12 @@ public ResponseEntity<Long> countConnectionOfTravelEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = connectionOfTravelEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = connectionOfTravelEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = connectionOfTravelEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Connection of Travel Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -243,13 +241,12 @@ public ResponseEntity<Long> countLaneDirectionOfTravelEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = laneDirectionOfTravelEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = laneDirectionOfTravelEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = laneDirectionOfTravelEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Lane Direction of Travel Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -301,13 +298,12 @@ public ResponseEntity<Long> countSignalGroupAlignmentEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = signalGroupAlignmentEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = signalGroupAlignmentEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = signalGroupAlignmentEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Signal Group Alignment Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -359,13 +355,12 @@ public ResponseEntity<Long> countSignalStateConflictEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = signalStateConflictEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = signalStateConflictEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = signalStateConflictEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Signal Group Alignment Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -417,13 +412,12 @@ public ResponseEntity<Long> countSignalStateEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = signalStateEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = signalStateEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = signalStateEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Signal State Count");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -477,13 +471,12 @@ public ResponseEntity<Long> countSignalStateStopEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = signalStateStopEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = signalStateStopEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = signalStateStopEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Signal State Stop Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -535,13 +528,12 @@ public ResponseEntity<Long> countTimeChangeDetailsEvent(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = timeChangeDetailsEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = timeChangeDetailsEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = timeChangeDetailsEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Time Change Detail Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -592,13 +584,12 @@ public ResponseEntity<Long> countSpatMinimumDataEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = spatMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = spatMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = spatMinimumDataEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Spat Minimum Data Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -633,13 +624,12 @@ public ResponseEntity<Long> countMapMinimumDataEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = mapMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = mapMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = mapMinimumDataEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Map Minimum Data Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -676,13 +666,12 @@ public ResponseEntity<Long> countMapBroadcastRateEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = mapBroadcastRateEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = mapBroadcastRateEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = mapBroadcastRateEventRepo.getQueryResultCount(query);
System.out.println("Map Broadcast Rate Event");
logger.info("Found: " + count + " Map Broadcast Rates");
Expand Down Expand Up @@ -720,13 +709,12 @@ public ResponseEntity<Long> countSpatBroadcastRateEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = spatBroadcastRateEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = spatBroadcastRateEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = spatBroadcastRateEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " Spat Broadcast Rate Events");
return ResponseEntity.ok(count);
Expand Down Expand Up @@ -762,13 +750,12 @@ public ResponseEntity<Long> countBsmEvents(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(1L);
} else {
Query query = bsmEventRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = bsmEventRepo.getQuery(intersectionID, startTime, endTime, false);
long count = bsmEventRepo.getQueryResultCount(query);
logger.info("Found: " + count + " BSM Events");
return ResponseEntity.ok(count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ public ResponseEntity<Long> countMaps(
@RequestParam(name = "intersection_id", required = false) Integer intersectionID,
@RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
@RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
@RequestParam(name= "latest", required = false, defaultValue = "false") boolean latest,
@RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {

if (testData) {
return ResponseEntity.ok(5L);
} else {
Query query = processedMapRepo.getQuery(intersectionID, startTime, endTime, latest);
Query query = processedMapRepo.getQuery(intersectionID, startTime, endTime, false);
long count = processedMapRepo.getQueryResultCount(query);

logger.info("Found: " + count + "Processed Map Messages");
Expand Down
Loading

0 comments on commit a0d830a

Please sign in to comment.