Skip to content

Commit

Permalink
Merge branch 'develop' into live-view
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob6838 committed Dec 28, 2023
2 parents cb5bdec + 515e108 commit dd0721e
Show file tree
Hide file tree
Showing 53 changed files with 436 additions and 1,439 deletions.
2 changes: 1 addition & 1 deletion jpo-conflictmonitor
Submodule jpo-conflictmonitor updated from 63cd37 to e8187d
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class ConflictMonitorApiProperties {
private String kafkaProducerType = AppContext.DEFAULT_KAFKA_PRODUCER_TYPE;
private Boolean verboseJson = false;
private Boolean load = false;
private String cmServerURL = "";
private String emailBroker = "";
private String emailFromAddress = "noreply@cimms.com";
private int importProcessorBufferSize = OdePlugin.INPUT_STREAM_BUFFER_SIZE;
Expand Down Expand Up @@ -138,6 +139,15 @@ public void setLoad(boolean load) {
this.load = load;
}

public String getCmServerURL() {
return cmServerURL;
}

@Value("${cmServerURL}")
public void setCmServerURL(String cmServerUrl) {
this.cmServerURL = cmServerUrl;
}

public String getEmailBroker() {
return emailBroker;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package us.dot.its.jpo.ode.api.accessors.assessments.ConnectionOfTravelAssessment;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -30,14 +30,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
}

if (startTime == null) {
startTime = 0L;
Date startTimeDate = new Date(0);
Date endTimeDate = new Date();

if (startTime != null) {
startTimeDate = new Date(startTime);
}
if (endTime == null) {
endTime = Instant.now().toEpochMilli();
if (endTime != null) {
endTimeDate = new Date(endTime);
}

query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTime).lte(endTime));
query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTimeDate).lte(endTimeDate));

if (latest) {
query.with(Sort.by(Sort.Direction.DESC, "assessmentGeneratedAt"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package us.dot.its.jpo.ode.api.accessors.assessments.LaneDirectionOfTravelAssessment;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -34,14 +34,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
}

if (startTime == null) {
startTime = 0L;
Date startTimeDate = new Date(0);
Date endTimeDate = new Date();

if (startTime != null) {
startTimeDate = new Date(startTime);
}
if (endTime == null) {
endTime = Instant.now().toEpochMilli();
if (endTime != null) {
endTimeDate = new Date(endTime);
}

query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTime).lte(endTime));
query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTimeDate).lte(endTimeDate));
if (latest) {
query.with(Sort.by(Sort.Direction.DESC, "assessmentGeneratedAt"));
query.limit(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package us.dot.its.jpo.ode.api.accessors.assessments.SignalStateAssessment;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -31,14 +31,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
}

if (startTime == null) {
startTime = 0L;
Date startTimeDate = new Date(0);
Date endTimeDate = new Date();

if (startTime != null) {
startTimeDate = new Date(startTime);
}
if (endTime == null) {
endTime = Instant.now().toEpochMilli();
if (endTime != null) {
endTimeDate = new Date(endTime);
}

query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTime).lte(endTime));
query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTimeDate).lte(endTimeDate));
if (latest) {
query.with(Sort.by(Sort.Direction.DESC, "assessmentGeneratedAt"));
query.limit(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package us.dot.its.jpo.ode.api.accessors.assessments.SignalStateEventAssessment;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -32,14 +32,17 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
}

if (startTime == null) {
startTime = 0L;
Date startTimeDate = new Date(0);
Date endTimeDate = new Date();

if (startTime != null) {
startTimeDate = new Date(startTime);
}
if (endTime == null) {
endTime = Instant.now().toEpochMilli();
if (endTime != null) {
endTimeDate = new Date(endTime);
}

query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTime).lte(endTime));
query.addCriteria(Criteria.where("assessmentGeneratedAt").gte(startTimeDate).lte(endTimeDate));
if (latest) {
query.with(Sort.by(Sort.Direction.DESC, "assessmentGeneratedAt"));
query.limit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public List<OdeBsmData> findOdeBsmDataGeo(String originIp, String vehicleId, Lon
}
query.limit(props.getMaximumResponseSize());
query.addCriteria(Criteria.where("metadata.odeReceivedAt").gte(startTimeString).lte(endTimeString));
query.fields().exclude("recordGeneratedAt");

if (longitude!=null && latitude!=null && distance!=null){
Double[] latitudes = calculateLatitudes(latitude, distance);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.ConnectionOfTravelEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -15,7 +14,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

package us.dot.its.jpo.ode.api.accessors.events.IntersectionReferenceAlignmentEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.LaneDirectionOfTravelEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -17,7 +16,6 @@
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ArithmeticOperators;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package us.dot.its.jpo.ode.api.accessors.events.MapBroadcastRateEvents;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -16,7 +15,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package us.dot.its.jpo.ode.api.accessors.events.MapMinimumDataEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -15,7 +14,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.conflictmonitor.monitor.models.events.minimum_data.MapMinimumDataEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.SignalStateConflictEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -15,7 +14,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.SignalStateEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -15,7 +14,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.SignalStateStopEvent;

import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -15,7 +14,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package us.dot.its.jpo.ode.api.accessors.events.SpatBroadcastRateEvent;


import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -16,7 +15,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.conflictmonitor.monitor.models.events.broadcast_rate.SpatBroadcastRateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package us.dot.its.jpo.ode.api.accessors.events.SpatMinimumDataEvent;


import java.time.Instant;
import java.util.Date;
import java.util.List;

Expand All @@ -16,7 +15,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.conflictmonitor.monitor.models.events.minimum_data.SpatMinimumDataEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package us.dot.its.jpo.ode.api.accessors.events.TimeChangeDetailsEvent;

import java.time.Instant;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,7 +15,6 @@

import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.ConvertOperators;
import org.springframework.data.mongodb.core.aggregation.DateOperators;

import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
}

query.addCriteria(Criteria.where("properties.timeStamp").gte(startTimeString).lte(endTimeString));
query.fields().exclude("recordGeneratedAt");
return query;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,13 @@
import java.util.List;
import java.util.Map;

import org.bson.BsonDocument;
import org.bson.conversions.Bson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver;
import com.mongodb.DBObject;

import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.ConnectionOfTravelNotification;
import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.IntersectionReferenceAlignmentNotification;
import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.LaneDirectionOfTravelNotification;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package us.dot.its.jpo.ode.api.accessors.notifications.ConnectionOfTravelNotification;

import java.time.Instant;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -26,14 +26,18 @@ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, bool
query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
}

if(startTime == null){
startTime = Instant.ofEpochMilli(0).toEpochMilli();
Date startTimeDate = new Date(0);
Date endTimeDate = new Date();

if (startTime != null) {
startTimeDate = new Date(startTime);
}
if(endTime == null){
endTime = Instant.now().toEpochMilli();
if (endTime != null) {
endTimeDate = new Date(endTime);
}

query.addCriteria(Criteria.where("notificationGeneratedAt").gte(startTime).lte(endTime));
query.addCriteria(Criteria.where("notificationGeneratedAt").gte(startTimeDate).lte(endTimeDate));

if(latest){
query.with(Sort.by(Sort.Direction.DESC, "notificationGeneratedAt"));
query.limit(1);
Expand Down
Loading

0 comments on commit dd0721e

Please sign in to comment.