Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
8f29767
Merge remote-tracking branch 'origin/fix/prevent-logging-constraint-v…
dmccoystephenson Mar 20, 2025
5874c8e
Formatted `WydotTimIncidentController` class
dmccoystephenson Mar 20, 2025
0fb9809
Addressed comments on `WydotTimIncidentController` class
dmccoystephenson Mar 20, 2025
0ce46b4
Added `@Slf4j` annotation to WydotTimIncidentController class
dmccoystephenson Mar 20, 2025
695273f
Removed unused imports in WydotTimIncidentController class
dmccoystephenson Mar 20, 2025
683d7b6
Formatted SetItisCodes class
dmccoystephenson Mar 20, 2025
6eac999
Addressed warnings in SetItisCodes class
dmccoystephenson Mar 20, 2025
3e7e3fe
Added `@Slf4j` annotation to SetItisCodes class
dmccoystephenson Mar 20, 2025
1cb2eab
Formatted SetItisCodesTest class
dmccoystephenson Mar 20, 2025
2121b6c
Added passing unit test for `setItisCodesIncident` when default incid…
dmccoystephenson Mar 20, 2025
8b9c0b5
Added failing unit test for `setItisCodesIncident` when existing prob…
dmccoystephenson Mar 20, 2025
95c6dd9
Fixed failing unit test for `setItisCodesIncident` when existing prob…
dmccoystephenson Mar 20, 2025
59e325a
Refactored part of `setItisCodesIncident` for clarity
dmccoystephenson Mar 20, 2025
7307b99
Added comment to `setItisCodesIncident` for clarity
dmccoystephenson Mar 20, 2025
312af13
Added `problemOtherText` instance variable to WydotTimIncident class
dmccoystephenson Mar 20, 2025
3ff0bf5
Formatted WydotTimIncident class
dmccoystephenson Mar 20, 2025
554aab5
Implemented failing unit test for GVW restriction incident in SetItis…
dmccoystephenson Mar 21, 2025
ea704a9
Removed duplicate when statement in `testSetItisCodesIncident_OtherPr…
dmccoystephenson Mar 21, 2025
ed4d295
Added constructors to ItisCode class
dmccoystephenson Mar 21, 2025
375dbf2
Updated setItisCodesIncident to handle "other" problem case for GVW r…
dmccoystephenson Mar 21, 2025
dc2dbb4
Added more unit tests for GVW restriction incidents to SetItisCodesTest
dmccoystephenson Mar 21, 2025
170d21a
Removed utility instance variable from SetItisCodes class
dmccoystephenson Mar 21, 2025
86ec481
Replaced `InjectDependencies` with constructor in SetItisCodes class,…
dmccoystephenson Mar 21, 2025
a9dbc31
Removed constructors from ItisCode class
dmccoystephenson Mar 21, 2025
4859c6f
Merge pull request #33 from Trihydro/sync-dev-with-main-3-20-2025
dmccoystephenson Mar 24, 2025
084778c
Merge pull request #35 from Trihydro/main
dmccoystephenson Mar 25, 2025
d5f5fa7
Update method comment to JavaDoc in TimRefreshController
dmccoystephenson Mar 25, 2025
285e204
Update refresh cron expression and standardize configuration
dmccoystephenson Mar 25, 2025
717a8a0
Formatted TimRefreshController
dmccoystephenson Mar 25, 2025
a5f176b
Addressed warnings for TimRefreshController class
dmccoystephenson Mar 25, 2025
5e94991
Added `@Slf4j` annotation to TimRefreshController class and transitio…
dmccoystephenson Mar 25, 2025
985f63d
Refactor constructor to use `this` for clarity.
dmccoystephenson Mar 25, 2025
2f3370d
Added `@Slfj4` annotation to DbInteractions class and transitioned to…
dmccoystephenson Mar 26, 2025
befaede
Removed utility instance variable from DbInteractions class
dmccoystephenson Mar 26, 2025
8306e2b
Refactor DbInteractions constructor to enforce final fields
dmccoystephenson Mar 26, 2025
dccc52e
Refactor DbInteractionsTest to remove @InjectMocks and initMocks
dmccoystephenson Mar 26, 2025
3b9b45d
Refactor `DbInteractions` to use try-with-resources for ResultSet.
dmccoystephenson Mar 26, 2025
38a8c00
Refactor DbInteractionsTest to use Mockito annotations
dmccoystephenson Mar 26, 2025
243b05b
Rename test methods for clarity and consistency
dmccoystephenson Mar 26, 2025
28c66f3
Add missing verifications to database interaction tests
dmccoystephenson Mar 26, 2025
cad9af3
Refactor DbInteractions fields to private visibility.
dmccoystephenson Mar 26, 2025
202814c
Add comprehensive JavaDoc comments to DbInteractions class
dmccoystephenson Mar 26, 2025
bcda5d1
Add LOGGING_LEVEL_COM_TRIHYDRO to environment variables
dmccoystephenson Mar 26, 2025
aa83d9f
Add LOGGING_LEVEL_COM_TRIHYDRO variable to services in root docker-co…
dmccoystephenson Mar 26, 2025
b03473f
Formatted classes in logger-kafka-consumer module that use `utility.l…
dmccoystephenson Mar 26, 2025
761c0cd
Added `@Slf4j` annotation to LoggerKafkaConsumer class and transition…
dmccoystephenson Mar 26, 2025
5341212
Added `@Slf4j` annotation to ActiveTimHoldingService class and transi…
dmccoystephenson Mar 26, 2025
91b671e
Added `@Slf4j` annotation to ActiveTimService class and transitioned …
dmccoystephenson Mar 26, 2025
b5ca466
Added `@Slf4j` annotation to DataFrameService class and transitioned …
dmccoystephenson Mar 26, 2025
3c7e8c5
Added `@Slf4j` annotation to TimService class and transitioned to cal…
dmccoystephenson Mar 26, 2025
56959d7
Addressed warnings in LoggerKafkaConsumer class
dmccoystephenson Mar 26, 2025
1545952
Refactor resource management to use try-with-resources in ActiveTimHo…
dmccoystephenson Mar 26, 2025
8cbbe6b
Refactor resource management to use try-with-resources in ActiveTimSe…
dmccoystephenson Mar 26, 2025
baf1e2a
Addressed warnings in ActiveTimService class
dmccoystephenson Mar 26, 2025
dacbc4c
Added TODO to ActiveTimService
dmccoystephenson Mar 26, 2025
e08d6a8
Added TODO to DataFrameService
dmccoystephenson Mar 26, 2025
41afca3
Refactor resource management to use try-with-resources in DataFrameSe…
dmccoystephenson Mar 26, 2025
1d44640
Addressed warnings in DataFrameService class
dmccoystephenson Mar 26, 2025
82834b2
Added TODO to TimService class
dmccoystephenson Mar 26, 2025
d34c921
Refactor resource management to use try-with-resources in TimService …
dmccoystephenson Mar 26, 2025
859ffdb
Addressed warnings in TimService class
dmccoystephenson Mar 26, 2025
02b4a19
Removed unused import in TimService class
dmccoystephenson Mar 26, 2025
a32609e
fix: Transitioned to try-with-resources for /expired endpoint in Acti…
dmccoystephenson Feb 19, 2025
e88a6f7
Fix: Updated RemoveExpiredActiveTims task to use batch processing, mi…
dmccoystephenson Feb 19, 2025
69ce37c
Added {limit} parameter to ActiveTImController.GetExpiredActiveTims()…
dmccoystephenson Feb 19, 2025
323269d
Updated RemoveExpiredActiveTims to break loop upon error accessing re…
dmccoystephenson Feb 19, 2025
fdd4763
Added batch limit to RemoveExpiredActiveTims
dmccoystephenson Feb 19, 2025
1722bba
Modified RemoveExpiredActiveTims to break loop upon failure to access…
dmccoystephenson Feb 19, 2025
5dc8a84
Modified ActiveTimController & ActiveTimService to use ? syntax for p…
dmccoystephenson Feb 20, 2025
f878288
Removed `milepost-graph-db` directory
dmccoystephenson Apr 2, 2025
b41166a
Removed `milepost-graph-db` docker service
dmccoystephenson Apr 2, 2025
1e19a00
Update Neo4j URI reference to use environment variable
dmccoystephenson Apr 2, 2025
6c7c0e7
Add note on Neo4j database requirement to README
dmccoystephenson Apr 2, 2025
fb212d5
Update Neo4j URI to use DOCKER_HOST_IP in sample.env
dmccoystephenson Apr 2, 2025
1247abe
Update notUsed field naming to doNotUse
mwodahl Jan 10, 2025
0c40793
Update x/y pos, elevation, width fields to comply with J2735 2024
mwodahl Jan 10, 2025
07e27c6
Update field names in cv-data-service-library test resources
mwodahl Jan 10, 2025
f9ed12a
Update logger-kafka-consumer testing resource field names
mwodahl Jan 10, 2025
bea2c61
Update sample data field names for J2735 2024
mwodahl Jan 10, 2025
1781fe0
Update version from 1.4.0-SNAPSHOT to 2.0.0
mwodahl Jan 10, 2025
d3c6e99
Uncomment local-deployment services
mwodahl Jan 10, 2025
f68d73c
Remove DOCKER_HOST_IP from CONFIG_ODE_URL
mwodahl Jan 10, 2025
b2128e0
Update jpo-ode packages to use latest release
mwodahl Jan 30, 2025
e13a73f
Update doNotUse values
mwodahl Jan 31, 2025
df04faf
Extract UpdateTimModel set properties into a new method, update TimUp…
mwodahl Mar 7, 2025
63a7a56
Update ode tags to 2025-q1
mwodahl Mar 7, 2025
6fc6e48
Remove unnecessary doNotUse references
mwodahl Mar 12, 2025
0a6b561
Add additional ODE env vars to local-deployment docker-compose.yml
mwodahl Mar 27, 2025
e0ada54
Remove equals sign from ode env var
mwodahl Mar 27, 2025
e7ead44
Update direction calculation, convertTmcTimTopicToJson methods to han…
mwodahl Mar 13, 2025
35e3873
Remove unused imports
mwodahl Mar 13, 2025
e163ea2
Update construction test data to match OdeTimJson new format
mwodahl Mar 13, 2025
b680d8c
Updating parking test data to match updated OdeTimJson format
mwodahl Mar 13, 2025
48c8ba1
Update VSL testing data to match OdeTimJson new format
mwodahl Mar 13, 2025
e7cb21e
Update odeTim testing files to match OdeTimJson new format
mwodahl Mar 13, 2025
f2f8de6
Remove unnecessary test from TimDataConverterTest
mwodahl Mar 13, 2025
bd91ded
Update getRegion to use StringBuilder, parseBoolean
mwodahl Apr 2, 2025
b0842c9
Improved frame type value resolution in `ActiveTimController` to defa…
dmccoystephenson Apr 3, 2025
0ddb702
Merge pull request #47 from Trihydro/fix/handle-frame-type-value-fail…
dmccoystephenson Apr 4, 2025
e89fc46
Update README to use placeholder versions for jar files
dmccoystephenson Apr 4, 2025
efc923f
Merge branch 'git/merge-ode-2025-q1-compatibility-changes-from-cdot-f…
dmccoystephenson Apr 4, 2025
cb7a9b6
Modified `DbInteractions.validateDbConfig` to return early if dataSou…
dmccoystephenson Apr 4, 2025
6411863
Merge branch 'logs/reduce-database-record-log-volume' into logs/reduc…
dmccoystephenson Apr 4, 2025
397083c
Refine logging levels in TimService.java
dmccoystephenson Apr 4, 2025
ff08cac
Merge pull request #45 from Trihydro/main
mcook42 Apr 7, 2025
2ac5b80
Merge branch 'dev' into feature/support-gvw-restriction-through-incid…
dmccoystephenson Apr 7, 2025
4375f68
Merge pull request #37 from Trihydro/logs/reduce-database-record-log-…
dmccoystephenson Apr 7, 2025
1ecbbab
Merge branch 'dev' into logs/reduce-logger-kafka-consumer-log-volume
dmccoystephenson Apr 7, 2025
1574877
Merge branch 'dev' into config/update-tim-refresh-interval
dmccoystephenson Apr 7, 2025
b5d237e
Merge branch 'dev' into neo4j/remove-tracked-database-and-docker-service
dmccoystephenson Apr 7, 2025
c27707d
Merge branch 'dev' into git/merge-ode-2025-q1-compatibility-changes-f…
dmccoystephenson Apr 7, 2025
479fef2
Merge branch 'dev' into git/pull-batch-processing-fix-from-azure
dmccoystephenson Apr 7, 2025
62a5dc6
Added note on GMT to sample.env
dmccoystephenson Apr 7, 2025
33d771a
Merge pull request #36 from Trihydro/config/update-tim-refresh-interval
dmccoystephenson Apr 7, 2025
1bdde7e
Merge branch 'dev' into neo4j/remove-tracked-database-and-docker-service
dmccoystephenson Apr 7, 2025
5b1f236
Merge pull request #44 from Trihydro/neo4j/remove-tracked-database-an…
dmccoystephenson Apr 7, 2025
4f6be22
Merge branch 'dev' into logs/reduce-logger-kafka-consumer-log-volume
dmccoystephenson Apr 7, 2025
8288a57
Merge branch 'dev' into git/pull-batch-processing-fix-from-azure
dmccoystephenson Apr 7, 2025
76740df
Merge branch 'dev' into git/merge-ode-2025-q1-compatibility-changes-f…
dmccoystephenson Apr 7, 2025
9d75305
Merge branch 'dev' into feature/support-gvw-restriction-through-incid…
dmccoystephenson Apr 7, 2025
0276c06
Renamed `setPropertiesForActiveTim` to `buildTimUpdateModelFromResult…
dmccoystephenson Apr 7, 2025
f622ef2
Switched to using the Slf4j logger
dmccoystephenson Apr 7, 2025
4c16bf1
Simplified logic in JsonToJavaConverter class
dmccoystephenson Apr 7, 2025
0831c0f
Use logger instead of printing stack trace directly
dmccoystephenson Apr 7, 2025
fe93cfa
Merge pull request #40 from Trihydro/git/pull-batch-processing-fix-fr…
dmccoystephenson Apr 7, 2025
4c4afc4
Merge pull request #46 from Trihydro/git/merge-ode-2025-q1-compatibil…
dmccoystephenson Apr 8, 2025
a2919fb
Merge remote-tracking branch 'origin/main' into release/v2.0
dmccoystephenson Apr 8, 2025
8ee29e3
Merge remote-tracking branch 'origin/dev' into logs/reduce-logger-kaf…
dmccoystephenson Apr 8, 2025
78e7282
Merge pull request #38 from Trihydro/logs/reduce-logger-kafka-consume…
mcook42 Apr 8, 2025
87ed541
Merge branch 'main' into sync-dev-with-main-4-8-2025
dmccoystephenson Apr 8, 2025
013c8ed
Merge branch 'dev' into release/v2.0
dmccoystephenson Apr 8, 2025
690acca
Merge branch 'main' into release/v2.0
dmccoystephenson Apr 8, 2025
9c5b7e7
Merge pull request #51 from Trihydro/sync-dev-with-main-4-8-2025
dmccoystephenson Apr 9, 2025
f435655
Merge branch 'dev' into release/v2.0
dmccoystephenson Apr 9, 2025
78b970d
Merge branch 'dev' into feature/support-gvw-restriction-through-incid…
dmccoystephenson Apr 9, 2025
d64bb9f
Added warn log statement for when 'itis' or 'text' not found in item …
dmccoystephenson Apr 9, 2025
6f3fba5
Added another warn log statement for when 'itis' or 'text' not found …
dmccoystephenson Apr 9, 2025
e0c5c74
Set default frameType to 'advisory' when missing in JSON.
dmccoystephenson Apr 9, 2025
4921818
Replaced usages of `System.out` with slf4j logging in JsonToJavaConve…
dmccoystephenson Apr 9, 2025
8c912f4
Refactor: remove unused conversion methods and imports
dmccoystephenson Apr 9, 2025
bdb6408
Make ObjectMapper instance final in JsonToJavaConverter
dmccoystephenson Apr 9, 2025
a9aa1ec
Refactor TIM test data handling with external JSON file
dmccoystephenson Apr 9, 2025
13adeb1
Set ACM_LOG_LEVEL via environment variable for local deployment
dmccoystephenson Apr 9, 2025
3a4fe48
Merge pull request #34 from Trihydro/feature/support-gvw-restriction-…
dmccoystephenson Apr 10, 2025
ed575b4
Merge remote-tracking branch 'origin/dev' into pr/addressing-comments…
dmccoystephenson Apr 10, 2025
9a5970f
Merge remote-tracking branch 'origin/dev' into release/v2.0
dmccoystephenson Apr 10, 2025
98992ab
Merge branch 'release/v2.0' into pr/addressing-comments-for-release-2.0
dmccoystephenson Apr 10, 2025
a035a84
Merge pull request #52 from Trihydro/pr/addressing-comments-for-relea…
payneBrandon Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,28 @@ This will create the `target` folder under each module. From here, create a new
```
.
├── cv-data-controller
│ ├── cv-data-controller-1.4.0-SNAPSHOT.jar
│ ├── cv-data-controller-x.x.x.jar
│ ├── Dockerfile
├── cv-data-tasks
│ ├── cv-data-tasks-1.4.0-SNAPSHOT.jar
│ ├── cv-data-tasks-x.x.x.jar
│ ├── Dockerfile
├── docker-compose.yml
├── ode-data-logger
│ ├── Dockerfile
│ ├── ode-data-logger-1.4.0-SNAPSHOT.jar
│ ├── ode-data-logger-x.x.x.jar
├── ode-mongo-logger
│ ├── Dockerfile
│ ├── ode-mongo-logger-1.4.0-SNAPSHOT.jar
│ ├── ode-mongo-logger-x.x.x.jar
├── ode-wrapper
│ ├── Dockerfile
│ ├── ode-wrapper-1.4.0-SNAPSHOT.jar
│ ├── ode-wrapper-x.x.x.jar
├── ode-wrapper-docs
│ └── swagger-ui-master
│ ├── Dockerfile
│ ├── (swagger folder structure)
└── tim-refresh
├── Dockerfile
├── tim-refresh-1.4.0-SNAPSHOT.jar
├── tim-refresh-x.x.x.jar

```

Expand Down
2 changes: 1 addition & 1 deletion cert-expiration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM maven:3.8-eclipse-temurin-21-alpine

ADD . /home/timm/timm_applications/cert-expiration

CMD java -jar /home/timm/timm_applications/cert-expiration/cert-expiration-1.4.0-SNAPSHOT.jar
CMD java -jar /home/timm/timm_applications/cert-expiration/cert-expiration-2.0.0.jar
2 changes: 1 addition & 1 deletion cert-expiration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.timm</groupId>
<artifactId>tim-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.0</version>
</parent>

<artifactId>cert-expiration</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cv-data-controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM maven:3.8-eclipse-temurin-21-alpine

ADD . /home/timm/timm_applications/cv-data-controller

CMD java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/timm/timm_applications/cv-data-controller/cv-data-controller-1.4.0-SNAPSHOT.jar
CMD java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/timm/timm_applications/cv-data-controller/cv-data-controller-2.0.0.jar
4 changes: 4 additions & 0 deletions cv-data-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ You may configure these values in `cv-data-controller/src/main/resources/applica
| SERVER_SSL_KEY_STORE_TYPE | CONTROLLER_SERVER_SSL_KEY_STORE_TYPE | server.ssl.keyStoreType | **PROD ONLY** Keystore type (JKS) | JKS |
| SERVER_SSL_KEY_ALIAS | CONTROLLER_SERVER_SSL_KEY_ALIAS | server.ssl.keyAlias | **PROD ONLY** Alias for Keystore | example.alias |

## Note on Neo4j Database
The system expects a Neo4j database to be running and accessible at the address specified in the `application.properties` file or the `sample.env` file. The
database should be populated with the necessary data for the system to function properly. The database should be running before starting the application.

## Testing
To run the unit tests, follow these steps:
1. Reopen the project in the provided dev container by clicking on the blue button in the bottom left corner of the window and selecting "Reopen in Container"
Expand Down
2 changes: 1 addition & 1 deletion cv-data-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.timm</groupId>
<artifactId>tim-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>2.0.0</version>
</parent>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.springframework.web.client.HttpServerErrorException;
import springfox.documentation.annotations.ApiIgnore;
import us.dot.its.jpo.ode.plugin.j2735.timstorage.FrameType.TravelerInfoType;

Expand Down Expand Up @@ -74,9 +75,8 @@ public void InjectDependencies(TimDbTables _timDbTables, SQLNullHandler _sqlNull
* @return List of ActiveTim objects
*/
@RequestMapping(value = "/expiring", method = RequestMethod.GET, produces = "application/json", headers = "Accept=application/json")
public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() throws SQLException {
TimUpdateModel activeTim;
List<TimUpdateModel> activeTims = new ArrayList<TimUpdateModel>();
public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() {
List<TimUpdateModel> activeTims = new ArrayList<>();

String selectStatement = "SELECT atim.*, tt.type as tim_type_name, tt.description as tim_type_description";
selectStatement += ", t.msg_cnt, t.url_b, t.is_satellite, t.sat_record_id, t.packet_id";
Expand All @@ -100,72 +100,18 @@ public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() throws SQLEx
try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
// convert to ActiveTim object
while (rs.next()) {
activeTim = new TimUpdateModel();

// Active_Tim properties
activeTim.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
activeTim.setTimId(rs.getLong("TIM_ID"));
activeTim.setDirection(rs.getString("DIRECTION"));
activeTim.setStartDateTime(rs.getString("TIM_START"));
activeTim.setEndDateTime(rs.getString("TIM_END"));
activeTim.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
activeTim.setSatRecordId(rs.getString("SAT_RECORD_ID"));
activeTim.setClientId(rs.getString("CLIENT_ID"));
activeTim.setRoute(rs.getString("ROUTE"));

Coordinate startPoint = null;
Coordinate endPoint = null;
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
if (!rs.wasNull()) {
startPoint = new Coordinate(startLat, startLon);
}
activeTim.setStartPoint(startPoint);

BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
if (!rs.wasNull()) {
endPoint = new Coordinate(endLat, endLon);
}
activeTim.setEndPoint(endPoint);

activeTim.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
activeTim.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));

// Tim properties
activeTim.setMsgCnt(rs.getInt("MSG_CNT"));
activeTim.setUrlB(rs.getString("URL_B"));
activeTim.setPacketId(rs.getString("PACKET_ID"));

// Tim Type properties
activeTim.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
activeTim.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));

// Region Properties
activeTim.setRegionId(rs.getInt("REGION_ID"));
activeTim.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
activeTim.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));

activeTim.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
activeTim.setRegionDirection(rs.getString("REGION_DIRECTION"));
activeTim.setDirectionality(rs.getString("DIRECTIONALITY"));
activeTim.setClosedPath(rs.getBoolean("CLOSED_PATH"));
activeTim.setPathId(rs.getInt("PATH_ID"));
activeTim.setRegionDescription(rs.getString("REGION_DESCRIPTION"));

// DataFrame properties
activeTim.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
activeTim.setDurationTime(rs.getInt("DURATION_TIME"));
activeTim.setNotUsed1((short) 0); // as of J2735 this should be set to 0 and is ignored
activeTim.setNotUsed((short) 0); // as of J2735 this should be set to 0 and is ignored
activeTim.setNotUsed3((short) 0); // as of J2735 this should be set to 0 and is ignored
activeTim.setNotUsed2((short) 0); // as of J2735 this should be set to 0 and is ignored
activeTim.setUrl(rs.getString("URL"));
var activeTim = buildTimUpdateModelFromResultSet(rs);

int frameTypeValue = rs.getInt("FRAME_TYPE");
if (!rs.wasNull() && frameTypeValue >= 0 && frameTypeValue < TravelerInfoType.values().length) {
activeTim.setFrameType(TravelerInfoType.values()[frameTypeValue]);
}
else {
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue,
activeTim.getActiveTimId());
// assume advisory
activeTim.setFrameType(TravelerInfoType.advisory);
}

// set dataFrame content. it's required for the ODE, so if we didn't record it,
// assume Advisory
Expand Down Expand Up @@ -210,72 +156,18 @@ public ResponseEntity<TimUpdateModel> GetUpdateModelFromActiveTimId(@PathVariabl
try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
// convert to ActiveTim object
while (rs.next()) {
activeTim = new TimUpdateModel();

// Active_Tim properties
activeTim.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
activeTim.setTimId(rs.getLong("TIM_ID"));
activeTim.setDirection(rs.getString("DIRECTION"));
activeTim.setStartDateTime(rs.getString("TIM_START"));
activeTim.setEndDateTime(rs.getString("TIM_END"));
activeTim.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
activeTim.setSatRecordId(rs.getString("SAT_RECORD_ID"));
activeTim.setClientId(rs.getString("CLIENT_ID"));
activeTim.setRoute(rs.getString("ROUTE"));

Coordinate startPoint = null;
Coordinate endPoint = null;
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
if (!rs.wasNull()) {
startPoint = new Coordinate(startLat, startLon);
}
activeTim.setStartPoint(startPoint);

BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
if (!rs.wasNull()) {
endPoint = new Coordinate(endLat, endLon);
}
activeTim.setEndPoint(endPoint);

activeTim.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
activeTim.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));

// Tim properties
activeTim.setMsgCnt(rs.getInt("MSG_CNT"));
activeTim.setUrlB(rs.getString("URL_B"));
activeTim.setPacketId(rs.getString("PACKET_ID"));

// Tim Type properties
activeTim.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
activeTim.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));

// Region Properties
activeTim.setRegionId(rs.getInt("REGION_ID"));
activeTim.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
activeTim.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));

activeTim.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
activeTim.setRegionDirection(rs.getString("REGION_DIRECTION"));
activeTim.setDirectionality(rs.getString("DIRECTIONALITY"));
activeTim.setClosedPath(rs.getBoolean("CLOSED_PATH"));
activeTim.setPathId(rs.getInt("PATH_ID"));
activeTim.setRegionDescription(rs.getString("REGION_DESCRIPTION"));

// DataFrame properties
activeTim.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
activeTim.setDurationTime(rs.getInt("DURATION_TIME"));
activeTim.setNotUsed1((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
activeTim.setNotUsed((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
activeTim.setNotUsed3((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
activeTim.setNotUsed2((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
activeTim.setUrl(rs.getString("URL"));
activeTim = buildTimUpdateModelFromResultSet(rs);

int frameTypeValue = rs.getInt("FRAME_TYPE");
if (!rs.wasNull() && frameTypeValue >= 0 && frameTypeValue < TravelerInfoType.values().length) {
activeTim.setFrameType(TravelerInfoType.values()[frameTypeValue]);
}
else {
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue, activeTimId);
// assume advisory
activeTim.setFrameType(TravelerInfoType.advisory);
}

// set dataFrame content. it's required for the ODE, so if we didn't record it,
// assume Advisory
Expand Down Expand Up @@ -373,22 +265,19 @@ public ResponseEntity<List<ActiveTim>> GetActiveTimsNotSent() {
return ResponseEntity.ok(activeTims);
}

@RequestMapping(value = "/expired", method = RequestMethod.GET)
public ResponseEntity<List<ActiveTim>> GetExpiredActiveTims() {
List<ActiveTim> activeTims = new ArrayList<ActiveTim>();

String selectStatement = "select * from ACTIVE_TIM";
selectStatement += " WHERE TIM_END <= (NOW() AT TIME ZONE 'UTC')";

try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
activeTims = getActiveTimFromRS(rs, false);
} catch (SQLException e) {
log.error("Error getting expired active tims", e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(activeTims);
}

return ResponseEntity.ok(activeTims);
}
@RequestMapping(value = "/expired", method = RequestMethod.GET)
public ResponseEntity<List<ActiveTim>> GetExpiredActiveTims(@RequestParam(required = false, defaultValue = "100") Integer limit) {
String query = "SELECT * FROM ACTIVE_TIM WHERE TIM_END <= (NOW() AT TIME ZONE 'UTC') LIMIT ?";
try (Connection connection = dbInteractions.getConnectionPool(); PreparedStatement preparedStatement = connection.prepareStatement(query)) {
preparedStatement.setInt(1, limit);
try (ResultSet rs = preparedStatement.executeQuery()) {
return ResponseEntity.ok(getActiveTimFromRS(rs, false));
}
} catch (SQLException e) {
log.error("Error retrieving expired active tims", e);
throw new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Error retrieving expired active tims");
}
}

@RequestMapping(value = "/indices-rsu/{rsuTarget}", method = RequestMethod.GET)
public ResponseEntity<List<Integer>> GetActiveTimIndicesByRsu(@PathVariable String rsuTarget) {
Expand Down Expand Up @@ -1134,4 +1023,63 @@ public ResponseEntity<Boolean> MarkForDeletion(@PathVariable Long activeTimId) {
}
return ResponseEntity.ok(success);
}

private TimUpdateModel buildTimUpdateModelFromResultSet(ResultSet rs) throws SQLException {
TimUpdateModel timUpdateModel = new TimUpdateModel();
timUpdateModel.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
timUpdateModel.setTimId(rs.getLong("TIM_ID"));
timUpdateModel.setDirection(rs.getString("DIRECTION"));
timUpdateModel.setStartDateTime(rs.getString("TIM_START"));
timUpdateModel.setEndDateTime(rs.getString("TIM_END"));
timUpdateModel.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
timUpdateModel.setSatRecordId(rs.getString("SAT_RECORD_ID"));
timUpdateModel.setClientId(rs.getString("CLIENT_ID"));
timUpdateModel.setRoute(rs.getString("ROUTE"));

Coordinate startPoint = null;
Coordinate endPoint = null;
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
if (!rs.wasNull()) {
startPoint = new Coordinate(startLat, startLon);
}
timUpdateModel.setStartPoint(startPoint);

BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
if (!rs.wasNull()) {
endPoint = new Coordinate(endLat, endLon);
}
timUpdateModel.setEndPoint(endPoint);

timUpdateModel.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
timUpdateModel.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));

// Tim properties
timUpdateModel.setMsgCnt(rs.getInt("MSG_CNT"));
timUpdateModel.setUrlB(rs.getString("URL_B"));
timUpdateModel.setPacketId(rs.getString("PACKET_ID"));

// Tim Type properties
timUpdateModel.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
timUpdateModel.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));

// Region Properties
timUpdateModel.setRegionId(rs.getInt("REGION_ID"));
timUpdateModel.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
timUpdateModel.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));

timUpdateModel.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
timUpdateModel.setRegionDirection(rs.getString("REGION_DIRECTION"));
timUpdateModel.setDirectionality(rs.getString("DIRECTIONALITY"));
timUpdateModel.setClosedPath(rs.getBoolean("CLOSED_PATH"));
timUpdateModel.setPathId(rs.getInt("PATH_ID"));
timUpdateModel.setRegionDescription(rs.getString("REGION_DESCRIPTION"));

// DataFrame properties
timUpdateModel.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
timUpdateModel.setDurationTime(rs.getInt("DURATION_TIME"));
timUpdateModel.setUrl(rs.getString("URL"));
return timUpdateModel;
}
}
Loading
Loading