diff --git a/docker-compose.yml b/docker-compose.yml index d2f41717b..c567d0d72 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,10 +12,3 @@ services: options: max-size: "10m" max-file: "5" - # networks: - # - conflictmonitor - -# networks: -# conflictmonitor: -# name: conflictmonitor_network -# external: true diff --git a/jpo-conflictvisualizer-api/pom.xml b/jpo-conflictvisualizer-api/pom.xml index 6d7a47748..cb82e6018 100644 --- a/jpo-conflictvisualizer-api/pom.xml +++ b/jpo-conflictvisualizer-api/pom.xml @@ -21,8 +21,6 @@ jacoco ${project.basedir}/target/site/jacoco/jacoco.xml java - usdot-jpo-ode @@ -92,11 +90,6 @@ spring-kafka-test test - usdot.jpo.ode jpo-ode-core @@ -182,12 +175,6 @@ org.springframework.boot spring-boot-starter-oauth2-resource-server - - - - - - org.keycloak keycloak-admin-client diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictApiApplication.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictApiApplication.java index 7089d06fd..afaa9195e 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictApiApplication.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictApiApplication.java @@ -14,10 +14,11 @@ @EnableWebMvc @SpringBootApplication @EnableScheduling -@ComponentScan(basePackages = {"us.dot.its.jpo.ode.api", "us.dot.its.jpo.geojsonconverter.validator"}) +@ComponentScan(basePackages = { "us.dot.its.jpo.ode.api", "us.dot.its.jpo.geojsonconverter.validator" }) public class ConflictApiApplication extends SpringBootServletInitializer { - @Autowired DecoderManager manager; + @Autowired + DecoderManager manager; @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { @@ -28,21 +29,6 @@ public static void main(String[] args) { SpringApplication.run(ConflictApiApplication.class, args); System.out.println("Started Conflict Monitor API"); System.out.println("Conflict Monitor API docs page found here: http://localhost:8081/swagger-ui/index.html"); - System.out.println("Startup Complete"); + System.out.println("Startup Complete"); } - -// @Bean -// public WebMvcConfigurer corsConfigurer() { -// return new WebMvcConfigurer() { -// @Override -// public void addCorsMappings(CorsRegistry registry) { -// ConflictMonitorApiProperties props = new ConflictMonitorApiProperties(); -// registry.addMapping("/**").allowedOrigins(props.getCors()); -// // registry.addMapping("/**").allowedMethods("*"); -// } -// }; -// } - - - } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java index a47cbd8fa..f59759481 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ConflictMonitorApiProperties.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import org.springframework.boot.context.properties.ConfigurationPropertiesScan; import us.dot.its.jpo.conflictmonitor.AlwaysContinueProductionExceptionHandler; import us.dot.its.jpo.geojsonconverter.DateJsonMapper; import org.springframework.context.annotation.Bean; @@ -37,7 +36,6 @@ import us.dot.its.jpo.ode.eventlog.EventLogger; import us.dot.its.jpo.ode.util.CommonUtils; - import org.apache.commons.lang3.SystemUtils; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.serialization.Serdes; @@ -66,8 +64,10 @@ public class ConflictMonitorApiProperties { private static final Logger logger = LoggerFactory.getLogger(ConflictMonitorApiProperties.class); private boolean confluentCloudEnabled = false; - @Getter private String confluentKey = null; - @Getter private String confluentSecret = null; + @Getter + private String confluentKey = null; + @Getter + private String confluentSecret = null; private String version; public static final int OUTPUT_SCHEMA_VERSION = 6; @@ -103,9 +103,7 @@ public class ConflictMonitorApiProperties { private int securitySvcsPort = 8090; private String securitySvcsSignatureEndpoint = "sign"; - private int lingerMs = 0; - @Autowired BuildProperties buildProperties; @@ -263,9 +261,6 @@ public void setKafkaTopicsDisabledSet(Set kafkaTopicsDisabledSet) { this.kafkaTopicsDisabledSet = kafkaTopicsDisabledSet; } - - - @Bean public ObjectMapper defaultMapper() { ObjectMapper objectMapper = DateJsonMapper.getInstance(); @@ -392,7 +387,6 @@ public Properties createStreamProperties(String name) { streamProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "zstd"); streamProps.put(ProducerConfig.LINGER_MS_CONFIG, getKafkaLingerMs()); - if (confluentCloudEnabled) { streamProps.put("ssl.endpoint.identification.algorithm", "https"); streamProps.put("security.protocol", "SASL_SSL"); @@ -413,7 +407,8 @@ public Properties createStreamProperties(String name) { // We do not want Kafka Streams default "earliest" for this app // https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#default-values streamProps.setProperty(StreamsConfig.consumerPrefix(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG), "latest"); - // Restore and global consumers also set to latest, instead of streams default "none" + // Restore and global consumers also set to latest, instead of streams default + // "none" // which would cause exceptions to be thrown if no offset found. // Ref: // https://docs.confluent.io/platform/current/streams/developer-guide/config-streams.html#parameters-controlled-by-kstreams diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/MongoConfig.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/MongoConfig.java index 75c6a732d..b84ebdc56 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/MongoConfig.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/MongoConfig.java @@ -19,12 +19,9 @@ @Configuration @EnableMongoRepositories -public class MongoConfig extends AbstractMongoClientConfiguration{ +public class MongoConfig extends AbstractMongoClientConfiguration { private List> converters = new ArrayList>(); - // @Value("${spring.data.mongodb.uri}") - // private String uri; - @Value("${spring.data.mongodb.database}") private String db; @@ -53,17 +50,16 @@ protected String getDatabaseName() { @Override public void configureClientSettings(MongoClientSettings.Builder builder) { - + String uri = ""; - if(overrideURI != null && !overrideURI.isEmpty() && !overrideURI.equals("null")){ + if (overrideURI != null && !overrideURI.isEmpty() && !overrideURI.equals("null")) { uri = overrideURI; - }else{ - uri = "mongodb://"+username+":"+password+"@"+host+":"+port+"/"+db + "?authSource="+authenticationDatabase; + } else { + uri = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/" + db + "?authSource=" + + authenticationDatabase; } - - // String uri = "mongodb://"+host+":"+port+"/"+db; System.out.println("Connecting to MongoDB at: " + uri); builder.applyConnectionString(new ConnectionString(uri)); } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java index 47f2159d5..d002f205a 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/ReportBuilder.java @@ -129,8 +129,10 @@ public void addMapBroadcastRate(List data) { if (lastDate != null) { - // If the difference between records is greater than 1 hour. Insert fake records to zero the delta - if (newDate.toInstant().toEpochMilli() - lastDate.toInstant().toEpochMilli() > timeDeltaSeconds * 1000 ) { + // If the difference between records is greater than 1 hour. Insert fake records + // to zero the delta + if (newDate.toInstant().toEpochMilli() - lastDate.toInstant().toEpochMilli() > timeDeltaSeconds + * 1000) { times.add(Date.from(lastDate.toInstant().plusSeconds(timeDeltaSeconds))); values.add(0.0); times.add(Date.from(newDate.toInstant().minusSeconds(timeDeltaSeconds))); @@ -154,7 +156,7 @@ public void addMapBroadcastRate(List data) { XYChart chart = new XYChartBuilder().width(width).height(400).title("MAP Broadcast Rate").xAxisTitle("Date") .yAxisTitle("Average Broadcast Rate (msg/sec)").build(); - if(times.size() > 0 && values.size() > 0){ + if (times.size() > 0 && values.size() > 0) { XYSeries series = chart.addSeries("MAP Broadcast Rate", times, values); series.setSmooth(true); series.setMarker(SeriesMarkers.NONE); @@ -174,7 +176,6 @@ public void addMapBroadcastRate(List data) { addMarkerLine(chart, markerDates, bottomMarkerValues); addMarkerLine(chart, markerDates, topMarkerValues); } - chart.getStyler().setShowWithinAreaPoint(false); chart.getStyler().setChartBackgroundColor(Color.WHITE); @@ -203,7 +204,8 @@ public void addSpatBroadcastRate(List data) { try { Date newDate = sdf.parse(elem.getId()); if (lastDate != null) { - if (newDate.toInstant().toEpochMilli() - lastDate.toInstant().toEpochMilli() > timeDeltaSeconds * 1000) { + if (newDate.toInstant().toEpochMilli() - lastDate.toInstant().toEpochMilli() > timeDeltaSeconds + * 1000) { times.add(Date.from(lastDate.toInstant().plusSeconds(timeDeltaSeconds))); values.add(0.0); times.add(Date.from(newDate.toInstant().minusSeconds(timeDeltaSeconds))); @@ -224,7 +226,7 @@ public void addSpatBroadcastRate(List data) { XYChart chart = new XYChartBuilder().width(width).height(400).title("SPaT Broadcast Rate").xAxisTitle("Date") .yAxisTitle("Broadcast Rate (msg/second)").build(); - if(times.size() > 0 && values.size() > 0){ + if (times.size() > 0 && values.size() > 0) { XYSeries series = chart.addSeries("SPaT Broadcast Rate", times, values); series.setSmooth(true); series.setMarker(SeriesMarkers.NONE); @@ -244,9 +246,6 @@ public void addSpatBroadcastRate(List data) { addMarkerLine(chart, markerDates, bottomMarkerValues); addMarkerLine(chart, markerDates, topMarkerValues); } - - - chart.getStyler().setShowWithinAreaPoint(false); chart.getStyler().setChartBackgroundColor(Color.WHITE); @@ -263,40 +262,39 @@ public void addSpatBroadcastRate(List data) { } - public void addSpatBroadcastRateDistribution(List data, Long startTime, Long endTime){ + public void addSpatBroadcastRateDistribution(List data, Long startTime, Long endTime) { // Calculate how many time intervals had no messages recorded long totalIntervals = (endTime - startTime) / 10; long countedIntervals = 0; - for(IDCount elem : data){ + for (IDCount elem : data) { countedIntervals += elem.getCount(); } long zeroIntervals = totalIntervals - countedIntervals; // Add Intervals with no data to the chart - if(data.size() > 0 && data.get(0).getId().equals("0")){ + if (data.size() > 0 && data.get(0).getId().equals("0")) { data.get(0).setCount(data.get(0).getCount() + zeroIntervals); - } else{ + } else { IDCount count = new IDCount(); count.setId("0"); count.setCount(zeroIntervals); - data.add(count); + data.add(count); } // Fill in Missing Intervals with Zeros and Rename ranges List output = new ArrayList<>(); - for(int i =0; i <200; i+=10){ + for (int i = 0; i < 200; i += 10) { IDCount count = new IDCount(); - count.setId(i + " - " + (i+9)); + count.setId(i + " - " + (i + 9)); output.add(count); } IDCount count = new IDCount(); count.setId("> 200"); output.add(count); - - for(IDCount elem : data){ + for (IDCount elem : data) { int index = Integer.parseInt(elem.getId()) / 10; output.get(index).setCount(elem.getCount()); } @@ -304,47 +302,47 @@ public void addSpatBroadcastRateDistribution(List data, Long startTime, // Convert to Chart Data and generate graph ChartData chartData = ChartData.fromIDCountList(output); try { - document.add(getBarGraph(chartData, "SPaT Broadcast Rate Distribution", "Messages Per 10 Seconds", "Count")); + document.add( + getBarGraph(chartData, "SPaT Broadcast Rate Distribution", "Messages Per 10 Seconds", "Count")); } catch (DocumentException e) { e.printStackTrace(); } } - public void addMapBroadcastRateDistribution(List data, Long startTime, Long endTime){ + public void addMapBroadcastRateDistribution(List data, Long startTime, Long endTime) { // Calculate how many time intervals had no messages recorded long totalIntervals = (endTime - startTime) / 10; long countedIntervals = 0; - for(IDCount elem : data){ + for (IDCount elem : data) { countedIntervals += elem.getCount(); } long zeroIntervals = totalIntervals - countedIntervals; // Add Intervals with no data to the chart - if(data.size() > 0 && data.get(0).getId().equals("0")){ + if (data.size() > 0 && data.get(0).getId().equals("0")) { data.get(0).setCount(data.get(0).getCount() + zeroIntervals); - } else{ + } else { IDCount count = new IDCount(); count.setId("0"); count.setCount(zeroIntervals); - data.add(count); + data.add(count); } // Fill in Missing Intervals with Zeros and Rename ranges List output = new ArrayList<>(); - for(int i =0; i <20; i++){ + for (int i = 0; i < 20; i++) { IDCount count = new IDCount(); - count.setId(""+i); + count.setId("" + i); output.add(count); } IDCount count = new IDCount(); count.setId("> 20"); output.add(count); - - for(IDCount elem : data){ + for (IDCount elem : data) { int index = Integer.parseInt(elem.getId()); output.get(index).setCount(elem.getCount()); } @@ -359,9 +357,9 @@ public void addMapBroadcastRateDistribution(List data, Long startTime, } - public void addMapMinimumDataEventErrors(List events){ + public void addMapMinimumDataEventErrors(List events) { List missingElements = new ArrayList<>(); - if(events.size()> 0){ + if (events.size() > 0) { MapMinimumDataEvent event = events.get(0); missingElements = event.getMissingDataElements(); } @@ -369,23 +367,19 @@ public void addMapMinimumDataEventErrors(List events){ Font boldFont = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD); Font rowFont = new Font(Font.FontFamily.TIMES_ROMAN, 10); - PdfPTable table = new PdfPTable(1); - // table.addCell(new PdfPCell(new Paragraph("Map Missing data Elements"))); table.addCell(new PdfPCell(new Paragraph("Latest MAP Missing Data Elements", boldFont))); - for(String missingElement: missingElements){ - if(!missingElement.contains("metadata")){ + for (String missingElement : missingElements) { + if (!missingElement.contains("metadata")) { int splitIndex = missingElement.indexOf(": is missing"); if (splitIndex >= 0) { - // table.addCell(missingElement.substring(2, splitIndex).trim()); table.addCell(new PdfPCell(new Paragraph(missingElement.substring(2, splitIndex).trim(), rowFont))); } - } - + } try { @@ -395,9 +389,9 @@ public void addMapMinimumDataEventErrors(List events){ } } - public void addSpatMinimumDataEventErrors(List events){ + public void addSpatMinimumDataEventErrors(List events) { List missingElements = new ArrayList<>(); - if(events.size()> 0){ + if (events.size() > 0) { SpatMinimumDataEvent event = events.get(0); missingElements = event.getMissingDataElements(); } @@ -405,23 +399,19 @@ public void addSpatMinimumDataEventErrors(List events){ Font boldFont = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD); Font rowFont = new Font(Font.FontFamily.TIMES_ROMAN, 10); - PdfPTable table = new PdfPTable(1); - // table.addCell(new PdfPCell(new Paragraph("Map Missing data Elements"))); table.addCell(new PdfPCell(new Paragraph("SPaT Missing Data Elements", boldFont))); - for(String missingElement: missingElements){ - if(!missingElement.contains("metadata")){ + for (String missingElement : missingElements) { + if (!missingElement.contains("metadata")) { int splitIndex = missingElement.indexOf(": is missing"); if (splitIndex >= 0) { - // table.addCell(missingElement.substring(2, splitIndex).trim()); table.addCell(new PdfPCell(new Paragraph(missingElement.substring(2, splitIndex).trim(), rowFont))); } - } - + } try { @@ -432,15 +422,16 @@ public void addSpatMinimumDataEventErrors(List events){ } public void addMarkerLine(XYChart chart, ArrayList startEndDate, ArrayList startEndValue) { - if(startEndDate.size() > 2 && startEndValue.size() > 2){ - XYSeries series = chart.addSeries("MAP Minimum Marker" + startEndValue.hashCode(), startEndDate, startEndValue); + if (startEndDate.size() > 2 && startEndValue.size() > 2) { + XYSeries series = chart.addSeries("MAP Minimum Marker" + startEndValue.hashCode(), startEndDate, + startEndValue); series.setSmooth(true); series.setMarker(SeriesMarkers.NONE); series.setLineWidth(0.125f); series.setLineColor(Color.BLACK); series.setShowInLegend(false); } - + } public void addSignalStateEvents(ChartData data) { @@ -557,8 +548,6 @@ public void addSpatBroadcastRateEvents(ChartData data) { } } - - public Image getLineGraph(ChartData data, String title, String xAxisLabel, String yAxislabel) { int width = (int) (document.getPageSize().getWidth() * 0.9); @@ -566,16 +555,14 @@ public Image getLineGraph(ChartData data, String title, String xAxisLabel, Strin XYChart chart = new XYChartBuilder().width(width).height(400).title("Test Report").xAxisTitle("X") .yAxisTitle("Y").build(); - if(data.getLabels().size() > 0 && data.getValues().size() > 0){ + if (data.getLabels().size() > 0 && data.getValues().size() > 0) { XYSeries series = chart.addSeries("Fake Data", data.getLabels(), data.getValues()); } - chart.getStyler().setShowWithinAreaPoint(false); chart.getStyler().setChartBackgroundColor(Color.WHITE); chart.getStyler().setPlotBackgroundColor(Color.WHITE); chart.getStyler().setLegendVisible(false); - BufferedImage chartImage = BitmapEncoder.getBufferedImage(chart); @@ -609,23 +596,18 @@ public Image getBarGraph(ChartData data, String title, String xAxisLabel, String chart.getStyler().setXAxisMaxLabelCount(31); chart.getStyler().setXAxisLabelAlignmentVertical(TextAlignment.Centre); chart.getStyler().setXAxisLabelRotation(90); - - if(data.getLabels().size() > 0 && data.getValues().size() > 0){ + + if (data.getLabels().size() > 0 && data.getValues().size() > 0) { CategorySeries series = chart.addSeries("series", data.getLabels(), data.getValues()); - series.setFillColor(Color.BLUE); - } - else{ - double[] fakeLabels = {0}; - double[] fakeData = {0}; + series.setFillColor(Color.BLUE); + } else { + double[] fakeLabels = { 0 }; + double[] fakeData = { 0 }; CategorySeries series = chart.addSeries("series", fakeLabels, fakeData); series.setFillColor(Color.BLUE); } - - - - BufferedImage chartImage = BitmapEncoder.getBufferedImage(chart); try { @@ -638,94 +620,23 @@ public Image getBarGraph(ChartData data, String title, String xAxisLabel, String } public void addHeadingOverTime(List assessments) { - // int width = (int) (document.getPageSize().getWidth() * 0.9); - // Map> distancesFromCenterline = new HashMap<>(); - // Map> timestamps = new HashMap<>(); - - // for (LaneDirectionOfTravelAssessment assessment : assessments) { - // for (LaneDirectionOfTravelAssessmentGroup group : assessment.getLaneDirectionOfTravelAssessmentGroup()) { - // String hash = "Lane: " + group.getLaneID() + " Segment: " + group.getSegmentID(); - // if (distancesFromCenterline.containsKey(hash)) { - // distancesFromCenterline.get(hash).add((double)Math.round(group.getMedianHeading() - group.getExpectedHeading())); - // timestamps.get(hash).add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - // } else { - // ArrayList distances = new ArrayList<>(); - // distances.add((double)Math.round(group.getMedianHeading() - group.getExpectedHeading())); - // distancesFromCenterline.put(hash, distances); - - // ArrayList times = new ArrayList<>(); - // times.add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - // timestamps.put(hash, times); - // } - // } - // } - - // XYChart chart = new XYChartBuilder().width(width).height(400).title("Vehicle Heading Error Delta") - // .xAxisTitle("Time") - // .yAxisTitle("Heading Delta (Degrees)").build(); - - // if (assessments.size() > 0) { - // Date minDate = Date.from(Instant.ofEpochMilli(assessments.get(0).getTimestamp())); - // Date maxDate = Date.from(Instant.ofEpochMilli(assessments.get(assessments.size() - 1).getTimestamp())); - // for (String key : distancesFromCenterline.keySet()) { - // ArrayList distances = distancesFromCenterline.get(key); - // ArrayList times = timestamps.get(key); - - // distances.add(0, distances.get(0)); - // times.add(0, minDate); - - // distances.add(distances.size(), distances.get(distances.size() - 1)); - // times.add(maxDate); - - // if(times.size() > 0 && distances.size() > 0){ - // XYSeries series = chart.addSeries(key, times, distances); - // series.setSmooth(true); - // series.setMarker(SeriesMarkers.NONE); - // } - // } - // } - - // chart.getStyler().setShowWithinAreaPoint(false); - // chart.getStyler().setChartBackgroundColor(Color.WHITE); - // chart.getStyler().setPlotBackgroundColor(Color.WHITE); - // chart.getStyler().setLegendVisible(true); - // chart.getStyler().setLegendPosition(LegendPosition.OutsideE); - // chart.getStyler().setLegendLayout(LegendLayout.Vertical); - // chart.getStyler().setLegendFont(new java.awt.Font("Times New Roman", java.awt.Font.PLAIN, 6)); - - - // chart.getStyler().setPlotGridLinesVisible(false); - // chart.getStyler().setXAxisMaxLabelCount(31); - // chart.getStyler().setXAxisLabelAlignmentVertical(TextAlignment.Centre); - // chart.getStyler().setXAxisLabelRotation(90); - - - // BufferedImage chartImage = BitmapEncoder.getBufferedImage(chart); - - // try { - // document.add(Image.getInstance(chartImage, null)); - // } catch (IOException | DocumentException e) { - // e.printStackTrace(); - // } int width = (int) (document.getPageSize().getWidth() * 0.9); Map>> headingsByLane = new HashMap<>(); Map>> timestamps = new HashMap<>(); - - - for (LaneDirectionOfTravelAssessment assessment : assessments) { for (LaneDirectionOfTravelAssessmentGroup group : assessment.getLaneDirectionOfTravelAssessmentGroup()) { if (headingsByLane.containsKey(group.getLaneID())) { - if(headingsByLane.get(group.getLaneID()).containsKey(group.getSegmentID())){ - headingsByLane.get(group.getLaneID()).get(group.getSegmentID()).add((double)Math.round(group.getMedianHeading() - group.getExpectedHeading())); - timestamps.get(group.getLaneID()).get(group.getSegmentID()).add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - } - else{ + if (headingsByLane.get(group.getLaneID()).containsKey(group.getSegmentID())) { + headingsByLane.get(group.getLaneID()).get(group.getSegmentID()) + .add((double) Math.round(group.getMedianHeading() - group.getExpectedHeading())); + timestamps.get(group.getLaneID()).get(group.getSegmentID()) + .add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); + } else { ArrayList headings = new ArrayList<>(); - headings.add((double)Math.round(group.getMedianHeading() - group.getExpectedHeading())); + headings.add((double) Math.round(group.getMedianHeading() - group.getExpectedHeading())); headingsByLane.get(group.getLaneID()).put(group.getSegmentID(), headings); ArrayList times = new ArrayList<>(); @@ -734,23 +645,20 @@ public void addHeadingOverTime(List assessments } - } else { ArrayList headings = new ArrayList<>(); - headings.add((double)Math.round(group.getMedianHeading() - group.getExpectedHeading())); - headingsByLane.put(group.getLaneID(), new HashMap>()); + headings.add((double) Math.round(group.getMedianHeading() - group.getExpectedHeading())); + headingsByLane.put(group.getLaneID(), new HashMap>()); headingsByLane.get(group.getLaneID()).put(group.getSegmentID(), headings); ArrayList times = new ArrayList<>(); times.add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - timestamps.put(group.getLaneID(), new HashMap>()); + timestamps.put(group.getLaneID(), new HashMap>()); timestamps.get(group.getLaneID()).put(group.getSegmentID(), times); } } } - - if (assessments.size() > 0) { Date minDate = Date.from(Instant.ofEpochMilli(assessments.get(0).getTimestamp())); Date maxDate = Date.from(Instant.ofEpochMilli(assessments.get(assessments.size() - 1).getTimestamp())); @@ -761,11 +669,8 @@ public void addHeadingOverTime(List assessments for (Integer key : keys) { XYChart chart = new XYChartBuilder().width(width).height(300).title("Vehicle Heading Error Delta") - .xAxisTitle("Time") - .yAxisTitle("Heading Delta (Degrees)").build(); - - - + .xAxisTitle("Time") + .yAxisTitle("Heading Delta (Degrees)").build(); ArrayList segments = new ArrayList<>(headingsByLane.get(key).keySet()); Collections.sort(segments); @@ -778,9 +683,9 @@ public void addHeadingOverTime(List assessments headings.add(headings.size(), headings.get(headings.size() - 1)); times.add(maxDate); - if(times.size() > 0 && headings.size() > 0){ - - XYSeries series = chart.addSeries("Segment: " + segment , times, headings); + if (times.size() > 0 && headings.size() > 0) { + + XYSeries series = chart.addSeries("Segment: " + segment, times, headings); series.setSmooth(true); series.setMarker(SeriesMarkers.NONE); } @@ -816,20 +721,18 @@ public void addDistanceFromCenterlineOverTime(List>> distancesFromCenterline = new HashMap<>(); Map>> timestamps = new HashMap<>(); - - - for (LaneDirectionOfTravelAssessment assessment : assessments) { for (LaneDirectionOfTravelAssessmentGroup group : assessment.getLaneDirectionOfTravelAssessmentGroup()) { if (distancesFromCenterline.containsKey(group.getLaneID())) { - if(distancesFromCenterline.get(group.getLaneID()).containsKey(group.getSegmentID())){ - distancesFromCenterline.get(group.getLaneID()).get(group.getSegmentID()).add((double)Math.round(group.getMedianCenterlineDistance())); - timestamps.get(group.getLaneID()).get(group.getSegmentID()).add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - } - else{ + if (distancesFromCenterline.get(group.getLaneID()).containsKey(group.getSegmentID())) { + distancesFromCenterline.get(group.getLaneID()).get(group.getSegmentID()) + .add((double) Math.round(group.getMedianCenterlineDistance())); + timestamps.get(group.getLaneID()).get(group.getSegmentID()) + .add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); + } else { ArrayList distances = new ArrayList<>(); - distances.add((double)Math.round(group.getMedianCenterlineDistance())); + distances.add((double) Math.round(group.getMedianCenterlineDistance())); distancesFromCenterline.get(group.getLaneID()).put(group.getSegmentID(), distances); ArrayList times = new ArrayList<>(); @@ -838,23 +741,20 @@ public void addDistanceFromCenterlineOverTime(List distances = new ArrayList<>(); - distances.add((double)Math.round(group.getMedianCenterlineDistance())); - distancesFromCenterline.put(group.getLaneID(), new HashMap>()); + distances.add((double) Math.round(group.getMedianCenterlineDistance())); + distancesFromCenterline.put(group.getLaneID(), new HashMap>()); distancesFromCenterline.get(group.getLaneID()).put(group.getSegmentID(), distances); ArrayList times = new ArrayList<>(); times.add(Date.from(Instant.ofEpochMilli(assessment.getTimestamp()))); - timestamps.put(group.getLaneID(), new HashMap>()); + timestamps.put(group.getLaneID(), new HashMap>()); timestamps.get(group.getLaneID()).put(group.getSegmentID(), times); } } } - - if (assessments.size() > 0) { Date minDate = Date.from(Instant.ofEpochMilli(assessments.get(0).getTimestamp())); Date maxDate = Date.from(Instant.ofEpochMilli(assessments.get(assessments.size() - 1).getTimestamp())); @@ -864,12 +764,10 @@ public void addDistanceFromCenterlineOverTime(List segments = new ArrayList<>(distancesFromCenterline.get(key).keySet()); Collections.sort(segments); @@ -882,9 +780,9 @@ public void addDistanceFromCenterlineOverTime(List 0 && distances.size() > 0){ - - XYSeries series = chart.addSeries("Segment: " + segment , times, distances); + if (times.size() > 0 && distances.size() > 0) { + + XYSeries series = chart.addSeries("Segment: " + segment, times, distances); series.setSmooth(true); series.setMarker(SeriesMarkers.NONE); } @@ -960,15 +858,14 @@ public void addLaneConnectionOfTravelMap(List laneConnectio chart.getStyler().setPlotContentSize(1); chart.getStyler().setShowValue(true); - if(ingressLaneLabels.length > 0 && egressLaneLabels.length > 0 ){ + if (ingressLaneLabels.length > 0 && egressLaneLabels.length > 0) { chart.addSeries("Ingress, Egress Lane Pairings", ingressLaneLabelsInt, egressLaneLabelsInt, pairMappings); - }else{ - int[] fakeIngressLanes = {0}; - int[] fakeEgressLanes = {0}; - int[][] fakePairs = {{0}}; + } else { + int[] fakeIngressLanes = { 0 }; + int[] fakeEgressLanes = { 0 }; + int[][] fakePairs = { { 0 } }; chart.addSeries("Ingress, Egress Lane Pairings", fakeIngressLanes, fakeEgressLanes, fakePairs); } - chart.getStyler().setShowWithinAreaPoint(false); chart.getStyler().setChartBackgroundColor(Color.WHITE); @@ -977,10 +874,6 @@ public void addLaneConnectionOfTravelMap(List laneConnectio chart.getStyler().setPlotGridLinesVisible(false); - // Color[] rangeColors = {Color.WHITE, Color.BLUE, Color.GREEN, Color.YELLOW, - // Color.ORANGE, Color.RED}; - // chart.getStyler().setRangeColors(rangeColors); - BufferedImage chartImage = BitmapEncoder.getBufferedImage(chart); Image iTextImage; try { @@ -1045,8 +938,8 @@ public List getSecondsStringInRange(long startTimeMillis, long endTimeMill return secondRange; } - public double roundPrec(double input, int precision){ - double scaler = Math.pow(10.0, (double)precision); + public double roundPrec(double input, int precision) { + double scaler = Math.pow(10.0, (double) precision); return Math.round(input * scaler) / scaler; } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/config/IntersectionConfig/IntersectionConfigRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/config/IntersectionConfig/IntersectionConfigRepositoryImpl.java index d39efef6d..9628ed5ff 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/config/IntersectionConfig/IntersectionConfigRepositoryImpl.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/config/IntersectionConfig/IntersectionConfigRepositoryImpl.java @@ -26,10 +26,6 @@ public Query getQuery(String key, Integer roadRegulatorID, Integer intersectionI query.addCriteria(Criteria.where("_id").is(key)); } - // if (roadRegulatorID != null) { - // query.addCriteria(Criteria.where("roadRegulatorID").is(roadRegulatorID)); - // } - if (intersectionID != null) { query.addCriteria(Criteria.where("intersectionID").is(intersectionID)); } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java index 9ea1cb2fc..d11d3cec9 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/notifications/ActiveNotification/ActiveNotificationRepositoryImpl.java @@ -1,4 +1,5 @@ package us.dot.its.jpo.ode.api.accessors.notifications.ActiveNotification; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -20,40 +21,36 @@ import us.dot.its.jpo.conflictmonitor.monitor.models.notifications.app_health.KafkaStreamsAnomalyNotification; @Component -public class ActiveNotificationRepositoryImpl implements ActiveNotificationRepository{ - +public class ActiveNotificationRepositoryImpl implements ActiveNotificationRepository { + @Autowired private MongoTemplate mongoTemplate; private String collectionName = "CmNotification"; - public Query getQuery(Integer intersectionID, Integer roadRegulatorID, String notificationType, String key){ + public Query getQuery(Integer intersectionID, Integer roadRegulatorID, String notificationType, String key) { Query query = new Query(); - if(intersectionID != null){ + if (intersectionID != null) { query.addCriteria(Criteria.where("intersectionID").is(intersectionID)); } - // if(roadRegulatorID != null){ - // query.addCriteria(Criteria.where("roadRegulatorID").is(roadRegulatorID)); - // } - - if(notificationType != null){ + if (notificationType != null) { query.addCriteria(Criteria.where("notificationType").is(notificationType)); } - if(key != null){ + if (key != null) { query.addCriteria(Criteria.where("key").is(key)); } return query; } - public long getQueryResultCount(Query query){ + public long getQueryResultCount(Query query) { return mongoTemplate.count(query, Notification.class, "CmNotification"); } - public long getQueryFullCount(Query query){ + public long getQueryFullCount(Query query) { int limit = query.getLimit(); query.limit(-1); long count = mongoTemplate.count(query, Notification.class, collectionName); @@ -63,39 +60,33 @@ public long getQueryFullCount(Query query){ public List find(Query query) { List dbObjects = mongoTemplate.find(query, Bson.class, collectionName); - + List notifications = new ArrayList<>(); for (Bson dbObject : dbObjects) { String type = dbObject.toBsonDocument().getString("notificationType").getValue(); - if(type.equals("ConnectionOfTravelNotification")){ + if (type.equals("ConnectionOfTravelNotification")) { notifications.add(mongoTemplate.getConverter().read(ConnectionOfTravelNotification.class, dbObject)); - } - else if(type.equals("IntersectionReferenceAlignmentNotification")){ - notifications.add(mongoTemplate.getConverter().read(IntersectionReferenceAlignmentNotification.class, dbObject)); - } - else if(type.equals("LaneDirectionOfTravelAssessmentNotification")){ + } else if (type.equals("IntersectionReferenceAlignmentNotification")) { + notifications.add( + mongoTemplate.getConverter().read(IntersectionReferenceAlignmentNotification.class, dbObject)); + } else if (type.equals("LaneDirectionOfTravelAssessmentNotification")) { notifications.add(mongoTemplate.getConverter().read(LaneDirectionOfTravelNotification.class, dbObject)); - } - else if(type.equals("SignalGroupAlignmentNotification")){ + } else if (type.equals("SignalGroupAlignmentNotification")) { notifications.add(mongoTemplate.getConverter().read(SignalGroupAlignmentNotification.class, dbObject)); - } - else if(type.equals("SignalStateConflictNotification")){ + } else if (type.equals("SignalStateConflictNotification")) { notifications.add(mongoTemplate.getConverter().read(SignalStateConflictNotification.class, dbObject)); - } - else if(type.equals("TimeChangeDetailsNotification")){ + } else if (type.equals("TimeChangeDetailsNotification")) { notifications.add(mongoTemplate.getConverter().read(TimeChangeDetailsNotification.class, dbObject)); - } - else if(type.equals("AppHealthNotification")){ + } else if (type.equals("AppHealthNotification")) { notifications.add(mongoTemplate.getConverter().read(KafkaStreamsAnomalyNotification.class, dbObject)); } } return notifications; - } - public long delete(Query query){ + public long delete(Query query) { long count = getQueryResultCount(query); mongoTemplate.findAndRemove(query, Map.class, "CmNotification"); diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/reports/ReportRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/reports/ReportRepositoryImpl.java index 93f98865b..fc7468a18 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/reports/ReportRepositoryImpl.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/reports/ReportRepositoryImpl.java @@ -36,10 +36,6 @@ public Query getQuery(String reportName, Integer intersectionID, Integer roadReg query.addCriteria(Criteria.where("intersectionID").is(intersectionID)); } - // if (roadRegulatorID != null) { - // query.addCriteria(Criteria.where("roadRegulatorID").is(intersectionID)); - // } - if (startTime == null) { startTime = 0L; } @@ -68,7 +64,7 @@ public long getQueryResultCount(Query query) { return mongoTemplate.count(query, ReportDocument.class, collectionName); } - public long getQueryFullCount(Query query){ + public long getQueryFullCount(Query query) { int limit = query.getLimit(); query.limit(-1); long count = mongoTemplate.count(query, ReportDocument.class, collectionName); diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java index 2b4bc510a..ec326e30a 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/asn1/DecoderManager.java @@ -17,188 +17,140 @@ import java.time.format.DateTimeFormatter; import java.util.UUID; - @Component @Slf4j public class DecoderManager { - public static final MessageType[] types = {MessageType.BSM, MessageType.MAP, MessageType.SPAT, MessageType.SRM, MessageType.SSM, MessageType.TIM}; - public static final String[] startFlags = {"0014", "0012", "0013", "001d", "001e", "001f"}; //BSM, MAP, SPAT, SRM, SSM, TIM - public static final int[] maxSizes = {500, 2048, 1000, 500, 500, 500}; + public static final MessageType[] types = { MessageType.BSM, MessageType.MAP, MessageType.SPAT, MessageType.SRM, + MessageType.SSM, MessageType.TIM }; + public static final String[] startFlags = { "0014", "0012", "0013", "001d", "001e", "001f" }; // BSM, MAP, SPAT, + // SRM, SSM, TIM + public static final int[] maxSizes = { 500, 2048, 1000, 500, 500, 500 }; public static final int HEADER_MINIMUM_SIZE = 20; public static final int bufferSize = 2048; - @Autowired + @Autowired public BsmDecoder bsmDecoder; - @Autowired + @Autowired public MapDecoder mapDecoder; - @Autowired + @Autowired public SpatDecoder spatDecoder; - @Autowired + @Autowired public SrmDecoder srmDecoder; - @Autowired + @Autowired public SsmDecoder ssmDecoder; - @Autowired + @Autowired public TimDecoder timDecoder; - // public static DecodedMessage decode(String inputAsn1){ - - // // Identify Message Type and Cut off any extra characters - // TypePayload payload = identifyAsn1(inputAsn1); - - - // // Convert Payload to Pojo and add Metadata - // OdeData data = getAsOdeData(payload); - - // XmlUtils xmlUtils = new XmlUtils(); - - // try { - // // Convert to XML for ASN.1 Decoder - // String xml = xmlUtils.toXml(data); - // System.out.println("XML" + xml); - - // // Send String through ASN.1 Decoder to get Decoded XML Data - // // String decodedXml = decodeXmlWithAcm(xml); - // String decodedXml = mockDecodeXmlWithAcm(xml); - - // if(payload.getType().equals(MessageType.BSM)){ - // OdeBsmData bsm = createOdeBsmData(decodedXml); - // DecodedMessage message = new BsmDecodedMessage(bsm, inputAsn1, MessageType.BSM, ""); - // return message; - // } - - // } catch (JsonProcessingException e) { - // e.printStackTrace(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - - - - // return null; - // } - - public DecodedMessage decode(EncodedMessage message){ + public DecodedMessage decode(EncodedMessage message) { String payload = removeHeader(message.getAsn1Message(), message.getType()); message.setAsn1Message(payload); Decoder decoder = null; - if(payload != null){ - if(message.getType() == MessageType.BSM){ + if (payload != null) { + if (message.getType() == MessageType.BSM) { decoder = new BsmDecoder(); - } - else if(message.getType() == MessageType.MAP){ + } else if (message.getType() == MessageType.MAP) { decoder = mapDecoder; - }else if(message.getType() == MessageType.SPAT){ + } else if (message.getType() == MessageType.SPAT) { decoder = spatDecoder; - }else if(message.getType() == MessageType.SRM){ + } else if (message.getType() == MessageType.SRM) { decoder = srmDecoder; - }else if(message.getType() == MessageType.SSM){ + } else if (message.getType() == MessageType.SSM) { decoder = ssmDecoder; - }else if(message.getType() == MessageType.TIM){ + } else if (message.getType() == MessageType.TIM) { decoder = timDecoder; - // return new DecodedMessage(payload, message.getType(), "Ode Does not support ODE Serialization / Deserialization"); - }else{ + } else { return new DecodedMessage(payload, message.getType(), "No Valid Decoder found for Message Type"); } - return decoder.decode(message); - - + } - - return new DecodedMessage(payload, message.getType(), "Unable to find valid message start flag within input data"); + + return new DecodedMessage(payload, message.getType(), + "Unable to find valid message start flag within input data"); } - public static String getOdeReceivedAt(){ + public static String getOdeReceivedAt() { ZonedDateTime utc = ZonedDateTime.now(ZoneOffset.UTC); String timestamp = utc.format(DateTimeFormatter.ISO_INSTANT); return timestamp; } - public static String getOriginIp(){ + public static String getOriginIp() { return "user-upload"; } public static String removeHeader(String hexPacket, MessageType type) { - + String startFlag = startFlags[ArrayUtils.indexOf(types, type)]; int startIndex = hexPacket.indexOf(startFlag); if (startIndex == 0) { - // Raw Message no Headers + // Raw Message no Headers } else if (startIndex == -1) { - return null; + return null; } else { - // We likely found a message with a header, look past the first 20 - // bytes for the start of the BSM - int trueStartIndex = HEADER_MINIMUM_SIZE - + hexPacket.substring(HEADER_MINIMUM_SIZE, hexPacket.length()).indexOf(startFlag); - hexPacket = hexPacket.substring(trueStartIndex, hexPacket.length()); + // We likely found a message with a header, look past the first 20 + // bytes for the start of the BSM + int trueStartIndex = HEADER_MINIMUM_SIZE + + hexPacket.substring(HEADER_MINIMUM_SIZE, hexPacket.length()).indexOf(startFlag); + hexPacket = hexPacket.substring(trueStartIndex, hexPacket.length()); } - - return hexPacket; - } + return hexPacket; + } - public static EncodedMessage identifyAsn1(String hexPacket){ - // Compute the Effective End Location of the real data. - //int endIndex = hexPacket.indexOf("0000000000000000"); - //if(endIndex == -1){ - int endIndex = hexPacket.length()-1; - //} + public static EncodedMessage identifyAsn1(String hexPacket) { + int endIndex = hexPacket.length() - 1; int closestStartIndex = endIndex; MessageType closestMessageType = MessageType.UNKNOWN; - // int closestBufferSize = bufferSize; - - for(int i = 0; i< startFlags.length; i++){ + for (int i = 0; i < startFlags.length; i++) { String startFlag = startFlags[i]; MessageType mType = types[i]; int typeBufferSize = maxSizes[i]; - - + // Skip possible message type if packet is too big - if(endIndex > typeBufferSize*2){ + if (endIndex > typeBufferSize * 2) { continue; } - int startIndex = hexPacket.indexOf(startFlag); - - if (startIndex == 0) { + + if (startIndex == 0) { return new EncodedMessage(hexPacket, mType); - }else if (startIndex == -1) { + } else if (startIndex == -1) { continue; - } else{ - int trueStartIndex = hexPacket.substring(HEADER_MINIMUM_SIZE, hexPacket.length()).indexOf(startFlag); - if(trueStartIndex ==-1){ - continue; - } - trueStartIndex += HEADER_MINIMUM_SIZE; - - while (trueStartIndex != -1 && (trueStartIndex % 2 == 1) && trueStartIndex < hexPacket.length()-4){ - int newStartIndex = hexPacket.substring(trueStartIndex+1, hexPacket.length()).indexOf(startFlag); - if(newStartIndex == -1){ - trueStartIndex = -1; - break; - }else{ - trueStartIndex += newStartIndex+1; - } - } - - if(trueStartIndex != -1 && trueStartIndex < closestStartIndex){ + } else { + int trueStartIndex = hexPacket.substring(HEADER_MINIMUM_SIZE, hexPacket.length()).indexOf(startFlag); + if (trueStartIndex == -1) { + continue; + } + trueStartIndex += HEADER_MINIMUM_SIZE; + + while (trueStartIndex != -1 && (trueStartIndex % 2 == 1) && trueStartIndex < hexPacket.length() - 4) { + int newStartIndex = hexPacket.substring(trueStartIndex + 1, hexPacket.length()).indexOf(startFlag); + if (newStartIndex == -1) { + trueStartIndex = -1; + break; + } else { + trueStartIndex += newStartIndex + 1; + } + } + + if (trueStartIndex != -1 && trueStartIndex < closestStartIndex) { closestStartIndex = trueStartIndex; closestMessageType = mType; // closestBufferSize = typeBufferSize; @@ -206,20 +158,15 @@ public static EncodedMessage identifyAsn1(String hexPacket){ } } - if(closestMessageType == MessageType.UNKNOWN){ + if (closestMessageType == MessageType.UNKNOWN) { return new EncodedMessage(hexPacket, MessageType.UNKNOWN); - }else{ + } else { return new EncodedMessage(hexPacket.substring(closestStartIndex, hexPacket.length()), closestMessageType); - } + } } - - - - public static String decodeXmlWithAcm(String xmlMessage) throws Exception { - log.info("Decoding Message: " + xmlMessage); log.info("Decoding message: {}", xmlMessage); @@ -234,7 +181,8 @@ public static String decodeXmlWithAcm(String xmlMessage) throws Exception { // Run ACM tool to decode message var pb = new ProcessBuilder( - "/build/acm", "-F", "-c", "/build/config/example.properties", "-T", "decode", tempFile.getAbsolutePath()); + "/build/acm", "-F", "-c", "/build/config/example.properties", "-T", "decode", + tempFile.getAbsolutePath()); pb.directory(new File("/build")); Process process = pb.start(); String result = IOUtils.toString(process.getInputStream(), StandardCharsets.UTF_8); diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/auth/StompHandshakeInterceptor.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/auth/StompHandshakeInterceptor.java index d1bab20f4..9c70cb432 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/auth/StompHandshakeInterceptor.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/auth/StompHandshakeInterceptor.java @@ -23,11 +23,12 @@ public class StompHandshakeInterceptor implements HandshakeInterceptor { private final JwtDecoder jwtDecoder; @Override - public boolean beforeHandshake(ServerHttpRequest req, ServerHttpResponse resp, WebSocketHandler h, Map atts) { - + public boolean beforeHandshake(ServerHttpRequest req, ServerHttpResponse resp, WebSocketHandler h, + Map atts) { + try { - for(String key: atts.keySet()){ + for (String key : atts.keySet()) { System.out.println("Attribute Key" + key); } @@ -58,39 +59,30 @@ public boolean beforeHandshake(ServerHttpRequest req, ServerHttpResponse resp, W } @Override - public void afterHandshake(ServerHttpRequest rq, ServerHttpResponse rp, WebSocketHandler h, @Nullable Exception e) {} - + public void afterHandshake(ServerHttpRequest rq, ServerHttpResponse rp, WebSocketHandler h, @Nullable Exception e) { + } - public String getToken(ServerHttpRequest req){ + public String getToken(ServerHttpRequest req) { HttpHeaders headers = req.getHeaders(); - if( headers != null){ + if (headers != null) { - // for(String header: headers.keySet()){ - // System.out.println(header); - // for(String value: headers.get(header)){ - // System.out.println(" "+ value); - // } - // } + if (headers.containsKey("Token")) { - - if(headers.containsKey("Token")){ - - //Parse Token from Token Header - if(headers.get("Token").size() > 0){ + // Parse Token from Token Header + if (headers.get("Token").size() > 0) { return headers.get("Token").get(0); } - - }else if(headers.containsKey("sec-websocket-protocol")){ - //Parse Token From Cookie + } else if (headers.containsKey("sec-websocket-protocol")) { + + // Parse Token From Cookie List cookies = req.getHeaders().get("sec-websocket-protocol"); String[] parts = cookies.get(0).split(", "); - if(parts.length >2){ + if (parts.length > 2) { return parts[2]; } - } - else{ + } else { return null; } } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/config/StompConfig.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/config/StompConfig.java index 1297d38db..b01d0e3d0 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/config/StompConfig.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/config/StompConfig.java @@ -18,15 +18,14 @@ @RequiredArgsConstructor public class StompConfig implements WebSocketMessageBrokerConfigurer { - private final OAuth2TokenValidator defaultTokenValidator; private final JwtDecoder jwtDecoder; private final ConflictMonitorApiProperties properties; @Override public void configureMessageBroker(MessageBrokerRegistry config) { - config.setApplicationDestinationPrefixes("/broker"); // prefix for incoming messages in @MessageMapping - config.enableSimpleBroker("/live"); // enabling broker @SendTo("/broker/blabla") + config.setApplicationDestinationPrefixes("/broker"); // prefix for incoming messages in @MessageMapping + config.enableSimpleBroker("/live"); // enabling broker @SendTo("/broker/blabla") } @Override @@ -36,5 +35,4 @@ public void registerStompEndpoints(StompEndpointRegistry registry) { .setAllowedOrigins(properties.getCors()); } - } \ No newline at end of file diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/DecoderController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/DecoderController.java index 0c3a551c0..974932981 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/DecoderController.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/DecoderController.java @@ -39,43 +39,13 @@ public class DecoderController { @Autowired ConflictMonitorApiProperties props; - @Autowired DecoderManager decoderManager; - - // private StringPublisher bsmPublisher; + @Autowired + DecoderManager decoderManager; public String getCurrentTime() { return ZonedDateTime.now().toInstant().toEpochMilli() + ""; } - // @CrossOrigin(origins = "http://localhost:3000") - // @RequestMapping(value = "/decoder/upload", method = RequestMethod.POST, - // produces = "application/json") - // public @ResponseBody ResponseEntity new_bulk_upload_request( - // @RequestBody UploadData newUploadData, - // @RequestParam(name = "test", required = false, defaultValue = "false") - // boolean testData) { - // try { - // logger.info("Uploading Bulk Data"); - - // if (testData) { - // newUploadData = MockUploadDataGenerator.getUploadData(); - // } else { - // return - // ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).contentType(MediaType.TEXT_PLAIN) - // .body(newUploadData.toString()); - // } - - // return - // ResponseEntity.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON) - // .body(newUploadData.toString()); - // } catch (Exception e) { - // logger.info("Failed to Upload Bulk Data"); - // return - // ResponseEntity.status(HttpStatus.BAD_REQUEST).contentType(MediaType.TEXT_PLAIN) - // .body(ExceptionUtils.getStackTrace(e)); - // } - // } - @CrossOrigin(origins = "http://localhost:3000") @RequestMapping(value = "/decoder/upload", method = RequestMethod.POST, produces = "application/json") public @ResponseBody ResponseEntity decode_request( @@ -132,34 +102,4 @@ public String getCurrentTime() { .body(ExceptionUtils.getStackTrace(e)); } } - - // public void publishBSM(String asn1Bsm){ - // String payloadHexString = HexUtils.toHexString(payload); - // logger.debug("Packet: {}", payloadHexString); - - // // Add header data for the decoding process - // ZonedDateTime utc = ZonedDateTime.now(ZoneOffset.UTC); - // String timestamp = utc.format(DateTimeFormatter.ISO_INSTANT); - - // JSONObject metadataObject = new JSONObject(); - // metadataObject.put("utctimestamp", timestamp); - // metadataObject.put("originRsu", senderIp); - - // JSONObject messageObject = new JSONObject(); - // messageObject.put("metadata", metadataObject); - // messageObject.put("payload", payloadHexString); - - // JSONArray messageList = new JSONArray(); - // messageList.put(messageObject); - - // JSONObject jsonObject = new JSONObject(); - // jsonObject.put("BsmMessageContent", messageList); - - // logger.debug("BSM JSON Object: {}", jsonObject.toString()); - - // // Submit JSON to the OdeRawEncodedMessageJson Kafka Topic - // this.bsmPublisher.publish(jsonObject.toString(), - // this.bsmPublisher.getOdeProperties().getKafkaTopicOdeRawEncodedBSMJson()); - - // } } \ No newline at end of file diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/ReportController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/ReportController.java index ed8b0a1fe..368185a81 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/ReportController.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/ReportController.java @@ -105,163 +105,4 @@ public ResponseEntity downloadReport( return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null); } } - - // @Bean - // public void testReportDownload(){ - - // // Query query = reportRepo.getQuery(null, null, null, null, null, false, - // false); - // // long count = reportRepo.getQueryResultCount(query); - - // // System.out.println("Returning Report List with Size: " + count); - - // // for(ReportDocument doc : reportRepo.find(query)){ - // // System.out.println(doc); - - // // } - - // // Query query = - // reportRepo.getQuery("CmReport_1234_-1_1698710400000_1699315200000", null, - // null, null, null, true, true); - // // long count = reportRepo.getQueryResultCount(query); - // // System.out.println("Returning Report List with Size: " + count); - // // System.out.println(reportRepo.find(query)); - - // } - - // @Bean - // public void test(){ - // System.out.println("Generating Test PDF"); - - // int intersectionID = 6311; - // long startTime = 0; - // // long startTime = 1678233600000L; - // long endTime = Instant.now().toEpochMilli(); - - // ReportDocument document = buildReport(intersectionID, roadRegulatorID, - // startTime, endTime); - - // // List laneDirectionOfTravelEventCounts = - // laneDirectionOfTravelEventRepo.getLaneDirectionOfTravelEventsByDay(intersectionID, - // startTime, endTime); - // // List laneDirectionOfTravelMedianDistanceDistribution = - // laneDirectionOfTravelEventRepo.getMedianDistanceByFoot(intersectionID, - // startTime, endTime); - // // List laneDirectionOfTravelMedianHeadingDistribution = - // laneDirectionOfTravelEventRepo.getMedianDistanceByDegree(intersectionID, - // startTime, endTime); - // // List laneDirectionOfTravelAssessmentCount - // = - // laneDirectionOfTravelAssessmentRepo.getLaneDirectionOfTravelOverTime(intersectionID, - // startTime, endTime); - - // // List connectionOfTravelEventCounts = - // connectionOfTravelEventRepo.getConnectionOfTravelEventsByDay(intersectionID, - // startTime, endTime); - // // List laneConnectionCounts = - // connectionOfTravelEventRepo.getConnectionOfTravelEventsByConnection(intersectionID, - // startTime, endTime); - - // // List signalstateEventCounts = - // signalStateEventRepo.getSignalStateEventsByDay(intersectionID, startTime, - // endTime); - - // // List signalStateStopEventCounts = - // signalStateStopEventRepo.getSignalStateStopEventsByDay(intersectionID, - // startTime, endTime); - - // // List signalStateConflictEventCounts = - // signalStateConflictEventRepo.getSignalStateConflictEventsByDay(intersectionID, - // startTime, endTime); - - // // List timeChangeDetailsEventCounts= - // timeChangeDetailsEventRepo.getTimeChangeDetailsEventsByDay(intersectionID, - // startTime, endTime); - - // // List mapCounts = - // processedMapRepo.getMapBroadcastRates(intersectionID, startTime, endTime); - // // List spatCounts = - // processedSpatRepo.getSpatBroadcastRates(intersectionID, startTime, endTime); - - // // List spatCountDistribution = - // processedSpatRepo.getSpatBroadcastRateDistribution(intersectionID, startTime, - // endTime); - // // List mapCountDistribution = - // processedMapRepo.getMapBroadcastRateDistribution(intersectionID, startTime, - // endTime); - - // try { - - // ReportBuilder builder = new ReportBuilder(new FileOutputStream("test.pdf")); - // List dateStrings = builder.getDayStringsInRange(startTime, endTime); - // builder.addTitlePage("Conflict Monitor Report", startTime, endTime); - - // // // Add Lane Direction of Travel Information - // // builder.addTitle("Lane Direction of Travel"); - // // - // builder.addLaneDirectionOfTravelEvent(DailyData.fromIDCountDays(laneDirectionOfTravelEventCounts, - // dateStrings)); - // // - // builder.addLaneDirectionOfTravelMedianDistanceDistribution(ChartData.fromIDCountList(laneDirectionOfTravelMedianDistanceDistribution)); - // // - // builder.addLaneDirectionOfTravelMedianHeadingDistribution(ChartData.fromIDCountList(laneDirectionOfTravelMedianHeadingDistribution)); - // // - // builder.addDistanceFromCenterlineOverTime(laneDirectionOfTravelAssessmentCount); - // // builder.addHeadingOverTime(laneDirectionOfTravelAssessmentCount); - // // builder.addPageBreak(); - - // // // Add Lane Connection of Travel Information - // // builder.addTitle("Connection of Travel"); - // // - // builder.addConnectionOfTravelEvent(DailyData.fromIDCountDays(connectionOfTravelEventCounts, - // dateStrings)); - // // builder.addLaneConnectionOfTravelMap(laneConnectionCounts); - // // builder.addPageBreak(); - - // // // Add Signal State Events - // // builder.addTitle("Signal State Events"); - // // - // builder.addSignalStateEvents(DailyData.fromIDCountDays(signalstateEventCounts, - // dateStrings)); - // // - // builder.addSignalStateStopEvents(DailyData.fromIDCountDays(signalStateStopEventCounts, - // dateStrings)); - // // - // builder.addSignalStateConflictEvent(DailyData.fromIDCountDays(signalStateConflictEventCounts, - // dateStrings)); - // // builder.addPageBreak(); - - // // // Add Time Change Details - // // - // builder.addSpatTimeChangeDetailsEvent(DailyData.fromIDCountDays(timeChangeDetailsEventCounts, - // dateStrings)); - // // builder.addPageBreak(); - - // // builder.addTitle("Map"); - // // builder.addMapBroadcastRate(mapCounts); - // // builder.addMapBroadcastRateDistribution(mapCountDistribution, startTime, - // endTime); - // // builder.addPageBreak(); - - // // builder.addTitle("SPaT"); - // // builder.addSpatBroadcastRate(spatCounts); - // // builder.addSpatBroadcastRateDistribution(spatCountDistribution, startTime, - // endTime); - // // builder.addPageBreak(); - - // // List secondStrings = builder.getSecondsStringInRange(startTime, - // endTime); - - // // builder.addSpatMinimumDataEventErrors(latestSpatMinimumdataEvent); - // // builder.addMapMinimumDataEventErrors(latestMapMinimumdataEvent); - - // builder.write(); - - // } catch (FileNotFoundException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // System.out.println("Test PDF Generation Complete"); - - // } } \ No newline at end of file diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/SampleController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/SampleController.java deleted file mode 100644 index 0bca5332d..000000000 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/SampleController.java +++ /dev/null @@ -1,55 +0,0 @@ -// package us.dot.its.jpo.ode.api.controllers; - -// import lombok.extern.slf4j.Slf4j; -// import org.keycloak.KeycloakSecurityContext; -// import org.springframework.http.ResponseEntity; -// import org.springframework.security.access.prepost.PreAuthorize; -// import org.springframework.web.bind.annotation.GetMapping; -// import org.springframework.web.bind.annotation.RequestMapping; -// import org.springframework.web.bind.annotation.RestController; -// import org.springframework.web.context.request.RequestContextHolder; -// import org.springframework.web.context.request.ServletRequestAttributes; - -// import javax.servlet.http.HttpServletRequest; - -// @RestController -// @RequestMapping(value = "/api") -// @Slf4j -// public class SampleController { - -// // url - http://localhost:9000/api/keycloak/user -// // permits only the authenticated user having either the ROLE_ADMIN or ROLE_USER -// // throws forbidden exception for the invalidated token or non authorized user -// @GetMapping("/keycloak/user") -// @PreAuthorize("hasRole('USER') || hasRole('ADMIN')") -// public ResponseEntity getUser() { -// log.info("Returning user information"); -// final String name = getSecurityContext().getToken().getPreferredUsername(); -// return ResponseEntity.ok("hello " + name); -// } - -// // url - http://localhost:9000/api/keycloak/admin -// // permits only the authenticated user having the ROLE_ADMIN -// // throws forbidden exception for the invalidated token or non authorized user -// @GetMapping("/keycloak/admin") -// @PreAuthorize("hasRole('ADMIN')") -// public ResponseEntity getAdmin() { -// log.info("Returning administrator information"); -// final String name = getSecurityContext().getToken().getPreferredUsername(); -// return ResponseEntity.ok("hello Admin:" + name); -// } - -// // url - http://localhost:9000/api/public/anonymous -// // permits everyone without a bearer token i.e. offers public access -// @GetMapping("/public/anonymous") -// public ResponseEntity getAnonymous() { -// log.info("Returning anonymous information"); -// return ResponseEntity.ok("hello anonymous user"); -// } - -// // helper method to return the KeycloakSecurityContext object to fetch details from access token -// private KeycloakSecurityContext getSecurityContext() { -// final HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); -// return (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName()); -// } -// } \ No newline at end of file diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java index ffcd6eeac..bea62da69 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java @@ -30,10 +30,10 @@ public class StompController { private ObjectMapper mapper; - StompController(){ + StompController() { mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); - + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_INSTANT; ZonedDateTimeSerializer zonedDateTimeSerializer = new ZonedDateTimeSerializer(dateTimeFormatter); @@ -44,8 +44,6 @@ public class StompController { mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true); } - - // @Scheduled(fixedRate = 10000) // Broadcast a message every second public void broadcastMessage(String topic, String message) { brokerMessagingTemplate.convertAndSend(topic, message); @@ -56,7 +54,7 @@ public String buildTopicName(int roadRegulatorID, int intersectionID, String mes } public void broadcastSpat(ProcessedSpat spat) { - if(spat != null){ + if (spat != null) { Integer intersectionID = spat.getIntersectionId(); if (intersectionID == null) { intersectionID = -1; @@ -73,13 +71,13 @@ public void broadcastSpat(ProcessedSpat spat) { } catch (JsonProcessingException e) { e.printStackTrace(); } - + } } } public void broadcastMap(ProcessedMap map) { - if(map != null){ + if (map != null) { Integer intersectionID = map.getProperties().getIntersectionId(); if (intersectionID == null) { intersectionID = -1; @@ -92,7 +90,7 @@ public void broadcastMap(ProcessedMap map) { if (intersectionID != -1) { try { - broadcastMessage(buildTopicName(-1, intersectionID, "map"), mapper.writeValueAsString(map)); + broadcastMessage(buildTopicName(-1, intersectionID, "map"), mapper.writeValueAsString(map)); } catch (JsonProcessingException e) { e.printStackTrace(); } @@ -101,10 +99,11 @@ public void broadcastMap(ProcessedMap map) { } public void broadcastBSM(BsmIntersectionIdKey key, OdeBsmData bsm) { - if(bsm != null){ + if (bsm != null) { if (key.getIntersectionId() != -1) { try { - broadcastMessage(buildTopicName(-1, key.getIntersectionId(), "bsm"), mapper.writeValueAsString(bsm)); + broadcastMessage(buildTopicName(-1, key.getIntersectionId(), "bsm"), + mapper.writeValueAsString(bsm)); } catch (JsonProcessingException e) { e.printStackTrace(); } @@ -112,16 +111,4 @@ public void broadcastBSM(BsmIntersectionIdKey key, OdeBsmData bsm) { } } - // Sample Format for receiving a message from a client, and broadcasting a - // response back. Not needed in current model, but left for future reference - - // @MessageMapping("/server") // Called when Data is received on /broker/server - // // @SendTo("/live/spat") // Reply with information on /live/spat - // public String getSpat(String message) { - // System.out.println("Incoming message: " + message); - // return "Response From Server: " + message; - // } - - - } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java index eab79ec37..8f81657c9 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/StringToZonedDateTimeConverter.java @@ -3,6 +3,8 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.ReadingConverter; @@ -10,28 +12,23 @@ @ReadingConverter public class StringToZonedDateTimeConverter implements Converter { + private static final Logger logger = LoggerFactory.getLogger(StringToZonedDateTimeConverter.class); - // DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSVV"); - // DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSVV"); - // DateTimeFormatter formatter3 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SVV"); - // DateTimeFormatter formatter4 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssVV"); DateTimeFormatter formats[] = { - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSVV"), - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSVV"), - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SVV"), - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssVV"), - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSVV") + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSVV"), + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSVV"), + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SVV"), + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssVV"), + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSVV") }; - - @Override public ZonedDateTime convert(@NonNull String source) { - for(DateTimeFormatter format: formats){ + for (DateTimeFormatter format : formats) { try { return ZonedDateTime.parse(source, format); } catch (Exception e) { - + logger.error("Error parsing ZonedDateTime: {}", e); // Block of code to handle errors } } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/ZonedDateTimeToStringConverter.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/ZonedDateTimeToStringConverter.java index 046e28e7c..ff7caa411 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/ZonedDateTimeToStringConverter.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/converters/ZonedDateTimeToStringConverter.java @@ -1,6 +1,5 @@ package us.dot.its.jpo.ode.api.converters; - import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -12,9 +11,8 @@ @WritingConverter public class ZonedDateTimeToStringConverter implements Converter { - // DateTimeFormatter formatter = DateTimeFormatter.ISO_ZONED_DATE_TIME; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX"); - + @Override public String convert(@NonNull ZonedDateTime source) { return source.format(formatter); diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java index ed6d4b009..568b02561 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/KeycloakSecurityConfig.java @@ -15,23 +15,19 @@ import us.dot.its.jpo.ode.api.keycloak.support.CorsUtil; import us.dot.its.jpo.ode.api.keycloak.support.KeycloakJwtAuthenticationConverter; - /** * Provides keycloak based spring security configuration. */ @Configuration @EnableWebSecurity @RequiredArgsConstructor -@ConditionalOnProperty(prefix = "security", - name = "enabled", - havingValue = "true") // Allow disabling security +@ConditionalOnProperty(prefix = "security", name = "enabled", havingValue = "true") // Allow disabling security public class KeycloakSecurityConfig { final ConflictMonitorApiProperties properties; final KeycloakJwtAuthenticationConverter keycloakJwtAuthenticationConverter; - @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { @@ -42,8 +38,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws .authorizeHttpRequests(request -> request .requestMatchers(HttpMethod.OPTIONS, "/**").permitAll() // Allow CORS preflight .requestMatchers("/**").access(AccessController::checkAccess) - .anyRequest().authenticated() - ) + .anyRequest().authenticated()) .oauth2ResourceServer(resourceServerConfigurer -> resourceServerConfigurer.jwt( jwtConfigurer -> jwtConfigurer.jwtAuthenticationConverter(keycloakJwtAuthenticationConverter) @@ -52,12 +47,9 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws } - @Bean AccessController accessController() { return new AccessController(); } - - } \ No newline at end of file diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java index 20f7efe04..23f286afd 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/keycloak/config/MethodSecurityConfig.java @@ -12,20 +12,17 @@ import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; import org.springframework.security.core.authority.mapping.SimpleAuthorityMapper; - /** - * Enables security annotations via like {@link org.springframework.security.access.prepost.PreAuthorize} and - * {@link org.springframework.security.access.prepost.PostAuthorize} annotations per-method. + * Enables security annotations via like + * {@link org.springframework.security.access.prepost.PreAuthorize} and + * {@link org.springframework.security.access.prepost.PostAuthorize} annotations + * per-method. */ @Configuration @EnableMethodSecurity(prePostEnabled = true, jsr250Enabled = true) // jsr250 = @RolesAllowed -@ConditionalOnProperty(prefix = "security", - name = "enabled", - havingValue = "true") // Allow disabling security +@ConditionalOnProperty(prefix = "security", name = "enabled", havingValue = "true") // Allow disabling security class MethodSecurityConfig { - - private final ApplicationContext applicationContext; private final PermissionEvaluator permissionEvaluator; diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java index 590ea44ce..28e21e06f 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/EmailSettings.java @@ -12,7 +12,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; - public class EmailSettings { public boolean receiveAnnouncements; public boolean receiveCeaseBroadcastRecommendations; @@ -22,7 +21,7 @@ public class EmailSettings { private static final Logger logger = LoggerFactory.getLogger(EmailSettings.class); - public EmailSettings(){ + public EmailSettings() { this.receiveAnnouncements = true; this.receiveCeaseBroadcastRecommendations = true; this.receiveCriticalErrorMessages = true; @@ -30,14 +29,12 @@ public EmailSettings(){ this.notificationFrequency = EmailFrequency.ALWAYS; } - public static EmailSettings fromAttributes(Map> attributes){ - + public static EmailSettings fromAttributes(Map> attributes) { List notifications = attributes.get("NotificationSettings"); - - if(notifications != null && notifications.size() > 0){ + + if (notifications != null && notifications.size() > 0) { ObjectMapper mapper = DateJsonMapper.getInstance(); - // mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); EmailSettings settings; try { settings = mapper.readValue(notifications.get(0), EmailSettings.class); @@ -46,16 +43,14 @@ public static EmailSettings fromAttributes(Map> attributes) // TODO Auto-generated catch block e.printStackTrace(); } - - } + } logger.info("No Settings found Returning Default"); - return new EmailSettings(); + return new EmailSettings(); } - - public Map> toAttributes(){ + public Map> toAttributes() { Map> attributes = new HashMap<>(); List notifications = new ArrayList<>(); @@ -77,79 +72,46 @@ public String toString() { return ""; } - - - public boolean isReceiveAnnouncements() { return receiveAnnouncements; } - - - public void setReceiveAnnouncements(boolean receiveAnnouncements) { this.receiveAnnouncements = receiveAnnouncements; } - - - public boolean isReceiveCeaseBroadcastRecommendations() { return receiveCeaseBroadcastRecommendations; } - - - public void setReceiveCeaseBroadcastRecommendations(boolean receiveCeaseBroadcastRecommendations) { this.receiveCeaseBroadcastRecommendations = receiveCeaseBroadcastRecommendations; } - - - public boolean isReceiveCriticalErrorMessages() { return receiveCriticalErrorMessages; } - - - public void setReceiveCriticalErrorMessages(boolean receiveCriticalErrorMessages) { this.receiveCriticalErrorMessages = receiveCriticalErrorMessages; } - - - public boolean isReceiveNewUserRequests() { return receiveNewUserRequests; } - - - public void setReceiveNewUserRequests(boolean receiveNewUserRequests) { this.receiveNewUserRequests = receiveNewUserRequests; } - - - public EmailFrequency getNotificationFrequency() { return notificationFrequency; } - - - public void setNotificationFrequency(EmailFrequency notificationFrequency) { this.notificationFrequency = notificationFrequency; } - - - public static Logger getLogger() { return logger; } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/messages/DecodedMessage.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/messages/DecodedMessage.java index 55338e75f..3076426ec 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/messages/DecodedMessage.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/models/messages/DecodedMessage.java @@ -1,9 +1,11 @@ - package us.dot.its.jpo.ode.api.models.messages; import java.time.Instant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.core.JsonProcessingException; @@ -12,16 +14,13 @@ import lombok.Getter; import lombok.Setter; import us.dot.its.jpo.geojsonconverter.DateJsonMapper; +import us.dot.its.jpo.ode.api.controllers.AssessmentController; import us.dot.its.jpo.ode.api.models.MessageType; @Setter @EqualsAndHashCode @Getter -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = BsmDecodedMessage.class, name = "BSM"), @JsonSubTypes.Type(value = MapDecodedMessage.class, name = "MAP"), @@ -31,12 +30,14 @@ @JsonSubTypes.Type(value = TimDecodedMessage.class, name = "TIM") }) public class DecodedMessage { + private static final Logger logger = LoggerFactory.getLogger(DecodedMessage.class); + String asn1Text; long decodeTime; String decodeErrors; String type; - public DecodedMessage(String asn1Text, MessageType type, String decodeErrors){ + public DecodedMessage(String asn1Text, MessageType type, String decodeErrors) { this.asn1Text = asn1Text; this.decodeTime = Instant.now().toEpochMilli(); this.decodeErrors = decodeErrors; @@ -48,11 +49,8 @@ public String toString() { try { return DateJsonMapper.getInstance().writeValueAsString(this); } catch (JsonProcessingException e) { - // logger.error(String.format("Exception serializing %s Event to JSON", eventType), e); + logger.debug(String.format("Error: Exception serializing %s Event to JSON", this), e); } return ""; } } - - - diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/ReportService.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/ReportService.java index 634b61af0..a30a766c1 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/ReportService.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/services/ReportService.java @@ -36,11 +36,10 @@ import us.dot.its.jpo.ode.api.models.LaneConnectionCount; import us.dot.its.jpo.ode.api.models.ReportDocument; - @Service public class ReportService { - @Autowired + @Autowired ProcessedMapRepository processedMapRepo; @Autowired @@ -96,61 +95,63 @@ public class ReportService { @Autowired ReportRepository reportRepo; - + public ReportDocument buildReport(int intersectionID, String roadRegulatorID, long startTime, long endTime) { - public ReportDocument buildReport(int intersectionID, String roadRegulatorID, long startTime, long endTime){ - - String reportName = "CmReport_"+ intersectionID + "_" + roadRegulatorID + "_" + startTime + "_" + endTime; + String reportName = "CmReport_" + intersectionID + "_" + roadRegulatorID + "_" + startTime + "_" + endTime; // Lane Direction of Travel Info - List laneDirectionOfTravelEventCounts = laneDirectionOfTravelEventRepo.getLaneDirectionOfTravelEventsByDay(intersectionID, startTime, endTime); - List laneDirectionOfTravelMedianDistanceDistribution = laneDirectionOfTravelEventRepo.getMedianDistanceByFoot(intersectionID, startTime, endTime); - List laneDirectionOfTravelMedianHeadingDistribution = laneDirectionOfTravelEventRepo.getMedianDistanceByDegree(intersectionID, startTime, endTime); - List laneDirectionOfTravelAssessmentCount = laneDirectionOfTravelAssessmentRepo.getLaneDirectionOfTravelOverTime(intersectionID, startTime, endTime); + List laneDirectionOfTravelEventCounts = laneDirectionOfTravelEventRepo + .getLaneDirectionOfTravelEventsByDay(intersectionID, startTime, endTime); + List laneDirectionOfTravelMedianDistanceDistribution = laneDirectionOfTravelEventRepo + .getMedianDistanceByFoot(intersectionID, startTime, endTime); + List laneDirectionOfTravelMedianHeadingDistribution = laneDirectionOfTravelEventRepo + .getMedianDistanceByDegree(intersectionID, startTime, endTime); + List laneDirectionOfTravelAssessmentCount = laneDirectionOfTravelAssessmentRepo + .getLaneDirectionOfTravelOverTime(intersectionID, startTime, endTime); // Connection of Travel Info - List connectionOfTravelEventCounts = connectionOfTravelEventRepo.getConnectionOfTravelEventsByDay(intersectionID, startTime, endTime); - List laneConnectionCounts = connectionOfTravelEventRepo.getConnectionOfTravelEventsByConnection(intersectionID, startTime, endTime); + List connectionOfTravelEventCounts = connectionOfTravelEventRepo + .getConnectionOfTravelEventsByDay(intersectionID, startTime, endTime); + List laneConnectionCounts = connectionOfTravelEventRepo + .getConnectionOfTravelEventsByConnection(intersectionID, startTime, endTime); // Signal State Event Counts - List signalstateEventCounts = signalStateEventRepo.getSignalStateEventsByDay(intersectionID, startTime, endTime); + List signalstateEventCounts = signalStateEventRepo.getSignalStateEventsByDay(intersectionID, startTime, + endTime); // Signal state Stop Events - List signalStateStopEventCounts = signalStateStopEventRepo.getSignalStateStopEventsByDay(intersectionID, startTime, endTime); + List signalStateStopEventCounts = signalStateStopEventRepo + .getSignalStateStopEventsByDay(intersectionID, startTime, endTime); // Signal state Conflict Events - List signalStateConflictEventCounts = signalStateConflictEventRepo.getSignalStateConflictEventsByDay(intersectionID, startTime, endTime); - + List signalStateConflictEventCounts = signalStateConflictEventRepo + .getSignalStateConflictEventsByDay(intersectionID, startTime, endTime); + // Time Change Details Events - List timeChangeDetailsEventCounts = timeChangeDetailsEventRepo.getTimeChangeDetailsEventsByDay(intersectionID, startTime, endTime); + List timeChangeDetailsEventCounts = timeChangeDetailsEventRepo + .getTimeChangeDetailsEventsByDay(intersectionID, startTime, endTime); // Intersection Reference Alignment Event Counts - List intersectionReferenceAlignmentEventCounts = intersectionReferenceAlignmentEventRepo.getIntersectionReferenceAlignmentEventsByDay(intersectionID, startTime, endTime); - - + List intersectionReferenceAlignmentEventCounts = intersectionReferenceAlignmentEventRepo + .getIntersectionReferenceAlignmentEventsByDay(intersectionID, startTime, endTime); // Map / Spat counts - // List mapCounts = processedMapRepo.getMapBroadcastRates(intersectionID, startTime, endTime); - // List spatCounts = processedSpatRepo.getSpatBroadcastRates(intersectionID, startTime, endTime); - - List mapMinimumDataEventCount = mapMinimumDataEventRepo.getMapMinimumDataEventsByDay(intersectionID, startTime, endTime); - List spatMinimumDataEventCount = spatMinimumDataEventRepo.getSpatMinimumDataEventsByDay(intersectionID, startTime, endTime); + List mapMinimumDataEventCount = mapMinimumDataEventRepo.getMapMinimumDataEventsByDay(intersectionID, + startTime, endTime); + List spatMinimumDataEventCount = spatMinimumDataEventRepo.getSpatMinimumDataEventsByDay(intersectionID, + startTime, endTime); - List mapBroadcastRateEventCount = mapBroadcastRateEventRepo.getMapBroadcastRateEventsByDay(intersectionID, startTime, endTime); - List spatBroadcastRateEventCount = spatBroadcastRateEventRepo.getSpatBroadcastRateEventsByDay(intersectionID, startTime, endTime); + List mapBroadcastRateEventCount = mapBroadcastRateEventRepo + .getMapBroadcastRateEventsByDay(intersectionID, startTime, endTime); + List spatBroadcastRateEventCount = spatBroadcastRateEventRepo + .getSpatBroadcastRateEventsByDay(intersectionID, startTime, endTime); - List latestSpatMinimumdataEvent = spatMinimumDataEventRepo.find(spatMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, true)); - List latestMapMinimumdataEvent = mapMinimumDataEventRepo.find(mapMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, true)); + List latestSpatMinimumdataEvent = spatMinimumDataEventRepo + .find(spatMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, true)); + List latestMapMinimumdataEvent = mapMinimumDataEventRepo + .find(mapMinimumDataEventRepo.getQuery(intersectionID, startTime, endTime, true)); - - - - - // Map / Spat Message Rate Distributions - // List spatCountDistribution = processedSpatRepo.getSpatBroadcastRateDistribution(intersectionID, startTime, endTime); - // List mapCountDistribution = processedMapRepo.getMapBroadcastRateDistribution(intersectionID, startTime, endTime); - ByteArrayOutputStream stream = new ByteArrayOutputStream(); ReportBuilder builder = new ReportBuilder(stream); @@ -160,8 +161,10 @@ public ReportDocument buildReport(int intersectionID, String roadRegulatorID, lo // Add Lane Direction of Travel Information builder.addTitle("Lane Direction of Travel"); builder.addLaneDirectionOfTravelEvent(DailyData.fromIDCountDays(laneDirectionOfTravelEventCounts, dateStrings)); - builder.addLaneDirectionOfTravelMedianDistanceDistribution(ChartData.fromIDCountList(laneDirectionOfTravelMedianDistanceDistribution)); - builder.addLaneDirectionOfTravelMedianHeadingDistribution(ChartData.fromIDCountList(laneDirectionOfTravelMedianHeadingDistribution)); + builder.addLaneDirectionOfTravelMedianDistanceDistribution( + ChartData.fromIDCountList(laneDirectionOfTravelMedianDistanceDistribution)); + builder.addLaneDirectionOfTravelMedianHeadingDistribution( + ChartData.fromIDCountList(laneDirectionOfTravelMedianHeadingDistribution)); builder.addDistanceFromCenterlineOverTime(laneDirectionOfTravelAssessmentCount); builder.addHeadingOverTime(laneDirectionOfTravelAssessmentCount); builder.addPageBreak(); @@ -184,7 +187,8 @@ public ReportDocument buildReport(int intersectionID, String roadRegulatorID, lo // Add Intersection Reference Alignment Event Counts builder.addTitle("Intersection Reference Alignment Event Counts"); - builder.addIntersectionReferenceAlignmentEvents(DailyData.fromIDCountDays(intersectionReferenceAlignmentEventCounts, dateStrings)); + builder.addIntersectionReferenceAlignmentEvents( + DailyData.fromIDCountDays(intersectionReferenceAlignmentEventCounts, dateStrings)); builder.addPageBreak(); // Add Map Broadcast Rate Events @@ -203,24 +207,6 @@ public ReportDocument buildReport(int intersectionID, String roadRegulatorID, lo builder.addSpatMinimumDataEventErrors(latestSpatMinimumdataEvent); builder.addPageBreak(); - - - - // builder.addTitle("Map"); - // builder.addMapBroadcastRate(mapCounts); - // builder.addMapBroadcastRateDistribution(mapCountDistribution, startTime, endTime); - - // builder.addPageBreak(); - - // builder.addTitle("SPaT"); - // builder.addSpatBroadcastRate(spatCounts); - // builder.addSpatBroadcastRateDistribution(spatCountDistribution, startTime, endTime); - - // builder.addPageBreak(); - - - - builder.write(); ReportDocument doc = new ReportDocument(); diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java index c25e89c80..c61673c56 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java @@ -85,7 +85,6 @@ public static LaneDirectionOfTravelEvent getLaneDirectionOfTravelEvent() { public static SignalGroupAlignmentEvent getSignalGroupAlignmentEvent() { SignalGroupAlignmentEvent event = new SignalGroupAlignmentEvent(); - // event.setSource("Made in China"); event.setTimestamp(ZonedDateTime.now().toInstant().toEpochMilli()); event.setSpatSignalGroupIds(Stream.of(1, 6).collect(Collectors.toSet())); event.setMapSignalGroupIds(Stream.of(2, 7).collect(Collectors.toSet())); @@ -146,20 +145,21 @@ public static StopLineStopEvent getStopLineStopEvent() { } public static TimeChangeDetailsEvent getTimeChangeDetailsEvent() { - + TimeChangeDetailsEvent event = new TimeChangeDetailsEvent(); event.setRoadRegulatorID(104); event.setIntersectionID(12109); event.setSignalGroup(6); event.setFirstSpatTimestamp(ZonedDateTime.now().toInstant().toEpochMilli()); event.setSecondSpatTimestamp(ZonedDateTime.now().toInstant().toEpochMilli()); - event.setFirstConflictingTimemark((ZonedDateTime.now().toInstant().toEpochMilli()+100) % (60 * 60 * 1000) / 100); - event.setSecondConflictingTimemark(ZonedDateTime.now().toInstant().toEpochMilli() % (60 * 60 * 1000) / 100); + event.setFirstConflictingTimemark( + (ZonedDateTime.now().toInstant().toEpochMilli() + 100) % (60 * 60 * 1000) / 100); + event.setSecondConflictingTimemark(ZonedDateTime.now().toInstant().toEpochMilli() % (60 * 60 * 1000) / 100); event.setFirstState(J2735MovementPhaseState.PROTECTED_CLEARANCE); event.setSecondState(J2735MovementPhaseState.PROTECTED_CLEARANCE); event.setFirstTimeMarkType("minEndTime"); event.setSecondTimeMarkType("maxEndTime"); - event.setFirstConflictingUtcTimestamp(ZonedDateTime.now().toInstant().toEpochMilli()+100); + event.setFirstConflictingUtcTimestamp(ZonedDateTime.now().toInstant().toEpochMilli() + 100); event.setSecondConflictingUtcTimestamp(ZonedDateTime.now().toInstant().toEpochMilli()); event.setSource("{\"intersectionID\": 12109, \"roadRegulatorID\": 104, \"originIp\": \"192.168.1.1\"}"); return event; @@ -222,12 +222,16 @@ public static BsmEvent getBsmEvent() { event.setIntersectionID(12109); event.setStartingBsm(MockBsmGenerator.getJsonBsms().getFirst()); event.setEndingBsm(MockBsmGenerator.getJsonBsms().getLast()); - event.setStartingBsmTimestamp(Instant.parse(event.getStartingBsm().getMetadata().getOdeReceivedAt()).toEpochMilli()); - event.setEndingBsmTimestamp(Instant.parse(event.getEndingBsm().getMetadata().getOdeReceivedAt()).toEpochMilli()); - event.setWktMapBoundingBox("LINESTRING (-105.09071084163995 39.587773371787485, -105.09071620693672 39.58779610924971, -105.09072266805292 39.58781264558122, -105.09072836868071 39.587833057609934)"); + event.setStartingBsmTimestamp( + Instant.parse(event.getStartingBsm().getMetadata().getOdeReceivedAt()).toEpochMilli()); + event.setEndingBsmTimestamp( + Instant.parse(event.getEndingBsm().getMetadata().getOdeReceivedAt()).toEpochMilli()); + event.setWktMapBoundingBox( + "LINESTRING (-105.09071084163995 39.587773371787485, -105.09071620693672 39.58779610924971, -105.09072266805292 39.58781264558122, -105.09072836868071 39.587833057609934)"); event.setInMapBoundingBox(true); event.setWallClockTimestamp(Instant.now().toEpochMilli()); - event.setWktPath("LINESTRING (-105.09071084163995 39.587773371787485, -105.09071620693672 39.58779610924971, -105.09072266805292 39.58781264558122, -105.09072836868071 39.587833057609934)"); + event.setWktPath( + "LINESTRING (-105.09071084163995 39.587773371787485, -105.09071620693672 39.58779610924971, -105.09072266805292 39.58781264558122, -105.09072836868071 39.587833057609934)"); return event; } } diff --git a/jpo-conflictvisualizer-api/src/main/resources/application.properties b/jpo-conflictvisualizer-api/src/main/resources/application.properties index 0d4174e25..1f51e369e 100644 --- a/jpo-conflictvisualizer-api/src/main/resources/application.properties +++ b/jpo-conflictvisualizer-api/src/main/resources/application.properties @@ -28,7 +28,7 @@ server.compression.min-response-size=1024 ### General Email Settings -#Email Broker Options: sendgrid , postmark, anything else will use generic SMTP mail server. +# Email Broker Options: sendgrid, postmark, anything else will use generic SMTP mail server. emailBroker=${CM_EMAIL_BROKER:""} emailFromAddress=${CM_EMAIL_FROM_ADDRESS:""} diff --git a/jpo-conflictvisualizer-api/src/main/resources/logback.xml b/jpo-conflictvisualizer-api/src/main/resources/logback.xml index ab5b8057d..d265443a6 100644 --- a/jpo-conflictvisualizer-api/src/main/resources/logback.xml +++ b/jpo-conflictvisualizer-api/src/main/resources/logback.xml @@ -10,7 +10,6 @@ -