From 7f0438a39a2eaee019688b58c1d577a3262f46ad Mon Sep 17 00:00:00 2001 From: dan-du-car <62157949+dan-du-car@users.noreply.github.com> Date: Mon, 27 Sep 2021 10:56:22 -0700 Subject: [PATCH 01/17] Merge develop to release6.1 (#259) * Creating smaller deployment image Lightweight Docker Container Remove mysql calls Issue-255: Create lightweight docker image + added .dockerignore and modified dockerfile Issue-255: Dockerfile-dev Issue-255: CircleCI arm lightweight build * Issue-255: Added +x permissions to container scripts * Issue-255: Remove unnecessary checkoutstep * Issue-255: Rm git files from dockerignore. * Issue-255: Remove git files from build context + Remove checkout step from CircleCI sonar-scanner workflow * Issue-255:Rename dockerfile * Issue-255:SonarScanner needs git files * Issue-255:Dockerfile WRKDIR necessary for run script * Issue-257:Fix logging Co-authored-by: Paul K Bourelly --- .circleci/config.yml | 8 +- .dockerignore | 16 ++ container/database.sh | 3 - container/library.sh | 0 container/service.sh | 0 container/wait-for-it.sh | 0 docker/Dockerfile-depl | 147 ++++++++++++++++++ .../j2735_messages/J2735MessageFactory.hpp | 2 - .../src/database/DbConnectionPool.cpp | 1 - 9 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 .dockerignore mode change 100644 => 100755 container/database.sh mode change 100644 => 100755 container/library.sh mode change 100644 => 100755 container/service.sh mode change 100644 => 100755 container/wait-for-it.sh create mode 100644 docker/Dockerfile-depl diff --git a/.circleci/config.yml b/.circleci/config.yml index d5a45658f..75b665fd5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,8 +40,6 @@ jobs: #setup remote docker - setup_remote_docker : docker_layer_caching: false - # Checkout PR branch - - checkout - run: name: Run Tests & Generate Gcovr Reports command: | @@ -88,8 +86,6 @@ jobs: #setup remote docker - setup_remote_docker : docker_layer_caching: false - # Checkout PR branch - - checkout - run: name: Run Tests & Generate Gcovr Reports command: | @@ -167,7 +163,7 @@ jobs: name: Docker Build # Run MYSQL image and build v2xhub docker image command: | - docker build -t usdotfhwaops/v2xhubarm:${CIRCLE_BRANCH,,} . + docker build -f docker/Dockerfile-depl -t usdotfhwaops/v2xhubarm:${CIRCLE_BRANCH,,} . - run: name: Docker Push @@ -185,7 +181,7 @@ jobs: name: Docker Build # Run MYSQL image and build v2xhub docker image develop image command: | - docker build -t usdotfhwaops/v2xhubarm:latest . + docker build -f docker/Dockerfile-depl -t usdotfhwaops/v2xhubarm:latest . - run: name: Docker Push diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..4f9521841 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +# Files to be ignored by the Docker context +# Any files mentioned here will not trigger Docker to force an image reuild +# if they change +.circleci +.vscode +/configuration +/data +/docker +/docs +/examples +/tests +/tools +*/*/secrets +Dockerfile +docker-compose.yml +*.md diff --git a/container/database.sh b/container/database.sh old mode 100644 new mode 100755 index 3ad021f91..8253f2110 --- a/container/database.sh +++ b/container/database.sh @@ -1,7 +1,4 @@ #!/bin/sh -x - -mysql -uroot -pivp -h127.0.0.1 -e "INSERT INTO IVP.user (IVP.user.username, IVP.user.password, IVP.user.accessLevel) VALUES('v2xadmin', 'V2xHub#321', 3)" - set +e id plugin >/dev/null 2>&1 if [ $? -ne 0 ]; then diff --git a/container/library.sh b/container/library.sh old mode 100644 new mode 100755 diff --git a/container/service.sh b/container/service.sh old mode 100644 new mode 100755 diff --git a/container/wait-for-it.sh b/container/wait-for-it.sh old mode 100644 new mode 100755 diff --git a/docker/Dockerfile-depl b/docker/Dockerfile-depl new file mode 100644 index 000000000..caeae84a1 --- /dev/null +++ b/docker/Dockerfile-depl @@ -0,0 +1,147 @@ +FROM ubuntu:bionic-20190807 AS install_dependencies + +RUN apt-get update && apt-get install -y cmake git build-essential libgtest-dev libssl-dev qtbase5-dev \ + zip libmysqlcppconn-dev libboost1.65-all-dev libmysqlclient-dev uuid-dev libxerces-c-dev qtbase5-dev \ + libcurl4-openssl-dev libgps-dev libsnmp-dev librdkafka-dev libev-dev libuv-dev libcpprest-dev +# Build and install GTest +WORKDIR cd /usr/src/googletest/googletest +RUN mkdir ~/build +WORKDIR /usr/src/googletest/googletest/build +RUN cmake .. +RUN make +RUN cp libgtest* /usr/lib/ +WORKDIR cd /usr/src/googletest/googletest +RUN rm -rf build +RUN mkdir /usr/local/lib/googletest +RUN ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a +RUN ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a +RUN ldconfig + +# Build and install tmx +RUN mkdir ~/V2X-Hub +COPY ./src /home/V2X-Hub/src/ +WORKDIR /home/V2X-Hub/src/tmx/ +RUN cmake . +RUN make +RUN make install + +# Scripts +COPY ./ext /home/V2X-Hub/ext +COPY ./container /home/V2X-Hub/container +WORKDIR /home/V2X-Hub/container/ +RUN /home/V2X-Hub/container/database.sh +RUN /home/V2X-Hub/container/library.sh +RUN ldconfig + +WORKDIR /home/V2X-Hub/ +RUN mkdir -p /home/V2X-Hub/ext +WORKDIR /home/V2X-Hub/ext/ +RUN git clone https://github.com/usdot-fhwa-OPS/libwebsockets.git +WORKDIR /home/V2X-Hub/ext/libwebsockets/ +RUN cmake -DLWS_WITH_SHARED=OFF . +RUN make +RUN make install + +WORKDIR /home/V2X-Hub/ext +RUN git clone https://github.com/usdot-fhwa-OPS/qhttpengine.git +WORKDIR /home/V2X-Hub/ext/qhttpengine +RUN cmake . +RUN make +RUN make install + +WORKDIR /home/V2X-Hub/ext/ +RUN git clone https://github.com/HowardHinnant/date.git +WORKDIR /home/V2X-Hub/ext/date +RUN cmake . +RUN make +RUN make install +RUN ldconfig + + + +COPY ext/ /home/V2X-Hub/ext +WORKDIR /home/V2X-Hub/ext/server +RUN cmake . +RUN make +RUN make install + +WORKDIR /home/V2X-Hub/ext/ccserver +RUN cmake . +RUN make +RUN make install +WORKDIR /home/V2X-Hub/ext/ccserver +RUN rm -rf /home/V2X-Hub/ext/ + + + +WORKDIR /home/V2X-Hub/src/v2i-hub/ +RUN cmake . -DqserverPedestrian_DIR=/usr/local/share/qserverPedestrian/cmake -Dv2xhubWebAPI_DIR=/usr/local/share/v2xhubWebAPI/cmake/ +RUN make + +RUN ln -s ../bin CommandPlugin/bin +RUN zip CommandPlugin.zip CommandPlugin/bin/CommandPlugin CommandPlugin/manifest.json +RUN ln -s ../bin CswPlugin/bin +RUN zip CswPlugin.zip CswPlugin/bin/CswPlugin CswPlugin/manifest.json +RUN ln -s ../bin DmsPlugin/bin +RUN zip DmsPlugin.zip DmsPlugin/bin/DmsPlugin DmsPlugin/manifest.json +RUN ln -s ../bin DsrcImmediateForwardPlugin/bin +RUN zip DsrcImmediateForwardPlugin.zip DsrcImmediateForwardPlugin/bin/DsrcImmediateForwardPlugin DsrcImmediateForwardPlugin/manifest.json +RUN ln -s ../bin LocationPlugin/bin +RUN zip LocationPlugin.zip LocationPlugin/bin/LocationPlugin LocationPlugin/manifest.json +RUN ln -s ../bin MapPlugin/bin +RUN zip MapPlugin.zip MapPlugin/bin/MapPlugin MapPlugin/manifest.json +RUN ln -s ../bin MessageReceiverPlugin/bin +RUN zip MessageReceiverPlugin.zip MessageReceiverPlugin/bin/MessageReceiverPlugin MessageReceiverPlugin/manifest.json +RUN ln -s ../bin ODEPlugin/bin +RUN zip ODEPlugin.zip ODEPlugin/bin/ODEPlugin ODEPlugin/manifest.json +RUN ln -s ../bin RtcmPlugin/bin +RUN zip RtcmPlugin.zip RtcmPlugin/bin/RtcmPlugin RtcmPlugin/manifest.json +RUN ln -s ../bin SpatPlugin/bin +RUN zip SpatPlugin.zip SpatPlugin/bin/SpatPlugin SpatPlugin/manifest.json +RUN ln -s ../bin PreemptionPlugin/bin +RUN zip PreemptionPlugin.zip PreemptionPlugin/bin/PreemptionPlugin PreemptionPlugin/manifest.json +RUN ln -s ../bin SPaTLoggerPlugin/bin +RUN zip SPaTLoggerPlugin.zip SPaTLoggerPlugin/bin/SPaTLoggerPlugin SPaTLoggerPlugin/manifest.json +RUN ln -s ../bin MessageLoggerPlugin/bin +RUN zip MessageLoggerPlugin.zip MessageLoggerPlugin/bin/MessageLoggerPlugin MessageLoggerPlugin/manifest.json +RUN ln -s ../bin PedestrianPlugin/bin +RUN zip PedestrianPlugin.zip PedestrianPlugin/bin/PedestrianPlugin PedestrianPlugin/manifest.json +RUN ln -s ../bin TimPlugin/bin +RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json +RUN ln -s ../bin CARMACloudPlugin/bin +RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json +RUN ln -s ../bin MobilityOperationPlugin/bin +RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json +RUN ln -s ../bin ODELoggerPlugin/bin +RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json + +WORKDIR /home/V2X-Hub/src/tmx/TmxCore/ +RUN cp tmxcore.service /lib/systemd/system/ && cp tmxcore.service /usr/sbin/ +WORKDIR /home/V2X-Hub/container/ +RUN chmod +x /home/V2X-Hub/container/service.sh && chmod +x /home/V2X-Hub/container/wait-for-it.sh +WORKDIR /var/www/ +RUN mkdir ~/plugins +WORKDIR /home/V2X-Hub/src/v2i-hub/ +WORKDIR /var/www/plugins/ +RUN mkdir /var/www/plugins/MAP +RUN mkdir /var/www/plugins/.ssl +RUN chown plugin .ssl +RUN chgrp www-data .ssl +WORKDIR /var/www/plugins/.ssl/ +RUN openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout tmxcmd.key -out tmxcmd.crt -subj "/CN= <127.0.0.1> " -days 3650 +RUN chown plugin * +RUN chgrp www-data * +WORKDIR /home/V2X-Hub/src/v2i-hub/ + +# Set metadata labels +LABEL org.label-schema.schema-version="1.0" +LABEL org.label-schema.name="V2X-Hub-Deployment" +LABEL org.label-schema.description="Image V2X-Hub Deployment" +LABEL org.label-schema.vendor="Leidos" +LABEL org.label-schema.version="${VERSION}" +LABEL org.label-schema.url="https://highways.dot.gov/research/research-programs/operations" +LABEL org.label-schema.vcs-url="https://github.com/usdot-fhwa-ops/V2X-HUB" +LABEL org.label-schema.vcs-ref=${VCS_REF} +LABEL org.label-schema.build-date=${BUILD_DATE} + +ENTRYPOINT ["/home/V2X-Hub/container/service.sh"] diff --git a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp index 38227ec52..cc75299a6 100644 --- a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp +++ b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp @@ -385,7 +385,6 @@ class J2735MessageFactory if(msgidindex = TmxJ2735ExtendedBytes(bytes)) { std::string byteStr(bytes.begin(),bytes.end()); - std::cout<<" Return = "<< msgidindex<< ", Extended bytes found, sanitized::"; } @@ -424,7 +423,6 @@ class J2735MessageFactory #endif int id = Codec.decode_contentId(bytes); - std::cout<<" Codec ID = "<< id < Date: Tue, 19 Oct 2021 14:57:27 -0400 Subject: [PATCH 02/17] Update Release_notes.md --- docs/Release_notes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/Release_notes.md b/docs/Release_notes.md index 8de9e31d4..b152d4861 100644 --- a/docs/Release_notes.md +++ b/docs/Release_notes.md @@ -1,6 +1,20 @@ V2X-Hub Release Notes ---------------------------- +Version 6.1, released Oct 15th, 2021 +-------------------------------------------------------- + +**Summary:** +V2X Hub release version 6.1 is a hotfix release for 6.0. + +Fixes in this release: +- Issue 233: Fixed SPaT message to report green status as "permissive" vs "protected" correctly. +- Issue 124: Fixed issue with interpreting when the signal controller is in flash state. +- Issue 245: Added configurable parameter for Carma cloud plugin to use for the “oldest” parameter in the TCR request to get controls created within the time period specified by this field in days. +- Issue 247: Added TCM PSID to messages forwarded to RSU for broadcast. +- Issue 186: Fixed sonar-scanner settings with code coverage to generate the coverage metrics in sonar cloud. +- Issue 201: Update docker-compose to manage sensitive data like mysql username and password with Docker secrets. + Version 6.0, released July 30th, 2021 -------------------------------------------------------- From 312035cfe36bab5198400a9b4ec91eace86c6245 Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Tue, 16 Nov 2021 17:06:23 -0500 Subject: [PATCH 03/17] Merge Carma freight to release branch for 6.2 hotfix (#275) * Issue-179: MobilityOperation plugin msg parse and parse MobilityOperation Plugin consumes port_drayage messages and queries PORT_DRAYAGE mysql DB for next action. Then forwards this message using the DSRCMessageManager plugin Issue-179:Docker-compose load port_drayage db Issue-179:Const string strategy Issue-179:DB name config and const string for Strat Issue-179: Fix long/lat to ints, fixed outgoing json * CF-143: Update Message schema, tables and logic CF-143 In progress CF-143: save point Save point fixed port_drayage.sql CF-143: Edited database tables and added new action with destination CF-143: Fixed and clean logic for new message schema CF-143: PR comments addressed * CF-189:Integration testing updates * Change MobilityOperationPlugin to CARMAFreightPlugin Updated localhost.sql files with new plugin name Edited header to remove mobilityoperationplugin name * Rename to PortDrayagePlugin + Fix segfault with not found actions + Fix CMakefile + Fix sql file to only include necessary information Added Dockerfile Fix retrieve action variable names and added if statment back * Rebase on develop fixes * Adding PortDrayage Webservice Maven Springboot proj * Save point * Save Point * Save Point * UI updates included TODO Better code commenting * Remove PortDrayage WebService Client code. * Remove PDClient build from dockerfile * Added PR Comments + Updates openapi endpoint description + Added checks for duplicate request to REST controllers + fixed HTML table column name + Comments for application.properties + updated docker-compose + More unit test coverage * Save Point * Initial Testing attempt * Onsite fixes plus logging for holding action insert * Updated lightweight dockerfile * Fix for holding confirmation * Logging fix * Rebase and PR prep * PR prep and cleanup * PR Comments + Added do while loops + Created global pointer for WebserviceClient * PR build issue fixes + Dowhile fix + qapplication fix * PR bug fixes + Using WebServiceClient pointer + Using local variables for REST response + Remove getter methods for client + Boolean flag for retry with bad responses * Added PortDrayagePlugin to sonar-scanner.properties Co-authored-by: Paul K Bourelly Co-authored-by: dan-du-car <62157949+dan-du-car@users.noreply.github.com> --- .gitignore | 8 +- .sonarqube/sonar-scanner.properties | 7 +- Dockerfile | 9 +- configuration/amd64/docker-compose.yml | 3 +- configuration/amd64/mysql/localhost.sql | 32 +- configuration/amd64/mysql/port_drayage.sql | 91 ++ configuration/arm64/docker-compose.yml | 3 +- configuration/arm64/mysql/localhost.sql | 32 +- configuration/arm64/mysql/port_drayage.sql | 91 ++ container/service.sh | 2 +- docker/Dockerfile-depl | 10 +- ext/pdclient/CMakeLists.txt | 42 + ext/pdclient/OAIActionStatusList.cpp | 100 ++ ext/pdclient/OAIActionStatusList.h | 62 + ext/pdclient/OAIContainerActionStatus.cpp | 250 ++++ ext/pdclient/OAIContainerActionStatus.h | 106 ++ ext/pdclient/OAIContainerRequest.cpp | 160 +++ ext/pdclient/OAIContainerRequest.h | 79 ++ ext/pdclient/OAIDefaultApi.cpp | 1175 +++++++++++++++++ ext/pdclient/OAIDefaultApi.h | 244 ++++ ext/pdclient/OAIEnum.h | 63 + ext/pdclient/OAIHelpers.cpp | 426 ++++++ ext/pdclient/OAIHelpers.h | 275 ++++ ext/pdclient/OAIHttpFileElement.cpp | 155 +++ ext/pdclient/OAIHttpFileElement.h | 47 + ext/pdclient/OAIHttpRequest.cpp | 505 +++++++ ext/pdclient/OAIHttpRequest.h | 113 ++ ext/pdclient/OAIInspectionRequest.cpp | 160 +++ ext/pdclient/OAIInspectionRequest.h | 79 ++ ext/pdclient/OAIInspectionStatus.cpp | 250 ++++ ext/pdclient/OAIInspectionStatus.h | 106 ++ ext/pdclient/OAIInspectionStatusList.cpp | 100 ++ ext/pdclient/OAIInspectionStatusList.h | 62 + ext/pdclient/OAIObject.h | 65 + ext/pdclient/OAIServerConfiguration.h | 82 ++ ext/pdclient/OAIServerVariable.h | 58 + ext/pdclient/client.pri | 35 + .../j2735_messages/J2735MessageFactory.hpp | 1 - .../src/DsrcMessageManagerPlugin.cpp | 3 +- .../MobilityOperationPlugin/CMakeLists.txt | 5 - .../MobilityOperationPlugin/manifest.json | 23 - .../src/MobilityOperationPlugin.cpp | 86 -- .../src/MobilityOperationPlugin.h | 33 - src/v2i-hub/PortDrayagePlugin/CMakeLists.txt | 24 + src/v2i-hub/PortDrayagePlugin/manifest.json | 78 ++ .../src/PortDrayagePlugin.cpp | 543 ++++++++ .../PortDrayagePlugin/src/PortDrayagePlugin.h | 173 +++ .../src/WebServiceClient.cpp | 276 ++++ .../PortDrayagePlugin/src/WebServiceClient.h | 109 ++ tools/port-drayage-webservice/pom.xml | 140 ++ .../src/main/java/com/leidos/Application.java | 25 + .../WebApplicationConfiguration.java | 27 + .../controller/InspectionController.java | 123 ++ .../leidos/controller/LoadingController.java | 105 ++ .../controller/UnloadingController.java | 104 ++ .../controller/UserInterfaceController.java | 32 + .../leidos/inspection/InspectionActions.java | 194 +++ .../com/leidos/loading/LoadingActions.java | 174 +++ .../leidos/unloading/UnloadingActions.java | 170 +++ .../src/main/resources/application.properties | 30 + .../resources/port-drayage-webservice.yml | 419 ++++++ .../src/main/resources/static/css/main.css | 0 .../main/resources/templates/_inspection.html | 117 ++ .../main/resources/templates/_loading.html | 115 ++ .../main/resources/templates/_unloading.html | 114 ++ .../src/main/resources/templates/index.html | 74 ++ .../controller/InspectionControllerTest.java | 212 +++ .../controller/LoadingControllerTest.java | 159 +++ .../controller/UnloadingControllerTest.java | 160 +++ .../inspection/InspectionActionsTest.java | 194 +++ .../leidos/loading/LoadingActionsTest.java | 155 +++ .../unloading/UnloadingActionsTest.java | 150 +++ 72 files changed, 9242 insertions(+), 192 deletions(-) create mode 100644 configuration/amd64/mysql/port_drayage.sql create mode 100644 configuration/arm64/mysql/port_drayage.sql create mode 100644 ext/pdclient/CMakeLists.txt create mode 100644 ext/pdclient/OAIActionStatusList.cpp create mode 100644 ext/pdclient/OAIActionStatusList.h create mode 100644 ext/pdclient/OAIContainerActionStatus.cpp create mode 100644 ext/pdclient/OAIContainerActionStatus.h create mode 100644 ext/pdclient/OAIContainerRequest.cpp create mode 100644 ext/pdclient/OAIContainerRequest.h create mode 100644 ext/pdclient/OAIDefaultApi.cpp create mode 100644 ext/pdclient/OAIDefaultApi.h create mode 100644 ext/pdclient/OAIEnum.h create mode 100644 ext/pdclient/OAIHelpers.cpp create mode 100644 ext/pdclient/OAIHelpers.h create mode 100644 ext/pdclient/OAIHttpFileElement.cpp create mode 100644 ext/pdclient/OAIHttpFileElement.h create mode 100644 ext/pdclient/OAIHttpRequest.cpp create mode 100644 ext/pdclient/OAIHttpRequest.h create mode 100644 ext/pdclient/OAIInspectionRequest.cpp create mode 100644 ext/pdclient/OAIInspectionRequest.h create mode 100644 ext/pdclient/OAIInspectionStatus.cpp create mode 100644 ext/pdclient/OAIInspectionStatus.h create mode 100644 ext/pdclient/OAIInspectionStatusList.cpp create mode 100644 ext/pdclient/OAIInspectionStatusList.h create mode 100644 ext/pdclient/OAIObject.h create mode 100644 ext/pdclient/OAIServerConfiguration.h create mode 100644 ext/pdclient/OAIServerVariable.h create mode 100644 ext/pdclient/client.pri delete mode 100644 src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt delete mode 100644 src/v2i-hub/MobilityOperationPlugin/manifest.json delete mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp delete mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h create mode 100644 src/v2i-hub/PortDrayagePlugin/CMakeLists.txt create mode 100644 src/v2i-hub/PortDrayagePlugin/manifest.json create mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp create mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h create mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp create mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h create mode 100644 tools/port-drayage-webservice/pom.xml create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/Application.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java create mode 100644 tools/port-drayage-webservice/src/main/resources/application.properties create mode 100755 tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml create mode 100644 tools/port-drayage-webservice/src/main/resources/static/css/main.css create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_inspection.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_loading.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_unloading.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/index.html create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java diff --git a/.gitignore b/.gitignore index 642afb16f..c4ca36aec 100644 --- a/.gitignore +++ b/.gitignore @@ -76,4 +76,10 @@ Thumbs.db *.app #docker-compose variables -.env \ No newline at end of file +.env + +#Maven build directory +tools/port-drayage-webservice/target/ + +#Java PKS for HTTPS setup +tools/port-drayage-webservice/src/main/resources/tutorial.jks diff --git a/.sonarqube/sonar-scanner.properties b/.sonarqube/sonar-scanner.properties index 334ba3ebb..9bbb4a3ab 100644 --- a/.sonarqube/sonar-scanner.properties +++ b/.sonarqube/sonar-scanner.properties @@ -47,7 +47,7 @@ sonar.modules= PedestrianPlugin, \ TmxTools, \ MessageLoggerPlugin, \ CommandPlugin, \ - MobilityOperationPlugin, \ + PortDrayagePlugin, \ ODELoggerPlugin, \ DsrcImmediateForwardPlugin, \ MessageReceiverPlugin @@ -61,7 +61,7 @@ TmxUtils.sonar.projectBaseDir =/home/V2X-Hub/src/tmx/TmxUtils CARMACloudPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CARMACloudPlugin CommandPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CommandPlugin CswPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CswPlugin -MobilityOperationPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MobilityOperationPlugin +PortDrayagePlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/PortDrayagePlugin ODELoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/ODELoggerPlugin MessageLoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MessageLoggerPlugin DmsPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/DmsPlugin @@ -85,6 +85,7 @@ TmxTools.sonar.sources =src TmxUtils.sonar.sources =src MessageLoggerPlugin.sonar.sources =src CswPlugin.sonar.sources =src +PortDrayagePlugin.sonar.sources =src DmsPlugin.sonar.sources =src DsrcImmediateForwardPlugin.sonar.sources =src LocationPlugin.sonar.sources =src @@ -113,6 +114,7 @@ MobilityOperationPlugin.sonar.sources =src TmxUtils.sonar.cfamily.gcov.reportsPath =coverage #MessageLoggerPlugin.sonar.cfamily.gcov.reportsPath =coverage #CswPlugin.sonar.cfamily.gcov.reportsPath =coverage +#PortDrayagePlugin.sonar.cfamily.gcov.reportsPath =coverage #DmsPlugin.sonar.cfamily.gcov.reportsPath =coverage #DsrcImmediateForwardPlugin.sonar.cfamily.gcov.reportsPath =coverage #LocationPlugin.sonar.cfamily.gcov.reportsPath =coverage @@ -138,6 +140,7 @@ TmxUtils.sonar.tests=test #TmxTools.sonar.tests=test #MessageLoggerPlugin.sonar.tests=test #CswPlugin.sonar.tests=test +#PortDrayagePlugin.sonar.tests=test #DmsPlugin.sonar.tests=test #DsrcImmediateForwardPlugin.sonar.tests=test #LocationPlugin.sonar.tests=test diff --git a/Dockerfile b/Dockerfile index 0085b6fb2..e483c6e53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,11 @@ RUN make install WORKDIR /home/V2X-Hub/ext/ccserver RUN cmake . RUN make +RUN make install + +WORKDIR /home/V2X-Hub/ext/pdclient +RUN cmake . +RUN make RUN make install ### setup and install v2x-hub core and plugins @@ -101,8 +106,8 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json -RUN ln -s ../bin MobilityOperationPlugin/bin -RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json +RUN ln -s ../bin PortDrayagePlugin/bin +RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index da7f207f3..bcfc8934c 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -16,6 +16,7 @@ services: - mysql_root_password volumes: - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql + - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql php: image: usdotfhwaops/php:latest @@ -27,7 +28,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:latest + image: usdotfhwaops/v2xhubamd:carma-freight container_name: v2xhub network_mode: host restart: always diff --git a/configuration/amd64/mysql/localhost.sql b/configuration/amd64/mysql/localhost.sql index 0430a75cf..12b072cc7 100644 --- a/configuration/amd64/mysql/localhost.sql +++ b/configuration/amd64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) -- --- Host: localhost Database: IVP +-- Host: 127.0.0.1 Database: IVP -- ------------------------------------------------------ --- Server version 5.7.34 +-- Server version 5.7.35 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); +INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-06-23 23:52:23 +-- Dump completed on 2021-08-25 13:36:29 diff --git a/configuration/amd64/mysql/port_drayage.sql b/configuration/amd64/mysql/port_drayage.sql new file mode 100644 index 000000000..eccdb199b --- /dev/null +++ b/configuration/amd64/mysql/port_drayage.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.35 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES ("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ("123",NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-07-21 11:42:55 diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index cab2e4176..faf42f067 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -15,7 +15,8 @@ services: - mysql_password - mysql_root_password volumes: - - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql + - "mysql_db:/var/lib/mysql" + - ./mysql/:/docker-entrypoint-initdb.d/ php: image: php:7.2.2-apache diff --git a/configuration/arm64/mysql/localhost.sql b/configuration/arm64/mysql/localhost.sql index 0430a75cf..12b072cc7 100644 --- a/configuration/arm64/mysql/localhost.sql +++ b/configuration/arm64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) -- --- Host: localhost Database: IVP +-- Host: 127.0.0.1 Database: IVP -- ------------------------------------------------------ --- Server version 5.7.34 +-- Server version 5.7.35 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); +INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-06-23 23:52:23 +-- Dump completed on 2021-08-25 13:36:29 diff --git a/configuration/arm64/mysql/port_drayage.sql b/configuration/arm64/mysql/port_drayage.sql new file mode 100644 index 000000000..71c93e51f --- /dev/null +++ b/configuration/arm64/mysql/port_drayage.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.35 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` int(4) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES (123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` int(4) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES (123,NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),(123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-07-21 11:42:55 diff --git a/container/service.sh b/container/service.sh index 808754dad..ad8da583b 100755 --- a/container/service.sh +++ b/container/service.sh @@ -19,8 +19,8 @@ tmxctl --plugin-install MessageLoggerPlugin.zip tmxctl --plugin-install PedestrianPlugin.zip tmxctl --plugin-install TimPlugin.zip tmxctl --plugin-install CARMACloudPlugin.zip -tmxctl --plugin-install MobilityOperationPlugin.zip tmxctl --plugin-install ODELoggerPlugin.zip +tmxctl --plugin-install PortDrayagePlugin.zip tmxctl --plugin CommandPlugin --enable /usr/local/bin/tmxcore diff --git a/docker/Dockerfile-depl b/docker/Dockerfile-depl index caeae84a1..5d6f0aa0b 100644 --- a/docker/Dockerfile-depl +++ b/docker/Dockerfile-depl @@ -70,7 +70,11 @@ RUN cmake . RUN make RUN make install WORKDIR /home/V2X-Hub/ext/ccserver -RUN rm -rf /home/V2X-Hub/ext/ + +WORKDIR /home/V2X-Hub/ext/pdclient +RUN cmake . +RUN make +RUN make install @@ -110,8 +114,8 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json -RUN ln -s ../bin MobilityOperationPlugin/bin -RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json +RUN ln -s ../bin PortDrayagePlugin/bin +RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/ext/pdclient/CMakeLists.txt b/ext/pdclient/CMakeLists.txt new file mode 100644 index 000000000..562b24523 --- /dev/null +++ b/ext/pdclient/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.2) + +project(pdclient) +set(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") +else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") +endif () + +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) + +add_library(${PROJECT_NAME} + OAIActionStatusList.cpp + OAIContainerActionStatus.cpp + OAIContainerRequest.cpp + OAIInspectionRequest.cpp + OAIInspectionStatus.cpp + OAIInspectionStatusList.cpp + OAIDefaultApi.cpp + OAIHelpers.cpp + OAIHttpRequest.cpp + OAIHttpFileElement.cpp +) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ) + +if(NOT APPLE) + target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto) +endif() + +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) + +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + +FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION /usr/local/include/${PROJECT_NAME} ) diff --git a/ext/pdclient/OAIActionStatusList.cpp b/ext/pdclient/OAIActionStatusList.cpp new file mode 100644 index 000000000..eff61e965 --- /dev/null +++ b/ext/pdclient/OAIActionStatusList.cpp @@ -0,0 +1,100 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIActionStatusList.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIActionStatusList::OAIActionStatusList(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIActionStatusList::OAIActionStatusList() { + this->initializeModel(); +} + +OAIActionStatusList::~OAIActionStatusList() {} + +void OAIActionStatusList::initializeModel() { + + m_actions_isSet = false; + m_actions_isValid = false; +} + +void OAIActionStatusList::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIActionStatusList::fromJsonObject(QJsonObject json) { + + m_actions_isValid = ::OpenAPI::fromJsonValue(actions, json[QString("actions")]); + m_actions_isSet = !json[QString("actions")].isNull() && m_actions_isValid; +} + +QString OAIActionStatusList::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIActionStatusList::asJsonObject() const { + QJsonObject obj; + if (actions.size() > 0) { + obj.insert(QString("actions"), ::OpenAPI::toJsonValue(actions)); + } + return obj; +} + +QList OAIActionStatusList::getActions() const { + return actions; +} +void OAIActionStatusList::setActions(const QList &actions) { + this->actions = actions; + this->m_actions_isSet = true; +} + +bool OAIActionStatusList::is_actions_Set() const{ + return m_actions_isSet; +} + +bool OAIActionStatusList::is_actions_Valid() const{ + return m_actions_isValid; +} + +bool OAIActionStatusList::isSet() const { + bool isObjectUpdated = false; + do { + if (actions.size() > 0) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIActionStatusList::isValid() const { + // only required properties are required for the object to be considered valid + return true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIActionStatusList.h b/ext/pdclient/OAIActionStatusList.h new file mode 100644 index 000000000..2447f1cfa --- /dev/null +++ b/ext/pdclient/OAIActionStatusList.h @@ -0,0 +1,62 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIActionStatusList.h + * + * + */ + +#ifndef OAIActionStatusList_H +#define OAIActionStatusList_H + +#include + +#include "OAIContainerActionStatus.h" +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIActionStatusList : public OAIObject { +public: + OAIActionStatusList(); + OAIActionStatusList(QString json); + ~OAIActionStatusList() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QList getActions() const; + void setActions(const QList &actions); + bool is_actions_Set() const; + bool is_actions_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QList actions; + bool m_actions_isSet; + bool m_actions_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIActionStatusList) + +#endif // OAIActionStatusList_H diff --git a/ext/pdclient/OAIContainerActionStatus.cpp b/ext/pdclient/OAIContainerActionStatus.cpp new file mode 100644 index 000000000..6b7f2a3a3 --- /dev/null +++ b/ext/pdclient/OAIContainerActionStatus.cpp @@ -0,0 +1,250 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIContainerActionStatus.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIContainerActionStatus::OAIContainerActionStatus(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIContainerActionStatus::OAIContainerActionStatus() { + this->initializeModel(); +} + +OAIContainerActionStatus::~OAIContainerActionStatus() {} + +void OAIContainerActionStatus::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; + + m_status_isSet = false; + m_status_isValid = false; + + m_requested_isSet = false; + m_requested_isValid = false; + + m_completed_isSet = false; + m_completed_isValid = false; +} + +void OAIContainerActionStatus::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIContainerActionStatus::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; + + m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; + + m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); + m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; + + m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); + m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; +} + +QString OAIContainerActionStatus::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIContainerActionStatus::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + if (m_status_isSet) { + obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + } + if (m_requested_isSet) { + obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); + } + if (m_completed_isSet) { + obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); + } + return obj; +} + +QString OAIContainerActionStatus::getVehicleId() const { + return vehicle_id; +} +void OAIContainerActionStatus::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIContainerActionStatus::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIContainerActionStatus::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIContainerActionStatus::getContainerId() const { + return container_id; +} +void OAIContainerActionStatus::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIContainerActionStatus::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIContainerActionStatus::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIContainerActionStatus::getActionId() const { + return action_id; +} +void OAIContainerActionStatus::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIContainerActionStatus::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIContainerActionStatus::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +QString OAIContainerActionStatus::getStatus() const { + return status; +} +void OAIContainerActionStatus::setStatus(const QString &status) { + this->status = status; + this->m_status_isSet = true; +} + +bool OAIContainerActionStatus::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIContainerActionStatus::is_status_Valid() const{ + return m_status_isValid; +} + +qint64 OAIContainerActionStatus::getRequested() const { + return requested; +} +void OAIContainerActionStatus::setRequested(const qint64 &requested) { + this->requested = requested; + this->m_requested_isSet = true; +} + +bool OAIContainerActionStatus::is_requested_Set() const{ + return m_requested_isSet; +} + +bool OAIContainerActionStatus::is_requested_Valid() const{ + return m_requested_isValid; +} + +qint64 OAIContainerActionStatus::getCompleted() const { + return completed; +} +void OAIContainerActionStatus::setCompleted(const qint64 &completed) { + this->completed = completed; + this->m_completed_isSet = true; +} + +bool OAIContainerActionStatus::is_completed_Set() const{ + return m_completed_isSet; +} + +bool OAIContainerActionStatus::is_completed_Valid() const{ + return m_completed_isValid; +} + +bool OAIContainerActionStatus::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + + if (m_requested_isSet) { + isObjectUpdated = true; + break; + } + + if (m_completed_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIContainerActionStatus::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerActionStatus.h b/ext/pdclient/OAIContainerActionStatus.h new file mode 100644 index 000000000..e117d287c --- /dev/null +++ b/ext/pdclient/OAIContainerActionStatus.h @@ -0,0 +1,106 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIContainerActionStatus.h + * + * + */ + +#ifndef OAIContainerActionStatus_H +#define OAIContainerActionStatus_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIContainerActionStatus : public OAIObject { +public: + OAIContainerActionStatus(); + OAIContainerActionStatus(QString json); + ~OAIContainerActionStatus() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + QString getStatus() const; + void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; + + qint64 getRequested() const; + void setRequested(const qint64 &requested); + bool is_requested_Set() const; + bool is_requested_Valid() const; + + qint64 getCompleted() const; + void setCompleted(const qint64 &completed); + bool is_completed_Set() const; + bool is_completed_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; + + QString status; + bool m_status_isSet; + bool m_status_isValid; + + qint64 requested; + bool m_requested_isSet; + bool m_requested_isValid; + + qint64 completed; + bool m_completed_isSet; + bool m_completed_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIContainerActionStatus) + +#endif // OAIContainerActionStatus_H diff --git a/ext/pdclient/OAIContainerRequest.cpp b/ext/pdclient/OAIContainerRequest.cpp new file mode 100644 index 000000000..616f75f7d --- /dev/null +++ b/ext/pdclient/OAIContainerRequest.cpp @@ -0,0 +1,160 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIContainerRequest.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIContainerRequest::OAIContainerRequest(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIContainerRequest::OAIContainerRequest() { + this->initializeModel(); +} + +OAIContainerRequest::~OAIContainerRequest() {} + +void OAIContainerRequest::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; +} + +void OAIContainerRequest::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIContainerRequest::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; +} + +QString OAIContainerRequest::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIContainerRequest::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + return obj; +} + +QString OAIContainerRequest::getVehicleId() const { + return vehicle_id; +} +void OAIContainerRequest::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIContainerRequest::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIContainerRequest::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIContainerRequest::getContainerId() const { + return container_id; +} +void OAIContainerRequest::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIContainerRequest::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIContainerRequest::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIContainerRequest::getActionId() const { + return action_id; +} +void OAIContainerRequest::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIContainerRequest::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIContainerRequest::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +bool OAIContainerRequest::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIContainerRequest::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerRequest.h b/ext/pdclient/OAIContainerRequest.h new file mode 100644 index 000000000..712b00534 --- /dev/null +++ b/ext/pdclient/OAIContainerRequest.h @@ -0,0 +1,79 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIContainerRequest.h + * + * + */ + +#ifndef OAIContainerRequest_H +#define OAIContainerRequest_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIContainerRequest : public OAIObject { +public: + OAIContainerRequest(); + OAIContainerRequest(QString json); + ~OAIContainerRequest() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIContainerRequest) + +#endif // OAIContainerRequest_H diff --git a/ext/pdclient/OAIDefaultApi.cpp b/ext/pdclient/OAIDefaultApi.cpp new file mode 100644 index 000000000..3b257c2b4 --- /dev/null +++ b/ext/pdclient/OAIDefaultApi.cpp @@ -0,0 +1,1175 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIDefaultApi.h" +#include "OAIServerConfiguration.h" +#include +#include + +namespace OpenAPI { + +OAIDefaultApi::OAIDefaultApi(const int timeOut) + : _timeOut(timeOut), + _manager(nullptr), + _isResponseCompressionEnabled(false), + _isRequestCompressionEnabled(false) { + initializeServerConfigs(); +} + +OAIDefaultApi::~OAIDefaultApi() { +} + +void OAIDefaultApi::initializeServerConfigs() { + //Default server + QList defaultConf = QList(); + //varying endpoint server + defaultConf.append(OAIServerConfiguration( + QUrl("http://127.0.0.1:8080"), + "Unsecured hosting for development", + QMap())); + defaultConf.append(OAIServerConfiguration( + QUrl("https://127.0.0.1:8443"), + "Secured hosting for deployment", + QMap())); + _serverConfigs.insert("inspectionActionIdGet", defaultConf); + _serverIndices.insert("inspectionActionIdGet", 0); + _serverConfigs.insert("inspectionCompleteActionIdPost", defaultConf); + _serverIndices.insert("inspectionCompleteActionIdPost", 0); + _serverConfigs.insert("inspectionHoldActionIdPost", defaultConf); + _serverIndices.insert("inspectionHoldActionIdPost", 0); + _serverConfigs.insert("inspectionHoldingActionIdPost", defaultConf); + _serverIndices.insert("inspectionHoldingActionIdPost", 0); + _serverConfigs.insert("inspectionPendingGet", defaultConf); + _serverIndices.insert("inspectionPendingGet", 0); + _serverConfigs.insert("inspectionPost", defaultConf); + _serverIndices.insert("inspectionPost", 0); + _serverConfigs.insert("loadingActionIdGet", defaultConf); + _serverIndices.insert("loadingActionIdGet", 0); + _serverConfigs.insert("loadingCompleteActionIdPost", defaultConf); + _serverIndices.insert("loadingCompleteActionIdPost", 0); + _serverConfigs.insert("loadingPendingGet", defaultConf); + _serverIndices.insert("loadingPendingGet", 0); + _serverConfigs.insert("loadingPost", defaultConf); + _serverIndices.insert("loadingPost", 0); + _serverConfigs.insert("loadingStartActionIdPost", defaultConf); + _serverIndices.insert("loadingStartActionIdPost", 0); + _serverConfigs.insert("unloadingActionIdGet", defaultConf); + _serverIndices.insert("unloadingActionIdGet", 0); + _serverConfigs.insert("unloadingCompleteActionIdPost", defaultConf); + _serverIndices.insert("unloadingCompleteActionIdPost", 0); + _serverConfigs.insert("unloadingPendingGet", defaultConf); + _serverIndices.insert("unloadingPendingGet", 0); + _serverConfigs.insert("unloadingPost", defaultConf); + _serverIndices.insert("unloadingPost", 0); + _serverConfigs.insert("unloadingStartActionIdPost", defaultConf); + _serverIndices.insert("unloadingStartActionIdPost", 0); +} + +/** +* returns 0 on success and -1, -2 or -3 on failure. +* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found +*/ +int OAIDefaultApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { + auto it = _serverConfigs.find(operation); + if (it != _serverConfigs.end() && serverIndex < it.value().size()) { + return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); + } + return -3; +} +void OAIDefaultApi::setServerIndex(const QString &operation, int serverIndex) { + if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { + _serverIndices[operation] = serverIndex; + } +} + +void OAIDefaultApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { + _apiKeys.insert(apiKeyName,apiKey); +} + +void OAIDefaultApi::setBearerToken(const QString &token) { + _bearerToken = token; +} + +void OAIDefaultApi::setUsername(const QString &username) { + _username = username; +} + +void OAIDefaultApi::setPassword(const QString &password) { + _password = password; +} + + +void OAIDefaultApi::setTimeOut(const int timeOut) { + _timeOut = timeOut; +} + +void OAIDefaultApi::setWorkingDirectory(const QString &path) { + _workingDirectory = path; +} + +void OAIDefaultApi::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + +/** + * Appends a new ServerConfiguration to the config map for a specific operation. + * @param operation The id to the target operation. + * @param url A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + * returns the index of the new server config on success and -1 if the operation is not found + */ +int OAIDefaultApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { + if (_serverConfigs.contains(operation)) { + _serverConfigs[operation].append(OAIServerConfiguration( + url, + description, + variables)); + return _serverConfigs[operation].size()-1; + } else { + return -1; + } +} + +/** + * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. + * @param url A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ +void OAIDefaultApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { + setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); + } +#else + for (auto &e : _serverIndices.keys()) { + setServerIndex(e, addServerConfiguration(e, url, description, variables)); + } +#endif +} + +/** + * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. + * @param URL A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ +void OAIDefaultApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { + setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); +} + +void OAIDefaultApi::addHeaders(const QString &key, const QString &value) { + _defaultHeaders.insert(key, value); +} + +void OAIDefaultApi::enableRequestCompression() { + _isRequestCompressionEnabled = true; +} + +void OAIDefaultApi::enableResponseCompression() { + _isResponseCompressionEnabled = true; +} + +void OAIDefaultApi::abortRequests() { + emit abortRequestsSignal(); +} + +QString OAIDefaultApi::getParamStylePrefix(const QString &style) { + if (style == "matrix") { + return ";"; + } else if (style == "label") { + return "."; + } else if (style == "form") { + return "&"; + } else if (style == "simple") { + return ""; + } else if (style == "spaceDelimited") { + return "&"; + } else if (style == "pipeDelimited") { + return "&"; + } else { + return "none"; + } +} + +QString OAIDefaultApi::getParamStyleSuffix(const QString &style) { + if (style == "matrix") { + return "="; + } else if (style == "label") { + return ""; + } else if (style == "form") { + return "="; + } else if (style == "simple") { + return ""; + } else if (style == "spaceDelimited") { + return "="; + } else if (style == "pipeDelimited") { + return "="; + } else { + return "none"; + } +} + +QString OAIDefaultApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { + + if (style == "matrix") { + return (isExplode) ? ";" + name + "=" : ","; + + } else if (style == "label") { + return (isExplode) ? "." : ","; + + } else if (style == "form") { + return (isExplode) ? "&" + name + "=" : ","; + + } else if (style == "simple") { + return ","; + } else if (style == "spaceDelimited") { + return (isExplode) ? "&" + name + "=" : " "; + + } else if (style == "pipeDelimited") { + return (isExplode) ? "&" + name + "=" : "|"; + + } else if (style == "deepObject") { + return (isExplode) ? "&" : "none"; + + } else { + return "none"; + } +} + +void OAIDefaultApi::inspectionActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionActionIdGet"][_serverIndices.value("inspectionActionIdGet")].URL()+"/inspection/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIInspectionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionActionIdGetSignal(output); + emit inspectionActionIdGetSignalFull(worker, output); + } else { + emit inspectionActionIdGetSignalE(output, error_type, error_str); + emit inspectionActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionCompleteActionIdPost"][_serverIndices.value("inspectionCompleteActionIdPost")].URL()+"/inspection/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionCompleteActionIdPostSignal(); + emit inspectionCompleteActionIdPostSignalFull(worker); + } else { + emit inspectionCompleteActionIdPostSignalE(error_type, error_str); + emit inspectionCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionHoldActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionHoldActionIdPost"][_serverIndices.value("inspectionHoldActionIdPost")].URL()+"/inspection/hold/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionHoldActionIdPostSignal(); + emit inspectionHoldActionIdPostSignalFull(worker); + } else { + emit inspectionHoldActionIdPostSignalE(error_type, error_str); + emit inspectionHoldActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionHoldingActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionHoldingActionIdPost"][_serverIndices.value("inspectionHoldingActionIdPost")].URL()+"/inspection/holding/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldingActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionHoldingActionIdPostSignal(); + emit inspectionHoldingActionIdPostSignalFull(worker); + } else { + emit inspectionHoldingActionIdPostSignalE(error_type, error_str); + emit inspectionHoldingActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionPendingGet() { + QString fullPath = QString(_serverConfigs["inspectionPendingGet"][_serverIndices.value("inspectionPendingGet")].URL()+"/inspection/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIInspectionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionPendingGetSignal(output); + emit inspectionPendingGetSignalFull(worker, output); + } else { + emit inspectionPendingGetSignalE(output, error_type, error_str); + emit inspectionPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionPost(const OAIInspectionRequest &oai_inspection_request) { + QString fullPath = QString(_serverConfigs["inspectionPost"][_serverIndices.value("inspectionPost")].URL()+"/inspection"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_inspection_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionPostSignal(); + emit inspectionPostSignalFull(worker); + } else { + emit inspectionPostSignalE(error_type, error_str); + emit inspectionPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingActionIdGet"][_serverIndices.value("loadingActionIdGet")].URL()+"/loading/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIContainerActionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingActionIdGetSignal(output); + emit loadingActionIdGetSignalFull(worker, output); + } else { + emit loadingActionIdGetSignalE(output, error_type, error_str); + emit loadingActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingCompleteActionIdPost"][_serverIndices.value("loadingCompleteActionIdPost")].URL()+"/loading/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingCompleteActionIdPostSignal(); + emit loadingCompleteActionIdPostSignalFull(worker); + } else { + emit loadingCompleteActionIdPostSignalE(error_type, error_str); + emit loadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingPendingGet() { + QString fullPath = QString(_serverConfigs["loadingPendingGet"][_serverIndices.value("loadingPendingGet")].URL()+"/loading/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIActionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingPendingGetSignal(output); + emit loadingPendingGetSignalFull(worker, output); + } else { + emit loadingPendingGetSignalE(output, error_type, error_str); + emit loadingPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingPost(const OAIContainerRequest &oai_container_request) { + QString fullPath = QString(_serverConfigs["loadingPost"][_serverIndices.value("loadingPost")].URL()+"/loading"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_container_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingPostSignal(); + emit loadingPostSignalFull(worker); + } else { + emit loadingPostSignalE(error_type, error_str); + emit loadingPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingStartActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingStartActionIdPost"][_serverIndices.value("loadingStartActionIdPost")].URL()+"/loading/start/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingStartActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingStartActionIdPostSignal(); + emit loadingStartActionIdPostSignalFull(worker); + } else { + emit loadingStartActionIdPostSignalE(error_type, error_str); + emit loadingStartActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingActionIdGet"][_serverIndices.value("unloadingActionIdGet")].URL()+"/unloading/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIContainerActionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingActionIdGetSignal(output); + emit unloadingActionIdGetSignalFull(worker, output); + } else { + emit unloadingActionIdGetSignalE(output, error_type, error_str); + emit unloadingActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingCompleteActionIdPost"][_serverIndices.value("unloadingCompleteActionIdPost")].URL()+"/unloading/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingCompleteActionIdPostSignal(); + emit unloadingCompleteActionIdPostSignalFull(worker); + } else { + emit unloadingCompleteActionIdPostSignalE(error_type, error_str); + emit unloadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingPendingGet() { + QString fullPath = QString(_serverConfigs["unloadingPendingGet"][_serverIndices.value("unloadingPendingGet")].URL()+"/unloading/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIActionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingPendingGetSignal(output); + emit unloadingPendingGetSignalFull(worker, output); + } else { + emit unloadingPendingGetSignalE(output, error_type, error_str); + emit unloadingPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingPost(const OAIContainerRequest &oai_container_request) { + QString fullPath = QString(_serverConfigs["unloadingPost"][_serverIndices.value("unloadingPost")].URL()+"/unloading"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_container_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingPostSignal(); + emit unloadingPostSignalFull(worker); + } else { + emit unloadingPostSignalE(error_type, error_str); + emit unloadingPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingStartActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingStartActionIdPost"][_serverIndices.value("unloadingStartActionIdPost")].URL()+"/unloading/start/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingStartActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingStartActionIdPostSignal(); + emit unloadingStartActionIdPostSignalFull(worker); + } else { + emit unloadingStartActionIdPostSignalE(error_type, error_str); + emit unloadingStartActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIDefaultApi.h b/ext/pdclient/OAIDefaultApi.h new file mode 100644 index 000000000..35f77a407 --- /dev/null +++ b/ext/pdclient/OAIDefaultApi.h @@ -0,0 +1,244 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_OAIDefaultApi_H +#define OAI_OAIDefaultApi_H + +#include "OAIHelpers.h" +#include "OAIHttpRequest.h" +#include "OAIServerConfiguration.h" + +#include "OAIActionStatusList.h" +#include "OAIContainerActionStatus.h" +#include "OAIContainerRequest.h" +#include "OAIInspectionRequest.h" +#include "OAIInspectionStatus.h" +#include "OAIInspectionStatusList.h" +#include + +#include +#include +#include +#include +#include + +namespace OpenAPI { + +class OAIDefaultApi : public QObject { + Q_OBJECT + +public: + OAIDefaultApi(const int timeOut = 0); + ~OAIDefaultApi(); + + void initializeServerConfigs(); + int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); + void setServerIndex(const QString &operation, int serverIndex); + void setApiKey(const QString &apiKeyName, const QString &apiKey); + void setBearerToken(const QString &token); + void setUsername(const QString &username); + void setPassword(const QString &password); + void setTimeOut(const int timeOut); + void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); + int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void addHeaders(const QString &key, const QString &value); + void enableRequestCompression(); + void enableResponseCompression(); + void abortRequests(); + QString getParamStylePrefix(const QString &style); + QString getParamStyleSuffix(const QString &style); + QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); + + /** + * @param[in] action_id QString [required] + */ + void inspectionActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionCompleteActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionHoldActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionHoldingActionIdPost(const QString &action_id); + + + void inspectionPendingGet(); + + /** + * @param[in] oai_inspection_request OAIInspectionRequest [required] + */ + void inspectionPost(const OAIInspectionRequest &oai_inspection_request); + + /** + * @param[in] action_id QString [required] + */ + void loadingActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void loadingCompleteActionIdPost(const QString &action_id); + + + void loadingPendingGet(); + + /** + * @param[in] oai_container_request OAIContainerRequest [required] + */ + void loadingPost(const OAIContainerRequest &oai_container_request); + + /** + * @param[in] action_id QString [required] + */ + void loadingStartActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void unloadingActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void unloadingCompleteActionIdPost(const QString &action_id); + + + void unloadingPendingGet(); + + /** + * @param[in] oai_container_request OAIContainerRequest [required] + */ + void unloadingPost(const OAIContainerRequest &oai_container_request); + + /** + * @param[in] action_id QString [required] + */ + void unloadingStartActionIdPost(const QString &action_id); + + +private: + QMap _serverIndices; + QMap> _serverConfigs; + QMap _apiKeys; + QString _bearerToken; + QString _username; + QString _password; + int _timeOut; + QString _workingDirectory; + QNetworkAccessManager* _manager; + QMap _defaultHeaders; + bool _isResponseCompressionEnabled; + bool _isRequestCompressionEnabled; + + void inspectionActionIdGetCallback(OAIHttpRequestWorker *worker); + void inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionPendingGetCallback(OAIHttpRequestWorker *worker); + void inspectionPostCallback(OAIHttpRequestWorker *worker); + void loadingActionIdGetCallback(OAIHttpRequestWorker *worker); + void loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void loadingPendingGetCallback(OAIHttpRequestWorker *worker); + void loadingPostCallback(OAIHttpRequestWorker *worker); + void loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); + void unloadingActionIdGetCallback(OAIHttpRequestWorker *worker); + void unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void unloadingPendingGetCallback(OAIHttpRequestWorker *worker); + void unloadingPostCallback(OAIHttpRequestWorker *worker); + void unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); + +signals: + + void inspectionActionIdGetSignal(OAIInspectionStatus summary); + void inspectionCompleteActionIdPostSignal(); + void inspectionHoldActionIdPostSignal(); + void inspectionHoldingActionIdPostSignal(); + void inspectionPendingGetSignal(OAIInspectionStatusList summary); + void inspectionPostSignal(); + void loadingActionIdGetSignal(OAIContainerActionStatus summary); + void loadingCompleteActionIdPostSignal(); + void loadingPendingGetSignal(OAIActionStatusList summary); + void loadingPostSignal(); + void loadingStartActionIdPostSignal(); + void unloadingActionIdGetSignal(OAIContainerActionStatus summary); + void unloadingCompleteActionIdPostSignal(); + void unloadingPendingGetSignal(OAIActionStatusList summary); + void unloadingPostSignal(); + void unloadingStartActionIdPostSignal(); + + void inspectionActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatus summary); + void inspectionCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionHoldActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionHoldingActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatusList summary); + void inspectionPostSignalFull(OAIHttpRequestWorker *worker); + void loadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); + void loadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void loadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); + void loadingPostSignalFull(OAIHttpRequestWorker *worker); + void loadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); + void unloadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); + void unloadingPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); + + void inspectionActionIdGetSignalE(OAIInspectionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldingActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPendingGetSignalE(OAIInspectionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void loadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + + void inspectionActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldingActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + + void abortRequestsSignal(); + void allPendingRequestsCompleted(); +}; + +} // namespace OpenAPI +#endif diff --git a/ext/pdclient/OAIEnum.h b/ext/pdclient/OAIEnum.h new file mode 100644 index 000000000..9177a8d38 --- /dev/null +++ b/ext/pdclient/OAIEnum.h @@ -0,0 +1,63 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_ENUM_H +#define OAI_ENUM_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIEnum { +public: + OAIEnum() {} + + OAIEnum(QString jsonString) { + fromJson(jsonString); + } + + virtual ~OAIEnum() {} + + virtual QJsonValue asJsonValue() const { + return QJsonValue(jstr); + } + + virtual QString asJson() const { + return jstr; + } + + virtual void fromJson(QString jsonString) { + jstr = jsonString; + } + + virtual void fromJsonValue(QJsonValue jval) { + jstr = jval.toString(); + } + + virtual bool isSet() const { + return false; + } + + virtual bool isValid() const { + return true; + } + +private: + QString jstr; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIEnum) + +#endif // OAI_ENUM_H diff --git a/ext/pdclient/OAIHelpers.cpp b/ext/pdclient/OAIHelpers.cpp new file mode 100644 index 000000000..aced612b3 --- /dev/null +++ b/ext/pdclient/OAIHelpers.cpp @@ -0,0 +1,426 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include "OAIHelpers.h" + +namespace OpenAPI { + +class OAISerializerSettings { +public: + struct CustomDateTimeFormat{ + bool isStringSet = false; + QString formatString; + bool isEnumSet = false; + Qt::DateFormat formatEnum; + }; + + static CustomDateTimeFormat getCustomDateTimeFormat() { + return getInstance()->customDateTimeFormat; + } + + static void setDateTimeFormatString(const QString &dtFormat){ + getInstance()->customDateTimeFormat.isStringSet = true; + getInstance()->customDateTimeFormat.isEnumSet = false; + getInstance()->customDateTimeFormat.formatString = dtFormat; + } + + static void setDateTimeFormatEnum(const Qt::DateFormat &dtFormat){ + getInstance()->customDateTimeFormat.isEnumSet = true; + getInstance()->customDateTimeFormat.isStringSet = false; + getInstance()->customDateTimeFormat.formatEnum = dtFormat; + } + + static OAISerializerSettings *getInstance(){ + if(instance == nullptr){ + instance = new OAISerializerSettings(); + } + return instance; + } + +private: + explicit OAISerializerSettings(){ + instance = this; + customDateTimeFormat.isStringSet = false; + customDateTimeFormat.isEnumSet = false; + } + static OAISerializerSettings *instance; + CustomDateTimeFormat customDateTimeFormat; +}; + +OAISerializerSettings * OAISerializerSettings::instance = nullptr; + +bool setDateTimeFormat(const QString &dateTimeFormat){ + bool success = false; + auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); + if (dt.isValid()) { + success = true; + OAISerializerSettings::setDateTimeFormatString(dateTimeFormat); + } + return success; +} + +bool setDateTimeFormat(const Qt::DateFormat &dateTimeFormat){ + bool success = false; + auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); + if (dt.isValid()) { + success = true; + OAISerializerSettings::setDateTimeFormatEnum(dateTimeFormat); + } + return success; +} + +QString toStringValue(const QString &value) { + return value; +} + +QString toStringValue(const QDateTime &value) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } + + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } + + // ISO 8601 + return value.toString(Qt::ISODate); +} + +QString toStringValue(const QByteArray &value) { + return QString(value); +} + +QString toStringValue(const QDate &value) { + // ISO 8601 + return value.toString(Qt::DateFormat::ISODate); +} + +QString toStringValue(const qint32 &value) { + return QString::number(value); +} + +QString toStringValue(const qint64 &value) { + return QString::number(value); +} + +QString toStringValue(const bool &value) { + return QString(value ? "true" : "false"); +} + +QString toStringValue(const float &value) { + return QString::number(static_cast(value)); +} + +QString toStringValue(const double &value) { + return QString::number(value); +} + +QString toStringValue(const OAIObject &value) { + return value.asJson(); +} + +QString toStringValue(const OAIEnum &value) { + return value.asJson(); +} + +QString toStringValue(const OAIHttpFileElement &value) { + return value.asJson(); +} + +QJsonValue toJsonValue(const QString &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const QDateTime &value) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString)); + } + + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum)); + } + + // ISO 8601 + return QJsonValue(value.toString(Qt::ISODate)); +} + +QJsonValue toJsonValue(const QByteArray &value) { + return QJsonValue(QString(value.toBase64())); +} + +QJsonValue toJsonValue(const QDate &value) { + return QJsonValue(value.toString(Qt::ISODate)); +} + +QJsonValue toJsonValue(const qint32 &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const qint64 &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const bool &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const float &value) { + return QJsonValue(static_cast(value)); +} + +QJsonValue toJsonValue(const double &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const OAIObject &value) { + return value.asJsonObject(); +} + +QJsonValue toJsonValue(const OAIEnum &value) { + return value.asJsonValue(); +} + +QJsonValue toJsonValue(const OAIHttpFileElement &value) { + return value.asJsonValue(); +} + +bool fromStringValue(const QString &inStr, QString &value) { + value.clear(); + value.append(inStr); + return !inStr.isEmpty(); +} + +bool fromStringValue(const QString &inStr, QDateTime &value) { + if (inStr.isEmpty()) { + return false; + } else { + QDateTime dateTime; + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } else { + dateTime = QDateTime::fromString(inStr, Qt::ISODate); + } + + if (dateTime.isValid()) { + value.setDate(dateTime.date()); + value.setTime(dateTime.time()); + } else { + qDebug() << "DateTime is invalid"; + } + return dateTime.isValid(); + } +} + +bool fromStringValue(const QString &inStr, QByteArray &value) { + if (inStr.isEmpty()) { + return false; + } else { + value.clear(); + value.append(inStr.toUtf8()); + return value.count() > 0; + } +} + +bool fromStringValue(const QString &inStr, QDate &value) { + if (inStr.isEmpty()) { + return false; + } else { + auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); + if (date.isValid()) { + value.setDate(date.year(), date.month(), date.day()); + } else { + qDebug() << "Date is invalid"; + } + return date.isValid(); + } +} + +bool fromStringValue(const QString &inStr, qint32 &value) { + bool ok = false; + value = QVariant(inStr).toInt(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, qint64 &value) { + bool ok = false; + value = QVariant(inStr).toLongLong(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, bool &value) { + value = QVariant(inStr).toBool(); + return ((inStr == "true") || (inStr == "false")); +} + +bool fromStringValue(const QString &inStr, float &value) { + bool ok = false; + value = QVariant(inStr).toFloat(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, double &value) { + bool ok = false; + value = QVariant(inStr).toDouble(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, OAIObject &value) +{ + QJsonParseError err; + QJsonDocument::fromJson(inStr.toUtf8(),&err); + if ( err.error == QJsonParseError::NoError ){ + value.fromJson(inStr); + return true; + } + return false; +} + +bool fromStringValue(const QString &inStr, OAIEnum &value) { + value.fromJson(inStr); + return true; +} + +bool fromStringValue(const QString &inStr, OAIHttpFileElement &value) { + return value.fromStringValue(inStr); +} + +bool fromJsonValue(QString &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull()) { + if (jval.isString()) { + value = jval.toString(); + } else if (jval.isBool()) { + value = jval.toBool() ? "true" : "false"; + } else if (jval.isDouble()) { + value = QString::number(jval.toDouble()); + } else { + ok = false; + } + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } else { + value = QDateTime::fromString(jval.toString(), Qt::ISODate); + } + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + value = QByteArray::fromBase64(QByteArray::fromStdString(jval.toString().toStdString())); + ok = value.size() > 0; + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QDate &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + value = QDate::fromString(jval.toString(), Qt::ISODate); + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(qint32 &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { + value = jval.toInt(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(qint64 &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { + value = jval.toVariant().toLongLong(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(bool &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isBool()) { + value = jval.toBool(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(float &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isDouble()) { + value = static_cast(jval.toDouble()); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(double &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isDouble()) { + value = jval.toDouble(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(OAIObject &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + value.fromJsonObject(jval.toObject()); + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(OAIEnum &value, const QJsonValue &jval) { + value.fromJsonValue(jval); + return true; +} + +bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval) { + return value.fromJsonValue(jval); +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHelpers.h b/ext/pdclient/OAIHelpers.h new file mode 100644 index 000000000..06fe6ff34 --- /dev/null +++ b/ext/pdclient/OAIHelpers.h @@ -0,0 +1,275 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_HELPERS_H +#define OAI_HELPERS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "OAIEnum.h" +#include "OAIHttpFileElement.h" +#include "OAIObject.h" + +namespace OpenAPI { + +template +class OptionalParam { +public: + T m_Value; + bool m_hasValue; +public: + OptionalParam(){ + m_hasValue = false; + } + OptionalParam(const T &val){ + m_hasValue = true; + m_Value = val; + } + bool hasValue() const { + return m_hasValue; + } + T value() const{ + return m_Value; + } +}; + +bool setDateTimeFormat(const QString &format); +bool setDateTimeFormat(const Qt::DateFormat &format); + +template +QString toStringValue(const QList &val); + +template +QString toStringValue(const QSet &val); + +template +bool fromStringValue(const QList &inStr, QList &val); + +template +bool fromStringValue(const QSet &inStr, QList &val); + +template +bool fromStringValue(const QMap &inStr, QMap &val); + +template +QJsonValue toJsonValue(const QList &val); + +template +QJsonValue toJsonValue(const QSet &val); + +template +QJsonValue toJsonValue(const QMap &val); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval); + +template +bool fromJsonValue(QSet &val, const QJsonValue &jval); + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval); + +QString toStringValue(const QString &value); +QString toStringValue(const QDateTime &value); +QString toStringValue(const QByteArray &value); +QString toStringValue(const QDate &value); +QString toStringValue(const qint32 &value); +QString toStringValue(const qint64 &value); +QString toStringValue(const bool &value); +QString toStringValue(const float &value); +QString toStringValue(const double &value); +QString toStringValue(const OAIObject &value); +QString toStringValue(const OAIEnum &value); +QString toStringValue(const OAIHttpFileElement &value); + +template +QString toStringValue(const QList &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); + } + if (val.count() > 0) { + strArray.chop(1); + } + return strArray; +} + +template +QString toStringValue(const QSet &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); + } + if (val.count() > 0) { + strArray.chop(1); + } + return strArray; +} + +QJsonValue toJsonValue(const QString &value); +QJsonValue toJsonValue(const QDateTime &value); +QJsonValue toJsonValue(const QByteArray &value); +QJsonValue toJsonValue(const QDate &value); +QJsonValue toJsonValue(const qint32 &value); +QJsonValue toJsonValue(const qint64 &value); +QJsonValue toJsonValue(const bool &value); +QJsonValue toJsonValue(const float &value); +QJsonValue toJsonValue(const double &value); +QJsonValue toJsonValue(const OAIObject &value); +QJsonValue toJsonValue(const OAIEnum &value); +QJsonValue toJsonValue(const OAIHttpFileElement &value); + +template +QJsonValue toJsonValue(const QList &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); + } + return jArray; +} + +template +QJsonValue toJsonValue(const QSet &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); + } + return jArray; +} + +template +QJsonValue toJsonValue(const QMap &val) { + QJsonObject jObject; + for (const auto &itemkey : val.keys()) { + jObject.insert(itemkey, toJsonValue(val.value(itemkey))); + } + return jObject; +} + +bool fromStringValue(const QString &inStr, QString &value); +bool fromStringValue(const QString &inStr, QDateTime &value); +bool fromStringValue(const QString &inStr, QByteArray &value); +bool fromStringValue(const QString &inStr, QDate &value); +bool fromStringValue(const QString &inStr, qint32 &value); +bool fromStringValue(const QString &inStr, qint64 &value); +bool fromStringValue(const QString &inStr, bool &value); +bool fromStringValue(const QString &inStr, float &value); +bool fromStringValue(const QString &inStr, double &value); +bool fromStringValue(const QString &inStr, OAIObject &value); +bool fromStringValue(const QString &inStr, OAIEnum &value); +bool fromStringValue(const QString &inStr, OAIHttpFileElement &value); + +template +bool fromStringValue(const QList &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); + } + return ok; +} + +template +bool fromStringValue(const QSet &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); + } + return ok; +} + +template +bool fromStringValue(const QMap &inStr, QMap &val) { + bool ok = (inStr.count() > 0); + for (const auto &itemkey : inStr.keys()) { + T itemVal; + ok &= fromStringValue(inStr.value(itemkey), itemVal); + val.insert(itemkey, itemVal); + } + return ok; +} + +bool fromJsonValue(QString &value, const QJsonValue &jval); +bool fromJsonValue(QDateTime &value, const QJsonValue &jval); +bool fromJsonValue(QByteArray &value, const QJsonValue &jval); +bool fromJsonValue(QDate &value, const QJsonValue &jval); +bool fromJsonValue(qint32 &value, const QJsonValue &jval); +bool fromJsonValue(qint64 &value, const QJsonValue &jval); +bool fromJsonValue(bool &value, const QJsonValue &jval); +bool fromJsonValue(float &value, const QJsonValue &jval); +bool fromJsonValue(double &value, const QJsonValue &jval); +bool fromJsonValue(OAIObject &value, const QJsonValue &jval); +bool fromJsonValue(OAIEnum &value, const QJsonValue &jval); +bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.push_back(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QSet &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.insert(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + auto varmap = jval.toObject().toVariantMap(); + if (varmap.count() > 0) { + for (const auto &itemkey : varmap.keys()) { + T itemVal; + ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); + val.insert(itemkey, itemVal); + } + } + } else { + ok = false; + } + return ok; +} + +} // namespace OpenAPI + +#endif // OAI_HELPERS_H diff --git a/ext/pdclient/OAIHttpFileElement.cpp b/ext/pdclient/OAIHttpFileElement.cpp new file mode 100644 index 000000000..b2c6774dd --- /dev/null +++ b/ext/pdclient/OAIHttpFileElement.cpp @@ -0,0 +1,155 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include +#include + +#include "OAIHttpFileElement.h" + +namespace OpenAPI { + +void OAIHttpFileElement::setMimeType(const QString &mime) { + mime_type = mime; +} + +void OAIHttpFileElement::setFileName(const QString &name) { + local_filename = name; +} + +void OAIHttpFileElement::setVariableName(const QString &name) { + variable_name = name; +} + +void OAIHttpFileElement::setRequestFileName(const QString &name) { + request_filename = name; +} + +bool OAIHttpFileElement::isSet() const { + return !local_filename.isEmpty() || !request_filename.isEmpty(); +} + +QString OAIHttpFileElement::asJson() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } + return QString(bArray); +} + +QJsonValue OAIHttpFileElement::asJsonValue() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + return QJsonDocument::fromJson(bArray.data()).object(); +#else + return QJsonDocument::fromBinaryData(bArray.data()).object(); +#endif +} + +bool OAIHttpFileElement::fromStringValue(const QString &instr) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); + file.write(instr.toUtf8()); + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +bool OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + file.write(QJsonDocument(jval.toObject()).toJson()); +#else + file.write(QJsonDocument(jval.toObject()).toBinaryData()); +#endif + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +QByteArray OAIHttpFileElement::asByteArray() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } + return bArray; +} + +bool OAIHttpFileElement::fromByteArray(const QByteArray &bytes) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); + file.write(bytes); + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +bool OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { + setMimeType(mime); + setFileName(localFName); + setVariableName(varName); + setRequestFileName(reqFname); + return fromByteArray(bytes); +} + +QByteArray OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { + setMimeType(mime); + setFileName(localFName); + setVariableName(varName); + setRequestFileName(reqFname); + return asByteArray(); +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpFileElement.h b/ext/pdclient/OAIHttpFileElement.h new file mode 100644 index 000000000..2f59cb8de --- /dev/null +++ b/ext/pdclient/OAIHttpFileElement.h @@ -0,0 +1,47 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_HTTP_FILE_ELEMENT_H +#define OAI_HTTP_FILE_ELEMENT_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIHttpFileElement { + +public: + QString variable_name; + QString local_filename; + QString request_filename; + QString mime_type; + void setMimeType(const QString &mime); + void setFileName(const QString &name); + void setVariableName(const QString &name); + void setRequestFileName(const QString &name); + bool isSet() const; + bool fromStringValue(const QString &instr); + bool fromJsonValue(const QJsonValue &jval); + bool fromByteArray(const QByteArray &bytes); + bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); + QString asJson() const; + QJsonValue asJsonValue() const; + QByteArray asByteArray() const; + QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime); +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement) + +#endif // OAI_HTTP_FILE_ELEMENT_H diff --git a/ext/pdclient/OAIHttpRequest.cpp b/ext/pdclient/OAIHttpRequest.cpp new file mode 100644 index 000000000..dfa70b26f --- /dev/null +++ b/ext/pdclient/OAIHttpRequest.cpp @@ -0,0 +1,505 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#else + #define SKIP_EMPTY_PARTS QString::SkipEmptyParts +#endif + +#include "OAIHttpRequest.h" + +namespace OpenAPI { + +OAIHttpRequestInput::OAIHttpRequestInput() { + initialize(); +} + +OAIHttpRequestInput::OAIHttpRequestInput(QString v_url_str, QString v_http_method) { + initialize(); + url_str = v_url_str; + http_method = v_http_method; +} + +void OAIHttpRequestInput::initialize() { + var_layout = NOT_SET; + url_str = ""; + http_method = "GET"; +} + +void OAIHttpRequestInput::add_var(QString key, QString value) { + vars[key] = value; +} + +void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { + OAIHttpFileElement file; + file.variable_name = variable_name; + file.local_filename = local_filename; + file.request_filename = request_filename; + file.mime_type = mime_type; + files.append(file); +} + +OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) + : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); +#else + qsrand(QDateTime::currentDateTime().toTime_t()); +#endif + + if (manager == nullptr) { + manager = new QNetworkAccessManager(this); + } + workingDirectory = QDir::currentPath(); + timeOutTimer.setSingleShot(true); +} + +OAIHttpRequestWorker::~OAIHttpRequestWorker() { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + timeOutTimer.stop(); + for (const auto &item : multiPartFields) { + if (item != nullptr) { + delete item; + } + } +} + +QMap OAIHttpRequestWorker::getResponseHeaders() const { + return headers; +} + +OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname) { + if (!files.isEmpty()) { + if (fieldname.isEmpty()) { + return files.first(); + } else if (files.contains(fieldname)) { + return files[fieldname]; + } + } + return OAIHttpFileElement(); +} + +QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname) { + if (!multiPartFields.isEmpty()) { + if (fieldname.isEmpty()) { + return multiPartFields.first(); + } else if (multiPartFields.contains(fieldname)) { + return multiPartFields[fieldname]; + } + } + return nullptr; +} + +void OAIHttpRequestWorker::setTimeOut(int timeOutMs) { + timeOutTimer.setInterval(timeOutMs); + if(timeOutTimer.interval() == 0) { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + } +} + +void OAIHttpRequestWorker::setWorkingDirectory(const QString &path) { + if (!path.isEmpty()) { + workingDirectory = path; + } +} + +void OAIHttpRequestWorker::setResponseCompressionEnabled(bool enable) { + isResponseCompressionEnabled = enable; +} + +void OAIHttpRequestWorker::setRequestCompressionEnabled(bool enable) { + isRequestCompressionEnabled = enable; +} + +int OAIHttpRequestWorker::getHttpResponseCode() const{ + return httpResponseCode; +} + +QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { + // result structure follows RFC 5987 + bool need_utf_encoding = false; + QString result = ""; + QByteArray input_c = input.toLocal8Bit(); + char c; + for (int i = 0; i < input_c.length(); i++) { + c = input_c.at(i); + if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { + // ignore and request utf-8 version + need_utf_encoding = true; + } else if (c == '"') { + result += "\\\""; + } else { + result += c; + } + } + + if (result.length() == 0) { + need_utf_encoding = true; + } + + if (!need_utf_encoding) { + // return simple version + return QString("%1=\"%2\"").arg(attribute_name, result); + } + + QString result_utf8 = ""; + for (int i = 0; i < input_c.length(); i++) { + c = input_c.at(i); + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { + result_utf8 += c; + } else { + result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); + } + } + + // return enhanced version with UTF-8 support + return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); +} + +void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { + + // reset variables + QNetworkReply *reply = nullptr; + QByteArray request_content = ""; + response = ""; + error_type = QNetworkReply::NoError; + error_str = ""; + bool isFormData = false; + + // decide on the variable layout + + if (input->files.length() > 0) { + input->var_layout = MULTIPART; + } + if (input->var_layout == NOT_SET) { + input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; + } + + // prepare request content + + QString boundary = ""; + + if (input->var_layout == ADDRESS || input->var_layout == URL_ENCODED) { + // variable layout is ADDRESS or URL_ENCODED + + if (input->vars.count() > 0) { + bool first = true; + isFormData = true; + foreach (QString key, input->vars.keys()) { + if (!first) { + request_content.append("&"); + } + first = false; + + request_content.append(QUrl::toPercentEncoding(key)); + request_content.append("="); + request_content.append(QUrl::toPercentEncoding(input->vars.value(key))); + } + + if (input->var_layout == ADDRESS) { + input->url_str += "?" + request_content; + request_content = ""; + } + } + } else { + // variable layout is MULTIPART + + boundary = QString("__-----------------------%1%2") + #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) + .arg(randomGenerator.generate()); + #else + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); + #endif + QString boundary_delimiter = "--"; + QString new_line = "\r\n"; + + // add variables + foreach (QString key, input->vars.keys()) { + // add boundary + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); + + // add header + request_content.append("Content-Disposition: form-data; "); + request_content.append(http_attribute_encode("name", key).toUtf8()); + request_content.append(new_line.toUtf8()); + request_content.append("Content-Type: text/plain"); + request_content.append(new_line.toUtf8()); + + // add header to body splitter + request_content.append(new_line.toUtf8()); + + // add variable content + request_content.append(input->vars.value(key).toUtf8()); + request_content.append(new_line.toUtf8()); + } + + // add files + for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { + QFileInfo fi(file_info->local_filename); + + // ensure necessary variables are available + if (file_info->local_filename == nullptr + || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr + || file_info->variable_name.isEmpty() + || !fi.exists() + || !fi.isFile() + || !fi.isReadable()) { + // silent abort for the current file + continue; + } + + QFile file(file_info->local_filename); + if (!file.open(QIODevice::ReadOnly)) { + // silent abort for the current file + continue; + } + + // ensure filename for the request + if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { + file_info->request_filename = fi.fileName(); + if (file_info->request_filename.isEmpty()) { + file_info->request_filename = "file"; + } + } + + // add boundary + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); + + // add header + request_content.append( + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); + request_content.append(new_line.toUtf8()); + + if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { + request_content.append("Content-Type: "); + request_content.append(file_info->mime_type.toUtf8()); + request_content.append(new_line.toUtf8()); + } + + request_content.append("Content-Transfer-Encoding: binary"); + request_content.append(new_line.toUtf8()); + + // add header to body splitter + request_content.append(new_line.toUtf8()); + + // add file content + request_content.append(file.readAll()); + request_content.append(new_line.toUtf8()); + + file.close(); + } + + // add end of body + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(boundary_delimiter.toUtf8()); + } + + if (input->request_body.size() > 0) { + qDebug() << "got a request body"; + request_content.clear(); + if(!isFormData && (input->var_layout != MULTIPART) && isRequestCompressionEnabled){ + request_content.append(compress(input->request_body, 7, OAICompressionType::Gzip)); + } else { + request_content.append(input->request_body); + } + } + // prepare connection + + QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); + if (OAIHttpRequestWorker::sslDefaultConfiguration != nullptr) { + request.setSslConfiguration(*OAIHttpRequestWorker::sslDefaultConfiguration); + } + request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt"); + foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); } + + if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { + if (!input->headers.contains("Content-Type")) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + } else { + request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); + } + if(isRequestCompressionEnabled){ + request.setRawHeader("Content-Encoding", "gzip"); + } + } else if (input->var_layout == URL_ENCODED) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + } else if (input->var_layout == MULTIPART) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); + } + + if(isResponseCompressionEnabled){ + request.setRawHeader("Accept-Encoding", "gzip"); + } else { + request.setRawHeader("Accept-Encoding", "identity"); + } + + if (input->http_method == "GET") { + reply = manager->get(request); + } else if (input->http_method == "POST") { + reply = manager->post(request, request_content); + } else if (input->http_method == "PUT") { + reply = manager->put(request, request_content); + } else if (input->http_method == "HEAD") { + reply = manager->head(request); + } else if (input->http_method == "DELETE") { + reply = manager->deleteResource(request); + } else { +#if (QT_VERSION >= 0x050800) + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); +#else + QBuffer *buffer = new QBuffer; + buffer->setData(request_content); + buffer->open(QIODevice::ReadOnly); + + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + buffer->setParent(reply); +#endif + } + if (reply != nullptr) { + reply->setParent(this); + connect(reply, &QNetworkReply::finished, [this, reply] { + on_reply_finished(reply); + }); + } + if (timeOutTimer.interval() > 0) { + QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { + on_reply_timeout(reply); + }); + timeOutTimer.start(); + } +} + +void OAIHttpRequestWorker::on_reply_finished(QNetworkReply *reply) { + bool codeSts = false; + if(timeOutTimer.isActive()) { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + timeOutTimer.stop(); + } + error_type = reply->error(); + error_str = reply->errorString(); + if (reply->rawHeaderPairs().count() > 0) { + for (const auto &item : reply->rawHeaderPairs()) { + headers.insert(item.first, item.second); + } + } + auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); + if(codeSts){ + httpResponseCode = rescode; + } else{ + httpResponseCode = -1; + } + process_response(reply); + reply->deleteLater(); + emit on_execution_finished(this); +} + +void OAIHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { + error_type = QNetworkReply::TimeoutError; + response = ""; + error_str = "Timed out waiting for response"; + disconnect(reply, nullptr, nullptr, nullptr); + reply->abort(); + reply->deleteLater(); + emit on_execution_finished(this); +} + +void OAIHttpRequestWorker::process_response(QNetworkReply *reply) { + QString contentDispositionHdr; + QString contentTypeHdr; + QString contentEncodingHdr; + + for(auto hdr: getResponseHeaders().keys()){ + if(hdr.compare(QString("Content-Disposition"), Qt::CaseInsensitive) == 0){ + contentDispositionHdr = getResponseHeaders().value(hdr); + } + if(hdr.compare(QString("Content-Type"), Qt::CaseInsensitive) == 0){ + contentTypeHdr = getResponseHeaders().value(hdr); + } + if(hdr.compare(QString("Content-Encoding"), Qt::CaseInsensitive) == 0){ + contentEncodingHdr = getResponseHeaders().value(hdr); + } + } + + if (!contentDispositionHdr.isEmpty()) { + auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentType = + !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); + if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { + QString filename = QUuid::createUuid().toString(); + for (const auto &file : contentDisposition) { + if (file.contains(QString("filename"))) { + filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); + break; + } + } + OAIHttpFileElement felement; + felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, reply->readAll()); + files.insert(filename, felement); + } + + } else if (!contentTypeHdr.isEmpty()) { + auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); + if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { + // TODO : Handle Multipart responses + } else { + if(!contentEncodingHdr.isEmpty()){ + auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); + if(encoding.count() > 0){ + auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); + if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ + response = decompress(reply->readAll()); + } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ + response = reply->readAll(); + } + } + } + else { + response = reply->readAll(); + } + } + } +} + +QByteArray OAIHttpRequestWorker::decompress(const QByteArray& data){ + + Q_UNUSED(data); + return QByteArray(); +} + +QByteArray OAIHttpRequestWorker::compress(const QByteArray& input, int level, OAICompressionType compressType) { + + Q_UNUSED(input); + Q_UNUSED(level); + Q_UNUSED(compressType); + return QByteArray(); +} + +QSslConfiguration *OAIHttpRequestWorker::sslDefaultConfiguration; + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpRequest.h b/ext/pdclient/OAIHttpRequest.h new file mode 100644 index 000000000..cda089bf2 --- /dev/null +++ b/ext/pdclient/OAIHttpRequest.h @@ -0,0 +1,113 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Based on http://www.creativepulse.gr/en/blog/2014/restful-api-requests-using-qt-cpp-for-linux-mac-osx-ms-windows + * By Alex Stylianos + * + **/ + +#ifndef OAI_HTTPREQUESTWORKER_H +#define OAI_HTTPREQUESTWORKER_H + +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + #include +#endif + +#include "OAIHttpFileElement.h" + +namespace OpenAPI { + +enum OAIHttpRequestVarLayout { + NOT_SET, + ADDRESS, + URL_ENCODED, + MULTIPART +}; + +class OAIHttpRequestInput { + +public: + QString url_str; + QString http_method; + OAIHttpRequestVarLayout var_layout; + QMap vars; + QMap headers; + QList files; + QByteArray request_body; + + OAIHttpRequestInput(); + OAIHttpRequestInput(QString v_url_str, QString v_http_method); + void initialize(); + void add_var(QString key, QString value); + void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); +}; + +class OAIHttpRequestWorker : public QObject { + Q_OBJECT + +public: + explicit OAIHttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); + virtual ~OAIHttpRequestWorker(); + + QByteArray response; + QNetworkReply::NetworkError error_type; + QString error_str; + + QMap getResponseHeaders() const; + QString http_attribute_encode(QString attribute_name, QString input); + void execute(OAIHttpRequestInput *input); + static QSslConfiguration *sslDefaultConfiguration; + void setTimeOut(int timeOutMs); + void setWorkingDirectory(const QString &path); + OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString()); + QByteArray *getMultiPartField(const QString &fieldname = QString()); + void setResponseCompressionEnabled(bool enable); + void setRequestCompressionEnabled(bool enable); + int getHttpResponseCode() const; + +signals: + void on_execution_finished(OAIHttpRequestWorker *worker); + +private: + enum OAICompressionType{ + Zlib, + Gzip + }; + QNetworkAccessManager *manager; + QMap headers; + QMap files; + QMap multiPartFields; + QString workingDirectory; + QTimer timeOutTimer; + bool isResponseCompressionEnabled; + bool isRequestCompressionEnabled; + int httpResponseCode; +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QRandomGenerator randomGenerator; +#endif + + void on_reply_timeout(QNetworkReply *reply); + void on_reply_finished(QNetworkReply *reply); + void process_response(QNetworkReply *reply); + QByteArray decompress(const QByteArray& data); + QByteArray compress(const QByteArray& input, int level, OAICompressionType compressType); +}; + +} // namespace OpenAPI + +#endif // OAI_HTTPREQUESTWORKER_H diff --git a/ext/pdclient/OAIInspectionRequest.cpp b/ext/pdclient/OAIInspectionRequest.cpp new file mode 100644 index 000000000..161d4cdfd --- /dev/null +++ b/ext/pdclient/OAIInspectionRequest.cpp @@ -0,0 +1,160 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionRequest.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionRequest::OAIInspectionRequest(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionRequest::OAIInspectionRequest() { + this->initializeModel(); +} + +OAIInspectionRequest::~OAIInspectionRequest() {} + +void OAIInspectionRequest::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; +} + +void OAIInspectionRequest::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionRequest::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; +} + +QString OAIInspectionRequest::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionRequest::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + return obj; +} + +QString OAIInspectionRequest::getVehicleId() const { + return vehicle_id; +} +void OAIInspectionRequest::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIInspectionRequest::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIInspectionRequest::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIInspectionRequest::getContainerId() const { + return container_id; +} +void OAIInspectionRequest::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIInspectionRequest::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIInspectionRequest::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIInspectionRequest::getActionId() const { + return action_id; +} +void OAIInspectionRequest::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIInspectionRequest::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIInspectionRequest::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +bool OAIInspectionRequest::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionRequest::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionRequest.h b/ext/pdclient/OAIInspectionRequest.h new file mode 100644 index 000000000..2270d3c18 --- /dev/null +++ b/ext/pdclient/OAIInspectionRequest.h @@ -0,0 +1,79 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionRequest.h + * + * + */ + +#ifndef OAIInspectionRequest_H +#define OAIInspectionRequest_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionRequest : public OAIObject { +public: + OAIInspectionRequest(); + OAIInspectionRequest(QString json); + ~OAIInspectionRequest() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionRequest) + +#endif // OAIInspectionRequest_H diff --git a/ext/pdclient/OAIInspectionStatus.cpp b/ext/pdclient/OAIInspectionStatus.cpp new file mode 100644 index 000000000..101fd0a41 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatus.cpp @@ -0,0 +1,250 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionStatus.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionStatus::OAIInspectionStatus(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionStatus::OAIInspectionStatus() { + this->initializeModel(); +} + +OAIInspectionStatus::~OAIInspectionStatus() {} + +void OAIInspectionStatus::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; + + m_status_isSet = false; + m_status_isValid = false; + + m_requested_isSet = false; + m_requested_isValid = false; + + m_completed_isSet = false; + m_completed_isValid = false; +} + +void OAIInspectionStatus::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionStatus::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; + + m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; + + m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); + m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; + + m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); + m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; +} + +QString OAIInspectionStatus::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionStatus::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + if (m_status_isSet) { + obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + } + if (m_requested_isSet) { + obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); + } + if (m_completed_isSet) { + obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); + } + return obj; +} + +QString OAIInspectionStatus::getVehicleId() const { + return vehicle_id; +} +void OAIInspectionStatus::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIInspectionStatus::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIInspectionStatus::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIInspectionStatus::getContainerId() const { + return container_id; +} +void OAIInspectionStatus::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIInspectionStatus::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIInspectionStatus::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIInspectionStatus::getActionId() const { + return action_id; +} +void OAIInspectionStatus::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIInspectionStatus::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIInspectionStatus::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +QString OAIInspectionStatus::getStatus() const { + return status; +} +void OAIInspectionStatus::setStatus(const QString &status) { + this->status = status; + this->m_status_isSet = true; +} + +bool OAIInspectionStatus::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIInspectionStatus::is_status_Valid() const{ + return m_status_isValid; +} + +qint64 OAIInspectionStatus::getRequested() const { + return requested; +} +void OAIInspectionStatus::setRequested(const qint64 &requested) { + this->requested = requested; + this->m_requested_isSet = true; +} + +bool OAIInspectionStatus::is_requested_Set() const{ + return m_requested_isSet; +} + +bool OAIInspectionStatus::is_requested_Valid() const{ + return m_requested_isValid; +} + +qint64 OAIInspectionStatus::getCompleted() const { + return completed; +} +void OAIInspectionStatus::setCompleted(const qint64 &completed) { + this->completed = completed; + this->m_completed_isSet = true; +} + +bool OAIInspectionStatus::is_completed_Set() const{ + return m_completed_isSet; +} + +bool OAIInspectionStatus::is_completed_Valid() const{ + return m_completed_isValid; +} + +bool OAIInspectionStatus::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + + if (m_requested_isSet) { + isObjectUpdated = true; + break; + } + + if (m_completed_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionStatus::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatus.h b/ext/pdclient/OAIInspectionStatus.h new file mode 100644 index 000000000..aee5d535d --- /dev/null +++ b/ext/pdclient/OAIInspectionStatus.h @@ -0,0 +1,106 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionStatus.h + * + * + */ + +#ifndef OAIInspectionStatus_H +#define OAIInspectionStatus_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionStatus : public OAIObject { +public: + OAIInspectionStatus(); + OAIInspectionStatus(QString json); + ~OAIInspectionStatus() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + QString getStatus() const; + void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; + + qint64 getRequested() const; + void setRequested(const qint64 &requested); + bool is_requested_Set() const; + bool is_requested_Valid() const; + + qint64 getCompleted() const; + void setCompleted(const qint64 &completed); + bool is_completed_Set() const; + bool is_completed_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; + + QString status; + bool m_status_isSet; + bool m_status_isValid; + + qint64 requested; + bool m_requested_isSet; + bool m_requested_isValid; + + qint64 completed; + bool m_completed_isSet; + bool m_completed_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatus) + +#endif // OAIInspectionStatus_H diff --git a/ext/pdclient/OAIInspectionStatusList.cpp b/ext/pdclient/OAIInspectionStatusList.cpp new file mode 100644 index 000000000..7145b1dd1 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatusList.cpp @@ -0,0 +1,100 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionStatusList.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionStatusList::OAIInspectionStatusList(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionStatusList::OAIInspectionStatusList() { + this->initializeModel(); +} + +OAIInspectionStatusList::~OAIInspectionStatusList() {} + +void OAIInspectionStatusList::initializeModel() { + + m_inspections_isSet = false; + m_inspections_isValid = false; +} + +void OAIInspectionStatusList::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionStatusList::fromJsonObject(QJsonObject json) { + + m_inspections_isValid = ::OpenAPI::fromJsonValue(inspections, json[QString("inspections")]); + m_inspections_isSet = !json[QString("inspections")].isNull() && m_inspections_isValid; +} + +QString OAIInspectionStatusList::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionStatusList::asJsonObject() const { + QJsonObject obj; + if (inspections.size() > 0) { + obj.insert(QString("inspections"), ::OpenAPI::toJsonValue(inspections)); + } + return obj; +} + +QList OAIInspectionStatusList::getInspections() const { + return inspections; +} +void OAIInspectionStatusList::setInspections(const QList &inspections) { + this->inspections = inspections; + this->m_inspections_isSet = true; +} + +bool OAIInspectionStatusList::is_inspections_Set() const{ + return m_inspections_isSet; +} + +bool OAIInspectionStatusList::is_inspections_Valid() const{ + return m_inspections_isValid; +} + +bool OAIInspectionStatusList::isSet() const { + bool isObjectUpdated = false; + do { + if (inspections.size() > 0) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionStatusList::isValid() const { + // only required properties are required for the object to be considered valid + return true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatusList.h b/ext/pdclient/OAIInspectionStatusList.h new file mode 100644 index 000000000..8849ffcf5 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatusList.h @@ -0,0 +1,62 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionStatusList.h + * + * + */ + +#ifndef OAIInspectionStatusList_H +#define OAIInspectionStatusList_H + +#include + +#include "OAIInspectionStatus.h" +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionStatusList : public OAIObject { +public: + OAIInspectionStatusList(); + OAIInspectionStatusList(QString json); + ~OAIInspectionStatusList() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QList getInspections() const; + void setInspections(const QList &inspections); + bool is_inspections_Set() const; + bool is_inspections_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QList inspections; + bool m_inspections_isSet; + bool m_inspections_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatusList) + +#endif // OAIInspectionStatusList_H diff --git a/ext/pdclient/OAIObject.h b/ext/pdclient/OAIObject.h new file mode 100644 index 000000000..68e114afe --- /dev/null +++ b/ext/pdclient/OAIObject.h @@ -0,0 +1,65 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_OBJECT_H +#define OAI_OBJECT_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIObject { +public: + OAIObject() {} + + OAIObject(QString jsonString) { + fromJson(jsonString); + } + + virtual ~OAIObject() {} + + virtual QJsonObject asJsonObject() const { + return jObj; + } + + virtual QString asJson() const { + QJsonDocument doc(jObj); + return doc.toJson(QJsonDocument::Compact); + } + + virtual void fromJson(QString jsonString) { + QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8()); + jObj = doc.object(); + } + + virtual void fromJsonObject(QJsonObject json) { + jObj = json; + } + + virtual bool isSet() const { + return false; + } + + virtual bool isValid() const { + return true; + } + +private: + QJsonObject jObj; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIObject) + +#endif // OAI_OBJECT_H diff --git a/ext/pdclient/OAIServerConfiguration.h b/ext/pdclient/OAIServerConfiguration.h new file mode 100644 index 000000000..8d33862a8 --- /dev/null +++ b/ext/pdclient/OAIServerConfiguration.h @@ -0,0 +1,82 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Representing a Server configuration. + */ +#ifndef OAI_SERVERVCONFIGURATION_H +#define OAI_SERVERVCONFIGURATION_H + +#include +#include +#include +#include +#include +#include "OAIServerVariable.h" + +namespace OpenAPI { + +class OAIServerConfiguration { +public: + /** + * @param url A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + OAIServerConfiguration(const QUrl &url, const QString &description, const QMap &variables) + : _description(description), + _variables(variables), + _url(url){} + OAIServerConfiguration(){} + ~OAIServerConfiguration(){} + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + QString URL() { + QString url = _url.toString(); + if(!_variables.empty()){ + // go through variables and replace placeholders + for (auto const& v : _variables.keys()) { + QString name = v; + OAIServerVariable serverVariable = _variables.value(v); + QString value = serverVariable._defaultValue; + + if (!serverVariable._enumValues.empty() && !serverVariable._enumValues.contains(value)) { + throw std::runtime_error(QString("The variable " + name + " in the server URL has invalid value " + value + ".").toUtf8()); + } + QRegularExpression regex(QString("\\{" + name + "\\}")); + url = url.replace(regex, value); + + } + return url; + } + return url; + } + + int setDefaultValue(const QString &variable,const QString &value){ + if(_variables.contains(variable)) + return _variables[variable].setDefaultValue(value); + return -1; + } + + QString _description; + QMap _variables; + QUrl _url; + +}; + +} // namespace OpenAPI + +#endif // OAI_SERVERVCONFIGURATION_H diff --git a/ext/pdclient/OAIServerVariable.h b/ext/pdclient/OAIServerVariable.h new file mode 100644 index 000000000..9930343ca --- /dev/null +++ b/ext/pdclient/OAIServerVariable.h @@ -0,0 +1,58 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Representing a Server Variable for server URL template substitution. + */ +#ifndef OAI_SERVERVARIABLE_H +#define OAI_SERVERVARIABLE_H +#include +#include + +namespace OpenAPI { + +class OAIServerVariable { +public: + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + OAIServerVariable(const QString &description, const QString &defaultValue, const QSet &enumValues) + : _defaultValue(defaultValue), + _description(description), + _enumValues(enumValues){} + + OAIServerVariable(){} + ~OAIServerVariable(){} + + int setDefaultValue(const QString& value){ + if( _enumValues.contains(value)){ + _defaultValue = value; + return 0; + } + return -2; + } + + QString getDefaultValue(){return _defaultValue;} + QSet getEnumValues(){return _enumValues;} + + + QString _defaultValue; + QString _description; + QSet _enumValues; + +}; + +} // namespace OpenAPI + +#endif // OAI_SERVERVARIABLE_H diff --git a/ext/pdclient/client.pri b/ext/pdclient/client.pri new file mode 100644 index 000000000..1a7c42bf9 --- /dev/null +++ b/ext/pdclient/client.pri @@ -0,0 +1,35 @@ +QT += network + +HEADERS += \ +# Models + $${PWD}/OAIActionStatusList.h \ + $${PWD}/OAIContainerActionStatus.h \ + $${PWD}/OAIContainerRequest.h \ + $${PWD}/OAIInspectionRequest.h \ + $${PWD}/OAIInspectionStatus.h \ + $${PWD}/OAIInspectionStatusList.h \ +# APIs + $${PWD}/OAIDefaultApi.h \ +# Others + $${PWD}/OAIHelpers.h \ + $${PWD}/OAIHttpRequest.h \ + $${PWD}/OAIObject.h \ + $${PWD}/OAIEnum.h \ + $${PWD}/OAIHttpFileElement.h \ + $${PWD}/OAIServerConfiguration.h \ + $${PWD}/OAIServerVariable.h + +SOURCES += \ +# Models + $${PWD}/OAIActionStatusList.cpp \ + $${PWD}/OAIContainerActionStatus.cpp \ + $${PWD}/OAIContainerRequest.cpp \ + $${PWD}/OAIInspectionRequest.cpp \ + $${PWD}/OAIInspectionStatus.cpp \ + $${PWD}/OAIInspectionStatusList.cpp \ +# APIs + $${PWD}/OAIDefaultApi.cpp \ +# Others + $${PWD}/OAIHelpers.cpp \ + $${PWD}/OAIHttpRequest.cpp \ + $${PWD}/OAIHttpFileElement.cpp diff --git a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp index cc75299a6..22bd9ab3a 100644 --- a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp +++ b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp @@ -340,7 +340,6 @@ class J2735MessageFactory int msgIdindex=0; // msgId = DD if (bytes[0] == 0x00) { - std::cout<<"No Extended bytes found\n"; return 0; } if(bytes[0] == 0x03){ // extended bytes present diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp index b0a93deb8..9a85bb6ed 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp @@ -71,7 +71,8 @@ void DsrcMessageManagerPlugin::OnMessageReceived(IvpMessage *msg) { // Uncomment this line to call the base method, which prints the message received to cout. //PluginClient::OnMessageReceived(msg); - + FILE_LOG(logERROR) << "Message Received " << + "Type: " << msg->type << ", Subtype: " << msg->subtype; if (!_configRead) { PLOG(logWARNING) << "Config not read yet. Message Ignored: " << diff --git a/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt b/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt deleted file mode 100644 index bb2ae8805..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -PROJECT ( MobilityOperationPlugin VERSION 5.0 LANGUAGES CXX ) - -BuildTmxPlugin ( ) - -TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils) \ No newline at end of file diff --git a/src/v2i-hub/MobilityOperationPlugin/manifest.json b/src/v2i-hub/MobilityOperationPlugin/manifest.json deleted file mode 100644 index 87f553c28..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/manifest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name":"MobilityOperationPlugin", - "description":"...", - "version":"@PROJECT_VERSION@", - "exeLocation":"/bin/MobilityOperationPlugin", - "coreIpAddr":"127.0.0.1", - "corePort":24601, - "messageTypes":[ - { - "type":"J2735", - "subtype":"TMSG03-P", - "description":"In development" - } - ], - "configuration":[ - { - "key":"...", - "default":"...", - "description":"..." - } - - ] -} diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp deleted file mode 100644 index e445d6c11..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================ -// Name : MobilityOperationPlugin.cpp -// Author : Paul Bourelly -// Version : 5.0 -// Copyright : Your copyright notice -// Description : Hello World in C++, Ansi-style -//============================================================================ - -#include "MobilityOperationPlugin.h" - - -namespace MobilityOperationPlugin { - - - -/** - * Construct a new MobililtyOperationPlugin with the given name. - * - * @param name The name to give the plugin for identification purposes - */ -MobilityOperationPlugin::MobilityOperationPlugin(string name) : - PluginClient(name) { - - FILELog::ReportingLevel() = FILELog::FromString("INFO"); - AddMessageFilter < tsm3Message > (this, &MobilityOperationPlugin::HandleMobilityOperationMessage); - SubscribeToMessages(); - -} - -MobilityOperationPlugin::~MobilityOperationPlugin() { -} - -void MobilityOperationPlugin::UpdateConfigSettings() { - -} - -void MobilityOperationPlugin::OnConfigChanged(const char *key, const char *value) { - PluginClient::OnConfigChanged(key, value); - UpdateConfigSettings(); -} - - -void MobilityOperationPlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { - auto mobilityOperation = msg.get_j2735_data(); - // FILE_LOG(logDEBUG) << "Checking log level : " << FILELog::ReportingLevel(); - PLOG(logDEBUG) << "Received MobilityOperation message (encoded) : " << routeableMsg.get_payload_str(); - PLOG(logDEBUG) << "Header Host BSM ID : " << mobilityOperation->header.hostBSMId.buf; - PLOG(logDEBUG) << "Header Host Static ID : " << mobilityOperation->header.hostStaticId.buf; - PLOG(logDEBUG) << "Header Plan ID : " << mobilityOperation->header.planId.buf; - PLOG(logDEBUG) << "Header Target Static ID : " << mobilityOperation->header.targetStaticId.buf; - PLOG(logDEBUG) << "Header Timestamp : " << mobilityOperation->header.timestamp.buf; - PLOG(logDEBUG) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf; - PLOG(logDEBUG) << "Body Strategy : " << mobilityOperation->body.strategy.buf; - - -} - -void MobilityOperationPlugin::OnStateChange(IvpPluginState state) { - PluginClient::OnStateChange(state); - - if (state == IvpPluginState_registered) { - UpdateConfigSettings(); - } -} - - -int MobilityOperationPlugin::Main() { - FILE_LOG(logINFO) << "Starting plugin."; - - uint64_t lastSendTime = 0; - - while (_plugin->state != IvpPluginState_error) { - - - - usleep(100000); //sleep for microseconds set from config. - } - - return (EXIT_SUCCESS); -} -} - -int main(int argc, char *argv[]) { - return run_plugin < MobilityOperationPlugin::MobilityOperationPlugin > ("MobilityOperationPlugin", argc, argv); -} - diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h deleted file mode 100644 index 6d704e3b0..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SRC_MOBILITYOPERATIONPLUGIN_H_ -#define SRC_MOBILITYOPERATIONPLUGIN_H_ -#include "PluginClient.h" -#include - - -using namespace std; -using namespace tmx; -using namespace tmx::utils; -using namespace tmx::messages; - -namespace MobilityOperationPlugin { - -class MobilityOperationPlugin: public PluginClient { -public: - MobilityOperationPlugin(std::string); - virtual ~MobilityOperationPlugin(); - int Main(); -protected: - - void UpdateConfigSettings(); - - // Virtual method overrides. - void OnConfigChanged(const char *key, const char *value); - - void OnStateChange(IvpPluginState state); - - void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); - -private: -}; -} -#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt b/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt new file mode 100644 index 000000000..8a8883b35 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt @@ -0,0 +1,24 @@ +PROJECT ( PortDrayagePlugin VERSION 5.0 LANGUAGES CXX ) + +SET (TMX_PLUGIN_NAME "PortDrayage") +set(CMAKE_AUTOMOC ON) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") + +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) + + +include_directories( "/usr/local/include/pdclient") + + + +message(CMAKE MODULE : ${CMAKE_MODULE_PATH} ) + + +BuildTmxPlugin ( ) + +target_link_libraries(${PROJECT_NAME} PRIVATE pdclient ) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ssl crypto ) +target_link_libraries(${PROJECT_NAME} PUBLIC tmxutils) + diff --git a/src/v2i-hub/PortDrayagePlugin/manifest.json b/src/v2i-hub/PortDrayagePlugin/manifest.json new file mode 100644 index 000000000..a3ee8f40c --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/manifest.json @@ -0,0 +1,78 @@ +{ + "name":"PortDrayagePlugin", + "description":"PortDrayagePlugin for sending freight trucks automated actions in a port.", + "version":"@PROJECT_VERSION@", + "exeLocation":"/bin/PortDrayagePlugin", + "coreIpAddr":"127.0.0.1", + "corePort":24601, + "messageTypes":[ + { + "type":"J2735", + "subtype":"TMSG03-P", + "description":"MobilityOperation message is a prototyping message with a configurable payload." + } + ], + "configuration":[ + { + "key":"Database_IP", + "default":"127.0.0.1", + "description":"IP address of database" + }, + { + "key":"Database_Port", + "default":"3306", + "description":"Port of database" + }, + { + "key":"Database_Username", + "default":"root", + "description":"Username for database" + }, + { + "key":"Database_Password", + "default":"ivp", + "description":"Password for database" + }, + { + "key":"Database_Name", + "default":"PORT_DRAYAGE", + "description":"Name of database." + }, + { + "key":"LogLevel", + "default":"INFO", + "description":"The log level for this plugin" + }, + { + "key":"Webservice_Host", + "default":"127.0.0.1", + "description":"PortDrayage Webservice Host Address" + }, + { + "key":"Webservice_Port", + "default": "8090", + "description": "PortDrayage WebService Port" + }, + { + "key":"Webservice_Secure", + "default": "false", + "description": "Boolean flag set to true for HTTPS communication" + }, + { + "key":"Webservice_Polling_Frequency", + "default": "5", + "description": "Polling Frequency for PortDrayage Webservice action status in seconds" + }, + { + "key":"Holding_Lat", + "default":"45.45", + "description":"Latitude Coordinate for Holding Area GPS Location in Degrees(-90,90)." + }, + { + "key":"Holding_Lon", + "default":"-45.45", + "description":"Longitude Coordinate for Holding Area GPS Location in Degrees(-180,180)." + } + + ] +} diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp new file mode 100644 index 000000000..f696f0b9f --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -0,0 +1,543 @@ +//============================================================================ +// Name : PortDrayagePlugin.cpp +// Author : Paul Bourelly +// Version : 5.0 +// Copyright : Your copyright notice +// Description : PortDrayagePlugin provides freight trucks in a port with a +// list of actions to complete. On initial communication with V2X-Hub the +// freight truck will request it's first action. Upon completion of each action +// the freight truck will send the completed action to V2X-Hub and the PortDrayagePlugin +// will retrieve it's next action from a MySQL DB. +//============================================================================ + +#include "PortDrayagePlugin.h" + + + +namespace PortDrayagePlugin { + + + + +PortDrayagePlugin::PortDrayagePlugin(string name) : + PluginClient(name) { + // Plugin Handles MobilityOperation Messages + AddMessageFilter < tsm3Message > (this, &PortDrayagePlugin::HandleMobilityOperationMessage); + SubscribeToMessages(); + +} + +PortDrayagePlugin::~PortDrayagePlugin() { +} + +void PortDrayagePlugin::UpdateConfigSettings() { + + lock_guard lock(_cfgLock); + + // Database configuration + GetConfigValue("Database_Username", _database_username); + GetConfigValue("Database_Password", _database_password); + GetConfigValue("Database_IP",_database_ip); + GetConfigValue("Database_Port",_database_port); + GetConfigValue("Database_Name", _database_name); + + // Port Drayage Web Service Configuration + uint16_t polling_frequency; + uint16_t polling_timeout; + std::string host; + uint16_t port; + bool secure; + // Host address + GetConfigValue("Webservice_Host", host); + // Host Port + GetConfigValue("Webservice_Port", port); + // True for HTTPS + GetConfigValue("Webservice_Secure", secure); + // Polling Frequency in seconds + GetConfigValue("Webservice_Polling_Frequency", polling_frequency); + + client = new WebServiceClient(host, port, secure, polling_frequency); + + // Port Holding Area Configurable location + GetConfigValue("Holding_Lat", _holding_lat); + GetConfigValue("Holding_Lon", _holding_lon); + PLOG(logDEBUG) << "Holding Area set : (" << _holding_lat << ", " << _holding_lon << ")" << std::endl; + + // Create DB connection + std::string connection_string = "tcp://" + _database_ip + ":" + std::to_string(_database_port); + try { + driver = get_driver_instance(); + con = driver->connect(connection_string,_database_username,_database_password); + con->setSchema(_database_name); + + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } + // Initialize PreparedStatements for MySQL + try { + // Get next_action for given action_id + next_action_id = con->prepareStatement("SELECT next_action FROM freight WHERE action_id = ? "); + // Get current action for given action_id + current_action = con->prepareStatement("SELECT * FROM freight WHERE action_id = ? "); + // Get first action for vehicle + first_action = con->prepareStatement("SELECT * FROM first_action WHERE cmv_id = ? " ); + // Insert action into freight table + insert_action = con->prepareStatement("INSERT INTO freight VALUES(?,?,?,?,?, UUID(), ?)"); + // Get action_id of the previous action given action_id + get_action_id_for_previous_action = con->prepareStatement("SELECT action_id FROM freight WHERE next_action = ? and operation = ? "); + // Update next_action for an action with given action_id + update_current_action = con->prepareStatement("UPDATE freight SET next_action = ? WHERE action_id = ?"); + } + catch( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } + +} + +void PortDrayagePlugin::OnConfigChanged(const char *key, const char *value) { + PluginClient::OnConfigChanged(key, value); + UpdateConfigSettings(); +} + + +void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { + + // Retrieve J2735 Message + auto mobilityOperation = msg.get_j2735_data(); + + // String Stream for strategy and operationParams + std::stringstream strat; + std::stringstream payload; + + // Create ptree object for json + ptree pr; + + // Create new PortDrayage_Object pointer + PortDrayage_Object *pd = new PortDrayage_Object(); + + // Read strategy and operationParams + strat << mobilityOperation->body.strategy.buf; + payload << mobilityOperation->body.operationParams.buf; + + // Compare strategy to PortDrayage strategy + std::string strategy = strat.str(); + if ( strategy.compare(PORT_DRAYAGE_STRATEGY) == 0 ){ + try { + PLOG(logINFO) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf; + PLOG(logINFO) << "Body Strategy : " << mobilityOperation->body.strategy.buf; + // Convert JSON payload to PortDrayage_Object + read_json(payload, pr); + *pd = readPortDrayageJson( pr ); + + // Handle actions that require PortDrayage WebService Input + PLOG(logDEBUG) << "Operation is " << pd->operation << std::endl; + if ( pd->operation.compare("PICKUP") == 0 ) { + try{ + client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + PLOG(logDEBUG) << "Loading Complete!" << std::endl; + + } + catch(std::exception &e) { + PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; + } + } + else if ( pd->operation.compare("DROPOFF") == 0) { + try{ + client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + PLOG(logDEBUG) << "Unloading Complete!" << std::endl; + } + catch(std::exception &e) { + PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; + } + } + else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { + try{ + // If holding == 1 insert HOLDING action into table + int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); + if ( holding == 1 ) { + PLOG(logDEBUG) << "Requested futher inspection. Inserting Holding Action!" << std::endl; + insert_holding_action_into_table( *pd ); + PLOG(logDEBUG) << "Inserted Holding action as next action!"; + } + } + catch(std::exception &e) { + PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; + } + } + else if ( pd->operation.compare("HOLDING_AREA") == 0) { + try{ + string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); + PLOG(logDEBUG) << "Requesting holding for action id : " << previous_checkpoint_id << std::endl; + client->request_holding( previous_checkpoint_id ); + PLOG(logDEBUG) << "Holding Action Complete!" << std::endl; + + } + catch(std::exception &e) { + PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; + } + } + + } + catch( const ptree_error &e ) { + PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; + } + PLOG(logDEBUG) << "Port Drayage Message" << std::endl << + "cmv_id : " << pd->cmv_id << std::endl << + "cargo_id : " << pd->cargo_id << std::endl << + "cargo : " << pd->cargo << std::endl << + "operation : " << pd->operation << std::endl << + "location_lat : " << pd->location_lat << std::endl << + "location_long : " << pd->location_long << std::endl << + "destination_lat : " << pd->destination_lat << std::endl << + "destination_long : " << pd->destination_long << std::endl << + "action_id : " << pd->action_id << std::endl << + "next_action : " << pd->next_action << std::endl; + + + try{ + // Retrieve first or next action + PortDrayage_Object *new_action = new PortDrayage_Object(); + if ( pd->action_id.empty() ) { + PLOG(logDEBUG) << "Retrieving first action." << std::endl; + *new_action = retrieveFirstAction( pd->cmv_id ); + } + else { + PLOG(logDEBUG) << "Retrieving next action." << std::endl; + *new_action = retrieveNextAction( pd->action_id ); + } + + if ( !new_action->action_id.empty()) { + // Initializer vars + tsm3Message mob_msg; + tsm3EncodedMessage mobilityENC; + tmx::message_container_type container; + std::unique_ptr msg; + + // Create operationParams payload json + ptree payload = createPortDrayageJson( *new_action ); + + // Create XML MobilityOperationMessage + ptree message = createMobilityOperationXml( payload ); + std::stringstream content; + write_xml(content, message); + + PLOG(logDEBUG) << "XML outgoing message : " << std::endl << content.str(); + + try { + // Uper encode message + container.load(content); + mob_msg.set_contents(container.get_storage().get_tree()); + mobilityENC.encode_j2735_message( mob_msg); + msg.reset(); + msg.reset(dynamic_cast(factory.NewMessage(api::MSGSUBTYPE_TESTMESSAGE03_STRING))); + string enc = mobilityENC.get_encoding(); + FILE_LOG(logERROR) << "Encoded outgoing message : " << std::endl << mobilityENC.get_payload_str(); + msg->refresh_timestamp(); + msg->set_payload(mobilityENC.get_payload_str()); + msg->set_encoding(enc); + msg->set_flags(IvpMsgFlags_RouteDSRC); + msg->addDsrcMetadata(172,0xBFEE); + msg->refresh_timestamp(); + routeable_message *rMsg = dynamic_cast(msg.get()); + BroadcastMessage(*rMsg); + } + catch (J2735Exception &e) { + PLOG(logERROR) << "Error occurred during message encoding " << std::endl << e.what() << std::endl; + } + } + else { + PLOG(logERROR) << "Could not find action!" << std::endl; + } + + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } + } +} + + +ptree PortDrayagePlugin::createPortDrayageJson( PortDrayage_Object &pd_obj) { + ptree json_payload; + json_payload.put("cmv_id", pd_obj.cmv_id ); + json_payload.put("cargo_id", pd_obj.cargo_id ); + ptree destination; + destination.put("latitude", pd_obj.destination_lat); + destination.put("longitude", pd_obj.destination_long); + json_payload.put_child("destination",destination); + json_payload.put("operation", pd_obj.operation ); + json_payload.put("action_id", pd_obj.action_id ); + return json_payload; +} + + +ptree PortDrayagePlugin::createMobilityOperationXml( ptree &json_payload ) { + ptree mobilityOperationXml; + std::stringstream pl; + write_json( pl, json_payload); + // Create XML MobilityOperationMessage + ptree message; + ptree header; + ptree body; + body.put("strategy",PORT_DRAYAGE_STRATEGY); + body.put("operationParams", pl.str()); + header.put("hostStaticId", "UNSET"); + header.put("targetStaticId", "UNSET"); + header.put("hostBSMId", "00000000"); + header.put("planId", "00000000-0000-0000-0000-000000000000"); + header.put("timestamp", "0000000000000000000"); + message.put_child("header", header); + message.put_child("body",body); + mobilityOperationXml.put_child( "TestMessage03", message); + return mobilityOperationXml; +} + + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std::string action_id ) { + try{ + // Set action_id + next_action_id->setString(1,action_id); + // Get current action + PLOG(logDEBUG) << "Getting next action for " << action_id << "." << std::endl; + + sql::ResultSet *cur_action = next_action_id->executeQuery(); + if ( cur_action->first() ) { + std::string next = cur_action->getString("next_action"); + PLOG(logDEBUG) << "Column next_action: " << next << std::endl; + // Set action_id to next_action + current_action->setString(1,next); + // Retrieve next action + sql::ResultSet *cur_action = current_action->executeQuery(); + + // Create PortDrayage_Object + PortDrayage_Object *rtn = new PortDrayage_Object(); + if ( cur_action->first() ) { + rtn->cmv_id = cur_action->getString("cmv_id"); + rtn->operation = cur_action->getString("operation"); + rtn->action_id = cur_action->getString("action_id"); + rtn->cargo_id = cur_action->getString("cargo_id"); + rtn->destination_long = cur_action->getDouble("destination_long"); + rtn->destination_lat = cur_action->getDouble("destination_lat"); + rtn->next_action = cur_action->getString("next_action"); + PLOG(logDEBUG) << "Port Drayage Message : " << std::endl << + "cmv_id : " << rtn->cmv_id << std::endl << + "cargo_id : " << rtn->cargo_id << std::endl << + "operation : " << rtn->operation << std::endl << + "destination_lat : " << rtn->destination_lat << std::endl << + "destination_long : " << rtn->destination_long << std::endl << + "action_id : " << rtn->action_id << std::endl << + "next_action : " << rtn->next_action << std::endl; + } + else { + // If we are able to retrieve the current action but not it's next_action we can + // assume it was the last action in the DB. + PLOG(logINFO) << "Last action completed! No action found with action id " << next << std::endl; + + } + return *rtn; + // Qt HttpClient setup + } + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } + +} + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( std::string cmv_id ) { + try{ + // Set cmv_id + first_action->setString(1,cmv_id); + // Retrieve first action of first_action table + sql::ResultSet *cur_action = first_action->executeQuery(); + if ( cur_action->first() ) { + // Create Port Drayage object + PortDrayage_Object *rtn = new PortDrayage_Object(); + rtn->cmv_id = cur_action->getString("cmv_id"); + rtn->operation = cur_action->getString("operation"); + rtn->action_id = cur_action->getString("action_id"); + rtn->cargo_id = cur_action->getString("cargo_id"); + rtn->destination_long = cur_action->getDouble("destination_long"); + rtn->destination_lat = cur_action->getDouble("destination_lat"); + rtn->next_action =cur_action->getString("next_action"); + PLOG(logDEBUG) << "Port Drayage Message" << std::endl << + "cmv_id : " << rtn->cmv_id << std::endl << + "cargo_id : " << rtn->cargo_id << std::endl << + "operation : " << rtn->operation << std::endl << + "destination_lat : " << rtn->destination_lat << std::endl << + "destination_long : " << rtn->destination_long << std::endl << + "action_id : " << rtn->action_id << std::endl << + "next_action : " << rtn->next_action << std::endl; + return *rtn; + } + else { + PortDrayage_Object *rtn = new PortDrayage_Object(); + PLOG(logERROR) << "No first action for cmv_id : " << cmv_id << " found!"; + return *rtn; + } + + + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } + +} + + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( ptree &pr ) { + PortDrayage_Object *pd = new PortDrayage_Object(); + try { + pd->cmv_id = pr.get_child("cmv_id").get_value(); + boost::optional< ptree& > child = pr.get_child_optional( "action_id" ); + if( !child ) + { + PLOG(logINFO) << "No action_id present! This is the vehicle's first action" << std::endl; + } + else { + pd->action_id = child.get_ptr()->get_value(); + // For eventually tracking of completed actions + pd->operation = pr.get_child("operation").get_value(); + child = pr.get_child_optional("cargo_id"); + if ( child ) { + pd->cargo_id = pr.get_child("cargo_id").get_value(); + } + child = pr.get_child_optional("location"); + if ( child ) { + ptree location = pr.get_child("location"); + pd->location_lat =location.get_child("latitude").get_value(); + pd->location_long = location.get_child("longitude").get_value(); + } + + + } + return *pd; + + } + catch( const ptree_error &e ) { + PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; + } +} + +void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object ¤t_action ) { + PortDrayage_Object *next_action = new PortDrayage_Object; + PortDrayage_Object *cur_action = ¤t_action; + + try{ + + *next_action = retrieveNextAction(cur_action->action_id); + PLOG(logINFO) << "Insert Holding action between " << cur_action->action_id << " and " + << next_action->action_id << "." << std::endl; + PLOG(logDEBUG) << "Insert Holding Action." << std::endl; + //INSERT INTO FREIGHT VALUES(cmv_id,cargo_id,_holding_lat,_holding_lon,HOLDING, UUID(), next_action->action_id) + insert_action->setString(1,cur_action->cmv_id); + insert_action->setString(2,cur_action->cargo_id); + insert_action->setDouble(3,_holding_lat); + insert_action->setDouble(4,_holding_lon); + insert_action->setString(5, "HOLDING_AREA"); + insert_action->setString(6, next_action->action_id); + PLOG(logDEBUG) << "Query : INSERT INTO FREIGHT VALUES(" + << cur_action->cmv_id << ", " << cur_action->cargo_id << ", " + << _holding_lat << ", " << _holding_lon << ", UUID(), HOLDING_AREA )" << std::endl; + sql::ResultSet *res = insert_action->executeQuery(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result : " << res->first()<< std::endl; + } + + PLOG(logDEBUG) << "Get Holding Action action_id." << std::endl; + // SELECT action_id FROM freight WHERE next_action = ? and operation = ? + get_action_id_for_previous_action->setString(1, next_action->action_id); + get_action_id_for_previous_action->setString(2, "HOLDING_AREA"); + PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " + << next_action->action_id << " and operation = HOLDING_AREA " << std::endl; + + res = get_action_id_for_previous_action->executeQuery(); + res->first(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; + } + std::string action_id = res->getString("action_id"); + + PLOG(logDEBUG) << "Update Checkpoint next_action = Holding Action action_id" << std::endl; + // UPDATE freight SET next_action = ? WHERE action_id = ? + update_current_action->setString( 1, action_id); + update_current_action->setString( 2, cur_action->action_id); + PLOG(logDEBUG) << "Query : UPDATE freight SET next_action = " + << action_id << " WHERE action_id = " << cur_action->action_id << std::endl; + res = update_current_action->executeQuery(); + res->first(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result : " << res->first() << std::endl; + } + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } +} + +std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( std::string action_id ) { + try{ + get_action_id_for_previous_action->setString(1, action_id); + get_action_id_for_previous_action->setString(2, "PORT_CHECKPOINT"); + PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " + << action_id << " and operation = PORT_CHECKPOINT " << std::endl; + + sql::ResultSet *res = get_action_id_for_previous_action->executeQuery(); + res->first(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; + } + std::string action_id = res->getString("action_id"); + return action_id; + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; + PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; + PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + } +} + +/** + * Trigger when Plugin state changes + * + * @param state IvpPluginState + */ +void PortDrayagePlugin::OnStateChange(IvpPluginState state) { + PluginClient::OnStateChange(state); + + if (state == IvpPluginState_registered) { + UpdateConfigSettings(); + } +} + + +int PortDrayagePlugin::Main() { + uint64_t lastSendTime = 0; + while (_plugin->state != IvpPluginState_error) { + usleep(100000); //sleep for microseconds set from config. + } + return (EXIT_SUCCESS); +} +} + +int main(int argc, char *argv[]) { + // Qt HttpClient setup + QCoreApplication a(argc, argv); + return run_plugin < PortDrayagePlugin::PortDrayagePlugin > ("PortDrayagePlugin", argc, argv); +} + diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h new file mode 100644 index 000000000..ef992c482 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h @@ -0,0 +1,173 @@ +#ifndef SRC_PortDrayagePlugin_H_ +#define SRC_PortDrayagePlugin_H_ +#include "PluginClient.h" +#include +#include +#include +#include +#include "mysql_connection.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "WebServiceClient.h" + + + + + +using namespace std; +using namespace tmx; +using namespace tmx::utils; +using namespace tmx::messages; +using namespace boost::property_tree; +using namespace OpenAPI; + + + + +namespace PortDrayagePlugin { +static CONSTEXPR const char *PORT_DRAYAGE_STRATEGY = "carma/port_drayage"; + +class PortDrayagePlugin: public PluginClient { +public: + struct PortDrayage_Object { + std::string cmv_id; + std::string cargo_id; + bool cargo; + std::string operation; + double location_lat; + double location_long; + double destination_lat; + double destination_long; + std::string action_id; + std::string next_action; + }; + /** + * Construct a new MobililtyOperationPlugin with the given name. + * + * @param name The name to give the plugin for identification purposes + */ + PortDrayagePlugin(std::string); + /** + * Constructor without paramaters + */ + virtual ~PortDrayagePlugin(); + int Main(); +protected: + /** + * Update Configuration + */ + void UpdateConfigSettings(); + + // Virtual method overrides. + /** + * Method triggers UpdateConfigSettings() on configuration changes + */ + void OnConfigChanged(const char *key, const char *value); + + void OnStateChange(IvpPluginState state); + /** + * Method to create port drayage payload JSON ptree using a PortDrayage_Object. + * + * @param pd_obj Port Drayage object. + * @return json ptree + */ + ptree createPortDrayageJson( PortDrayage_Object &pd_obj); + /** + * Method to create MobilityOperation XML ptree. + * + * @param ptree json payload + * @return MobilityOperation message XML ptree + */ + ptree createMobilityOperationXml( ptree &json_payload); + + /** + * Handle MobilityOperation message. + * + * @param tsm3Message J2735 MobilityOperation message + * @param routeableMsg JSON MobilityOperation message + */ + void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); + /** + * Retrieve next action from freight table using action_id + * + * @param action_id string + */ + PortDrayage_Object retrieveNextAction( std::string action_id ); + /** + * Retrieve first action from first_action table using cmv_id. + * + * @param cmv_id + * @return PortDrayage_Object of first action + */ + PortDrayage_Object retrieveFirstAction( std::string cmv_id ); + + /** + * Create PortDrayage_Object from ptree JSON. + * + * @param pr PortDrayage JSON + * @return PortDrayage_Object + */ + PortDrayage_Object readPortDrayageJson( ptree &pr ); + + /** + * Dynamically inserts HOLDING_AREA action into mysql table between + * current_action and next_action. Current action should be PORT_CHECKPOINT + * and next_action should be EXIT_PORT + * + * @param current_action PORT_CHECKPOINT action + */ + void insert_holding_action_into_table(PortDrayage_Object ¤t_action ); + + /** + * Retrieves HOLDING_AREA action when provided with PORT_CHECKPOINT action + * from mysql freight table. + * + * @return action_id of HOLDING_AREA action + */ + std::string retrieve_holding_inspection_action_id( std::string action_id ); + + +private: + // Database configuration values + std::string _database_username; + std::string _database_password; + uint16_t _database_port; + std::string _database_ip; + std::string _database_name; + + + sql::Driver *driver; + sql::Connection *con; + + // Prepared Statements + sql::PreparedStatement *next_action_id; + sql::PreparedStatement *current_action; + sql::PreparedStatement *first_action; + sql::PreparedStatement *insert_action; + sql::PreparedStatement *get_action_id_for_previous_action; + sql::PreparedStatement *update_current_action; + + // Message Factory for J2735 messages + J2735MessageFactory factory; + + // Web Service Client + WebServiceClient *client; + + // Port HOLDING_AREA Configuration + double _holding_lat; + double _holding_lon; + +}; +std::mutex _cfgLock; + +} +#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp new file mode 100644 index 000000000..e869d80e0 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -0,0 +1,276 @@ +#include "WebServiceClient.h" + + +WebServiceClient::WebServiceClient() { + // Set polling frequency to 5s + polling_frequency = 5; + // Initialize API + api = new OAIDefaultApi(0); + // Setup Server config + api->setNewServerForAllOperations( + QUrl("http://127.0.0.1:8090"), + QString::fromStdString("Unsecured hosting for development"), + QMap() + ); +} + +WebServiceClient::WebServiceClient(std::string host, uint16_t port, bool secure , uint16_t polling_frequency ) { + this->polling_frequency = polling_frequency; + + // Create URL + QUrl *url = new QUrl(); + url->setHost(QString::fromStdString(host)); + url->setPort(port); + if ( secure ) { + url->setScheme(QString::fromStdString("https")); + } + else { + url->setScheme(QString::fromStdString("http")); + + } + FILE_LOG(logERROR) << "Setting API URL as " << url->toString().toStdString() << std::endl; + // Initialize API + api = new OAIDefaultApi(0); + // Setup server config + api->setNewServerForAllOperations( + *url, + QString::fromStdString("V2X-Hub Configured PortDrayage WebService"), + QMap() + ); +} + +void WebServiceClient::request_loading_action(std::string vehicle_id, std::string container_id, std::string action_id) { + OAIContainerRequest req; + QEventLoop loop; + + // Call back for POST /loading/ + connect(api, &OAIDefaultApi::loadingPostSignal, [&]() { + FILE_LOG(logERROR) << "Success /loading POST"; + loop.quit(); + }); + // Error call back for POST /loading/ + connect(api, &OAIDefaultApi::loadingPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure /loading POST : " << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + loop.quit(); + }); + + // Setup request + req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req.setContainerId( QString::fromStdString( container_id ) ); + req.setActionId( QString::fromStdString( action_id ) ); + + FILE_LOG(logINFO) << "Sending loading request : " << req.asJson().toStdString(); + api->loadingPost( req ); + QTimer::singleShot(0, &loop, &QEventLoop::quit); + loop.exec(); + + + // Poll loading action until complete + pollLoadingAction( req.getActionId() ); + +} + +void WebServiceClient::request_unloading_action(std::string vehicle_id, std::string container_id, std::string action_id) { + OAIContainerRequest req; + QEventLoop loop; + + // Call back for POST /unloading/ + connect(api, &OAIDefaultApi::unloadingPostSignal, [&]() { + FILE_LOG(logINFO) << "Success /unloading POST"; + loop.quit(); + }); + // Error call back for POST /unloading/ + connect(api, &OAIDefaultApi::unloadingPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + + loop.quit(); + }); + + // Setup request + req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req.setContainerId( QString::fromStdString( container_id ) ); + req.setActionId( QString::fromStdString( action_id ) ); + + FILE_LOG(logINFO) << "Sending unloading request : " << req.asJson().toStdString(); + api->unloadingPost( req ); + QTimer::singleShot(0, &loop, &QEventLoop::quit); + loop.exec(); + + // Polling unloading action until complete + pollUnloadingAction( req.getActionId() ); + +} + +int WebServiceClient::request_inspection(std::string vehicle_id, std::string container_id, std::string action_id ) { + OAIInspectionRequest req; + QEventLoop loop; + + // Call back for POST /inspection/ + connect(api, &OAIDefaultApi::inspectionPostSignal, [&]() { + FILE_LOG(logINFO) << "Success /inspection POST"; + loop.quit(); + }); + // Error call back for POST /inspection/ + connect(api, &OAIDefaultApi::inspectionPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + loop.quit(); + }); + + // Setup request + req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req.setContainerId( QString::fromStdString( container_id ) ); + req.setActionId( QString::fromStdString( action_id ) ); + + FILE_LOG(logINFO) << "Sending inspection request : " << req.asJson().toStdString(); + api->inspectionPost( req ); + QTimer::singleShot(0, &loop, &QEventLoop::quit); + loop.exec(); + + // Poll inspection status until complete or proceed to holding + return pollInspectionAction( req.getActionId() ); +} + +void WebServiceClient::request_holding( std::string action_id ) { + QEventLoop loop; + + // Call back for POST /inspection/ + connect(api, &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { + FILE_LOG(logINFO) << "Success /inspection/holding/{action_id} POST"; + loop.quit(); + }); + // Error call back for POST /inspection/ + connect(api, &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + loop.quit(); + }); + + api->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); + QTimer::singleShot(5000, &loop, &QEventLoop::quit); + loop.exec(); + + // Poll inspection action until complete + pollInspectionAction( QString::fromStdString( action_id ) ); + +} + +void WebServiceClient::pollLoadingAction( QString action_id ) { + FILE_LOG(logDEBUG) << "Starting loading action Polling"; + QEventLoop loop; + OAIContainerActionStatus current_loading_action; + // Flag to continue polling until receiving a non error response from server + bool badResponse = true; + + // Call back for Get /loading/{action_id} + connect(api, &OAIDefaultApi::loadingActionIdGetSignal, [&](OAIContainerActionStatus loading_action) { + FILE_LOG(logINFO) << "Success /loading/{action_id} GET : " << loading_action.asJson().toStdString(); + current_loading_action = loading_action; + badResponse = false; + loop.quit(); + }); + // Error call back for Get /loading/{action_id} + connect(api, &OAIDefaultApi::loadingActionIdGetSignalE, + [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + badResponse = true; + loop.quit(); + }); + + do { + api->loadingActionIdGet( action_id ); + QTimer::singleShot(5000, &loop, &QEventLoop::quit); + loop.exec(); + + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + } + while ( badResponse || current_loading_action.getStatus() != QString::fromStdString( "LOADED") ) ; + +} + +void WebServiceClient::pollUnloadingAction( QString action_id) { + FILE_LOG(logDEBUG) << "Starting unloading action Polling"; + QEventLoop loop; + OAIContainerActionStatus current_unloading_action; + // Flag to continue polling until receiving a non error response from server + bool badResponse = true; + + + // Call back for Get /unloading/{action_id} + connect(api, &OAIDefaultApi::unloadingActionIdGetSignal, [&](OAIContainerActionStatus unloading_action) { + FILE_LOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_action.asJson().toStdString(); + current_unloading_action = unloading_action; + badResponse = false; + loop.quit(); + }); + // Error call back for Get /unloading/{action_id} + connect(api, &OAIDefaultApi::unloadingActionIdGetSignalE, + [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + badResponse = true; + loop.quit(); + }); + + do { + + api->unloadingActionIdGet( action_id ); + QTimer::singleShot(0, &loop, &QEventLoop::quit); + loop.exec(); + + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + + } + while( badResponse || current_unloading_action.getStatus() != QString::fromStdString( "UNLOADED") ); +} + +int WebServiceClient::pollInspectionAction( QString action_id ) { + FILE_LOG(logERROR) << "Starting inspection action Polling"; + QEventLoop loop; + OAIInspectionStatus current_inspection; + // Flag to continue polling until receiving a non error response from server + bool badResponse = true; + + // Call back for GET /inspection/{action_id} + connect(api, &OAIDefaultApi::inspectionActionIdGetSignal, [&](OAIInspectionStatus inspection) { + current_inspection = inspection; + FILE_LOG(logINFO) << "Success /inspection/{action_id} GET : " << current_inspection.asJson().toStdString() ; + badResponse = false; + loop.quit(); + }); + // Error call back for /inspection/{action_id} + connect(api, &OAIDefaultApi::inspectionActionIdGetSignalE, + [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { + FILE_LOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString(); + FILE_LOG(logERROR) << error_code; + badResponse = true; + loop.quit(); + }); + + do { + + api->inspectionActionIdGet( action_id ); + QTimer::singleShot(0, &loop, &QEventLoop::quit); + loop.exec(); + + if (current_inspection.getStatus() == QString::fromStdString( "PASSED")){ + return 0; + } + else if (current_inspection.getStatus() == QString::fromStdString( "PROCEED_TO_HOLDING")) { + return 1; + } + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + + } + while( badResponse || (current_inspection.getStatus() != QString::fromStdString( "PASSED") && + current_inspection.getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); + return -1; +} + + diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h new file mode 100644 index 000000000..5c6315e6c --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h @@ -0,0 +1,109 @@ +#pragma once +#include +#include +#include "PluginLog.h" +#include +#include +#include +#include + +using namespace OpenAPI; +using namespace tmx::utils; + +/** + * WebService REST Client using OpenAPI codegen library pdclient found under V2X-Hub/ext/pdclient. Contains several method to + * send POST requests for loading, unloading, and inspection actions and poll the action status. + * + * @author Paul Bourelly + */ +class WebServiceClient : public QObject +{ + Q_OBJECT +public slots: + +private: + // Stored in Seconds + uint16_t polling_frequency; + + // OAIDefaultApi pointer + OAIDefaultApi *api; + + /** + * Method to poll the status of a loading action with a given action id. + * + * @param action_id of the loading action to be polled + */ + void pollLoadingAction(QString action_id); + + /** + * Method to poll the status of a unloading action with a given action id. + * + * @param action_id of the unloading action to be polled + */ + void pollUnloadingAction(QString action_id); + + /** + * Method to poll the status of a inspection with a given action id. + * + * @param action_id of the inspection to be polled + * @return 0 if inspection is passed and 1 if further inspection at the holding area is requested + */ + int pollInspectionAction(QString action_id); + + +public: + + /** + * Constructor without parameters + */ + WebServiceClient(); + + /** + * Constructor for WebServiceClient + * + * @param host string webservice host URL + * @param port uint8_t webservice port + * @param secure boolean flag set to true when using HTTPS + * @param int polling frequency in seconds for action status + * + */ + WebServiceClient(std::string host, uint16_t port, bool secure , uint16_t polling_frequency ); + + /** + * Method to request a loading action. Sends a HTTP POST call to the loading endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once loading action is completed. + * + * @param vehicle_id static unique identifier for vehicle + * @param container_id static unique identifier for container + * @param action_id static unique identifier for action + */ + void request_loading_action(std::string vehicle_id, std::string container_id, std::string action_id); + /** + * Method to request an unloading action. Sends a HTTP POST call to the unloading endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once unloading action is completed. + * + * @param vehicle_id static unique identifier for the vehicle + * @param container_id static unique identifier for the container + * @param action_id static unique identifier for the action + */ + void request_unloading_action(std::string vehicle_id, std::string container_id, std::string action_id); + /** + * Method to request an inspection action. Sends a HTTP POST call to the inspection endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once inspection action is completed or operator indicates the + * vehicle requires further inspection at the Holding area + * + * @param vehicle_id static unique identifier for the vehicle + * @param container_id static unique identifier for container + * @param action_id static unique identifier for the action + */ + int request_inspection(std::string vehicle_id, std::string container_id, std::string action_id); + /** + * Method request further inspection at the Holding area. Sends a HTTP POST call to inspection holding endpoint of the PortDrayage Webservice + * and then poll the status of the request every 5 seconds. Method will exit once inspection action is completed. + * + * @param action_id static unique identifier for action + */ + void request_holding(std::string action_id); + + +}; diff --git a/tools/port-drayage-webservice/pom.xml b/tools/port-drayage-webservice/pom.xml new file mode 100644 index 000000000..f3df86964 --- /dev/null +++ b/tools/port-drayage-webservice/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + + com.leidos + port-drayage-webservice + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 2.5.5 + + + + + org.springframework.boot + spring-boot-starter-web + + + io.springfox + springfox-boot-starter + 3.0.0 + + + org.openapitools + jackson-databind-nullable + 0.2.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-validation + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.fasterxml.jackson.core + jackson-core + + + + org.webjars + bootstrap + 4.0.0-2 + + + org.webjars + webjars-locator + 0.30 + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + + org.openapitools + openapi-generator-maven-plugin + 5.1.0 + + + + generate + + + + ${project.basedir}/src/main/resources/port-drayage-webservice.yml + + spring + spring-boot + com.baeldung.openapi.api + com.baeldung.openapi.model + true + + ApiUtil.java + + + true + true + + + + + + + + org.jacoco + jacoco-maven-plugin + + + + com/baeldung/openapi/** + + + + + + prepare-agent + + + + report + test + + report + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java b/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java new file mode 100644 index 000000000..2b6d3f403 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java @@ -0,0 +1,25 @@ +package com.leidos; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Main class for SpringBoot application. {@link EnableAutoConfiguration} annotation allow spring to scan all sub-directories for defined beans. + * + * @author Paul Bourelly + */ + +@EnableAutoConfiguration +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + + +} \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java b/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java new file mode 100644 index 000000000..3b70bdc7e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java @@ -0,0 +1,27 @@ +package com.leidos.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class WebApplicationConfiguration { + + /** + * Allow Cross Origin Resource Sharing (CORS) for all endpoints. + * @return + */ + @Bean + public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } + }; + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java new file mode 100644 index 000000000..df1694509 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java @@ -0,0 +1,123 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.InspectionApi; +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatusList; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.leidos.inspection.InspectionActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + +/** + * {@link RestController} for all inspection/ REST endpoints. Implements + * {@link InspectionApi} generated by openapi-generator-maven-plugin (see + * pom.xml), which configures endpoint content type, response type and path. + * + * @author Paul Bourelly + */ +@RestController +public class InspectionController implements InspectionApi { + + private static Logger logger = LoggerFactory.getLogger(InspectionController.class); + + // Injected InspectionActions spring bean + @Autowired + private InspectionActions inspectionActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionPendingGet() { + return ResponseEntity.ok(inspectionActions.getPendingInspections()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionActionIdGet(String actionId) { + logger.debug(String.format("Received GET inspection/%s .", actionId)); + InspectionStatus status = inspectionActions.getInspectionStatus(actionId); + if (status != null) + return ResponseEntity.ok(status); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionPost(InspectionRequest request) { + logger.debug(String.format("Received POST inspection/ with payload : %s .", request)); + // Assure there is not current inspection with action_id + if (inspectionActions.getInspectionStatus(request.getActionId()) == null) { + inspectionActions.requestInspectionAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionHoldingActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/holding/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + // Check that action is current action and that status is PROCEED_TO_HOLDING + if (cur != null && cur.getActionId().equals(actionId) + && cur.getStatus().equals(StatusEnum.PROCEED_TO_HOLDING)) { + inspectionActions.requestHolding(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format( + "Action ID %s is not current inspection %s or does not have a status of PROCEED_TO_HOLDING AREA.\n Discarding potential duplicate request.", + actionId, inspectionActions.getCurrentInspection().toString())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/complete/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + if (cur != null && cur.getActionId().equals(actionId)) { + inspectionActions.completeInspection(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionHoldActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/hold/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + if (cur != null && cur.getActionId().equals(actionId)) { + inspectionActions.proceedToHolding(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java new file mode 100644 index 000000000..f0f92230a --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java @@ -0,0 +1,105 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.LoadingApi; +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.leidos.loading.LoadingActions; + +import org.springframework.web.bind.annotation.RestController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +/** + * {@link RestController} for all /loading REST API endpoints. Implements + * {@link LoadingApi} interface generated by openapi codegen to define methods + * of endpoint responses. + * + * @author Paul Bourelly + */ +@RestController +public class LoadingController implements LoadingApi { + + private static Logger logger = LoggerFactory.getLogger(LoadingController.class); + + /** + * Injected {@link LoadingActions} Spring Bean + */ + @Autowired + private LoadingActions loadingActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingPendingGet() { + return ResponseEntity.ok(loadingActions.getPendingActions()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingActionIdGet(String actionId) { + logger.debug(String.format("Received GET loading/%s .", actionId)); + ContainerActionStatus action = loadingActions.getContainerActionStatus(actionId); + if (action != null) + return ResponseEntity.ok(action); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingPost(ContainerRequest request) { + logger.debug(String.format("Received POST loading/ with payload : %s .", request)); + // Check no action already exists for given action ID + if (loadingActions.getContainerActionStatus(request.getActionId()) == null) { + loadingActions.requestLoadingAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingStartActionIdPost(String actionId) { + logger.debug(String.format("Received POST loading/start/%s .", actionId)); + ContainerActionStatus cur = loadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + loadingActions.startCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST loading/complete/%s .", actionId)); + ContainerActionStatus cur = loadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + loadingActions.completeCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java new file mode 100644 index 000000000..2559a67c1 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java @@ -0,0 +1,104 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.UnloadingApi; +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.leidos.unloading.UnloadingActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + +/** + * {@link RestController} for all /unloading REST API endpoints. Implements + * {@link Unloading} interface generated by openapi codegen to define methods of + * endpoint responses. + * + * @author Paul Bourelly + */ +@RestController +public class UnloadingController implements UnloadingApi { + + Logger logger = LoggerFactory.getLogger(UnloadingController.class); + + /** + * Injected {@link UnloadingActions} Spring Bean + */ + @Autowired + UnloadingActions unloadingActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingPendingGet() { + return ResponseEntity.ok(unloadingActions.getPendingActions()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingActionIdGet(String actionId) { + logger.debug(String.format("Received GET unloading/%s .", actionId)); + ContainerActionStatus action = unloadingActions.getContainerActionStatus(actionId); + if (action != null) + return ResponseEntity.ok(action); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingPost(ContainerRequest request) { + logger.debug(String.format("Received POST unloading/ with payload : %s .", request)); + // Check no action already exists for given action ID + if (unloadingActions.getContainerActionStatus(request.getActionId()) == null) { + unloadingActions.requestUnloadingAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingStartActionIdPost(String actionId) { + logger.debug(String.format("Received POST unloading/start/%s .", actionId)); + ContainerActionStatus cur = unloadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + unloadingActions.startCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST unloading/complete/%s .", actionId)); + ContainerActionStatus cur = unloadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + unloadingActions.completeCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java new file mode 100644 index 000000000..daa9b4ddd --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java @@ -0,0 +1,32 @@ +package com.leidos.controller; + + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class UserInterfaceController { + + + @GetMapping("/") + public String main( Model model) { + return "index"; + } + + @GetMapping("/loading") + public String loading() { + return "_loading"; + + } + @GetMapping("/unloading") + public String unloading() { + return "_unloading"; + + } + @GetMapping("/inspection") + public String inspection() { + return "_inspection"; + + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java new file mode 100644 index 000000000..58368ee2e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java @@ -0,0 +1,194 @@ +package com.leidos.inspection; + +import com.baeldung.openapi.api.InspectionApi; +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.baeldung.openapi.model.InspectionStatusList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link InspectionActions} is a spring bean for managing inspections. Only + * allows for a single inspection to be in progress at a time and is stored as + * the {@link InspectionActions#currentInspection}. Any inspections requested + * while the current inspection is not yet completed will be added to + * {@link InspectionActions#pendingInspections} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link InspectionActions#completedInspections} list. + * + * @author Paul Bourelly + */ +@Component +public class InspectionActions implements InspectionApi { + + private static Logger logger = LoggerFactory.getLogger(InspectionActions.class); + + // List of pending inspection statuses + private InspectionStatusList pendingInspections = new InspectionStatusList(); + + // List of completed inspections + private InspectionStatusList completedInspections = new InspectionStatusList(); + + // Current in progress action + private InspectionStatus currentInspection; + + /** + * Empty Constructor + */ + public InspectionActions() { + } + + /** + * Getter for pending inspection. + * + * @return {@link InspectionStatusList} list of pending inspection. + */ + public InspectionStatusList getPendingInspections() { + return pendingInspections; + } + + /** + * Getter for completed inspections. + * + * @return {@link InspectionStatusList} list of completed inspection. + */ + public InspectionStatusList getCompletedInspections() { + return completedInspections; + } + + /** + * Getter for current action. + * + * @return {@link InspectionStatus} current action. + */ + public InspectionStatus getCurrentInspection() { + return currentInspection; + } + + /** + * Create {@link InspectionStatus} for valid {@link InspectionRequest}s. Valid + * requests require vehicleId and containerId. Set as current inspection if none + * already exists or added to list of pending inspections if current inspection + * is still in progress. + * + * @param request {@link InspectionRequest} Request to load container. + */ + public void requestInspectionAction(InspectionRequest request) { + if (request != null) { + InspectionStatus inspectionStatus = new InspectionStatus(); + inspectionStatus.setContainerId(request.getContainerId()); + inspectionStatus.setVehicleId(request.getVehicleId()); + inspectionStatus.setActionId(request.getActionId()); + inspectionStatus.setStatus(StatusEnum.PENDING); + inspectionStatus.setRequested(System.currentTimeMillis()); + + // If no current action set as current action + if (currentInspection == null) { + currentInspection = inspectionStatus; + } + + // else add to list of pending action + else { + pendingInspections.addInspectionsItem(inspectionStatus); + } + } else { + logger.warn("Attempted to add null InspectionRequest!"); + } + + } + + /** + * Searches all inspections ( pending, current and completed ) for a given + * actionId and returns {@link InspectionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public InspectionStatus getInspectionStatus(String actionId) { + if (actionId != null) { + // Pending actions ( null check since arraylist is initially null ) + if (pendingInspections.getInspections() != null) { + for (InspectionStatus inspectionStatus : pendingInspections.getInspections()) { + if (actionId.equals(inspectionStatus.getActionId())) { + return inspectionStatus; + } + } + } + // Current action + if (currentInspection != null && actionId.equals(currentInspection.getActionId())) { + return currentInspection; + } + // Completed actions ( null check since arraylist is initially null ) + if (completedInspections.getInspections() != null) { + for (InspectionStatus inspectionStatus : completedInspections.getInspections()) { + if (actionId.equals(inspectionStatus.getActionId())) { + return inspectionStatus; + } + } + } + logger.warn(String.format("No inspection action with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * To complete inspection set {@link InspectionActions#currentInspection} status + * to {@link StatusEnum#PASSED}. Current inspection is then added to the + * completed inspections list and the first pending action , if any are present + * is set as the new current action. If no pending actions are present the + * current action is set to null. + * + */ + public void completeInspection() { + if (currentInspection != null) { + // Set current inspection to PASSED + currentInspection.setStatus(StatusEnum.PASSED); + currentInspection.setCompleted(System.currentTimeMillis()); + completedInspections.addInspectionsItem(currentInspection); + // If there are any pending actions set them to current + if (pendingInspections.getInspections() != null && !pendingInspections.getInspections().isEmpty()) { + currentInspection = pendingInspections.getInspections().remove(0); + } + // else set current to null + else { + currentInspection = null; + } + + } else + logger.warn("No current inspection in progress!"); + } + + /** + * To indicate that the vehicle under inspection is required to proceed to the + * holding area for further inspection an operator will use this request to set + * {@link InspectionActions#currentInspection} status to. + * {@link StatusEnum#PROCEED_TO_HOLDING}. + */ + public void proceedToHolding() { + if (currentInspection != null) { + currentInspection.setStatus(StatusEnum.PROCEED_TO_HOLDING); + } else + logger.warn("No current inspection in progress!"); + } + + /** + * Vehicle under current inspection, which has been instructed to proceed to + * holding area by operator will indicate it has arrived at the holding area and + * is prepared for further inspection with this request which sets the status of + * the {@link InspectionActions#currentInspection} to + * {@link StatusEnum#HOLDING}. + */ + public void requestHolding() { + if (currentInspection != null) { + currentInspection.setStatus(StatusEnum.HOLDING); + } else + logger.warn("No current inspection in progress!"); + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java new file mode 100644 index 000000000..299e6b905 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java @@ -0,0 +1,174 @@ +package com.leidos.loading; + +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link LoadingActions} is a spring bean for managing loading actions. Only + * allows for a single loading action to be in progress at a time and is stored + * as the {@link LoadingActions#currentAction}. Any loading actions requested + * while the current action is not yet completed will be added to + * {@link LoadingActions#pendingActions} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link LoadingActions#completedActions} list. + * + * @author Paul Bourelly + */ +@Component +public class LoadingActions { + + private static Logger logger = LoggerFactory.getLogger(LoadingActions.class); + + // List of all pending loading actions + private ActionStatusList pendingActions = new ActionStatusList(); + + // List of completed loading actions + private ActionStatusList completedActions = new ActionStatusList(); + + // Current Loading Action + private ContainerActionStatus currentAction; + + /** + * Empty Constructor. + */ + public LoadingActions() { + + } + + /** + * Getter for pending loading actions. + * + * @return {@link ActionStatusList} list of pending loading actions + */ + public ActionStatusList getPendingActions() { + return pendingActions; + } + + /** + * Getter for completed Actions. + * + * @return {@link ActionStatusList} list of completed actions + */ + public ActionStatusList getCompletedActions() { + return completedActions; + } + + /** + * Getter for current Action. + * + * @return {@link ContainerActionStatus} current in progress loading + */ + public ContainerActionStatus getCurrentAction() { + return currentAction; + } + + /** + * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. + * Valid requests require vehicleId and containerId. Valid request will be set + * as {@link LoadingActions#currentAction} if no current action is present or + * added to list of pending actions. + * + * @param request {@link ContainerRequest} Request to load container. + */ + public void requestLoadingAction(ContainerRequest request) { + if (request != null) { + ContainerActionStatus requestedAction = new ContainerActionStatus(); + requestedAction.setContainerId(request.getContainerId()); + requestedAction.setVehicleId(request.getVehicleId()); + requestedAction.setActionId(request.getActionId()); + requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); + requestedAction.setRequested(System.currentTimeMillis()); + // Add action to list of pending actions if an + // action is already in progress. Otherwise set + // as current action + if (currentAction != null) + pendingActions.addActionsItem(requestedAction); + else + currentAction = requestedAction; + } else { + logger.warn("Attempted to add null ContainerRequest!"); + } + + } + + /** + * Searches all loading actions ( pending, current and completed ) for a given + * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public ContainerActionStatus getContainerActionStatus(String actionId) { + if (actionId != null) { + // First search pending loading actions ( null check since actions array is null + // before adding values ) + if (pendingActions.getActions() != null) { + for (ContainerActionStatus containerAction : pendingActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + // search current action + if (currentAction != null && actionId.equals(currentAction.getActionId())) { + return currentAction; + } + // Search completed loading actions ( null check since actions array is null + // before adding values ) + if (completedActions.getActions() != null) { + for (ContainerActionStatus containerAction : completedActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + logger.warn(String.format("No loading actions exist with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * Mark {@link LoadingActions#currentAction} as in progress by setting the + * {@link ContainerActionStatus#status} to {@link StatusEnum#LOADING}. + */ + public void startCurrentAction() { + if (currentAction != null) { + logger.debug(String.format("Starting loading for action %s", currentAction.toString())); + currentAction.setStatus(StatusEnum.LOADING); + } else + logger.warn("There is no current action!"); + } + + /** + * Mark {@link LoadingActions#currentAction} as complete and move it to the + * completedActions list. If there are pending actions, set the next pending + * action to current action, else set current action to null. + */ + public void completeCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(ContainerActionStatus.StatusEnum.LOADED); + currentAction.setCompleted(System.currentTimeMillis()); + logger.debug(String.format("Complete loading for action %s", currentAction.toString())); + logger.debug(String.format("Complete loading for action %s", currentAction.toString())); + completedActions.addActionsItem(currentAction); + // Remove first item in list of pending actions and set it to current action + if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { + currentAction = pendingActions.getActions().remove(0); + } else { + currentAction = null; + } + } else + logger.warn("There is no current action!"); + + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java new file mode 100644 index 000000000..9987acb79 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java @@ -0,0 +1,170 @@ +package com.leidos.unloading; + +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link UnloadingActions} is a spring bean for managing unloading actions. + * Only allows for a single unloading action to be in progress at a time and is + * stored as the {@link UnloadingActions#currentAction}. Any unloading actions + * requested while the current action is not yet completed will be added to + * {@link UnloadingActions#pendingActions} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link UnloadingActions#completedActions} list. + * + * @author Paul Bourelly + */ +@Component +public class UnloadingActions { + + private static Logger logger = LoggerFactory.getLogger(UnloadingActions.class); + // List of all pending unloading actions + private ActionStatusList pendingActions = new ActionStatusList(); + + // List of completed unloading actions + private ActionStatusList completedActions = new ActionStatusList(); + + // Current unloading Action + private ContainerActionStatus currentAction; + + /** + * Empty Constructor + */ + public UnloadingActions() { + } + + /** + * Getter for pending unloading actions + * + * @return {@link ActionStatusList} list of pending unloading actions + */ + public ActionStatusList getPendingActions() { + return pendingActions; + } + + /** + * Getter for completed Actions + * + * @return {@link ActionStatusList} list of completed actions + */ + public ActionStatusList getCompletedActions() { + return completedActions; + } + + /** + * Getter for current Action + * + * @return {@link ContainerActionStatus} current in progress unloading + */ + public ContainerActionStatus getCurrentAction() { + return currentAction; + } + + /** + * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. + * Valid requests require vehicleId and containerId. Valid request will be set + * as {@link UnloadingActions#currentAction} if no current action is present or + * added list of pending actions. + * + * @param request {@link ContainerRequest} Request to load container on to a + * vehicle + */ + public void requestUnloadingAction(ContainerRequest request) { + if (request != null) { + ContainerActionStatus requestedAction = new ContainerActionStatus(); + requestedAction.setContainerId(request.getContainerId()); + requestedAction.setVehicleId(request.getVehicleId()); + requestedAction.setActionId(request.getActionId()); + requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); + requestedAction.setRequested(System.currentTimeMillis()); + // Add action to list of pending actions if an + // action is already in progress. Otherwise set + // as current action + if (currentAction != null) + pendingActions.addActionsItem(requestedAction); + else + currentAction = requestedAction; + } else { + logger.warn("Attempted to add null ContainerRequest!"); + } + + } + + /** + * Searches all unloading actions ( pending, current and completed ) for a given + * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public ContainerActionStatus getContainerActionStatus(String actionId) { + if (actionId != null) { + // First search pending loading actions ( null check since actions array is null + // before adding values ) + if (pendingActions.getActions() != null) { + for (ContainerActionStatus containerAction : pendingActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + // search current action + if (currentAction != null && actionId.equals(currentAction.getActionId())) { + return currentAction; + } + // Search completed loading actions ( null check since actions array is null + // before adding values ) + if (completedActions.getActions() != null) { + for (ContainerActionStatus containerAction : completedActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + logger.warn(String.format("No unloading actions exist with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * Mark {@link UnloadingActions#currentAction} as in progress by setting the + * {@link ContainerActionStatus#status} to {@link StatusEnum#UNLOADING}. + */ + public void startCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(StatusEnum.UNLOADING); + } else + logger.warn("There is no current action!"); + } + + /** + * Mark {@link UnloadingActions#currentAction} as complete and move it to the + * completedActions list. If there are pending actions, set the next pending + * action to current action, else set current action to null. + */ + public void completeCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(StatusEnum.UNLOADED); + currentAction.setCompleted(System.currentTimeMillis()); + completedActions.addActionsItem(currentAction); + // Remove first item in list of pending actions and set it to current action + if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { + currentAction = pendingActions.getActions().remove(0); + } else { + currentAction = null; + } + } else + logger.warn("There is no current action!"); + + } + +} diff --git a/tools/port-drayage-webservice/src/main/resources/application.properties b/tools/port-drayage-webservice/src/main/resources/application.properties new file mode 100644 index 000000000..d01b3f16d --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/application.properties @@ -0,0 +1,30 @@ +# +# Keystore properties for SSL HTTPS hosting. Requires a java key store which can be generated using JDK with the following command : +# keytool -genkey -keyalg RSA -alias tutorial -keystore tutorial.jks -storepass password -validity 365 -keysize 4096 -storetype pkcs12 + +# server.ssl.key-store=src/main/resources/tutorial.jks +# server.ssl.key-store-type=pkcs12 +# server.ssl.key-store-password=password +# server.ssl.key-password=password +# server.ssl.key-alias=tutorial + +# Set UI and REST API server port +server.port=8090 + +# Spring boot actuator properties allow for rest endpoint exposure for monitoring spring bean status for debuging. Should be disable for production +# Documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html +management.endpoints.web.exposure.include=* + + +# Logging configuration + +# Set output log file +#logging.file=log/application.log + +# Set class/package level log level +#logging.level.com.leidos.loading.LoadingActions=DEBUG + +# Set root log level +#logging.level.root=INFO + + diff --git a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml new file mode 100755 index 000000000..c77be3c91 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml @@ -0,0 +1,419 @@ +openapi: 3.0.0 +info: + title: Port Drayage Web Service. + description: Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + version: "1.0" +servers: + - url: http://127.0.0.1:8090 + description: Unsecured hosting for development + - url: https://127.0.0.1:8443 + description: Secured hosting for deployment +paths: + /loading: + post: + summary: Request a container is loaded on to freight vehicle. + description: + Provide ContainerRequest JSON to request a container with a given id be loaded on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID, Vehicle ID and an Action ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerRequest" + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/pending: + get: + summary: List of all pending loading actions. + description: + Provides a list of ContainerActionStatus JSON objects describing the loading actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ActionStatusList" + /loading/start/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Start a loading action. + description: + Will attempt to start current loading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a loading action has started. Will return 400 if provided action id is not \ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete a loading action. + description: + Will attempt to complete current loading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a loading action has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerActionStatus" + "400": + description: Bad Request + /unloading: + post: + summary: Request a container is unloaded on to freight Vehicle. + description: + Provide ContainerRequest JSON to request a container with a given id be unloaded on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID, Vehicle ID and an Action ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerRequest" + responses: + "201": + description: Created + /unloading/pending: + get: + summary: List of all pending unloading actions and status. + description: + Provides a list of ContainerActionStatus JSON describing the unloading actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ActionStatusList" + /unloading/start/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Start an unloading action. + description: + Will attempt to start current unloading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a unloading action has started. Will return 400 if provided action id is not current\ + action. + responses: + "201": + description: Created + "400": + description: Bad Request + /unloading/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete an unloading action. + description: + Will attempt to complete current unloading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate an unloading action has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /unloading/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerActionStatus" + "400": + description: Bad Request + /inspection: + post: + summary: Request a container is inspected on to Freight Vehicle. + description: + Provide InspectionRequest JSON to request a container with a given id be inspected on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID and Vehicle ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionRequest" + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/holding/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Vehicle has arrive at Holding area an is waiting on inspection. + description: + After being instructed to proceed to holding area and navigating to holding area, vehicle will request further inspection at holding\ + area. This request will be sent from the PortDrayage V2X-Hub Plugin after receiving a vehicles arrival message at the holding area.\ + Will return 400 if not current action or status is not PROCEED_TO_HOLDING and discard request. + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/pending: + get: + summary: List of all pending inspection actions and status. + description: + Provides a list of InspectionStatus JSON objects describing the inspection actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionStatusList" + /inspection/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete an inspection action. + description: + Will attempt to complete current inspection. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate an inspection has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/hold/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Request vehicle proceed to holding area for further inspection + description: Will attempt to request vehicle proceed to holding area for further inspection. Will return 400 if no current action + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If non is found returns 400. Intended for polling inspection status. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionStatus" + "400": + description: Bad Request +components: + schemas: + ContainerRequest: + title: Container Request + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + required: + - vehicle_id + - container_id + - action_id + ContainerActionStatus: + title: Container Action Status + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + status: + type: string + enum: + - LOADING + - UNLOADING + - LOADED + - UNLOADED + - PENDING + - ABORTED + requested: + type: integer + format: int64 + completed: + type: integer + format: int64 + required: + - vehicle_id + - container_id + - action_id + - status + - requested + ActionStatusList: + title: List of Container Action Status elements + type: object + properties: + actions: + type: array + items: + type: object + $ref: "#/components/schemas/ContainerActionStatus" + InspectionRequest: + title: Inspection Request + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + required: + - vehicle_id + - container_id + - action_id + InspectionStatus: + title: Inspection Status + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + status: + type: string + enum: + - PENDING + - PROCEED_TO_HOLDING + - PASSED + - FAILED + - HOLDING + requested: + type: integer + format: int64 + completed: + type: integer + format: int64 + required: + - vehicle_id + - container_id + - action_id + - status + - requested + InspectionStatusList: + title: List of Container Action Status elements + type: object + properties: + inspections: + type: array + items: + type: object + $ref: "#/components/schemas/InspectionStatus" diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/main.css b/tools/port-drayage-webservice/src/main/resources/static/css/main.css new file mode 100644 index 000000000..e69de29bb diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html b/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html new file mode 100644 index 000000000..b92f5ad73 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html @@ -0,0 +1,117 @@ +
+

Requested Inspection

+

+ Inspection for vehicle : + + with container : + +

+
+

+

+ + + +

Vehicle is proceeding to Holding Area.
+

+
+

Pending Inspections

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested
No Pending Inspections
+ +

Completed Inspections

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_loading.html b/tools/port-drayage-webservice/src/main/resources/templates/_loading.html new file mode 100644 index 000000000..cfa8f880e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_loading.html @@ -0,0 +1,115 @@ +
+

Requested Loading Action

+

+ Load vehicle : + + with container : + +

+
+

+

+ + + +

+
+

Pending Loading Actions

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Actions ID Requested
No Pending Actions
+ +

Completed Loading Actions

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html b/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html new file mode 100644 index 000000000..6bc7f9b21 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html @@ -0,0 +1,114 @@ +
+

Requested Unloading Action

+

+ Unload vehicle : + + with container : + +

+
+

+

+ + + + +

+
+

Pending Unloading Actions

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested
No Pending Actions
+ +

Completed Unloading Actions

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/index.html b/tools/port-drayage-webservice/src/main/resources/templates/index.html new file mode 100644 index 000000000..20afe2ac7 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/index.html @@ -0,0 +1,74 @@ + + + + + + + CARMA Freight Web Service + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+
+
+
+ +
+ + + + + +
+ + + + + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java new file mode 100644 index 000000000..9b8afb1d1 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java @@ -0,0 +1,212 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.inspection.InspectionActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +/** + * Test class for Inspection {@link RestController} bean + */ +@WebMvcTest(controllers = { InspectionController.class }) +public class InspectionControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private InspectionActions mockInspectionActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /inspection {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetInspection() throws Exception { + + mvc.perform(MockMvcRequestBuilders.get("/inspection/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /inspection responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testPostInspection() throws Exception { + + // Test response for valid payload + InspectionRequest request = new InspectionRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock duplicate request + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock already existing action for action ID + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test POST /inspection/holding responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testPostInspectionHolding() throws Exception { + + // Mock inspectionAction to have current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock current inspection + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus("actionId")).thenReturn(responseStatus); + + // Test response for valid payload + InspectionRequest request = new InspectionRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + // Correct + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for non current action ( both incorrect vehicle and container + // id) + request.setActionId("wrong"); + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /inspection/{vehicleId} responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testInspectionVehicleIdGet() throws Exception { + + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockInspectionActions.getInspectionStatus("vehicleId")).thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) + .andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/inspection/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test inspection/complete/{action_id} POST + */ + @Test + public void testInspectionCompleteActionIdPost() throws Exception { + // Create current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test inspection/hold/{action_id} POST + */ + @Test + public void testInspectionHoldActionIdPost() throws Exception { + // Create current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java new file mode 100644 index 000000000..d37a5f68d --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java @@ -0,0 +1,159 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.loading.LoadingActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +@WebMvcTest(controllers = { LoadingController.class }) +public class LoadingControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private LoadingActions mockLoadingActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /loading {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetLoading() throws Exception { + + mvc.perform(MockMvcRequestBuilders.get("/loading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /loading responses from {@link LoadingController}. + * + * @throws Exception + */ + @Test + public void testPostLoading() throws Exception { + + // Test response for valid payload + ContainerRequest request = new ContainerRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock already existing duplicate action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); + responseStatus.setRequested(System.currentTimeMillis()); + Mockito.when(mockLoadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /loading/{vehicleId} responses from {@link LoadingController}. + * + * @throws Exception + */ + @Test + public void testLoadingVehicleIdGet() throws Exception { + + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockLoadingActions.getContainerActionStatus("vehicleId")).thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")).andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/loading/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test loading/complete/{action_id} POST + */ + @Test + public void testLoadingCompleteActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test unloading/start/{action_id} POST + */ + @Test + public void testUnloadingStartActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java new file mode 100644 index 000000000..9ae3e4751 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java @@ -0,0 +1,160 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.unloading.UnloadingActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +@WebMvcTest(controllers = { UnloadingController.class }) +public class UnloadingControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private UnloadingActions mockUnloadingActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /unloading {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetUnloading() throws Exception { + mvc.perform(MockMvcRequestBuilders.get("/unloading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /unloading responses from {@link UnloadingController}. + * + * @throws Exception + */ + @Test + public void testPostUnloading() throws Exception { + + // Test response for valid payload + ContainerRequest request = new ContainerRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock already existing duplicate action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); + responseStatus.setRequested(System.currentTimeMillis()); + Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /unloading/{vehicleId} responses from {@link UnloadingController}. + * + * @throws Exception + */ + @Test + public void testUnloadingVehicleIdGet() throws Exception { + + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) + .andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/unloading/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test unloading/complete/{action_id} POST + */ + @Test + public void testUnloadingCompleteActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test unloading/start/{action_id} POST + */ + @Test + public void testUnloadingStartActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java new file mode 100644 index 000000000..304a5c5f2 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java @@ -0,0 +1,194 @@ +package com.leidos.inspection; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; + +/** + * Test Class to test {@link InspectionActions} class. + * + * @author Paul Bourelly + */ +public class InspectionActionsTest { + + private InspectionActions inspectionActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + inspectionActions = new InspectionActions(); + } + + /** + * Test case to test {@link InspectionActions#getInspectionStatus(String)} and + * {@link InspectionActions#requestInspectionAction(InspectionRequest)} for + * different possible inputs. + */ + @Test + public void requestInspectionTest() { + // Returns null when provided null vehicleId + assertNull(inspectionActions.getInspectionStatus(null)); + + // requestInspectionAction does not throw exceptions for null parameters + inspectionActions.requestInspectionAction(null); + + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("inspectionA"); + + // Returns null before inspection is requested + assertNull(inspectionActions.getInspectionStatus(req1.getActionId())); + assertNull(inspectionActions.getCurrentInspection()); + + // Current action and inspection status returns action after inspection is + // requested + inspectionActions.requestInspectionAction(req1); + assertEquals(req1.getVehicleId(), inspectionActions.getCurrentInspection().getVehicleId()); + assertEquals(req1.getContainerId(), inspectionActions.getCurrentInspection().getContainerId()); + assertEquals(req1.getVehicleId(), inspectionActions.getInspectionStatus(req1.getActionId()).getVehicleId()); + assertEquals(req1.getContainerId(), inspectionActions.getInspectionStatus(req1.getActionId()).getContainerId()); + + // Attempt to request new inspection while another inspection is in progress + InspectionRequest req2 = new InspectionRequest(); + req2.setVehicleId("vehicleC"); + req2.setContainerId("containerC"); + req2.setActionId("inspectionC"); + inspectionActions.requestInspectionAction(req2); + InspectionStatus status = inspectionActions.getCurrentInspection(); + + // Current Action is still first request + assertEquals(req1.getContainerId(), status.getContainerId()); + assertEquals(req1.getVehicleId(), status.getVehicleId()); + + // New inspection request is in pending inspection list + InspectionStatus pending = inspectionActions.getPendingInspections().getInspections().get(0); + assertEquals(req2.getVehicleId(), pending.getVehicleId()); + assertEquals(req2.getContainerId(), pending.getContainerId()); + } + + /** + * Test case to test {@link InspectionActions#completeInspection()} for + * different possible parameters. + */ + @Test + public void completeInspectionTest() { + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("inspectionA"); + + InspectionRequest req2 = new InspectionRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("inspectionB"); + + InspectionRequest req3 = new InspectionRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("inspectionC"); + + // Calling complete inspection with no current inspection does not add any + // inspection to completed list + inspectionActions.completeInspection(); + assertNull(inspectionActions.getCompletedInspections().getInspections()); + + inspectionActions.requestInspectionAction(req1); + inspectionActions.requestInspectionAction(req2); + inspectionActions.requestInspectionAction(req3); + + // Completed Inspections is empty before completing any inspection but + // inspection is in inspectionActions list of in progress inspections + assertNull(inspectionActions.getCompletedInspections().getInspections()); + + InspectionStatus req1Status = inspectionActions.getInspectionStatus(req1.getActionId()); + InspectionStatus req2Status = inspectionActions.getInspectionStatus(req2.getActionId()); + InspectionStatus req3Status = inspectionActions.getInspectionStatus(req3.getActionId()); + + // First request becomes current action and additional requests are added to + // pending inspections + assertEquals(req1Status, inspectionActions.getCurrentInspection()); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req2Status)); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); + + // Complete inspection adds current inspection to completedInspections list and + // sets next pending action as currentAction + inspectionActions.completeInspection(); + + assertTrue(inspectionActions.getCompletedInspections().getInspections().contains(req1Status)); + assertEquals(req2Status, inspectionActions.getCurrentInspection()); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(InspectionStatus.StatusEnum.PASSED, req1Status.getStatus()); + + // Completing inspection when no pending actions are left sets current action to + // null + // req2Status + inspectionActions.completeInspection(); + + // req3Status + inspectionActions.completeInspection(); + + assertNull(inspectionActions.getCurrentInspection()); + assertEquals(3, inspectionActions.getCompletedInspections().getInspections().size()); + + // Get InspectionStatus will return most recent inspection even when it is completed + // for a given vehicleID + assertEquals(req3Status, inspectionActions.getInspectionStatus(req3.getActionId())); + } + + /** + * Test case to test {@link InspectionActions#requestHolding()} method and + * holding vehicle interactions. + */ + @Test + public void requestHoldingTest() { + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + + // Call proceed to holding with no current action + assertNull(inspectionActions.getCurrentInspection()); + inspectionActions.proceedToHolding(); + + // Call request holding with to current action + inspectionActions.requestHolding(); + assertNull(inspectionActions.getCurrentInspection()); + + // Request Inspection + inspectionActions.requestInspectionAction(req1); + InspectionStatus req1Status = inspectionActions.getCurrentInspection(); + + assertEquals(StatusEnum.PENDING, req1Status.getStatus() ); + + // Proceed To Holding + inspectionActions.proceedToHolding(); + + assertEquals(StatusEnum.PROCEED_TO_HOLDING, req1Status.getStatus() ); + + // Request Holding + inspectionActions.requestHolding(); + + assertEquals(StatusEnum.HOLDING, req1Status.getStatus() ); + + // Complete + inspectionActions.completeInspection(); + assertEquals(StatusEnum.PASSED, req1Status.getStatus() ); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java new file mode 100644 index 000000000..dae1c3400 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java @@ -0,0 +1,155 @@ +package com.leidos.loading; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class LoadingActionsTest { + + public LoadingActions loadingActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + loadingActions = new LoadingActions(); + } + + /** + * Test case to test {@link LoadingActions#getContainerActionStatus(String)} and + * {@link LoadingActions#requestLoadingAction(ContainerRequest)} for different + * possible inputs. + */ + @Test + public void requestLoadingActionTest() { + // Returns null when provided null vehicleId + assertNull(loadingActions.getContainerActionStatus(null)); + + // requestLoadingAction does not throw exceptions for null parameters + loadingActions.requestLoadingAction(null); + + // Populate Loading actions with Loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + // Returns null before loading action is requested + assertNull(loadingActions.getContainerActionStatus(req1.getActionId())); + assertNull(loadingActions.getCurrentAction()); + + // Returns action after loading action is requested + loadingActions.requestLoadingAction(req1); + assertEquals(req1.getVehicleId(), loadingActions.getCurrentAction().getVehicleId()); + assertEquals(req1.getContainerId(), loadingActions.getCurrentAction().getContainerId()); + + // Attempt to request new loading action for vehicle with already pending + // loading action + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleA"); + req2.setContainerId("containerC"); + req2.setActionId("actionC"); + loadingActions.requestLoadingAction(req2); + ContainerActionStatus status = loadingActions.getCurrentAction(); + assertEquals(req1.getContainerId(), status.getContainerId()); + } + + /** + * Test case to test + * {@link LoadingAction#completeCurrentAction(com.baeldung.openapi.model.ContainerActionStatus)} + * for different possible parameters. + */ + @Test + public void completeLoadingTest() { + // Populate loading actions with loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("actionB"); + + ContainerRequest req3 = new ContainerRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("actionC"); + + // Run completeCurrentAction with no current action + assertNull(loadingActions.getCurrentAction()); + loadingActions.completeCurrentAction(); + + // Run startCurrentAction with no current action + assertNull(loadingActions.getCurrentAction()); + loadingActions.startCurrentAction(); + + loadingActions.requestLoadingAction(req1); + loadingActions.requestLoadingAction(req2); + loadingActions.requestLoadingAction(req3); + + // Completed actions is empty before completing any loading action but + // loading action is in loadingActions list of in progress actions + assertNull(loadingActions.getCompletedActions().getActions()); + ContainerActionStatus req1Status = loadingActions.getContainerActionStatus(req1.getActionId()); + ContainerActionStatus req2Status = loadingActions.getContainerActionStatus(req2.getActionId()); + ContainerActionStatus req3Status = loadingActions.getContainerActionStatus(req3.getActionId()); + + // First requested action becomes current action and each action requested after + // is added to + // pending actions + assertEquals(req1Status, loadingActions.getCurrentAction()); + assertTrue(loadingActions.getPendingActions().getActions().contains(req2Status)); + assertTrue(loadingActions.getPendingActions().getActions().contains(req3Status)); + + + + // Start current action sets status to LOADING + assertEquals(StatusEnum.PENDING, loadingActions.getCurrentAction().getStatus()); + loadingActions.startCurrentAction(); + assertEquals(StatusEnum.LOADING, loadingActions.getCurrentAction().getStatus()); + + // Current action status is set to LOADED and added to completedActions list. + // Current action is replaced with next action in pending actions + // Complete req1 + loadingActions.completeCurrentAction(); + + assertTrue(loadingActions.getCompletedActions().getActions().contains(req1Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.LOADED, req1Status.getStatus()); + assertEquals(req2Status, loadingActions.getCurrentAction()); + + // Complete req2 + loadingActions.completeCurrentAction(); + + assertTrue(loadingActions.getCompletedActions().getActions().contains(req2Status)); + assertNotNull(req2Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.LOADED, req2Status.getStatus()); + assertEquals(req3Status, loadingActions.getCurrentAction()); + assertTrue(loadingActions.getPendingActions().getActions().isEmpty()); + + // Complete req3 + loadingActions.completeCurrentAction(); + + assertNull(loadingActions.getCurrentAction()); + assertEquals(3, loadingActions.getCompletedActions().getActions().size()); + + // Get ContainerActionStatus will return most recent action even when it is + // completed + // for a given vehicleID + assertEquals(req3Status, loadingActions.getContainerActionStatus(req3.getActionId())); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java new file mode 100644 index 000000000..edb0e47ce --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java @@ -0,0 +1,150 @@ +package com.leidos.unloading; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class UnloadingActionsTest { + public UnloadingActions unloadingActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + unloadingActions = new UnloadingActions(); + } + + /** + * Test case to test {@link UnloadingActions#getContainerActionStatus(String)} + * and {@link UnloadingActions#requestUnloadingAction(ContainerRequest)} for + * different possible inputs. + */ + @Test + public void requestLoadingActionTest() { + // Returns null when provided null vehicleId + assertNull(unloadingActions.getContainerActionStatus(null)); + + // requestLoadingAction does not throw exceptions for null parameters + unloadingActions.requestUnloadingAction(null); + + // Populate unloading actions with unloading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + // Returns null before unloading action is requested + assertNull(unloadingActions.getContainerActionStatus(req1.getActionId())); + + // Returns action after unloading action is requested + unloadingActions.requestUnloadingAction(req1); + assertEquals(req1.getVehicleId(), unloadingActions.getCurrentAction().getVehicleId()); + assertEquals(req1.getContainerId(), unloadingActions.getCurrentAction().getContainerId()); + + // Attempt to request new unloading action with already pending + // unloading action + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleC"); + req2.setContainerId("containerC"); + req2.setActionId("actionC"); + unloadingActions.requestUnloadingAction(req2); + ContainerActionStatus status = unloadingActions.getCurrentAction(); + assertEquals(req1.getContainerId(), status.getContainerId()); + } + + /** + * Test case to test + * {@link LoadingAction#completeCurrentAction(ContainerActionStatus)} for + * different possible parameters. + */ + @Test + public void completeLoadingTest() { + // Populate loading actions with loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("actionB"); + + ContainerRequest req3 = new ContainerRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("actionC"); + + // Run completeCurrentAction with no current action + assertNull(unloadingActions.getCurrentAction()); + unloadingActions.completeCurrentAction(); + + // Run startCurrentAction with no current action + assertNull(unloadingActions.getCurrentAction()); + unloadingActions.startCurrentAction(); + + unloadingActions.requestUnloadingAction(req1); + unloadingActions.requestUnloadingAction(req2); + unloadingActions.requestUnloadingAction(req3); + + // Completed actions is empty before completing any loading action but + // loading action is in unloadingActions list of in progress actions + assertNull(unloadingActions.getCompletedActions().getActions()); + ContainerActionStatus req1Status = unloadingActions.getContainerActionStatus(req1.getActionId()); + ContainerActionStatus req2Status = unloadingActions.getContainerActionStatus(req2.getActionId()); + ContainerActionStatus req3Status = unloadingActions.getContainerActionStatus(req3.getActionId()); + + // First requested action becomes current action and each action requested after + // is added to + // pending actions + assertEquals(req1Status, unloadingActions.getCurrentAction()); + assertTrue(unloadingActions.getPendingActions().getActions().contains(req2Status)); + assertTrue(unloadingActions.getPendingActions().getActions().contains(req3Status)); + + // Start current action sets status to UNLOADING + assertEquals(StatusEnum.PENDING, unloadingActions.getCurrentAction().getStatus()); + unloadingActions.startCurrentAction(); + assertEquals(StatusEnum.UNLOADING, unloadingActions.getCurrentAction().getStatus()); + + // Current action status is set to UNLOADED and added to completedActions list. + // Current action is replaced with next action in pending actions + // Complete req1 + unloadingActions.completeCurrentAction(); + + assertTrue(unloadingActions.getCompletedActions().getActions().contains(req1Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req1Status.getStatus()); + assertEquals(req2Status, unloadingActions.getCurrentAction()); + + // Complete req2 + unloadingActions.completeCurrentAction(); + + assertTrue(unloadingActions.getCompletedActions().getActions().contains(req2Status)); + assertNotNull(req2Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req2Status.getStatus()); + assertEquals(req3Status, unloadingActions.getCurrentAction()); + assertTrue(unloadingActions.getPendingActions().getActions().isEmpty()); + + // Complete req3 + unloadingActions.completeCurrentAction(); + + assertNull(unloadingActions.getCurrentAction()); + assertEquals(3, unloadingActions.getCompletedActions().getActions().size()); + + // Get ContainerActionStatus will return most recent action even when it is + // completed + // for a given vehicleID + assertEquals(req3Status, unloadingActions.getContainerActionStatus(req3.getActionId())); + } +} From 5d74af5edff755cbbf1a15765106b195c8fb4fb3 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Mon, 22 Nov 2021 10:29:50 -0500 Subject: [PATCH 04/17] Release Candidate fixes --- configuration/amd64/docker-compose.yml | 2 +- src/tmx/TmxCore/src/ivpcore.cpp | 2 +- src/tmx/TmxCtl/src/lib/PluginConfig.cpp | 14 - src/tmx/TmxCtl/src/lib/PluginStatus.cpp | 39 ++- src/tmx/TmxCtl/src/lib/TmxControl.h | 3 +- .../DsrcImmediateForwardPlugin/manifest.json | 2 +- .../src/PortDrayagePlugin.cpp | 40 ++- .../PortDrayagePlugin/src/PortDrayagePlugin.h | 8 +- .../src/WebServiceClient.cpp | 259 +++++++++--------- .../PortDrayagePlugin/src/WebServiceClient.h | 16 +- 10 files changed, 200 insertions(+), 185 deletions(-) diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index bcfc8934c..354284c12 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -28,7 +28,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:carma-freight + image: usdotfhwaops/v2xhubamd:v2xrelease_6.2 container_name: v2xhub network_mode: host restart: always diff --git a/src/tmx/TmxCore/src/ivpcore.cpp b/src/tmx/TmxCore/src/ivpcore.cpp index 50dd49d96..84eb3cf8f 100644 --- a/src/tmx/TmxCore/src/ivpcore.cpp +++ b/src/tmx/TmxCore/src/ivpcore.cpp @@ -133,7 +133,7 @@ std::string GetPwd(){ pwd = std::getenv(EnvVar); if(pwd == NULL){ - LOG_ERROR("Unable to set MYSQL_ROOT_PASSWORD)"); + LOG_ERROR("Unable to set MYSQL_PASSWORD)"); return ""; } else{ diff --git a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp index ca80c112c..888546b99 100644 --- a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp @@ -525,19 +525,5 @@ bool TmxControl::remove(pluginlist &plugins, ...) } -// static std::string TmxControl::GetPwd(){ -// const char* EnvVar = "MYSQL_ROOT_PASSWORD"; -// const char* psw; -// psw = std::getenv(EnvVar); - -// if(psw == NULL){ -// PLOG(logERROR) << "Unable to set MYSQL_ROOT_PASSWORD)"; -// return ""; -// } -// else{ -// std::string PswStr(psw); -// return PswStr; -// } -// } } /* namespace tmxctl */ diff --git a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp index 28bbb0bb3..1d12472ba 100644 --- a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp @@ -87,7 +87,8 @@ bool TmxControl::list(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -173,7 +174,8 @@ bool TmxControl::state(pluginlist &plugins, ...) PLOG(logDEBUG) << "Executing query " << query; _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) { @@ -215,7 +217,8 @@ bool TmxControl::max_message_interval(pluginlist &plugins, ...) PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -269,7 +272,8 @@ bool TmxControl::args(pluginlist &plugins, ...) { PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -298,7 +302,8 @@ bool TmxControl::messages(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -380,7 +385,8 @@ bool TmxControl::events(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); @@ -434,7 +440,8 @@ bool TmxControl::system_config(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -476,7 +483,8 @@ bool TmxControl::clear_event_log(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->executeUpdate(); //unique_ptr stmt(conn.Get()->createStatement()); @@ -511,7 +519,8 @@ bool TmxControl::user_info(bool showPassword) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); unique_ptr rs(stmt->executeQuery()); @@ -566,7 +575,8 @@ bool TmxControl::all_users_info(bool showPassword) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -631,7 +641,8 @@ bool TmxControl::user_add() PLOG(logDEBUG1) << "Executing query (?1 = " << username << ", ?2 = " << password << ", ?3 = " << access_level << ", ?4 = " << username << "): " << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt.reset(conn.Get()->prepareStatement(query)); stmt->setString(1, username); @@ -699,7 +710,8 @@ bool TmxControl::user_update() query += " WHERE username = ?"; PLOG(logDEBUG1) << "Executing query : " << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); if (havePassword) { @@ -754,7 +766,8 @@ bool TmxControl::user_delete() _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); int deleted = stmt->executeUpdate(); diff --git a/src/tmx/TmxCtl/src/lib/TmxControl.h b/src/tmx/TmxCtl/src/lib/TmxControl.h index 2c65e1b94..77169d205 100644 --- a/src/tmx/TmxCtl/src/lib/TmxControl.h +++ b/src/tmx/TmxCtl/src/lib/TmxControl.h @@ -88,8 +88,7 @@ class TmxControl: public tmx::utils::Runnable { void DisablePermissionCheck(); std::string GetOutput(TmxControlOutputFormat format, bool pretty); tmx::message_container_type* GetOutput(); - // Method for getting credentials - // std::string GetPwd(); + private: boost::program_options::variables_map *_opts; diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json index 34316088a..993db59b3 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json @@ -9,7 +9,7 @@ "configuration": [ { "key": "Messages_Destination_1", - "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }", + "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }", "description": "JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1." }, { diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index f696f0b9f..139f952f7 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -34,13 +34,17 @@ void PortDrayagePlugin::UpdateConfigSettings() { lock_guard lock(_cfgLock); + std::string _database_username; + std::string _database_password; + uint16_t _database_port; + std::string _database_ip; + std::string _database_name; // Database configuration GetConfigValue("Database_Username", _database_username); GetConfigValue("Database_Password", _database_password); GetConfigValue("Database_IP",_database_ip); GetConfigValue("Database_Port",_database_port); GetConfigValue("Database_Name", _database_name); - // Port Drayage Web Service Configuration uint16_t polling_frequency; uint16_t polling_timeout; @@ -56,12 +60,13 @@ void PortDrayagePlugin::UpdateConfigSettings() { // Polling Frequency in seconds GetConfigValue("Webservice_Polling_Frequency", polling_frequency); - client = new WebServiceClient(host, port, secure, polling_frequency); - + client = std::make_shared( host, port, secure, polling_frequency ); // Port Holding Area Configurable location GetConfigValue("Holding_Lat", _holding_lat); GetConfigValue("Holding_Lon", _holding_lon); PLOG(logDEBUG) << "Holding Area set : (" << _holding_lat << ", " << _holding_lon << ")" << std::endl; + PLOG(logERROR) << "FILE_LOG::ReportingLevel() = " << FILE_LOG::ReportingLevel() << std::endl; + PLOG(logERROR) << "PLOG::ReportingLevel() = " << PLOG::ReportingLevel() << std::endl; // Create DB connection std::string connection_string = "tcp://" + _database_ip + ":" + std::to_string(_database_port); @@ -141,7 +146,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab if ( pd->operation.compare("PICKUP") == 0 ) { try{ client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - PLOG(logDEBUG) << "Loading Complete!" << std::endl; + PLOG(logDEBUG) << "Pickup Complete!" << std::endl; } catch(std::exception &e) { @@ -151,7 +156,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab else if ( pd->operation.compare("DROPOFF") == 0) { try{ client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - PLOG(logDEBUG) << "Unloading Complete!" << std::endl; + PLOG(logDEBUG) << "Dropoff Complete!" << std::endl; } catch(std::exception &e) { PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; @@ -164,7 +169,10 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab if ( holding == 1 ) { PLOG(logDEBUG) << "Requested futher inspection. Inserting Holding Action!" << std::endl; insert_holding_action_into_table( *pd ); - PLOG(logDEBUG) << "Inserted Holding action as next action!"; + } + else { + PLOG(logDEBUG) << "Checkpoint Action Complete!" << std::endl; + } } catch(std::exception &e) { @@ -174,7 +182,6 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab else if ( pd->operation.compare("HOLDING_AREA") == 0) { try{ string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); - PLOG(logDEBUG) << "Requesting holding for action id : " << previous_checkpoint_id << std::endl; client->request_holding( previous_checkpoint_id ); PLOG(logDEBUG) << "Holding Action Complete!" << std::endl; @@ -228,7 +235,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab std::stringstream content; write_xml(content, message); - PLOG(logDEBUG) << "XML outgoing message : " << std::endl << content.str(); + PLOG(logINFO) << "XML outgoing message : " << std::endl << content.str(); try { // Uper encode message @@ -238,7 +245,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab msg.reset(); msg.reset(dynamic_cast(factory.NewMessage(api::MSGSUBTYPE_TESTMESSAGE03_STRING))); string enc = mobilityENC.get_encoding(); - FILE_LOG(logERROR) << "Encoded outgoing message : " << std::endl << mobilityENC.get_payload_str(); + PLOG(logDEBUG) << "Encoded outgoing message : " << std::endl << mobilityENC.get_payload_str(); msg->refresh_timestamp(); msg->set_payload(mobilityENC.get_payload_str()); msg->set_encoding(enc); @@ -303,6 +310,7 @@ ptree PortDrayagePlugin::createMobilityOperationXml( ptree &json_payload ) { PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std::string action_id ) { + PortDrayage_Object *rtn = new PortDrayage_Object(); try{ // Set action_id next_action_id->setString(1,action_id); @@ -319,7 +327,6 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std sql::ResultSet *cur_action = current_action->executeQuery(); // Create PortDrayage_Object - PortDrayage_Object *rtn = new PortDrayage_Object(); if ( cur_action->first() ) { rtn->cmv_id = cur_action->getString("cmv_id"); rtn->operation = cur_action->getString("operation"); @@ -351,11 +358,13 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + return *rtn; } } PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( std::string cmv_id ) { + PortDrayage_Object *rtn = new PortDrayage_Object(); try{ // Set cmv_id first_action->setString(1,cmv_id); @@ -363,7 +372,6 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( st sql::ResultSet *cur_action = first_action->executeQuery(); if ( cur_action->first() ) { // Create Port Drayage object - PortDrayage_Object *rtn = new PortDrayage_Object(); rtn->cmv_id = cur_action->getString("cmv_id"); rtn->operation = cur_action->getString("operation"); rtn->action_id = cur_action->getString("action_id"); @@ -393,6 +401,7 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( st PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + return *rtn; } } @@ -429,6 +438,7 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( pt } catch( const ptree_error &e ) { PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; + return *pd; } } @@ -439,9 +449,8 @@ void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object &cu try{ *next_action = retrieveNextAction(cur_action->action_id); - PLOG(logINFO) << "Insert Holding action between " << cur_action->action_id << " and " + PLOG(logDEBUG1) << "Insert Holding action between " << cur_action->action_id << " and " << next_action->action_id << "." << std::endl; - PLOG(logDEBUG) << "Insert Holding Action." << std::endl; //INSERT INTO FREIGHT VALUES(cmv_id,cargo_id,_holding_lat,_holding_lon,HOLDING, UUID(), next_action->action_id) insert_action->setString(1,cur_action->cmv_id); insert_action->setString(2,cur_action->cargo_id); @@ -457,7 +466,7 @@ void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object &cu PLOG(logDEBUG) << "Query Result : " << res->first()<< std::endl; } - PLOG(logDEBUG) << "Get Holding Action action_id." << std::endl; + PLOG(logDEBUG1) << "Get Holding Action action_id." << std::endl; // SELECT action_id FROM freight WHERE next_action = ? and operation = ? get_action_id_for_previous_action->setString(1, next_action->action_id); get_action_id_for_previous_action->setString(2, "HOLDING_AREA"); @@ -471,7 +480,7 @@ void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object &cu } std::string action_id = res->getString("action_id"); - PLOG(logDEBUG) << "Update Checkpoint next_action = Holding Action action_id" << std::endl; + PLOG(logDEBUG1) << "Update Checkpoint next_action = Holding Action action_id" << std::endl; // UPDATE freight SET next_action = ? WHERE action_id = ? update_current_action->setString( 1, action_id); update_current_action->setString( 2, cur_action->action_id); @@ -509,6 +518,7 @@ std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( std::strin PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + return ""; } } diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h index ef992c482..35d90aa68 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h @@ -138,11 +138,7 @@ class PortDrayagePlugin: public PluginClient { private: // Database configuration values - std::string _database_username; - std::string _database_password; - uint16_t _database_port; - std::string _database_ip; - std::string _database_name; + sql::Driver *driver; @@ -160,7 +156,7 @@ class PortDrayagePlugin: public PluginClient { J2735MessageFactory factory; // Web Service Client - WebServiceClient *client; + std::shared_ptr client; // Port HOLDING_AREA Configuration double _holding_lat; diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp index e869d80e0..267458923 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -2,156 +2,160 @@ WebServiceClient::WebServiceClient() { - // Set polling frequency to 5s - polling_frequency = 5; - // Initialize API - api = new OAIDefaultApi(0); - // Setup Server config - api->setNewServerForAllOperations( - QUrl("http://127.0.0.1:8090"), - QString::fromStdString("Unsecured hosting for development"), - QMap() - ); + initialize("127.0.0.1", 8090, false, 5); } WebServiceClient::WebServiceClient(std::string host, uint16_t port, bool secure , uint16_t polling_frequency ) { + initialize(host, port, secure, polling_frequency); +} +void WebServiceClient::initialize(std::string host, uint16_t port, bool secure , uint16_t polling_frequency) { this->polling_frequency = polling_frequency; // Create URL - QUrl *url = new QUrl(); - url->setHost(QString::fromStdString(host)); - url->setPort(port); + std::unique_ptr url( new QUrl()); + url.get()->setHost(QString::fromStdString(host)); + url.get()->setPort(port); if ( secure ) { - url->setScheme(QString::fromStdString("https")); + url.get()->setScheme(QString::fromStdString("https")); } else { - url->setScheme(QString::fromStdString("http")); + url.get()->setScheme(QString::fromStdString("http")); } - FILE_LOG(logERROR) << "Setting API URL as " << url->toString().toStdString() << std::endl; + FILE_LOG(logINFO) << "Setting API URL as " << url.get()->toString().toStdString() << std::endl; // Initialize API - api = new OAIDefaultApi(0); + api = std::make_shared(0); // Setup server config - api->setNewServerForAllOperations( - *url, + api.get()->setNewServerForAllOperations( + *url.get(), QString::fromStdString("V2X-Hub Configured PortDrayage WebService"), QMap() ); + } void WebServiceClient::request_loading_action(std::string vehicle_id, std::string container_id, std::string action_id) { - OAIContainerRequest req; - QEventLoop loop; + std::unique_ptr req(new OAIContainerRequest ()); + std::unique_ptr loop( new QEventLoop()); + + // Disconnect duplicate signals + disconnect(api.get(), &OAIDefaultApi::loadingPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::loadingPostSignalE, nullptr, nullptr); - // Call back for POST /loading/ - connect(api, &OAIDefaultApi::loadingPostSignal, [&]() { - FILE_LOG(logERROR) << "Success /loading POST"; - loop.quit(); + // Call back for POST /loading/ + connect(api.get(), &OAIDefaultApi::loadingPostSignal, this, [&]() { + FILE_LOG(logINFO) << "Success /loading POST"; + loop->quit(); }); // Error call back for POST /loading/ - connect(api, &OAIDefaultApi::loadingPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + connect(api.get(), &OAIDefaultApi::loadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure /loading POST : " << error_str.toStdString(); FILE_LOG(logERROR) << error_code; - loop.quit(); + loop->quit(); }); // Setup request - req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req.setContainerId( QString::fromStdString( container_id ) ); - req.setActionId( QString::fromStdString( action_id ) ); - - FILE_LOG(logINFO) << "Sending loading request : " << req.asJson().toStdString(); - api->loadingPost( req ); - QTimer::singleShot(0, &loop, &QEventLoop::quit); - loop.exec(); - + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); + FILE_LOG(logINFO) << "Sending loading request : " << req->asJson().toStdString(); + api->loadingPost( *req.get() ); + loop->exec(); // Poll loading action until complete - pollLoadingAction( req.getActionId() ); - + pollLoadingAction( req->getActionId() ); + + } void WebServiceClient::request_unloading_action(std::string vehicle_id, std::string container_id, std::string action_id) { - OAIContainerRequest req; - QEventLoop loop; + std::unique_ptr req(new OAIContainerRequest ()); + std::unique_ptr loop( new QEventLoop()); + + // Disconnect duplicate signals + disconnect(api.get(), &OAIDefaultApi::unloadingPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::unloadingPostSignalE, nullptr, nullptr); // Call back for POST /unloading/ - connect(api, &OAIDefaultApi::unloadingPostSignal, [&]() { + connect(api.get(), &OAIDefaultApi::unloadingPostSignal, this, [&]() { FILE_LOG(logINFO) << "Success /unloading POST"; - loop.quit(); + loop->quit(); }); // Error call back for POST /unloading/ - connect(api, &OAIDefaultApi::unloadingPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + connect(api.get(), &OAIDefaultApi::unloadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString(); FILE_LOG(logERROR) << error_code; - - loop.quit(); + loop->quit(); }); // Setup request - req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req.setContainerId( QString::fromStdString( container_id ) ); - req.setActionId( QString::fromStdString( action_id ) ); + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); - FILE_LOG(logINFO) << "Sending unloading request : " << req.asJson().toStdString(); - api->unloadingPost( req ); - QTimer::singleShot(0, &loop, &QEventLoop::quit); - loop.exec(); + FILE_LOG(logINFO) << "Sending unloading request : " << req->asJson().toStdString(); + api->unloadingPost( *req.get() ); + loop->exec(); // Polling unloading action until complete - pollUnloadingAction( req.getActionId() ); + pollUnloadingAction( req->getActionId() ); } int WebServiceClient::request_inspection(std::string vehicle_id, std::string container_id, std::string action_id ) { - OAIInspectionRequest req; - QEventLoop loop; + std::unique_ptr req(new OAIInspectionRequest()); + std::unique_ptr loop( new QEventLoop()); - // Call back for POST /inspection/ - connect(api, &OAIDefaultApi::inspectionPostSignal, [&]() { + // Disconnect all duplicate signals + disconnect(api.get(),&OAIDefaultApi::inspectionPostSignal, nullptr, nullptr ); + disconnect(api.get(),&OAIDefaultApi::inspectionPostSignalE, nullptr, nullptr ); + + // Call back for POST /inspection/ + connect(api.get(), &OAIDefaultApi::inspectionPostSignal, this, [&]() { FILE_LOG(logINFO) << "Success /inspection POST"; - loop.quit(); + loop->quit(); }); // Error call back for POST /inspection/ - connect(api, &OAIDefaultApi::inspectionPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + connect(api.get(), &OAIDefaultApi::inspectionPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString(); FILE_LOG(logERROR) << error_code; - loop.quit(); + loop->quit(); }); // Setup request - req.setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req.setContainerId( QString::fromStdString( container_id ) ); - req.setActionId( QString::fromStdString( action_id ) ); + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); - FILE_LOG(logINFO) << "Sending inspection request : " << req.asJson().toStdString(); - api->inspectionPost( req ); - QTimer::singleShot(0, &loop, &QEventLoop::quit); - loop.exec(); + FILE_LOG(logINFO) << "Sending inspection request : " << req->asJson().toStdString(); + api->inspectionPost( *req.get() ); + loop->exec(); // Poll inspection status until complete or proceed to holding - return pollInspectionAction( req.getActionId() ); + return pollInspectionAction( req->getActionId() ); } void WebServiceClient::request_holding( std::string action_id ) { - QEventLoop loop; + std::unique_ptr loop( new QEventLoop()); + + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, nullptr, nullptr); // Call back for POST /inspection/ - connect(api, &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { + connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { FILE_LOG(logINFO) << "Success /inspection/holding/{action_id} POST"; - loop.quit(); + loop->quit(); }); // Error call back for POST /inspection/ - connect(api, &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString(); FILE_LOG(logERROR) << error_code; - loop.quit(); + loop->quit(); }); - - api->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); - QTimer::singleShot(5000, &loop, &QEventLoop::quit); - loop.exec(); - + FILE_LOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; + api.get()->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); + loop->exec(); // Poll inspection action until complete pollInspectionAction( QString::fromStdString( action_id ) ); @@ -159,117 +163,112 @@ void WebServiceClient::request_holding( std::string action_id ) { void WebServiceClient::pollLoadingAction( QString action_id ) { FILE_LOG(logDEBUG) << "Starting loading action Polling"; - QEventLoop loop; - OAIContainerActionStatus current_loading_action; - // Flag to continue polling until receiving a non error response from server + std::unique_ptr loop( new QEventLoop()); bool badResponse = true; - - // Call back for Get /loading/{action_id} - connect(api, &OAIDefaultApi::loadingActionIdGetSignal, [&](OAIContainerActionStatus loading_action) { - FILE_LOG(logINFO) << "Success /loading/{action_id} GET : " << loading_action.asJson().toStdString(); - current_loading_action = loading_action; + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, nullptr, nullptr); + + // Call back for Get /loading/{action_id} + connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, this, [&](OAIContainerActionStatus loading_action) { + loading_status.reset( new OAIContainerActionStatus( loading_action.asJson( ) ) ); + FILE_LOG(logINFO) << "Success /loading/{action_id} GET : " << loading_status->asJson().toStdString(); badResponse = false; - loop.quit(); + loop->quit(); }); // Error call back for Get /loading/{action_id} - connect(api, &OAIDefaultApi::loadingActionIdGetSignalE, + connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, this, [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString(); FILE_LOG(logERROR) << error_code; badResponse = true; - loop.quit(); + loop->quit(); }); - + // Flag to continue polling until receiving a non error response from server do { api->loadingActionIdGet( action_id ); - QTimer::singleShot(5000, &loop, &QEventLoop::quit); - loop.exec(); - + loop->exec(); // usleep coversion from seconds to microseconds usleep( polling_frequency * 1e6 ); } - while ( badResponse || current_loading_action.getStatus() != QString::fromStdString( "LOADED") ) ; + while ( badResponse || loading_status->getStatus() != QString::fromStdString( "LOADED") ) ; } void WebServiceClient::pollUnloadingAction( QString action_id) { FILE_LOG(logDEBUG) << "Starting unloading action Polling"; - QEventLoop loop; - OAIContainerActionStatus current_unloading_action; - // Flag to continue polling until receiving a non error response from server - bool badResponse = true; - + std::unique_ptr loop( new QEventLoop()); + bool badResponse = true; + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, nullptr, nullptr); // Call back for Get /unloading/{action_id} - connect(api, &OAIDefaultApi::unloadingActionIdGetSignal, [&](OAIContainerActionStatus unloading_action) { - FILE_LOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_action.asJson().toStdString(); - current_unloading_action = unloading_action; + connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, this, [&](OAIContainerActionStatus unloading_action) { + unloading_status.reset(&unloading_action); + FILE_LOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); badResponse = false; - loop.quit(); + loop->quit(); }); // Error call back for Get /unloading/{action_id} - connect(api, &OAIDefaultApi::unloadingActionIdGetSignalE, + connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, this, [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString(); FILE_LOG(logERROR) << error_code; badResponse = true; - loop.quit(); + loop->quit(); }); - + // Flag to continue polling until receiving a non error response from server do { - - api->unloadingActionIdGet( action_id ); - QTimer::singleShot(0, &loop, &QEventLoop::quit); - loop.exec(); - + api.get()->unloadingActionIdGet( action_id ); + loop->exec(); // usleep coversion from seconds to microseconds usleep( polling_frequency * 1e6 ); } - while( badResponse || current_unloading_action.getStatus() != QString::fromStdString( "UNLOADED") ); + while( badResponse || unloading_status->getStatus() != QString::fromStdString( "UNLOADED") ); } int WebServiceClient::pollInspectionAction( QString action_id ) { FILE_LOG(logERROR) << "Starting inspection action Polling"; - QEventLoop loop; - OAIInspectionStatus current_inspection; - // Flag to continue polling until receiving a non error response from server + std::unique_ptr loop( new QEventLoop()); + bool badResponse = true; + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, nullptr, nullptr); // Call back for GET /inspection/{action_id} - connect(api, &OAIDefaultApi::inspectionActionIdGetSignal, [&](OAIInspectionStatus inspection) { - current_inspection = inspection; - FILE_LOG(logINFO) << "Success /inspection/{action_id} GET : " << current_inspection.asJson().toStdString() ; - badResponse = false; - loop.quit(); + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, [&](OAIInspectionStatus inspection) { + inspection_status.reset( &inspection ); + FILE_LOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; + badResponse = false; + loop->quit(); }); // Error call back for /inspection/{action_id} - connect(api, &OAIDefaultApi::inspectionActionIdGetSignalE, + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { FILE_LOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString(); FILE_LOG(logERROR) << error_code; badResponse = true; - loop.quit(); + loop->quit(); }); - do { - api->inspectionActionIdGet( action_id ); - QTimer::singleShot(0, &loop, &QEventLoop::quit); - loop.exec(); + loop->exec(); - if (current_inspection.getStatus() == QString::fromStdString( "PASSED")){ + if (inspection_status->getStatus() == QString::fromStdString( "PASSED")){ return 0; } - else if (current_inspection.getStatus() == QString::fromStdString( "PROCEED_TO_HOLDING")) { + else if (inspection_status->getStatus() == QString::fromStdString( "PROCEED_TO_HOLDING")) { return 1; } // usleep coversion from seconds to microseconds usleep( polling_frequency * 1e6 ); } - while( badResponse || (current_inspection.getStatus() != QString::fromStdString( "PASSED") && - current_inspection.getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); + while( badResponse || (inspection_status->getStatus() != QString::fromStdString( "PASSED") && + inspection_status->getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); return -1; } diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h index 5c6315e6c..b0aa945bd 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h @@ -26,8 +26,10 @@ public slots: uint16_t polling_frequency; // OAIDefaultApi pointer - OAIDefaultApi *api; - + std::shared_ptr api; + std::shared_ptr loading_status; + std::shared_ptr unloading_status; + std::shared_ptr inspection_status; /** * Method to poll the status of a loading action with a given action id. * @@ -50,6 +52,16 @@ public slots: */ int pollInspectionAction(QString action_id); + /** + * Method to initialize server configuration and polling frequency + * + * @param host string host name of server + * @param port uint16_t port of server + * @param secure bool flag set to true for using HTTPS + * @param polling_frequency + */ + void initialize(std::string host, uint16_t port, bool secure , uint16_t polling_frequency); + public: From ecacf3749f18600f195d48140c36d9f6775ebab7 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Mon, 22 Nov 2021 16:52:25 -0500 Subject: [PATCH 05/17] Fixed Logging for V2X-Hub --- src/tmx/TmxUtils/src/Logger.h | 4 +- .../src/PortDrayagePlugin.cpp | 2 - .../src/WebServiceClient.cpp | 58 +++++++++---------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/tmx/TmxUtils/src/Logger.h b/src/tmx/TmxUtils/src/Logger.h index 855146577..51c3af4f3 100644 --- a/src/tmx/TmxUtils/src/Logger.h +++ b/src/tmx/TmxUtils/src/Logger.h @@ -9,11 +9,11 @@ #define SRC_LOGGER_H_ #ifndef LOGGER_MAX_LEVEL -#define LOGGER_MAX_LEVEL tmx::utils::logERROR +#define LOGGER_MAX_LEVEL tmx::utils::logDEBUG4 #endif #ifndef DEFAULT_LOG_LEVEL -#define DEFAULT_LOG_LEVEL "DEBUG" +#define DEFAULT_LOG_LEVEL "ERROR" #endif #define UNKNOWN_SOURCE "Unknown source" diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index 139f952f7..da31c794a 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -65,8 +65,6 @@ void PortDrayagePlugin::UpdateConfigSettings() { GetConfigValue("Holding_Lat", _holding_lat); GetConfigValue("Holding_Lon", _holding_lon); PLOG(logDEBUG) << "Holding Area set : (" << _holding_lat << ", " << _holding_lon << ")" << std::endl; - PLOG(logERROR) << "FILE_LOG::ReportingLevel() = " << FILE_LOG::ReportingLevel() << std::endl; - PLOG(logERROR) << "PLOG::ReportingLevel() = " << PLOG::ReportingLevel() << std::endl; // Create DB connection std::string connection_string = "tcp://" + _database_ip + ":" + std::to_string(_database_port); diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp index 267458923..a3ee23aa3 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -22,7 +22,7 @@ void WebServiceClient::initialize(std::string host, uint16_t port, bool secure , url.get()->setScheme(QString::fromStdString("http")); } - FILE_LOG(logINFO) << "Setting API URL as " << url.get()->toString().toStdString() << std::endl; + PLOG(logINFO) << "Setting API URL as " << url.get()->toString().toStdString() << std::endl; // Initialize API api = std::make_shared(0); // Setup server config @@ -44,13 +44,13 @@ void WebServiceClient::request_loading_action(std::string vehicle_id, std::strin // Call back for POST /loading/ connect(api.get(), &OAIDefaultApi::loadingPostSignal, this, [&]() { - FILE_LOG(logINFO) << "Success /loading POST"; + PLOG(logINFO) << "Success /loading POST"; loop->quit(); }); // Error call back for POST /loading/ connect(api.get(), &OAIDefaultApi::loadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure /loading POST : " << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /loading POST : " << error_str.toStdString(); + PLOG(logERROR) << error_code; loop->quit(); }); @@ -59,7 +59,7 @@ void WebServiceClient::request_loading_action(std::string vehicle_id, std::strin req->setContainerId( QString::fromStdString( container_id ) ); req->setActionId( QString::fromStdString( action_id ) ); - FILE_LOG(logINFO) << "Sending loading request : " << req->asJson().toStdString(); + PLOG(logINFO) << "Sending loading request : " << req->asJson().toStdString(); api->loadingPost( *req.get() ); loop->exec(); // Poll loading action until complete @@ -78,13 +78,13 @@ void WebServiceClient::request_unloading_action(std::string vehicle_id, std::str // Call back for POST /unloading/ connect(api.get(), &OAIDefaultApi::unloadingPostSignal, this, [&]() { - FILE_LOG(logINFO) << "Success /unloading POST"; + PLOG(logINFO) << "Success /unloading POST"; loop->quit(); }); // Error call back for POST /unloading/ connect(api.get(), &OAIDefaultApi::unloadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString(); + PLOG(logERROR) << error_code; loop->quit(); }); @@ -93,7 +93,7 @@ void WebServiceClient::request_unloading_action(std::string vehicle_id, std::str req->setContainerId( QString::fromStdString( container_id ) ); req->setActionId( QString::fromStdString( action_id ) ); - FILE_LOG(logINFO) << "Sending unloading request : " << req->asJson().toStdString(); + PLOG(logINFO) << "Sending unloading request : " << req->asJson().toStdString(); api->unloadingPost( *req.get() ); loop->exec(); @@ -112,13 +112,13 @@ int WebServiceClient::request_inspection(std::string vehicle_id, std::string con // Call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionPostSignal, this, [&]() { - FILE_LOG(logINFO) << "Success /inspection POST"; + PLOG(logINFO) << "Success /inspection POST"; loop->quit(); }); // Error call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString(); + PLOG(logERROR) << error_code; loop->quit(); }); @@ -127,7 +127,7 @@ int WebServiceClient::request_inspection(std::string vehicle_id, std::string con req->setContainerId( QString::fromStdString( container_id ) ); req->setActionId( QString::fromStdString( action_id ) ); - FILE_LOG(logINFO) << "Sending inspection request : " << req->asJson().toStdString(); + PLOG(logINFO) << "Sending inspection request : " << req->asJson().toStdString(); api->inspectionPost( *req.get() ); loop->exec(); @@ -144,16 +144,16 @@ void WebServiceClient::request_holding( std::string action_id ) { // Call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { - FILE_LOG(logINFO) << "Success /inspection/holding/{action_id} POST"; + PLOG(logINFO) << "Success /inspection/holding/{action_id} POST"; loop->quit(); }); // Error call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString(); + PLOG(logERROR) << error_code; loop->quit(); }); - FILE_LOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; + PLOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; api.get()->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); loop->exec(); // Poll inspection action until complete @@ -162,7 +162,7 @@ void WebServiceClient::request_holding( std::string action_id ) { } void WebServiceClient::pollLoadingAction( QString action_id ) { - FILE_LOG(logDEBUG) << "Starting loading action Polling"; + PLOG(logDEBUG) << "Starting loading action Polling"; std::unique_ptr loop( new QEventLoop()); bool badResponse = true; // Disconnect all duplicate signals @@ -172,15 +172,15 @@ void WebServiceClient::pollLoadingAction( QString action_id ) { // Call back for Get /loading/{action_id} connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, this, [&](OAIContainerActionStatus loading_action) { loading_status.reset( new OAIContainerActionStatus( loading_action.asJson( ) ) ); - FILE_LOG(logINFO) << "Success /loading/{action_id} GET : " << loading_status->asJson().toStdString(); + PLOG(logINFO) << "Success /loading/{action_id} GET : " << loading_status->asJson().toStdString(); badResponse = false; loop->quit(); }); // Error call back for Get /loading/{action_id} connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, this, [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString(); + PLOG(logERROR) << error_code; badResponse = true; loop->quit(); }); @@ -196,7 +196,7 @@ void WebServiceClient::pollLoadingAction( QString action_id ) { } void WebServiceClient::pollUnloadingAction( QString action_id) { - FILE_LOG(logDEBUG) << "Starting unloading action Polling"; + PLOG(logDEBUG) << "Starting unloading action Polling"; std::unique_ptr loop( new QEventLoop()); bool badResponse = true; @@ -206,15 +206,15 @@ void WebServiceClient::pollUnloadingAction( QString action_id) { // Call back for Get /unloading/{action_id} connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, this, [&](OAIContainerActionStatus unloading_action) { unloading_status.reset(&unloading_action); - FILE_LOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); + PLOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); badResponse = false; loop->quit(); }); // Error call back for Get /unloading/{action_id} connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, this, [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString(); + PLOG(logERROR) << error_code; badResponse = true; loop->quit(); }); @@ -230,7 +230,7 @@ void WebServiceClient::pollUnloadingAction( QString action_id) { } int WebServiceClient::pollInspectionAction( QString action_id ) { - FILE_LOG(logERROR) << "Starting inspection action Polling"; + PLOG(logERROR) << "Starting inspection action Polling"; std::unique_ptr loop( new QEventLoop()); bool badResponse = true; @@ -241,15 +241,15 @@ int WebServiceClient::pollInspectionAction( QString action_id ) { // Call back for GET /inspection/{action_id} connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, [&](OAIInspectionStatus inspection) { inspection_status.reset( &inspection ); - FILE_LOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; + PLOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; badResponse = false; loop->quit(); }); // Error call back for /inspection/{action_id} connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { - FILE_LOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString(); - FILE_LOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString(); + PLOG(logERROR) << error_code; badResponse = true; loop->quit(); }); From a673a9ba208a3460cc11e424d3c2e785fd5dc6af Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Tue, 23 Nov 2021 10:31:13 -0500 Subject: [PATCH 06/17] Sonar Scanner issue fixes + Using auto instead of data type + Using const reference instead of copy by value + Consolidating logging to reduce Cognitive Complexity --- .../j2735_messages/J2735MessageFactory.hpp | 1 - .../src/PortDrayagePlugin.cpp | 195 +++++++----------- .../PortDrayagePlugin/src/PortDrayagePlugin.h | 14 +- 3 files changed, 80 insertions(+), 130 deletions(-) diff --git a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp index 22bd9ab3a..88609ec81 100644 --- a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp +++ b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp @@ -353,7 +353,6 @@ class J2735MessageFactory else // 64 < length < 128 bytes [0380XX00DD] msgIdindex = 3; } - std::cout<<"Extended bytes found\n"; } bytes.erase(bytes.begin(),bytes.begin()+msgIdindex); diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index da31c794a..ad81f77aa 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -72,16 +72,7 @@ void PortDrayagePlugin::UpdateConfigSettings() { driver = get_driver_instance(); con = driver->connect(connection_string,_database_username,_database_password); con->setSchema(_database_name); - - } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; - } - // Initialize PreparedStatements for MySQL - try { + // Initialize PreparedStatements for MySQL // Get next_action for given action_id next_action_id = con->prepareStatement("SELECT next_action FROM freight WHERE action_id = ? "); // Get current action for given action_id @@ -94,12 +85,13 @@ void PortDrayagePlugin::UpdateConfigSettings() { get_action_id_for_previous_action = con->prepareStatement("SELECT action_id FROM freight WHERE next_action = ? and operation = ? "); // Update next_action for an action with given action_id update_current_action = con->prepareStatement("UPDATE freight SET next_action = ? WHERE action_id = ?"); + } - catch( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; } } @@ -123,7 +115,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab ptree pr; // Create new PortDrayage_Object pointer - PortDrayage_Object *pd = new PortDrayage_Object(); + auto *pd = new PortDrayage_Object(); // Read strategy and operationParams strat << mobilityOperation->body.strategy.buf; @@ -133,66 +125,35 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab std::string strategy = strat.str(); if ( strategy.compare(PORT_DRAYAGE_STRATEGY) == 0 ){ try { - PLOG(logINFO) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf; - PLOG(logINFO) << "Body Strategy : " << mobilityOperation->body.strategy.buf; + PLOG(logINFO) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf + << std::endl << "Body Strategy : " << mobilityOperation->body.strategy.buf; // Convert JSON payload to PortDrayage_Object read_json(payload, pr); *pd = readPortDrayageJson( pr ); - - // Handle actions that require PortDrayage WebService Input - PLOG(logDEBUG) << "Operation is " << pd->operation << std::endl; - if ( pd->operation.compare("PICKUP") == 0 ) { - try{ - client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - PLOG(logDEBUG) << "Pickup Complete!" << std::endl; - - } - catch(std::exception &e) { - PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; - } - } - else if ( pd->operation.compare("DROPOFF") == 0) { - try{ - client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - PLOG(logDEBUG) << "Dropoff Complete!" << std::endl; - } - catch(std::exception &e) { - PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; - } - } - else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { - try{ - // If holding == 1 insert HOLDING action into table - int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); - if ( holding == 1 ) { - PLOG(logDEBUG) << "Requested futher inspection. Inserting Holding Action!" << std::endl; - insert_holding_action_into_table( *pd ); - } - else { - PLOG(logDEBUG) << "Checkpoint Action Complete!" << std::endl; - - } - } - catch(std::exception &e) { - PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; - } - } - else if ( pd->operation.compare("HOLDING_AREA") == 0) { - try{ - string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); - client->request_holding( previous_checkpoint_id ); - PLOG(logDEBUG) << "Holding Action Complete!" << std::endl; - - } - catch(std::exception &e) { - PLOG(logERROR) << "Error occurred during Qt Connection " << std::endl << e.what() << std::endl; - } - } - } catch( const ptree_error &e ) { PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; } + // Handle actions that require PortDrayage WebService Input + if ( pd->operation.compare("PICKUP") == 0 ) { + client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + } + else if ( pd->operation.compare("DROPOFF") == 0) { + client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + } + else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { + // If holding == 1 insert HOLDING action into table + int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); + if ( holding == 1 ) { + insert_holding_action_into_table( *pd ); + } + } + else if ( pd->operation.compare("HOLDING_AREA") == 0) { + string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); + client->request_holding( previous_checkpoint_id ); + } + + PLOG(logDEBUG) << "Port Drayage Message" << std::endl << "cmv_id : " << pd->cmv_id << std::endl << "cargo_id : " << pd->cargo_id << std::endl << @@ -231,10 +192,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab // Create XML MobilityOperationMessage ptree message = createMobilityOperationXml( payload ); std::stringstream content; - write_xml(content, message); - - PLOG(logINFO) << "XML outgoing message : " << std::endl << content.str(); - + write_xml(content, message); try { // Uper encode message container.load(content); @@ -253,25 +211,25 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab routeable_message *rMsg = dynamic_cast(msg.get()); BroadcastMessage(*rMsg); } - catch (J2735Exception &e) { + catch ( const J2735Exception &e) { PLOG(logERROR) << "Error occurred during message encoding " << std::endl << e.what() << std::endl; } } else { - PLOG(logERROR) << "Could not find action!" << std::endl; + PLOG(logWARNING) << "Could not find action!" << std::endl; } } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; } } } -ptree PortDrayagePlugin::createPortDrayageJson( PortDrayage_Object &pd_obj) { +ptree PortDrayagePlugin::createPortDrayageJson( const PortDrayage_Object &pd_obj) { ptree json_payload; json_payload.put("cmv_id", pd_obj.cmv_id ); json_payload.put("cargo_id", pd_obj.cargo_id ); @@ -285,7 +243,7 @@ ptree PortDrayagePlugin::createPortDrayageJson( PortDrayage_Object &pd_obj) { } -ptree PortDrayagePlugin::createMobilityOperationXml( ptree &json_payload ) { +ptree PortDrayagePlugin::createMobilityOperationXml( const ptree &json_payload ) { ptree mobilityOperationXml; std::stringstream pl; write_json( pl, json_payload); @@ -307,23 +265,19 @@ ptree PortDrayagePlugin::createMobilityOperationXml( ptree &json_payload ) { } -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std::string action_id ) { - PortDrayage_Object *rtn = new PortDrayage_Object(); +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction(const std::string &action_id ) { + auto *rtn = new PortDrayage_Object(); try{ // Set action_id next_action_id->setString(1,action_id); // Get current action - PLOG(logDEBUG) << "Getting next action for " << action_id << "." << std::endl; - sql::ResultSet *cur_action = next_action_id->executeQuery(); if ( cur_action->first() ) { std::string next = cur_action->getString("next_action"); - PLOG(logDEBUG) << "Column next_action: " << next << std::endl; // Set action_id to next_action current_action->setString(1,next); // Retrieve next action sql::ResultSet *cur_action = current_action->executeQuery(); - // Create PortDrayage_Object if ( cur_action->first() ) { rtn->cmv_id = cur_action->getString("cmv_id"); @@ -333,6 +287,7 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std rtn->destination_long = cur_action->getDouble("destination_long"); rtn->destination_lat = cur_action->getDouble("destination_lat"); rtn->next_action = cur_action->getString("next_action"); + PLOG(logDEBUG) << "Port Drayage Message : " << std::endl << "cmv_id : " << rtn->cmv_id << std::endl << "cargo_id : " << rtn->cargo_id << std::endl << @@ -348,21 +303,18 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction( std PLOG(logINFO) << "Last action completed! No action found with action id " << next << std::endl; } - return *rtn; - // Qt HttpClient setup } } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; - return *rtn; + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; } - + return *rtn; } -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( std::string cmv_id ) { - PortDrayage_Object *rtn = new PortDrayage_Object(); +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( const std::string &cmv_id ) { + auto *rtn = new PortDrayage_Object(); try{ // Set cmv_id first_action->setString(1,cmv_id); @@ -388,28 +340,27 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( st return *rtn; } else { - PortDrayage_Object *rtn = new PortDrayage_Object(); PLOG(logERROR) << "No first action for cmv_id : " << cmv_id << " found!"; return *rtn; } } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; return *rtn; } } -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( ptree &pr ) { - PortDrayage_Object *pd = new PortDrayage_Object(); +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( const ptree &pr ) { + auto *pd = new PortDrayage_Object(); try { pd->cmv_id = pr.get_child("cmv_id").get_value(); - boost::optional< ptree& > child = pr.get_child_optional( "action_id" ); + boost::optional child = pr.get_child_optional( "action_id" ); if( !child ) { PLOG(logINFO) << "No action_id present! This is the vehicle's first action" << std::endl; @@ -440,24 +391,24 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( pt } } -void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object ¤t_action ) { - PortDrayage_Object *next_action = new PortDrayage_Object; - PortDrayage_Object *cur_action = ¤t_action; +void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Object ¤t_action ) { + auto *next_action = new PortDrayage_Object; + // const PortDrayage_Object *cur_action = ¤t_action; try{ - *next_action = retrieveNextAction(cur_action->action_id); - PLOG(logDEBUG1) << "Insert Holding action between " << cur_action->action_id << " and " + *next_action = retrieveNextAction(current_action.action_id); + PLOG(logDEBUG1) << "Insert Holding action between " << current_action.action_id << " and " << next_action->action_id << "." << std::endl; //INSERT INTO FREIGHT VALUES(cmv_id,cargo_id,_holding_lat,_holding_lon,HOLDING, UUID(), next_action->action_id) - insert_action->setString(1,cur_action->cmv_id); - insert_action->setString(2,cur_action->cargo_id); + insert_action->setString(1,current_action.cmv_id); + insert_action->setString(2,current_action.cargo_id); insert_action->setDouble(3,_holding_lat); insert_action->setDouble(4,_holding_lon); insert_action->setString(5, "HOLDING_AREA"); insert_action->setString(6, next_action->action_id); PLOG(logDEBUG) << "Query : INSERT INTO FREIGHT VALUES(" - << cur_action->cmv_id << ", " << cur_action->cargo_id << ", " + << current_action.cmv_id << ", " << current_action.cargo_id << ", " << _holding_lat << ", " << _holding_lon << ", UUID(), HOLDING_AREA )" << std::endl; sql::ResultSet *res = insert_action->executeQuery(); if ( res->isFirst() ) { @@ -481,9 +432,9 @@ void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object &cu PLOG(logDEBUG1) << "Update Checkpoint next_action = Holding Action action_id" << std::endl; // UPDATE freight SET next_action = ? WHERE action_id = ? update_current_action->setString( 1, action_id); - update_current_action->setString( 2, cur_action->action_id); + update_current_action->setString( 2, current_action.action_id); PLOG(logDEBUG) << "Query : UPDATE freight SET next_action = " - << action_id << " WHERE action_id = " << cur_action->action_id << std::endl; + << action_id << " WHERE action_id = " << current_action.action_id << std::endl; res = update_current_action->executeQuery(); res->first(); if ( res->isFirst() ) { @@ -491,13 +442,13 @@ void PortDrayagePlugin::insert_holding_action_into_table( PortDrayage_Object &cu } } catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; } } -std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( std::string action_id ) { +std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( const std::string &action_id ) { try{ get_action_id_for_previous_action->setString(1, action_id); get_action_id_for_previous_action->setString(2, "PORT_CHECKPOINT"); @@ -513,9 +464,9 @@ std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( std::strin return action_id; } catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl; - PLOG(logERROR) << "Error code " << e.getErrorCode() << std::endl; - PLOG(logERROR) << "Error status " << e.getSQLState() << std::endl; + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; return ""; } } diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h index 35d90aa68..13a1eba07 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h @@ -80,14 +80,14 @@ class PortDrayagePlugin: public PluginClient { * @param pd_obj Port Drayage object. * @return json ptree */ - ptree createPortDrayageJson( PortDrayage_Object &pd_obj); + ptree createPortDrayageJson( const PortDrayage_Object &pd_obj); /** * Method to create MobilityOperation XML ptree. * * @param ptree json payload * @return MobilityOperation message XML ptree */ - ptree createMobilityOperationXml( ptree &json_payload); + ptree createMobilityOperationXml( const ptree &json_payload); /** * Handle MobilityOperation message. @@ -101,14 +101,14 @@ class PortDrayagePlugin: public PluginClient { * * @param action_id string */ - PortDrayage_Object retrieveNextAction( std::string action_id ); + PortDrayage_Object retrieveNextAction( const std::string &action_id ); /** * Retrieve first action from first_action table using cmv_id. * * @param cmv_id * @return PortDrayage_Object of first action */ - PortDrayage_Object retrieveFirstAction( std::string cmv_id ); + PortDrayage_Object retrieveFirstAction( const std::string &cmv_id ); /** * Create PortDrayage_Object from ptree JSON. @@ -116,7 +116,7 @@ class PortDrayagePlugin: public PluginClient { * @param pr PortDrayage JSON * @return PortDrayage_Object */ - PortDrayage_Object readPortDrayageJson( ptree &pr ); + PortDrayage_Object readPortDrayageJson( const ptree &pr ); /** * Dynamically inserts HOLDING_AREA action into mysql table between @@ -125,7 +125,7 @@ class PortDrayagePlugin: public PluginClient { * * @param current_action PORT_CHECKPOINT action */ - void insert_holding_action_into_table(PortDrayage_Object ¤t_action ); + void insert_holding_action_into_table(const PortDrayage_Object ¤t_action ); /** * Retrieves HOLDING_AREA action when provided with PORT_CHECKPOINT action @@ -133,7 +133,7 @@ class PortDrayagePlugin: public PluginClient { * * @return action_id of HOLDING_AREA action */ - std::string retrieve_holding_inspection_action_id( std::string action_id ); + std::string retrieve_holding_inspection_action_id( const std::string &action_id ); private: From 40d2a385948f29c1ce2f32a970e0bc3d41b72c96 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Tue, 23 Nov 2021 16:35:57 -0500 Subject: [PATCH 07/17] Sonar Scanner issue fixes + Consolidate log statements for Cognitive Complexity + Use const reference instead of copy by value for std::string + exit(1) to indicate error + added this to connect calls + Fix possible memory leak in PortDrayagePlugin HandleMobilityOperationMessage --- .../src/DsrcMessageManagerPlugin.cpp | 2 +- .../src/PortDrayagePlugin.cpp | 17 +++--- .../src/WebServiceClient.cpp | 59 +++++++++---------- .../PortDrayagePlugin/src/WebServiceClient.h | 12 ++-- 4 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp index 9a85bb6ed..bd0aed219 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp @@ -71,7 +71,7 @@ void DsrcMessageManagerPlugin::OnMessageReceived(IvpMessage *msg) { // Uncomment this line to call the base method, which prints the message received to cout. //PluginClient::OnMessageReceived(msg); - FILE_LOG(logERROR) << "Message Received " << + PLOG(logDEBUG) << "Message Received " << "Type: " << msg->type << ", Subtype: " << msg->subtype; if (!_configRead) { diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index ad81f77aa..74238d5cf 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -115,7 +115,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab ptree pr; // Create new PortDrayage_Object pointer - auto *pd = new PortDrayage_Object(); + std::unique_ptr pd( new PortDrayage_Object()); // Read strategy and operationParams strat << mobilityOperation->body.strategy.buf; @@ -144,6 +144,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { // If holding == 1 insert HOLDING action into table int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); + PLOG(logINFO) << "Inspection request completed" << std::endl; if ( holding == 1 ) { insert_holding_action_into_table( *pd ); } @@ -266,7 +267,7 @@ ptree PortDrayagePlugin::createMobilityOperationXml( const ptree &json_payload ) PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction(const std::string &action_id ) { - auto *rtn = new PortDrayage_Object(); + std::unique_ptr rtn( new PortDrayage_Object()); try{ // Set action_id next_action_id->setString(1,action_id); @@ -314,7 +315,7 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction(cons } PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( const std::string &cmv_id ) { - auto *rtn = new PortDrayage_Object(); + std::unique_ptr rtn( new PortDrayage_Object()); try{ // Set cmv_id first_action->setString(1,cmv_id); @@ -357,7 +358,7 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( co PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( const ptree &pr ) { - auto *pd = new PortDrayage_Object(); + std::unique_ptr pd( new PortDrayage_Object()); try { pd->cmv_id = pr.get_child("cmv_id").get_value(); boost::optional child = pr.get_child_optional( "action_id" ); @@ -382,18 +383,18 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( co } - return *pd; + return *pd.get(); } catch( const ptree_error &e ) { PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; - return *pd; + return *pd.get(); } } void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Object ¤t_action ) { - auto *next_action = new PortDrayage_Object; - // const PortDrayage_Object *cur_action = ¤t_action; + std::unique_ptr next_action( new PortDrayage_Object()); + // const PortDrayage_Object *cur_action = ¤t_action; TODO: Clean this up if not necessary try{ diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp index a3ee23aa3..b531a6803 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -5,10 +5,10 @@ WebServiceClient::WebServiceClient() { initialize("127.0.0.1", 8090, false, 5); } -WebServiceClient::WebServiceClient(std::string host, uint16_t port, bool secure , uint16_t polling_frequency ) { +WebServiceClient::WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ) { initialize(host, port, secure, polling_frequency); } -void WebServiceClient::initialize(std::string host, uint16_t port, bool secure , uint16_t polling_frequency) { +void WebServiceClient::initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency) { this->polling_frequency = polling_frequency; // Create URL @@ -34,7 +34,7 @@ void WebServiceClient::initialize(std::string host, uint16_t port, bool secure , } -void WebServiceClient::request_loading_action(std::string vehicle_id, std::string container_id, std::string action_id) { +void WebServiceClient::request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { std::unique_ptr req(new OAIContainerRequest ()); std::unique_ptr loop( new QEventLoop()); @@ -49,9 +49,8 @@ void WebServiceClient::request_loading_action(std::string vehicle_id, std::strin }); // Error call back for POST /loading/ connect(api.get(), &OAIDefaultApi::loadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /loading POST : " << error_str.toStdString(); - PLOG(logERROR) << error_code; - loop->quit(); + PLOG(logERROR) << "Failure /loading POST : " << error_str.toStdString() << std::endl << "Error Code" << error_code; + loop->exit(1); }); // Setup request @@ -68,7 +67,7 @@ void WebServiceClient::request_loading_action(std::string vehicle_id, std::strin } -void WebServiceClient::request_unloading_action(std::string vehicle_id, std::string container_id, std::string action_id) { +void WebServiceClient::request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { std::unique_ptr req(new OAIContainerRequest ()); std::unique_ptr loop( new QEventLoop()); @@ -83,9 +82,8 @@ void WebServiceClient::request_unloading_action(std::string vehicle_id, std::str }); // Error call back for POST /unloading/ connect(api.get(), &OAIDefaultApi::unloadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString(); - PLOG(logERROR) << error_code; - loop->quit(); + PLOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; + loop->exit(1); }); // Setup request @@ -102,7 +100,7 @@ void WebServiceClient::request_unloading_action(std::string vehicle_id, std::str } -int WebServiceClient::request_inspection(std::string vehicle_id, std::string container_id, std::string action_id ) { +int WebServiceClient::request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id ) { std::unique_ptr req(new OAIInspectionRequest()); std::unique_ptr loop( new QEventLoop()); @@ -117,9 +115,8 @@ int WebServiceClient::request_inspection(std::string vehicle_id, std::string con }); // Error call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString(); - PLOG(logERROR) << error_code; - loop->quit(); + PLOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString() << std::endl << "Error Code :" << error_code; + loop->exit(1); }); // Setup request @@ -135,7 +132,7 @@ int WebServiceClient::request_inspection(std::string vehicle_id, std::string con return pollInspectionAction( req->getActionId() ); } -void WebServiceClient::request_holding( std::string action_id ) { +void WebServiceClient::request_holding( const std::string &action_id ) { std::unique_ptr loop( new QEventLoop()); // Disconnect all duplicate signals @@ -149,9 +146,8 @@ void WebServiceClient::request_holding( std::string action_id ) { }); // Error call back for POST /inspection/ connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString(); - PLOG(logERROR) << error_code; - loop->quit(); + PLOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString()<< std::endl << "Error Code : " << error_code; + loop->exit(1); }); PLOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; api.get()->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); @@ -179,10 +175,9 @@ void WebServiceClient::pollLoadingAction( QString action_id ) { // Error call back for Get /loading/{action_id} connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, this, [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString(); - PLOG(logERROR) << error_code; + PLOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; badResponse = true; - loop->quit(); + loop->exit(1); }); // Flag to continue polling until receiving a non error response from server do { @@ -213,14 +208,13 @@ void WebServiceClient::pollUnloadingAction( QString action_id) { // Error call back for Get /unloading/{action_id} connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, this, [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString(); - PLOG(logERROR) << error_code; + PLOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; badResponse = true; - loop->quit(); + loop->exit(1); }); // Flag to continue polling until receiving a non error response from server do { - api.get()->unloadingActionIdGet( action_id ); + api->unloadingActionIdGet( action_id ); loop->exec(); // usleep coversion from seconds to microseconds usleep( polling_frequency * 1e6 ); @@ -230,28 +224,28 @@ void WebServiceClient::pollUnloadingAction( QString action_id) { } int WebServiceClient::pollInspectionAction( QString action_id ) { - PLOG(logERROR) << "Starting inspection action Polling"; + PLOG(logDEBUG) << "Starting inspection action Polling"; std::unique_ptr loop( new QEventLoop()); - bool badResponse = true; + // Disconnect all duplicate signals disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, nullptr, nullptr); disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, nullptr, nullptr); // Call back for GET /inspection/{action_id} - connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, [&](OAIInspectionStatus inspection) { + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, this , [&](OAIInspectionStatus inspection) { inspection_status.reset( &inspection ); PLOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; badResponse = false; loop->quit(); + PLOG(logDEBUG)<< "Loop quit called " << std::endl; }); // Error call back for /inspection/{action_id} - connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, this, [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString(); - PLOG(logERROR) << error_code; + PLOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; badResponse = true; - loop->quit(); + loop->exit(1); }); do { api->inspectionActionIdGet( action_id ); @@ -266,6 +260,7 @@ int WebServiceClient::pollInspectionAction( QString action_id ) { // usleep coversion from seconds to microseconds usleep( polling_frequency * 1e6 ); + } while( badResponse || (inspection_status->getStatus() != QString::fromStdString( "PASSED") && inspection_status->getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h index b0aa945bd..f87eecb9a 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h @@ -60,7 +60,7 @@ public slots: * @param secure bool flag set to true for using HTTPS * @param polling_frequency */ - void initialize(std::string host, uint16_t port, bool secure , uint16_t polling_frequency); + void initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency); public: @@ -79,7 +79,7 @@ public slots: * @param int polling frequency in seconds for action status * */ - WebServiceClient(std::string host, uint16_t port, bool secure , uint16_t polling_frequency ); + WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ); /** * Method to request a loading action. Sends a HTTP POST call to the loading endpoint of the PortDrayage Webservice and then @@ -89,7 +89,7 @@ public slots: * @param container_id static unique identifier for container * @param action_id static unique identifier for action */ - void request_loading_action(std::string vehicle_id, std::string container_id, std::string action_id); + void request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); /** * Method to request an unloading action. Sends a HTTP POST call to the unloading endpoint of the PortDrayage Webservice and then * polls the status of the request every 5 seconds. Method will exit once unloading action is completed. @@ -98,7 +98,7 @@ public slots: * @param container_id static unique identifier for the container * @param action_id static unique identifier for the action */ - void request_unloading_action(std::string vehicle_id, std::string container_id, std::string action_id); + void request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); /** * Method to request an inspection action. Sends a HTTP POST call to the inspection endpoint of the PortDrayage Webservice and then * polls the status of the request every 5 seconds. Method will exit once inspection action is completed or operator indicates the @@ -108,14 +108,14 @@ public slots: * @param container_id static unique identifier for container * @param action_id static unique identifier for the action */ - int request_inspection(std::string vehicle_id, std::string container_id, std::string action_id); + int request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); /** * Method request further inspection at the Holding area. Sends a HTTP POST call to inspection holding endpoint of the PortDrayage Webservice * and then poll the status of the request every 5 seconds. Method will exit once inspection action is completed. * * @param action_id static unique identifier for action */ - void request_holding(std::string action_id); + void request_holding(const std::string &action_id); }; From 7f6d74754ff18eef5c9d8f3292d5f85fcf9a9992 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Tue, 23 Nov 2021 17:08:13 -0500 Subject: [PATCH 08/17] Added fix for inspection/unloading post --- src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp index b531a6803..32b0e775b 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -200,7 +200,7 @@ void WebServiceClient::pollUnloadingAction( QString action_id) { disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, nullptr, nullptr); // Call back for Get /unloading/{action_id} connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, this, [&](OAIContainerActionStatus unloading_action) { - unloading_status.reset(&unloading_action); + unloading_status.reset( new OAIContainerActionStatus( unloading_action.asJson() ) ); PLOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); badResponse = false; loop->quit(); @@ -234,11 +234,10 @@ int WebServiceClient::pollInspectionAction( QString action_id ) { // Call back for GET /inspection/{action_id} connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, this , [&](OAIInspectionStatus inspection) { - inspection_status.reset( &inspection ); + inspection_status.reset( new OAIInspectionStatus( inspection.asJson() ) ); PLOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; badResponse = false; loop->quit(); - PLOG(logDEBUG)<< "Loop quit called " << std::endl; }); // Error call back for /inspection/{action_id} connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, this, From dd1698d153747d48fb2d6d16b2f01fc435303ef4 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Wed, 24 Nov 2021 09:42:10 -0500 Subject: [PATCH 09/17] Removed TODO and additional logging to decrease cognitive complexity --- .../PortDrayagePlugin/src/PortDrayagePlugin.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index 74238d5cf..69b47afe1 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -144,7 +144,6 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { // If holding == 1 insert HOLDING action into table int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); - PLOG(logINFO) << "Inspection request completed" << std::endl; if ( holding == 1 ) { insert_holding_action_into_table( *pd ); } @@ -394,8 +393,6 @@ PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( co void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Object ¤t_action ) { std::unique_ptr next_action( new PortDrayage_Object()); - // const PortDrayage_Object *cur_action = ¤t_action; TODO: Clean this up if not necessary - try{ *next_action = retrieveNextAction(current_action.action_id); @@ -412,11 +409,7 @@ void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Obje << current_action.cmv_id << ", " << current_action.cargo_id << ", " << _holding_lat << ", " << _holding_lon << ", UUID(), HOLDING_AREA )" << std::endl; sql::ResultSet *res = insert_action->executeQuery(); - if ( res->isFirst() ) { - PLOG(logDEBUG) << "Query Result : " << res->first()<< std::endl; - } - PLOG(logDEBUG1) << "Get Holding Action action_id." << std::endl; // SELECT action_id FROM freight WHERE next_action = ? and operation = ? get_action_id_for_previous_action->setString(1, next_action->action_id); get_action_id_for_previous_action->setString(2, "HOLDING_AREA"); @@ -430,17 +423,12 @@ void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Obje } std::string action_id = res->getString("action_id"); - PLOG(logDEBUG1) << "Update Checkpoint next_action = Holding Action action_id" << std::endl; // UPDATE freight SET next_action = ? WHERE action_id = ? update_current_action->setString( 1, action_id); update_current_action->setString( 2, current_action.action_id); PLOG(logDEBUG) << "Query : UPDATE freight SET next_action = " << action_id << " WHERE action_id = " << current_action.action_id << std::endl; res = update_current_action->executeQuery(); - res->first(); - if ( res->isFirst() ) { - PLOG(logDEBUG) << "Query Result : " << res->first() << std::endl; - } } catch ( sql::SQLException &e ) { PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl From 658ab7ebc84c8f267274e7fc4b499a58cce06e54 Mon Sep 17 00:00:00 2001 From: Paul K Bourelly Date: Wed, 24 Nov 2021 13:22:22 -0500 Subject: [PATCH 10/17] PR Improvements + Added Operation Enum and method to translate to string + Added constants for default constructor for WebServiceClient + Added comments for Class definitions and Header comm --- .../src/PortDrayagePlugin.cpp | 38 +++++------ .../PortDrayagePlugin/src/PortDrayagePlugin.h | 68 +++++++++++++++++-- .../src/WebServiceClient.cpp | 17 ++++- .../PortDrayagePlugin/src/WebServiceClient.h | 25 ++++++- 4 files changed, 120 insertions(+), 28 deletions(-) diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp index 69b47afe1..da15930d0 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -1,24 +1,24 @@ -//============================================================================ -// Name : PortDrayagePlugin.cpp -// Author : Paul Bourelly -// Version : 5.0 -// Copyright : Your copyright notice -// Description : PortDrayagePlugin provides freight trucks in a port with a -// list of actions to complete. On initial communication with V2X-Hub the -// freight truck will request it's first action. Upon completion of each action -// the freight truck will send the completed action to V2X-Hub and the PortDrayagePlugin -// will retrieve it's next action from a MySQL DB. -//============================================================================ - +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ #include "PortDrayagePlugin.h" namespace PortDrayagePlugin { - - - PortDrayagePlugin::PortDrayagePlugin(string name) : PluginClient(name) { // Plugin Handles MobilityOperation Messages @@ -135,20 +135,20 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; } // Handle actions that require PortDrayage WebService Input - if ( pd->operation.compare("PICKUP") == 0 ) { + if ( pd->operation.compare(operation_to_string(Operation::PICKUP)) == 0 ) { client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); } - else if ( pd->operation.compare("DROPOFF") == 0) { + else if ( pd->operation.compare(operation_to_string(Operation::DROPOFF)) == 0) { client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); } - else if ( pd->operation.compare("PORT_CHECKPOINT") == 0) { + else if ( pd->operation.compare(operation_to_string(Operation::CHECKPOINT)) == 0) { // If holding == 1 insert HOLDING action into table int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); if ( holding == 1 ) { insert_holding_action_into_table( *pd ); } } - else if ( pd->operation.compare("HOLDING_AREA") == 0) { + else if ( pd->operation.compare(operation_to_string(Operation::HOLDING)) == 0) { string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); client->request_holding( previous_checkpoint_id ); } diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h index 13a1eba07..c823ac3b3 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h @@ -1,3 +1,18 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ #ifndef SRC_PortDrayagePlugin_H_ #define SRC_PortDrayagePlugin_H_ #include "PluginClient.h" @@ -19,10 +34,6 @@ #include #include "WebServiceClient.h" - - - - using namespace std; using namespace tmx; using namespace tmx::utils; @@ -30,12 +41,55 @@ using namespace tmx::messages; using namespace boost::property_tree; using namespace OpenAPI; - - - namespace PortDrayagePlugin { +// constant for MobilityOperation strategy static CONSTEXPR const char *PORT_DRAYAGE_STRATEGY = "carma/port_drayage"; +// Enumeration for different operations +enum Operation { + PICKUP,DROPOFF,CHECKPOINT,HOLDING,ENTER_STAGING,EXIT_STAGING,ENTER_PORT,EXIT_PORT +}; + +std::string operation_to_string( Operation operation ) { + switch(operation) { + case PICKUP: + return "PICKUP"; + case DROPOFF: + return "DROPOFF"; + case CHECKPOINT: + return "PORT_CHECKPOINT"; + case HOLDING: + return "HOLDING_AREA"; + case ENTER_STAGING: + return "ENTER_STAGING_AREA"; + case EXIT_STAGING: + return "EXIT_STAGING_AREA"; + case ENTER_PORT: + return "ENTER_PORT"; + case EXIT_PORT: + return "EXIT_PORT"; + default: + return "INVALID_OPERATION"; + } +} +/** + * PortDrayagePlugin is a V2X-Hub plugin for automating Freight truck interactions for + * moving containers between and Port and a Staging Area. The plugin process MobilityOperation + * messages with the strategy PORT_DRAYAGE_STRATEGY. The payload of this MobilityOperation + * message is a JSON object consisting of mainly : + * action_id : unique identifier for the action + * vehicle_id : unique static identifier for the vehicle (NOT BSMID) + * operation : string enumeration describing the action that is to take place + * This Plugin requires a MySQL database with two table to store all vehicle action (table name: freight) and + * to store the first action for any given vehicle (table name : first_action). Upon initial communication + * with V2X-Hub the vehicle will just send an ENTER_STAGING_AREA actions with no action ID. When this initial + * message is received by V2X-Hub it will query the first_action table for the vehicle first action. Every action + * in the database is linked to a next action. Once the vehicle completes an action it notifies V2X-Hub of completion + * by sending out the action it just completed. V2X-Hub will then query the database for the next linked action + * + * @author Paul Bourelly + * @version 6.2 + */ class PortDrayagePlugin: public PluginClient { public: struct PortDrayage_Object { diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp index 32b0e775b..9227946ac 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -1,8 +1,23 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ #include "WebServiceClient.h" WebServiceClient::WebServiceClient() { - initialize("127.0.0.1", 8090, false, 5); + initialize(DEF_HOST, DEF_PORT, DEF_SECURITY, DEF_POLLING_FREQ); } WebServiceClient::WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ) { diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h index f87eecb9a..f0f835259 100644 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + #pragma once #include #include @@ -10,6 +26,12 @@ using namespace OpenAPI; using namespace tmx::utils; +// Default values for no arg constructor +static CONSTEXPR const char *DEF_HOST = "127.0.0.1"; +static CONSTEXPR const uint16_t DEF_PORT = 8090; +static CONSTEXPR const uint16_t DEF_POLLING_FREQ = 5; +static CONSTEXPR const bool DEF_SECURITY = false; + /** * WebService REST Client using OpenAPI codegen library pdclient found under V2X-Hub/ext/pdclient. Contains several method to * send POST requests for loading, unloading, and inspection actions and poll the action status. @@ -24,7 +46,8 @@ public slots: private: // Stored in Seconds uint16_t polling_frequency; - + + // OAIDefaultApi pointer std::shared_ptr api; std::shared_ptr loading_status; From 5d30733d8f9b9bf77968bd94df54538873bc621f Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Fri, 3 Dec 2021 13:00:50 -0500 Subject: [PATCH 11/17] 279 integrate port drayage webservice ci cd (#281) * Issue-279: Added Port Drayage Webservice to CI/CD + Added Dockerfile to create Port Drayage Webservice image + Added circleci workflow to build Port Drayage Webservice and push image * Issue-279: Fixed CircleCI and Docker-compose + Added Port Drayage Web Service to docker-compose + Fixed docker build in circle ci for Port Drayage Web Service * Issue-279: Fixed CircleCI base image for Port Drayage maven build * Issue-279: CircleCI Docker build fix * Issue-279: CircleCI fix * Issue-279:CircleCI Fix * Issue-279: Running Docker daemon in CircleCI * Issue-279: Sudo for starting daemon * Issue-279: Remote Docker setup * Issue-279:Correct circleCI script format * Issue-279: CircleCI navigate to correct directory * Issue-279: Release Updates + Updated default and starting config for DRSCImmediateForwardPlugin to include mobility operation message by default. + Added sql files for verification test at suntrax --- .circleci/config.yml | 51 +++++++++++ configuration/amd64/docker-compose.yml | 4 + configuration/amd64/mysql/localhost.sql | 2 +- .../mysql/suntrax/port_area_operations.sql | 90 ++++++++++++++++++ .../mysql/suntrax/staging_area_operations.sql | 91 +++++++++++++++++++ configuration/arm64/docker-compose.yml | 6 +- tools/port-drayage-webservice/.dockerignore | 9 ++ tools/port-drayage-webservice/Dockerfile | 5 + 8 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 configuration/amd64/mysql/suntrax/port_area_operations.sql create mode 100644 configuration/amd64/mysql/suntrax/staging_area_operations.sql create mode 100644 tools/port-drayage-webservice/.dockerignore create mode 100644 tools/port-drayage-webservice/Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 75b665fd5..ca7e2700a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -189,6 +189,49 @@ jobs: command: | echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin docker push usdotfhwaops/v2xhubarm:latest + port_drayage_webservice_build_develop : + docker: + - image: cimg/openjdk:11.0.12 + # Set working directory + working_directory: "/home/V2X-Hub" + steps: + - setup_remote_docker + - checkout + - run: + name: Maven Build JAR + # Build Port Drayage Web Service + command: | + cd tools/port-drayage-webservice/ + mvn clean install + - run: + name: Build Docker Image and Push + # Build and push Port Drayage Web Service Docker images + command: | + cd tools/port-drayage-webservice/ + docker build -t usdotfhwaops/port-drayage-webservice:latest . + echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin + docker push usdotfhwaops/port-drayage-webservice:latest + port_drayage_webservice_build : + docker: + - image: cimg/openjdk:11.0.12 + # Set working directory + steps: + - setup_remote_docker + - checkout + - run: + name: Maven Build JAR + # Build Port Drayage Web Service + command: | + cd tools/port-drayage-webservice/ + mvn clean install + - run: + name: Build Docker Image and Push + # Build and push Port Drayage Web Service Docker images + command: | + cd tools/port-drayage-webservice/ + docker build -t usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} . + echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin + docker push usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} workflows: version: 2 build: @@ -215,5 +258,13 @@ workflows: - sonar-scanner_develop: requires: - docker_build_push_develop + - port_drayage_webservice_build_develop: + filters: + branches: + only: develop + - port_drayage_webservice_build: + filters: + branches: + ignore: develop diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index 354284c12..3e11f945e 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -41,6 +41,10 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP + port_drayage_webservice: + image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + container_name: port_drayage_webservice + network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/amd64/mysql/localhost.sql b/configuration/amd64/mysql/localhost.sql index 12b072cc7..06d9abcf4 100644 --- a/configuration/amd64/mysql/localhost.sql +++ b/configuration/amd64/mysql/localhost.sql @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; diff --git a/configuration/amd64/mysql/suntrax/port_area_operations.sql b/configuration/amd64/mysql/suntrax/port_area_operations.sql new file mode 100644 index 000000000..abeb6e478 --- /dev/null +++ b/configuration/amd64/mysql/suntrax/port_area_operations.sql @@ -0,0 +1,90 @@ +-- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.36 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_A',28.1119763,-81.8312035,'DROPOFF','67eadd3a-38b4-11ec-930a-000145098e4f','0bf7ebda-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1117373,-81.8309654,'PICKUP','0bf7ebda-38b5-11ec-930a-000145098e4f','9230504d-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','9230504d-38b5-11ec-930a-000145098e4f','511ad052-38b6-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','511ad052-38b6-11ec-930a-000145098e4f','fc15d52a-3c0c-11ec-b00d-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_A',28.1119763,-81.8312035,'DROPOFF','c9bba171-52c2-11ec-9105-000145098e4f','8e1d456a-52c3-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1117373,-81.8309654,'PICKUP','8e1d456a-52c3-11ec-9105-000145098e4f','744be658-52c4-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','744be658-52c4-11ec-9105-000145098e4f','a4b419b9-52c5-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','a4b419b9-52c5-11ec-9105-000145098e4f','20b546e3-52c6-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-12-03 11:03:12 diff --git a/configuration/amd64/mysql/suntrax/staging_area_operations.sql b/configuration/amd64/mysql/suntrax/staging_area_operations.sql new file mode 100644 index 000000000..7332feb90 --- /dev/null +++ b/configuration/amd64/mysql/suntrax/staging_area_operations.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.36 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES ('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','66bba4cb-52c1-11ec-9105-000145098e4f','84f6b797-52c2-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-12-03 11:25:03 diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index faf42f067..d00bc28f6 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -30,7 +30,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubarm:latest + image: usdotfhwaops/v2xhubarm:v2xrelease_6.2 container_name: v2xhub network_mode: host restart: always @@ -43,6 +43,10 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP + port_drayage_webservice: + image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + container_name: port_drayage_webservice + network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/tools/port-drayage-webservice/.dockerignore b/tools/port-drayage-webservice/.dockerignore new file mode 100644 index 000000000..b2be670ee --- /dev/null +++ b/tools/port-drayage-webservice/.dockerignore @@ -0,0 +1,9 @@ +src/ +target/classes/ +target/generated-soures/ +target/generated-test-sources/ +target/maven-archiver/ +target/site/ +target/surefire-reports/ +target/test-classes/ +target/jacoco.exec diff --git a/tools/port-drayage-webservice/Dockerfile b/tools/port-drayage-webservice/Dockerfile new file mode 100644 index 000000000..f10c360d8 --- /dev/null +++ b/tools/port-drayage-webservice/Dockerfile @@ -0,0 +1,5 @@ +FROM adoptopenjdk/openjdk11:alpine-jre +RUN mkdir ~/port-drayage-webservice/ +COPY ./target/port-drayage-webservice-0.0.1-SNAPSHOT.jar ~/port-drayage-webservice/ +WORKDIR ~/port-drayage-webservice/ +ENTRYPOINT ["java","-jar","port-drayage-webservice-0.0.1-SNAPSHOT.jar"] \ No newline at end of file From dae4f7f7ef4182401f78f7e5d8c1ee4fab4fac1b Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Fri, 3 Dec 2021 14:18:36 -0500 Subject: [PATCH 12/17] Added button to clear all actions in web-service (#282) + This allows repeated demonstrations of one set of actions with given actions IDs with requiring web-service restart. --- .../leidos/controller/ResetController.java | 50 +++++++++++++++++++ .../leidos/inspection/InspectionActions.java | 13 ++++- .../com/leidos/loading/LoadingActions.java | 11 ++++ .../leidos/unloading/UnloadingActions.java | 10 ++++ .../resources/port-drayage-webservice.yml | 8 +++ .../src/main/resources/templates/index.html | 41 +++++++++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java new file mode 100644 index 000000000..f054d9f03 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java @@ -0,0 +1,50 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.ResetApi; +import com.leidos.inspection.InspectionActions; +import com.leidos.loading.LoadingActions; +import com.leidos.unloading.UnloadingActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +public class ResetController implements ResetApi { + + private static Logger logger = LoggerFactory.getLogger(ResetController.class); + + /** + * Injected {@link LoadingActions} Spring Bean + */ + @Autowired + private LoadingActions loadingActions; + + /** + * Injected {@link UnloadingActions} Spring Bean + */ + @Autowired + private UnloadingActions unloadingActions; + + /** + * Injected {@link InspectionActions} Spring Bean + */ + @Autowired + private InspectionActions inspectionActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity resetPost() { + inspectionActions.clear(); + unloadingActions.clear(); + loadingActions.clear(); + logger.warn("Web Service Actions were cleared!"); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java index 58368ee2e..fb7c90140 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java @@ -22,7 +22,7 @@ * @author Paul Bourelly */ @Component -public class InspectionActions implements InspectionApi { +public class InspectionActions { private static Logger logger = LoggerFactory.getLogger(InspectionActions.class); @@ -191,4 +191,15 @@ public void requestHolding() { logger.warn("No current inspection in progress!"); } + /** + * Clear all inspection actions + */ + public void clear() { + if ( pendingInspections.getInspections() != null ) + pendingInspections.getInspections().clear(); + if ( completedInspections.getInspections() != null ) + completedInspections.getInspections().clear(); + currentInspection = null; + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java index 299e6b905..97c3683ac 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java @@ -171,4 +171,15 @@ public void completeCurrentAction() { } + /** + * Clear all loading actions + */ + public void clear() { + if ( pendingActions.getActions() != null ) + pendingActions.getActions().clear(); + if ( completedActions.getActions() != null ) + completedActions.getActions().clear(); + currentAction = null; + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java index 9987acb79..29692e0e1 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java @@ -167,4 +167,14 @@ public void completeCurrentAction() { } + /** + * Clear all unloading actions + */ + public void clear() { + if ( pendingActions.getActions() != null ) + pendingActions.getActions().clear(); + if ( completedActions.getActions() != null ) + completedActions.getActions().clear(); + currentAction = null; + } } diff --git a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml index c77be3c91..c8a30edfe 100755 --- a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml +++ b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml @@ -9,6 +9,14 @@ servers: - url: https://127.0.0.1:8443 description: Secured hosting for deployment paths: + /reset: + post: + summary: Clear Web Service Actions + description: + Request will clear all actions in InspectionActions, LoadingActions, and UnloadingActions. + responses: + "201": + description: Created /loading: post: summary: Request a container is loaded on to freight vehicle. diff --git a/tools/port-drayage-webservice/src/main/resources/templates/index.html b/tools/port-drayage-webservice/src/main/resources/templates/index.html index 20afe2ac7..bc02e3020 100644 --- a/tools/port-drayage-webservice/src/main/resources/templates/index.html +++ b/tools/port-drayage-webservice/src/main/resources/templates/index.html @@ -29,6 +29,31 @@
+ + + + + @@ -66,6 +91,22 @@ }); + From 93ac2e6e6671a427809f942c5ea2e0d10ef1d509 Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Sun, 5 Dec 2021 18:14:45 -0500 Subject: [PATCH 13/17] V2xrelease 6.2 (#283) * Creating smaller deployment image Lightweight Docker Container Remove mysql calls Issue-255: Create lightweight docker image + added .dockerignore and modified dockerfile Issue-255: Dockerfile-dev Issue-255: CircleCI arm lightweight build * Issue-255: Added +x permissions to container scripts * Issue-255: Remove unnecessary checkoutstep * Issue-255: Rm git files from dockerignore. * Issue-255: Remove git files from build context + Remove checkout step from CircleCI sonar-scanner workflow * Issue-255:Rename dockerfile * Issue-255:SonarScanner needs git files * Issue-255:Dockerfile WRKDIR necessary for run script * Issue-257:Fix logging * Preemption sonar issues (#260) * init * init * test * update * update * update * update * update * update * update * update * merge Master to develop for hotfix6.1 (#266) * Merge develop to release6.1 (#259) * Creating smaller deployment image Lightweight Docker Container Remove mysql calls Issue-255: Create lightweight docker image + added .dockerignore and modified dockerfile Issue-255: Dockerfile-dev Issue-255: CircleCI arm lightweight build * Issue-255: Added +x permissions to container scripts * Issue-255: Remove unnecessary checkoutstep * Issue-255: Rm git files from dockerignore. * Issue-255: Remove git files from build context + Remove checkout step from CircleCI sonar-scanner workflow * Issue-255:Rename dockerfile * Issue-255:SonarScanner needs git files * Issue-255:Dockerfile WRKDIR necessary for run script * Issue-257:Fix logging Co-authored-by: Paul K Bourelly * Update Release_notes.md Co-authored-by: dan-du-car <62157949+dan-du-car@users.noreply.github.com> Co-authored-by: Paul K Bourelly * Merge Carma freight to release branch for 6.2 hotfix (#275) * Issue-179: MobilityOperation plugin msg parse and parse MobilityOperation Plugin consumes port_drayage messages and queries PORT_DRAYAGE mysql DB for next action. Then forwards this message using the DSRCMessageManager plugin Issue-179:Docker-compose load port_drayage db Issue-179:Const string strategy Issue-179:DB name config and const string for Strat Issue-179: Fix long/lat to ints, fixed outgoing json * CF-143: Update Message schema, tables and logic CF-143 In progress CF-143: save point Save point fixed port_drayage.sql CF-143: Edited database tables and added new action with destination CF-143: Fixed and clean logic for new message schema CF-143: PR comments addressed * CF-189:Integration testing updates * Change MobilityOperationPlugin to CARMAFreightPlugin Updated localhost.sql files with new plugin name Edited header to remove mobilityoperationplugin name * Rename to PortDrayagePlugin + Fix segfault with not found actions + Fix CMakefile + Fix sql file to only include necessary information Added Dockerfile Fix retrieve action variable names and added if statment back * Rebase on develop fixes * Adding PortDrayage Webservice Maven Springboot proj * Save point * Save Point * Save Point * UI updates included TODO Better code commenting * Remove PortDrayage WebService Client code. * Remove PDClient build from dockerfile * Added PR Comments + Updates openapi endpoint description + Added checks for duplicate request to REST controllers + fixed HTML table column name + Comments for application.properties + updated docker-compose + More unit test coverage * Save Point * Initial Testing attempt * Onsite fixes plus logging for holding action insert * Updated lightweight dockerfile * Fix for holding confirmation * Logging fix * Rebase and PR prep * PR prep and cleanup * PR Comments + Added do while loops + Created global pointer for WebserviceClient * PR build issue fixes + Dowhile fix + qapplication fix * PR bug fixes + Using WebServiceClient pointer + Using local variables for REST response + Remove getter methods for client + Boolean flag for retry with bad responses * Added PortDrayagePlugin to sonar-scanner.properties Co-authored-by: Paul K Bourelly Co-authored-by: dan-du-car <62157949+dan-du-car@users.noreply.github.com> * Release Candidate fixes * Fixed Logging for V2X-Hub * Sonar Scanner issue fixes + Using auto instead of data type + Using const reference instead of copy by value + Consolidating logging to reduce Cognitive Complexity * Sonar Scanner issue fixes + Consolidate log statements for Cognitive Complexity + Use const reference instead of copy by value for std::string + exit(1) to indicate error + added this to connect calls + Fix possible memory leak in PortDrayagePlugin HandleMobilityOperationMessage * Added fix for inspection/unloading post * Removed TODO and additional logging to decrease cognitive complexity * PR Improvements + Added Operation Enum and method to translate to string + Added constants for default constructor for WebServiceClient + Added comments for Class definitions and Header comm * 279 integrate port drayage webservice ci cd (#281) * Issue-279: Added Port Drayage Webservice to CI/CD + Added Dockerfile to create Port Drayage Webservice image + Added circleci workflow to build Port Drayage Webservice and push image * Issue-279: Fixed CircleCI and Docker-compose + Added Port Drayage Web Service to docker-compose + Fixed docker build in circle ci for Port Drayage Web Service * Issue-279: Fixed CircleCI base image for Port Drayage maven build * Issue-279: CircleCI Docker build fix * Issue-279: CircleCI fix * Issue-279:CircleCI Fix * Issue-279: Running Docker daemon in CircleCI * Issue-279: Sudo for starting daemon * Issue-279: Remote Docker setup * Issue-279:Correct circleCI script format * Issue-279: CircleCI navigate to correct directory * Issue-279: Release Updates + Updated default and starting config for DRSCImmediateForwardPlugin to include mobility operation message by default. + Added sql files for verification test at suntrax * Added button to clear all actions in web-service (#282) + This allows repeated demonstrations of one set of actions with given actions IDs with requiring web-service restart. Co-authored-by: Paul K Bourelly Co-authored-by: dan-du-car <62157949+dan-du-car@users.noreply.github.com> Co-authored-by: Sudhakar Nallamothu Co-authored-by: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> --- .circleci/config.yml | 51 + .gitignore | 8 +- .sonarqube/sonar-scanner.properties | 7 +- Dockerfile | 9 +- configuration/amd64/docker-compose.yml | 7 +- configuration/amd64/mysql/localhost.sql | 32 +- configuration/amd64/mysql/port_drayage.sql | 91 ++ .../mysql/suntrax/port_area_operations.sql | 90 ++ .../mysql/suntrax/staging_area_operations.sql | 91 ++ configuration/arm64/docker-compose.yml | 9 +- configuration/arm64/mysql/localhost.sql | 32 +- configuration/arm64/mysql/port_drayage.sql | 91 ++ container/service.sh | 2 +- docker/Dockerfile-depl | 12 +- ext/pdclient/CMakeLists.txt | 42 + ext/pdclient/OAIActionStatusList.cpp | 100 ++ ext/pdclient/OAIActionStatusList.h | 62 + ext/pdclient/OAIContainerActionStatus.cpp | 250 ++++ ext/pdclient/OAIContainerActionStatus.h | 106 ++ ext/pdclient/OAIContainerRequest.cpp | 160 +++ ext/pdclient/OAIContainerRequest.h | 79 ++ ext/pdclient/OAIDefaultApi.cpp | 1175 +++++++++++++++++ ext/pdclient/OAIDefaultApi.h | 244 ++++ ext/pdclient/OAIEnum.h | 63 + ext/pdclient/OAIHelpers.cpp | 426 ++++++ ext/pdclient/OAIHelpers.h | 275 ++++ ext/pdclient/OAIHttpFileElement.cpp | 155 +++ ext/pdclient/OAIHttpFileElement.h | 47 + ext/pdclient/OAIHttpRequest.cpp | 505 +++++++ ext/pdclient/OAIHttpRequest.h | 113 ++ ext/pdclient/OAIInspectionRequest.cpp | 160 +++ ext/pdclient/OAIInspectionRequest.h | 79 ++ ext/pdclient/OAIInspectionStatus.cpp | 250 ++++ ext/pdclient/OAIInspectionStatus.h | 106 ++ ext/pdclient/OAIInspectionStatusList.cpp | 100 ++ ext/pdclient/OAIInspectionStatusList.h | 62 + ext/pdclient/OAIObject.h | 65 + ext/pdclient/OAIServerConfiguration.h | 82 ++ ext/pdclient/OAIServerVariable.h | 58 + ext/pdclient/client.pri | 35 + .../j2735_messages/J2735MessageFactory.hpp | 2 - src/tmx/TmxCore/src/ivpcore.cpp | 2 +- src/tmx/TmxCtl/src/lib/PluginConfig.cpp | 14 - src/tmx/TmxCtl/src/lib/PluginStatus.cpp | 39 +- src/tmx/TmxCtl/src/lib/TmxControl.h | 3 +- src/tmx/TmxUtils/src/Logger.h | 4 +- .../DsrcImmediateForwardPlugin/manifest.json | 2 +- .../src/DsrcMessageManagerPlugin.cpp | 3 +- .../MobilityOperationPlugin/CMakeLists.txt | 5 - .../MobilityOperationPlugin/manifest.json | 23 - .../src/MobilityOperationPlugin.cpp | 86 -- .../src/MobilityOperationPlugin.h | 33 - src/v2i-hub/PortDrayagePlugin/CMakeLists.txt | 24 + src/v2i-hub/PortDrayagePlugin/manifest.json | 78 ++ .../src/PortDrayagePlugin.cpp | 491 +++++++ .../PortDrayagePlugin/src/PortDrayagePlugin.h | 223 ++++ .../src/WebServiceClient.cpp | 284 ++++ .../PortDrayagePlugin/src/WebServiceClient.h | 144 ++ .../PreemptionPlugin/src/PreemptionPlugin.cpp | 10 +- .../PreemptionPlugin/src/PreemptionPlugin.hpp | 2 +- .../src/include/PreemptionPluginWorker.cpp | 57 +- .../src/include/PreemptionPluginWorker.hpp | 16 +- .../PreemptionPlugin/test/PreemptionTest.cpp | 2 +- tools/port-drayage-webservice/.dockerignore | 9 + tools/port-drayage-webservice/Dockerfile | 5 + tools/port-drayage-webservice/pom.xml | 140 ++ .../src/main/java/com/leidos/Application.java | 25 + .../WebApplicationConfiguration.java | 27 + .../controller/InspectionController.java | 123 ++ .../leidos/controller/LoadingController.java | 105 ++ .../leidos/controller/ResetController.java | 50 + .../controller/UnloadingController.java | 104 ++ .../controller/UserInterfaceController.java | 32 + .../leidos/inspection/InspectionActions.java | 205 +++ .../com/leidos/loading/LoadingActions.java | 185 +++ .../leidos/unloading/UnloadingActions.java | 180 +++ .../src/main/resources/application.properties | 30 + .../resources/port-drayage-webservice.yml | 427 ++++++ .../src/main/resources/static/css/main.css | 0 .../main/resources/templates/_inspection.html | 117 ++ .../main/resources/templates/_loading.html | 115 ++ .../main/resources/templates/_unloading.html | 114 ++ .../src/main/resources/templates/index.html | 115 ++ .../controller/InspectionControllerTest.java | 212 +++ .../controller/LoadingControllerTest.java | 159 +++ .../controller/UnloadingControllerTest.java | 160 +++ .../inspection/InspectionActionsTest.java | 194 +++ .../leidos/loading/LoadingActionsTest.java | 155 +++ .../unloading/UnloadingActionsTest.java | 150 +++ 89 files changed, 9739 insertions(+), 277 deletions(-) create mode 100644 configuration/amd64/mysql/port_drayage.sql create mode 100644 configuration/amd64/mysql/suntrax/port_area_operations.sql create mode 100644 configuration/amd64/mysql/suntrax/staging_area_operations.sql create mode 100644 configuration/arm64/mysql/port_drayage.sql create mode 100644 ext/pdclient/CMakeLists.txt create mode 100644 ext/pdclient/OAIActionStatusList.cpp create mode 100644 ext/pdclient/OAIActionStatusList.h create mode 100644 ext/pdclient/OAIContainerActionStatus.cpp create mode 100644 ext/pdclient/OAIContainerActionStatus.h create mode 100644 ext/pdclient/OAIContainerRequest.cpp create mode 100644 ext/pdclient/OAIContainerRequest.h create mode 100644 ext/pdclient/OAIDefaultApi.cpp create mode 100644 ext/pdclient/OAIDefaultApi.h create mode 100644 ext/pdclient/OAIEnum.h create mode 100644 ext/pdclient/OAIHelpers.cpp create mode 100644 ext/pdclient/OAIHelpers.h create mode 100644 ext/pdclient/OAIHttpFileElement.cpp create mode 100644 ext/pdclient/OAIHttpFileElement.h create mode 100644 ext/pdclient/OAIHttpRequest.cpp create mode 100644 ext/pdclient/OAIHttpRequest.h create mode 100644 ext/pdclient/OAIInspectionRequest.cpp create mode 100644 ext/pdclient/OAIInspectionRequest.h create mode 100644 ext/pdclient/OAIInspectionStatus.cpp create mode 100644 ext/pdclient/OAIInspectionStatus.h create mode 100644 ext/pdclient/OAIInspectionStatusList.cpp create mode 100644 ext/pdclient/OAIInspectionStatusList.h create mode 100644 ext/pdclient/OAIObject.h create mode 100644 ext/pdclient/OAIServerConfiguration.h create mode 100644 ext/pdclient/OAIServerVariable.h create mode 100644 ext/pdclient/client.pri delete mode 100644 src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt delete mode 100644 src/v2i-hub/MobilityOperationPlugin/manifest.json delete mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp delete mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h create mode 100644 src/v2i-hub/PortDrayagePlugin/CMakeLists.txt create mode 100644 src/v2i-hub/PortDrayagePlugin/manifest.json create mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp create mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h create mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp create mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h create mode 100644 tools/port-drayage-webservice/.dockerignore create mode 100644 tools/port-drayage-webservice/Dockerfile create mode 100644 tools/port-drayage-webservice/pom.xml create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/Application.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java create mode 100644 tools/port-drayage-webservice/src/main/resources/application.properties create mode 100755 tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml create mode 100644 tools/port-drayage-webservice/src/main/resources/static/css/main.css create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_inspection.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_loading.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_unloading.html create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/index.html create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java create mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java diff --git a/.circleci/config.yml b/.circleci/config.yml index 75b665fd5..ca7e2700a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -189,6 +189,49 @@ jobs: command: | echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin docker push usdotfhwaops/v2xhubarm:latest + port_drayage_webservice_build_develop : + docker: + - image: cimg/openjdk:11.0.12 + # Set working directory + working_directory: "/home/V2X-Hub" + steps: + - setup_remote_docker + - checkout + - run: + name: Maven Build JAR + # Build Port Drayage Web Service + command: | + cd tools/port-drayage-webservice/ + mvn clean install + - run: + name: Build Docker Image and Push + # Build and push Port Drayage Web Service Docker images + command: | + cd tools/port-drayage-webservice/ + docker build -t usdotfhwaops/port-drayage-webservice:latest . + echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin + docker push usdotfhwaops/port-drayage-webservice:latest + port_drayage_webservice_build : + docker: + - image: cimg/openjdk:11.0.12 + # Set working directory + steps: + - setup_remote_docker + - checkout + - run: + name: Maven Build JAR + # Build Port Drayage Web Service + command: | + cd tools/port-drayage-webservice/ + mvn clean install + - run: + name: Build Docker Image and Push + # Build and push Port Drayage Web Service Docker images + command: | + cd tools/port-drayage-webservice/ + docker build -t usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} . + echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin + docker push usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} workflows: version: 2 build: @@ -215,5 +258,13 @@ workflows: - sonar-scanner_develop: requires: - docker_build_push_develop + - port_drayage_webservice_build_develop: + filters: + branches: + only: develop + - port_drayage_webservice_build: + filters: + branches: + ignore: develop diff --git a/.gitignore b/.gitignore index 642afb16f..c4ca36aec 100644 --- a/.gitignore +++ b/.gitignore @@ -76,4 +76,10 @@ Thumbs.db *.app #docker-compose variables -.env \ No newline at end of file +.env + +#Maven build directory +tools/port-drayage-webservice/target/ + +#Java PKS for HTTPS setup +tools/port-drayage-webservice/src/main/resources/tutorial.jks diff --git a/.sonarqube/sonar-scanner.properties b/.sonarqube/sonar-scanner.properties index 334ba3ebb..9bbb4a3ab 100644 --- a/.sonarqube/sonar-scanner.properties +++ b/.sonarqube/sonar-scanner.properties @@ -47,7 +47,7 @@ sonar.modules= PedestrianPlugin, \ TmxTools, \ MessageLoggerPlugin, \ CommandPlugin, \ - MobilityOperationPlugin, \ + PortDrayagePlugin, \ ODELoggerPlugin, \ DsrcImmediateForwardPlugin, \ MessageReceiverPlugin @@ -61,7 +61,7 @@ TmxUtils.sonar.projectBaseDir =/home/V2X-Hub/src/tmx/TmxUtils CARMACloudPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CARMACloudPlugin CommandPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CommandPlugin CswPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CswPlugin -MobilityOperationPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MobilityOperationPlugin +PortDrayagePlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/PortDrayagePlugin ODELoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/ODELoggerPlugin MessageLoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MessageLoggerPlugin DmsPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/DmsPlugin @@ -85,6 +85,7 @@ TmxTools.sonar.sources =src TmxUtils.sonar.sources =src MessageLoggerPlugin.sonar.sources =src CswPlugin.sonar.sources =src +PortDrayagePlugin.sonar.sources =src DmsPlugin.sonar.sources =src DsrcImmediateForwardPlugin.sonar.sources =src LocationPlugin.sonar.sources =src @@ -113,6 +114,7 @@ MobilityOperationPlugin.sonar.sources =src TmxUtils.sonar.cfamily.gcov.reportsPath =coverage #MessageLoggerPlugin.sonar.cfamily.gcov.reportsPath =coverage #CswPlugin.sonar.cfamily.gcov.reportsPath =coverage +#PortDrayagePlugin.sonar.cfamily.gcov.reportsPath =coverage #DmsPlugin.sonar.cfamily.gcov.reportsPath =coverage #DsrcImmediateForwardPlugin.sonar.cfamily.gcov.reportsPath =coverage #LocationPlugin.sonar.cfamily.gcov.reportsPath =coverage @@ -138,6 +140,7 @@ TmxUtils.sonar.tests=test #TmxTools.sonar.tests=test #MessageLoggerPlugin.sonar.tests=test #CswPlugin.sonar.tests=test +#PortDrayagePlugin.sonar.tests=test #DmsPlugin.sonar.tests=test #DsrcImmediateForwardPlugin.sonar.tests=test #LocationPlugin.sonar.tests=test diff --git a/Dockerfile b/Dockerfile index 0085b6fb2..e483c6e53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,11 @@ RUN make install WORKDIR /home/V2X-Hub/ext/ccserver RUN cmake . RUN make +RUN make install + +WORKDIR /home/V2X-Hub/ext/pdclient +RUN cmake . +RUN make RUN make install ### setup and install v2x-hub core and plugins @@ -101,8 +106,8 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json -RUN ln -s ../bin MobilityOperationPlugin/bin -RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json +RUN ln -s ../bin PortDrayagePlugin/bin +RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index da7f207f3..3e11f945e 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -16,6 +16,7 @@ services: - mysql_root_password volumes: - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql + - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql php: image: usdotfhwaops/php:latest @@ -27,7 +28,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:latest + image: usdotfhwaops/v2xhubamd:v2xrelease_6.2 container_name: v2xhub network_mode: host restart: always @@ -40,6 +41,10 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP + port_drayage_webservice: + image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + container_name: port_drayage_webservice + network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/amd64/mysql/localhost.sql b/configuration/amd64/mysql/localhost.sql index 0430a75cf..06d9abcf4 100644 --- a/configuration/amd64/mysql/localhost.sql +++ b/configuration/amd64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) -- --- Host: localhost Database: IVP +-- Host: 127.0.0.1 Database: IVP -- ------------------------------------------------------ --- Server version 5.7.34 +-- Server version 5.7.35 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); +INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-06-23 23:52:23 +-- Dump completed on 2021-08-25 13:36:29 diff --git a/configuration/amd64/mysql/port_drayage.sql b/configuration/amd64/mysql/port_drayage.sql new file mode 100644 index 000000000..eccdb199b --- /dev/null +++ b/configuration/amd64/mysql/port_drayage.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.35 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES ("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ("123",NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-07-21 11:42:55 diff --git a/configuration/amd64/mysql/suntrax/port_area_operations.sql b/configuration/amd64/mysql/suntrax/port_area_operations.sql new file mode 100644 index 000000000..abeb6e478 --- /dev/null +++ b/configuration/amd64/mysql/suntrax/port_area_operations.sql @@ -0,0 +1,90 @@ +-- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.36 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_A',28.1119763,-81.8312035,'DROPOFF','67eadd3a-38b4-11ec-930a-000145098e4f','0bf7ebda-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1117373,-81.8309654,'PICKUP','0bf7ebda-38b5-11ec-930a-000145098e4f','9230504d-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','9230504d-38b5-11ec-930a-000145098e4f','511ad052-38b6-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','511ad052-38b6-11ec-930a-000145098e4f','fc15d52a-3c0c-11ec-b00d-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_A',28.1119763,-81.8312035,'DROPOFF','c9bba171-52c2-11ec-9105-000145098e4f','8e1d456a-52c3-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1117373,-81.8309654,'PICKUP','8e1d456a-52c3-11ec-9105-000145098e4f','744be658-52c4-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','744be658-52c4-11ec-9105-000145098e4f','a4b419b9-52c5-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','a4b419b9-52c5-11ec-9105-000145098e4f','20b546e3-52c6-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-12-03 11:03:12 diff --git a/configuration/amd64/mysql/suntrax/staging_area_operations.sql b/configuration/amd64/mysql/suntrax/staging_area_operations.sql new file mode 100644 index 000000000..7332feb90 --- /dev/null +++ b/configuration/amd64/mysql/suntrax/staging_area_operations.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.36 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES ('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` varchar(20) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','66bba4cb-52c1-11ec-9105-000145098e4f','84f6b797-52c2-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-12-03 11:25:03 diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index cab2e4176..d00bc28f6 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -15,7 +15,8 @@ services: - mysql_password - mysql_root_password volumes: - - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql + - "mysql_db:/var/lib/mysql" + - ./mysql/:/docker-entrypoint-initdb.d/ php: image: php:7.2.2-apache @@ -29,7 +30,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubarm:latest + image: usdotfhwaops/v2xhubarm:v2xrelease_6.2 container_name: v2xhub network_mode: host restart: always @@ -42,6 +43,10 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP + port_drayage_webservice: + image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + container_name: port_drayage_webservice + network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/arm64/mysql/localhost.sql b/configuration/arm64/mysql/localhost.sql index 0430a75cf..12b072cc7 100644 --- a/configuration/arm64/mysql/localhost.sql +++ b/configuration/arm64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) -- --- Host: localhost Database: IVP +-- Host: 127.0.0.1 Database: IVP -- ------------------------------------------------------ --- Server version 5.7.34 +-- Server version 5.7.35 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); +INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-06-23 23:52:23 +-- Dump completed on 2021-08-25 13:36:29 diff --git a/configuration/arm64/mysql/port_drayage.sql b/configuration/arm64/mysql/port_drayage.sql new file mode 100644 index 000000000..71c93e51f --- /dev/null +++ b/configuration/arm64/mysql/port_drayage.sql @@ -0,0 +1,91 @@ +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) +-- +-- Host: 127.0.0.1 Database: PORT_DRAYAGE +-- ------------------------------------------------------ +-- Server version 5.7.35 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Current Database: `PORT_DRAYAGE` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `PORT_DRAYAGE`; + +-- +-- Table structure for table `first_action` +-- + +DROP TABLE IF EXISTS `first_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `first_action` ( + `cmv_id` int(4) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `first_action` +-- + +LOCK TABLES `first_action` WRITE; +/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; +INSERT INTO `first_action` VALUES (123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `freight` +-- + +DROP TABLE IF EXISTS `freight`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `freight` ( + `cmv_id` int(4) NOT NULL, + `cargo_id` varchar(20) DEFAULT NULL, + `destination_lat` decimal(9,7) NOT NULL, + `destination_long` decimal(9,7) NOT NULL, + `operation` varchar(20) NOT NULL, + `action_id` varchar(36) NOT NULL, + `next_action` varchar(36) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `freight` +-- + +LOCK TABLES `freight` WRITE; +/*!40000 ALTER TABLE `freight` DISABLE KEYS */; +INSERT INTO `freight` VALUES (123,NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),(123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); +/*!40000 ALTER TABLE `freight` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-07-21 11:42:55 diff --git a/container/service.sh b/container/service.sh index 808754dad..ad8da583b 100755 --- a/container/service.sh +++ b/container/service.sh @@ -19,8 +19,8 @@ tmxctl --plugin-install MessageLoggerPlugin.zip tmxctl --plugin-install PedestrianPlugin.zip tmxctl --plugin-install TimPlugin.zip tmxctl --plugin-install CARMACloudPlugin.zip -tmxctl --plugin-install MobilityOperationPlugin.zip tmxctl --plugin-install ODELoggerPlugin.zip +tmxctl --plugin-install PortDrayagePlugin.zip tmxctl --plugin CommandPlugin --enable /usr/local/bin/tmxcore diff --git a/docker/Dockerfile-depl b/docker/Dockerfile-depl index caeae84a1..6be0a8170 100644 --- a/docker/Dockerfile-depl +++ b/docker/Dockerfile-depl @@ -70,9 +70,11 @@ RUN cmake . RUN make RUN make install WORKDIR /home/V2X-Hub/ext/ccserver -RUN rm -rf /home/V2X-Hub/ext/ - +WORKDIR /home/V2X-Hub/ext/pdclient +RUN cmake . +RUN make +RUN make install WORKDIR /home/V2X-Hub/src/v2i-hub/ RUN cmake . -DqserverPedestrian_DIR=/usr/local/share/qserverPedestrian/cmake -Dv2xhubWebAPI_DIR=/usr/local/share/v2xhubWebAPI/cmake/ @@ -110,8 +112,10 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json -RUN ln -s ../bin MobilityOperationPlugin/bin -RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json + +RUN ln -s ../bin PortDrayagePlugin/bin +RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json + RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/ext/pdclient/CMakeLists.txt b/ext/pdclient/CMakeLists.txt new file mode 100644 index 000000000..562b24523 --- /dev/null +++ b/ext/pdclient/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.2) + +project(pdclient) +set(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") +else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") +endif () + +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) + +add_library(${PROJECT_NAME} + OAIActionStatusList.cpp + OAIContainerActionStatus.cpp + OAIContainerRequest.cpp + OAIInspectionRequest.cpp + OAIInspectionStatus.cpp + OAIInspectionStatusList.cpp + OAIDefaultApi.cpp + OAIHelpers.cpp + OAIHttpRequest.cpp + OAIHttpFileElement.cpp +) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ) + +if(NOT APPLE) + target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto) +endif() + +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) + +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + +FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION /usr/local/include/${PROJECT_NAME} ) diff --git a/ext/pdclient/OAIActionStatusList.cpp b/ext/pdclient/OAIActionStatusList.cpp new file mode 100644 index 000000000..eff61e965 --- /dev/null +++ b/ext/pdclient/OAIActionStatusList.cpp @@ -0,0 +1,100 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIActionStatusList.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIActionStatusList::OAIActionStatusList(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIActionStatusList::OAIActionStatusList() { + this->initializeModel(); +} + +OAIActionStatusList::~OAIActionStatusList() {} + +void OAIActionStatusList::initializeModel() { + + m_actions_isSet = false; + m_actions_isValid = false; +} + +void OAIActionStatusList::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIActionStatusList::fromJsonObject(QJsonObject json) { + + m_actions_isValid = ::OpenAPI::fromJsonValue(actions, json[QString("actions")]); + m_actions_isSet = !json[QString("actions")].isNull() && m_actions_isValid; +} + +QString OAIActionStatusList::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIActionStatusList::asJsonObject() const { + QJsonObject obj; + if (actions.size() > 0) { + obj.insert(QString("actions"), ::OpenAPI::toJsonValue(actions)); + } + return obj; +} + +QList OAIActionStatusList::getActions() const { + return actions; +} +void OAIActionStatusList::setActions(const QList &actions) { + this->actions = actions; + this->m_actions_isSet = true; +} + +bool OAIActionStatusList::is_actions_Set() const{ + return m_actions_isSet; +} + +bool OAIActionStatusList::is_actions_Valid() const{ + return m_actions_isValid; +} + +bool OAIActionStatusList::isSet() const { + bool isObjectUpdated = false; + do { + if (actions.size() > 0) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIActionStatusList::isValid() const { + // only required properties are required for the object to be considered valid + return true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIActionStatusList.h b/ext/pdclient/OAIActionStatusList.h new file mode 100644 index 000000000..2447f1cfa --- /dev/null +++ b/ext/pdclient/OAIActionStatusList.h @@ -0,0 +1,62 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIActionStatusList.h + * + * + */ + +#ifndef OAIActionStatusList_H +#define OAIActionStatusList_H + +#include + +#include "OAIContainerActionStatus.h" +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIActionStatusList : public OAIObject { +public: + OAIActionStatusList(); + OAIActionStatusList(QString json); + ~OAIActionStatusList() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QList getActions() const; + void setActions(const QList &actions); + bool is_actions_Set() const; + bool is_actions_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QList actions; + bool m_actions_isSet; + bool m_actions_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIActionStatusList) + +#endif // OAIActionStatusList_H diff --git a/ext/pdclient/OAIContainerActionStatus.cpp b/ext/pdclient/OAIContainerActionStatus.cpp new file mode 100644 index 000000000..6b7f2a3a3 --- /dev/null +++ b/ext/pdclient/OAIContainerActionStatus.cpp @@ -0,0 +1,250 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIContainerActionStatus.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIContainerActionStatus::OAIContainerActionStatus(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIContainerActionStatus::OAIContainerActionStatus() { + this->initializeModel(); +} + +OAIContainerActionStatus::~OAIContainerActionStatus() {} + +void OAIContainerActionStatus::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; + + m_status_isSet = false; + m_status_isValid = false; + + m_requested_isSet = false; + m_requested_isValid = false; + + m_completed_isSet = false; + m_completed_isValid = false; +} + +void OAIContainerActionStatus::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIContainerActionStatus::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; + + m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; + + m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); + m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; + + m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); + m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; +} + +QString OAIContainerActionStatus::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIContainerActionStatus::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + if (m_status_isSet) { + obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + } + if (m_requested_isSet) { + obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); + } + if (m_completed_isSet) { + obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); + } + return obj; +} + +QString OAIContainerActionStatus::getVehicleId() const { + return vehicle_id; +} +void OAIContainerActionStatus::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIContainerActionStatus::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIContainerActionStatus::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIContainerActionStatus::getContainerId() const { + return container_id; +} +void OAIContainerActionStatus::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIContainerActionStatus::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIContainerActionStatus::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIContainerActionStatus::getActionId() const { + return action_id; +} +void OAIContainerActionStatus::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIContainerActionStatus::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIContainerActionStatus::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +QString OAIContainerActionStatus::getStatus() const { + return status; +} +void OAIContainerActionStatus::setStatus(const QString &status) { + this->status = status; + this->m_status_isSet = true; +} + +bool OAIContainerActionStatus::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIContainerActionStatus::is_status_Valid() const{ + return m_status_isValid; +} + +qint64 OAIContainerActionStatus::getRequested() const { + return requested; +} +void OAIContainerActionStatus::setRequested(const qint64 &requested) { + this->requested = requested; + this->m_requested_isSet = true; +} + +bool OAIContainerActionStatus::is_requested_Set() const{ + return m_requested_isSet; +} + +bool OAIContainerActionStatus::is_requested_Valid() const{ + return m_requested_isValid; +} + +qint64 OAIContainerActionStatus::getCompleted() const { + return completed; +} +void OAIContainerActionStatus::setCompleted(const qint64 &completed) { + this->completed = completed; + this->m_completed_isSet = true; +} + +bool OAIContainerActionStatus::is_completed_Set() const{ + return m_completed_isSet; +} + +bool OAIContainerActionStatus::is_completed_Valid() const{ + return m_completed_isValid; +} + +bool OAIContainerActionStatus::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + + if (m_requested_isSet) { + isObjectUpdated = true; + break; + } + + if (m_completed_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIContainerActionStatus::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerActionStatus.h b/ext/pdclient/OAIContainerActionStatus.h new file mode 100644 index 000000000..e117d287c --- /dev/null +++ b/ext/pdclient/OAIContainerActionStatus.h @@ -0,0 +1,106 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIContainerActionStatus.h + * + * + */ + +#ifndef OAIContainerActionStatus_H +#define OAIContainerActionStatus_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIContainerActionStatus : public OAIObject { +public: + OAIContainerActionStatus(); + OAIContainerActionStatus(QString json); + ~OAIContainerActionStatus() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + QString getStatus() const; + void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; + + qint64 getRequested() const; + void setRequested(const qint64 &requested); + bool is_requested_Set() const; + bool is_requested_Valid() const; + + qint64 getCompleted() const; + void setCompleted(const qint64 &completed); + bool is_completed_Set() const; + bool is_completed_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; + + QString status; + bool m_status_isSet; + bool m_status_isValid; + + qint64 requested; + bool m_requested_isSet; + bool m_requested_isValid; + + qint64 completed; + bool m_completed_isSet; + bool m_completed_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIContainerActionStatus) + +#endif // OAIContainerActionStatus_H diff --git a/ext/pdclient/OAIContainerRequest.cpp b/ext/pdclient/OAIContainerRequest.cpp new file mode 100644 index 000000000..616f75f7d --- /dev/null +++ b/ext/pdclient/OAIContainerRequest.cpp @@ -0,0 +1,160 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIContainerRequest.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIContainerRequest::OAIContainerRequest(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIContainerRequest::OAIContainerRequest() { + this->initializeModel(); +} + +OAIContainerRequest::~OAIContainerRequest() {} + +void OAIContainerRequest::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; +} + +void OAIContainerRequest::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIContainerRequest::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; +} + +QString OAIContainerRequest::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIContainerRequest::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + return obj; +} + +QString OAIContainerRequest::getVehicleId() const { + return vehicle_id; +} +void OAIContainerRequest::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIContainerRequest::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIContainerRequest::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIContainerRequest::getContainerId() const { + return container_id; +} +void OAIContainerRequest::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIContainerRequest::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIContainerRequest::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIContainerRequest::getActionId() const { + return action_id; +} +void OAIContainerRequest::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIContainerRequest::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIContainerRequest::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +bool OAIContainerRequest::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIContainerRequest::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerRequest.h b/ext/pdclient/OAIContainerRequest.h new file mode 100644 index 000000000..712b00534 --- /dev/null +++ b/ext/pdclient/OAIContainerRequest.h @@ -0,0 +1,79 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIContainerRequest.h + * + * + */ + +#ifndef OAIContainerRequest_H +#define OAIContainerRequest_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIContainerRequest : public OAIObject { +public: + OAIContainerRequest(); + OAIContainerRequest(QString json); + ~OAIContainerRequest() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIContainerRequest) + +#endif // OAIContainerRequest_H diff --git a/ext/pdclient/OAIDefaultApi.cpp b/ext/pdclient/OAIDefaultApi.cpp new file mode 100644 index 000000000..3b257c2b4 --- /dev/null +++ b/ext/pdclient/OAIDefaultApi.cpp @@ -0,0 +1,1175 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIDefaultApi.h" +#include "OAIServerConfiguration.h" +#include +#include + +namespace OpenAPI { + +OAIDefaultApi::OAIDefaultApi(const int timeOut) + : _timeOut(timeOut), + _manager(nullptr), + _isResponseCompressionEnabled(false), + _isRequestCompressionEnabled(false) { + initializeServerConfigs(); +} + +OAIDefaultApi::~OAIDefaultApi() { +} + +void OAIDefaultApi::initializeServerConfigs() { + //Default server + QList defaultConf = QList(); + //varying endpoint server + defaultConf.append(OAIServerConfiguration( + QUrl("http://127.0.0.1:8080"), + "Unsecured hosting for development", + QMap())); + defaultConf.append(OAIServerConfiguration( + QUrl("https://127.0.0.1:8443"), + "Secured hosting for deployment", + QMap())); + _serverConfigs.insert("inspectionActionIdGet", defaultConf); + _serverIndices.insert("inspectionActionIdGet", 0); + _serverConfigs.insert("inspectionCompleteActionIdPost", defaultConf); + _serverIndices.insert("inspectionCompleteActionIdPost", 0); + _serverConfigs.insert("inspectionHoldActionIdPost", defaultConf); + _serverIndices.insert("inspectionHoldActionIdPost", 0); + _serverConfigs.insert("inspectionHoldingActionIdPost", defaultConf); + _serverIndices.insert("inspectionHoldingActionIdPost", 0); + _serverConfigs.insert("inspectionPendingGet", defaultConf); + _serverIndices.insert("inspectionPendingGet", 0); + _serverConfigs.insert("inspectionPost", defaultConf); + _serverIndices.insert("inspectionPost", 0); + _serverConfigs.insert("loadingActionIdGet", defaultConf); + _serverIndices.insert("loadingActionIdGet", 0); + _serverConfigs.insert("loadingCompleteActionIdPost", defaultConf); + _serverIndices.insert("loadingCompleteActionIdPost", 0); + _serverConfigs.insert("loadingPendingGet", defaultConf); + _serverIndices.insert("loadingPendingGet", 0); + _serverConfigs.insert("loadingPost", defaultConf); + _serverIndices.insert("loadingPost", 0); + _serverConfigs.insert("loadingStartActionIdPost", defaultConf); + _serverIndices.insert("loadingStartActionIdPost", 0); + _serverConfigs.insert("unloadingActionIdGet", defaultConf); + _serverIndices.insert("unloadingActionIdGet", 0); + _serverConfigs.insert("unloadingCompleteActionIdPost", defaultConf); + _serverIndices.insert("unloadingCompleteActionIdPost", 0); + _serverConfigs.insert("unloadingPendingGet", defaultConf); + _serverIndices.insert("unloadingPendingGet", 0); + _serverConfigs.insert("unloadingPost", defaultConf); + _serverIndices.insert("unloadingPost", 0); + _serverConfigs.insert("unloadingStartActionIdPost", defaultConf); + _serverIndices.insert("unloadingStartActionIdPost", 0); +} + +/** +* returns 0 on success and -1, -2 or -3 on failure. +* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found +*/ +int OAIDefaultApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { + auto it = _serverConfigs.find(operation); + if (it != _serverConfigs.end() && serverIndex < it.value().size()) { + return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); + } + return -3; +} +void OAIDefaultApi::setServerIndex(const QString &operation, int serverIndex) { + if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { + _serverIndices[operation] = serverIndex; + } +} + +void OAIDefaultApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { + _apiKeys.insert(apiKeyName,apiKey); +} + +void OAIDefaultApi::setBearerToken(const QString &token) { + _bearerToken = token; +} + +void OAIDefaultApi::setUsername(const QString &username) { + _username = username; +} + +void OAIDefaultApi::setPassword(const QString &password) { + _password = password; +} + + +void OAIDefaultApi::setTimeOut(const int timeOut) { + _timeOut = timeOut; +} + +void OAIDefaultApi::setWorkingDirectory(const QString &path) { + _workingDirectory = path; +} + +void OAIDefaultApi::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + +/** + * Appends a new ServerConfiguration to the config map for a specific operation. + * @param operation The id to the target operation. + * @param url A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + * returns the index of the new server config on success and -1 if the operation is not found + */ +int OAIDefaultApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { + if (_serverConfigs.contains(operation)) { + _serverConfigs[operation].append(OAIServerConfiguration( + url, + description, + variables)); + return _serverConfigs[operation].size()-1; + } else { + return -1; + } +} + +/** + * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. + * @param url A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ +void OAIDefaultApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) + for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { + setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); + } +#else + for (auto &e : _serverIndices.keys()) { + setServerIndex(e, addServerConfiguration(e, url, description, variables)); + } +#endif +} + +/** + * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. + * @param URL A string that contains the URL of the server + * @param description A String that describes the server + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ +void OAIDefaultApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { + setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); +} + +void OAIDefaultApi::addHeaders(const QString &key, const QString &value) { + _defaultHeaders.insert(key, value); +} + +void OAIDefaultApi::enableRequestCompression() { + _isRequestCompressionEnabled = true; +} + +void OAIDefaultApi::enableResponseCompression() { + _isResponseCompressionEnabled = true; +} + +void OAIDefaultApi::abortRequests() { + emit abortRequestsSignal(); +} + +QString OAIDefaultApi::getParamStylePrefix(const QString &style) { + if (style == "matrix") { + return ";"; + } else if (style == "label") { + return "."; + } else if (style == "form") { + return "&"; + } else if (style == "simple") { + return ""; + } else if (style == "spaceDelimited") { + return "&"; + } else if (style == "pipeDelimited") { + return "&"; + } else { + return "none"; + } +} + +QString OAIDefaultApi::getParamStyleSuffix(const QString &style) { + if (style == "matrix") { + return "="; + } else if (style == "label") { + return ""; + } else if (style == "form") { + return "="; + } else if (style == "simple") { + return ""; + } else if (style == "spaceDelimited") { + return "="; + } else if (style == "pipeDelimited") { + return "="; + } else { + return "none"; + } +} + +QString OAIDefaultApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { + + if (style == "matrix") { + return (isExplode) ? ";" + name + "=" : ","; + + } else if (style == "label") { + return (isExplode) ? "." : ","; + + } else if (style == "form") { + return (isExplode) ? "&" + name + "=" : ","; + + } else if (style == "simple") { + return ","; + } else if (style == "spaceDelimited") { + return (isExplode) ? "&" + name + "=" : " "; + + } else if (style == "pipeDelimited") { + return (isExplode) ? "&" + name + "=" : "|"; + + } else if (style == "deepObject") { + return (isExplode) ? "&" : "none"; + + } else { + return "none"; + } +} + +void OAIDefaultApi::inspectionActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionActionIdGet"][_serverIndices.value("inspectionActionIdGet")].URL()+"/inspection/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIInspectionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionActionIdGetSignal(output); + emit inspectionActionIdGetSignalFull(worker, output); + } else { + emit inspectionActionIdGetSignalE(output, error_type, error_str); + emit inspectionActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionCompleteActionIdPost"][_serverIndices.value("inspectionCompleteActionIdPost")].URL()+"/inspection/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionCompleteActionIdPostSignal(); + emit inspectionCompleteActionIdPostSignalFull(worker); + } else { + emit inspectionCompleteActionIdPostSignalE(error_type, error_str); + emit inspectionCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionHoldActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionHoldActionIdPost"][_serverIndices.value("inspectionHoldActionIdPost")].URL()+"/inspection/hold/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionHoldActionIdPostSignal(); + emit inspectionHoldActionIdPostSignalFull(worker); + } else { + emit inspectionHoldActionIdPostSignalE(error_type, error_str); + emit inspectionHoldActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionHoldingActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["inspectionHoldingActionIdPost"][_serverIndices.value("inspectionHoldingActionIdPost")].URL()+"/inspection/holding/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldingActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionHoldingActionIdPostSignal(); + emit inspectionHoldingActionIdPostSignalFull(worker); + } else { + emit inspectionHoldingActionIdPostSignalE(error_type, error_str); + emit inspectionHoldingActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionPendingGet() { + QString fullPath = QString(_serverConfigs["inspectionPendingGet"][_serverIndices.value("inspectionPendingGet")].URL()+"/inspection/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIInspectionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionPendingGetSignal(output); + emit inspectionPendingGetSignalFull(worker, output); + } else { + emit inspectionPendingGetSignalE(output, error_type, error_str); + emit inspectionPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::inspectionPost(const OAIInspectionRequest &oai_inspection_request) { + QString fullPath = QString(_serverConfigs["inspectionPost"][_serverIndices.value("inspectionPost")].URL()+"/inspection"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_inspection_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::inspectionPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit inspectionPostSignal(); + emit inspectionPostSignalFull(worker); + } else { + emit inspectionPostSignalE(error_type, error_str); + emit inspectionPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingActionIdGet"][_serverIndices.value("loadingActionIdGet")].URL()+"/loading/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIContainerActionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingActionIdGetSignal(output); + emit loadingActionIdGetSignalFull(worker, output); + } else { + emit loadingActionIdGetSignalE(output, error_type, error_str); + emit loadingActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingCompleteActionIdPost"][_serverIndices.value("loadingCompleteActionIdPost")].URL()+"/loading/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingCompleteActionIdPostSignal(); + emit loadingCompleteActionIdPostSignalFull(worker); + } else { + emit loadingCompleteActionIdPostSignalE(error_type, error_str); + emit loadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingPendingGet() { + QString fullPath = QString(_serverConfigs["loadingPendingGet"][_serverIndices.value("loadingPendingGet")].URL()+"/loading/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIActionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingPendingGetSignal(output); + emit loadingPendingGetSignalFull(worker, output); + } else { + emit loadingPendingGetSignalE(output, error_type, error_str); + emit loadingPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingPost(const OAIContainerRequest &oai_container_request) { + QString fullPath = QString(_serverConfigs["loadingPost"][_serverIndices.value("loadingPost")].URL()+"/loading"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_container_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingPostSignal(); + emit loadingPostSignalFull(worker); + } else { + emit loadingPostSignalE(error_type, error_str); + emit loadingPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::loadingStartActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["loadingStartActionIdPost"][_serverIndices.value("loadingStartActionIdPost")].URL()+"/loading/start/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingStartActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit loadingStartActionIdPostSignal(); + emit loadingStartActionIdPostSignalFull(worker); + } else { + emit loadingStartActionIdPostSignalE(error_type, error_str); + emit loadingStartActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingActionIdGet(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingActionIdGet"][_serverIndices.value("unloadingActionIdGet")].URL()+"/unloading/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingActionIdGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingActionIdGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIContainerActionStatus output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingActionIdGetSignal(output); + emit unloadingActionIdGetSignalFull(worker, output); + } else { + emit unloadingActionIdGetSignalE(output, error_type, error_str); + emit unloadingActionIdGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingCompleteActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingCompleteActionIdPost"][_serverIndices.value("unloadingCompleteActionIdPost")].URL()+"/unloading/complete/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingCompleteActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingCompleteActionIdPostSignal(); + emit unloadingCompleteActionIdPostSignalFull(worker); + } else { + emit unloadingCompleteActionIdPostSignalE(error_type, error_str); + emit unloadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingPendingGet() { + QString fullPath = QString(_serverConfigs["unloadingPendingGet"][_serverIndices.value("unloadingPendingGet")].URL()+"/unloading/pending"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "GET"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPendingGetCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingPendingGetCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + OAIActionStatusList output(QString(worker->response)); + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingPendingGetSignal(output); + emit unloadingPendingGetSignalFull(worker, output); + } else { + emit unloadingPendingGetSignalE(output, error_type, error_str); + emit unloadingPendingGetSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingPost(const OAIContainerRequest &oai_container_request) { + QString fullPath = QString(_serverConfigs["unloadingPost"][_serverIndices.value("unloadingPost")].URL()+"/unloading"); + + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + { + + QByteArray output = oai_container_request.asJson().toUtf8(); + input.request_body.append(output); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingPostSignal(); + emit unloadingPostSignalFull(worker); + } else { + emit unloadingPostSignalE(error_type, error_str); + emit unloadingPostSignalEFull(worker, error_type, error_str); + } +} + +void OAIDefaultApi::unloadingStartActionIdPost(const QString &action_id) { + QString fullPath = QString(_serverConfigs["unloadingStartActionIdPost"][_serverIndices.value("unloadingStartActionIdPost")].URL()+"/unloading/start/{action_id}"); + + + { + QString action_idPathParam("{"); + action_idPathParam.append("action_id").append("}"); + QString pathPrefix, pathSuffix, pathDelimiter; + QString pathStyle = "simple"; + if (pathStyle == "") + pathStyle = "simple"; + pathPrefix = getParamStylePrefix(pathStyle); + pathSuffix = getParamStyleSuffix(pathStyle); + pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); + QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; + fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); + } + OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); + worker->setTimeOut(_timeOut); + worker->setWorkingDirectory(_workingDirectory); + OAIHttpRequestInput input(fullPath, "POST"); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { + input.headers.insert(keyValueIt->first, keyValueIt->second); + } +#else + for (auto key : _defaultHeaders.keys()) { + input.headers.insert(key, _defaultHeaders[key]); + } +#endif + + connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingStartActionIdPostCallback); + connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); + connect(worker, &QObject::destroyed, this, [this]() { + if (findChildren().count() == 0) { + emit allPendingRequestsCompleted(); + } + }); + + worker->execute(&input); +} + +void OAIDefaultApi::unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type != QNetworkReply::NoError) { + error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); + } + worker->deleteLater(); + + if (worker->error_type == QNetworkReply::NoError) { + emit unloadingStartActionIdPostSignal(); + emit unloadingStartActionIdPostSignalFull(worker); + } else { + emit unloadingStartActionIdPostSignalE(error_type, error_str); + emit unloadingStartActionIdPostSignalEFull(worker, error_type, error_str); + } +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIDefaultApi.h b/ext/pdclient/OAIDefaultApi.h new file mode 100644 index 000000000..35f77a407 --- /dev/null +++ b/ext/pdclient/OAIDefaultApi.h @@ -0,0 +1,244 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_OAIDefaultApi_H +#define OAI_OAIDefaultApi_H + +#include "OAIHelpers.h" +#include "OAIHttpRequest.h" +#include "OAIServerConfiguration.h" + +#include "OAIActionStatusList.h" +#include "OAIContainerActionStatus.h" +#include "OAIContainerRequest.h" +#include "OAIInspectionRequest.h" +#include "OAIInspectionStatus.h" +#include "OAIInspectionStatusList.h" +#include + +#include +#include +#include +#include +#include + +namespace OpenAPI { + +class OAIDefaultApi : public QObject { + Q_OBJECT + +public: + OAIDefaultApi(const int timeOut = 0); + ~OAIDefaultApi(); + + void initializeServerConfigs(); + int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); + void setServerIndex(const QString &operation, int serverIndex); + void setApiKey(const QString &apiKeyName, const QString &apiKey); + void setBearerToken(const QString &token); + void setUsername(const QString &username); + void setPassword(const QString &password); + void setTimeOut(const int timeOut); + void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); + int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); + void addHeaders(const QString &key, const QString &value); + void enableRequestCompression(); + void enableResponseCompression(); + void abortRequests(); + QString getParamStylePrefix(const QString &style); + QString getParamStyleSuffix(const QString &style); + QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); + + /** + * @param[in] action_id QString [required] + */ + void inspectionActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionCompleteActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionHoldActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void inspectionHoldingActionIdPost(const QString &action_id); + + + void inspectionPendingGet(); + + /** + * @param[in] oai_inspection_request OAIInspectionRequest [required] + */ + void inspectionPost(const OAIInspectionRequest &oai_inspection_request); + + /** + * @param[in] action_id QString [required] + */ + void loadingActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void loadingCompleteActionIdPost(const QString &action_id); + + + void loadingPendingGet(); + + /** + * @param[in] oai_container_request OAIContainerRequest [required] + */ + void loadingPost(const OAIContainerRequest &oai_container_request); + + /** + * @param[in] action_id QString [required] + */ + void loadingStartActionIdPost(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void unloadingActionIdGet(const QString &action_id); + + /** + * @param[in] action_id QString [required] + */ + void unloadingCompleteActionIdPost(const QString &action_id); + + + void unloadingPendingGet(); + + /** + * @param[in] oai_container_request OAIContainerRequest [required] + */ + void unloadingPost(const OAIContainerRequest &oai_container_request); + + /** + * @param[in] action_id QString [required] + */ + void unloadingStartActionIdPost(const QString &action_id); + + +private: + QMap _serverIndices; + QMap> _serverConfigs; + QMap _apiKeys; + QString _bearerToken; + QString _username; + QString _password; + int _timeOut; + QString _workingDirectory; + QNetworkAccessManager* _manager; + QMap _defaultHeaders; + bool _isResponseCompressionEnabled; + bool _isRequestCompressionEnabled; + + void inspectionActionIdGetCallback(OAIHttpRequestWorker *worker); + void inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker); + void inspectionPendingGetCallback(OAIHttpRequestWorker *worker); + void inspectionPostCallback(OAIHttpRequestWorker *worker); + void loadingActionIdGetCallback(OAIHttpRequestWorker *worker); + void loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void loadingPendingGetCallback(OAIHttpRequestWorker *worker); + void loadingPostCallback(OAIHttpRequestWorker *worker); + void loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); + void unloadingActionIdGetCallback(OAIHttpRequestWorker *worker); + void unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); + void unloadingPendingGetCallback(OAIHttpRequestWorker *worker); + void unloadingPostCallback(OAIHttpRequestWorker *worker); + void unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); + +signals: + + void inspectionActionIdGetSignal(OAIInspectionStatus summary); + void inspectionCompleteActionIdPostSignal(); + void inspectionHoldActionIdPostSignal(); + void inspectionHoldingActionIdPostSignal(); + void inspectionPendingGetSignal(OAIInspectionStatusList summary); + void inspectionPostSignal(); + void loadingActionIdGetSignal(OAIContainerActionStatus summary); + void loadingCompleteActionIdPostSignal(); + void loadingPendingGetSignal(OAIActionStatusList summary); + void loadingPostSignal(); + void loadingStartActionIdPostSignal(); + void unloadingActionIdGetSignal(OAIContainerActionStatus summary); + void unloadingCompleteActionIdPostSignal(); + void unloadingPendingGetSignal(OAIActionStatusList summary); + void unloadingPostSignal(); + void unloadingStartActionIdPostSignal(); + + void inspectionActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatus summary); + void inspectionCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionHoldActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionHoldingActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void inspectionPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatusList summary); + void inspectionPostSignalFull(OAIHttpRequestWorker *worker); + void loadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); + void loadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void loadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); + void loadingPostSignalFull(OAIHttpRequestWorker *worker); + void loadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); + void unloadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); + void unloadingPostSignalFull(OAIHttpRequestWorker *worker); + void unloadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); + + void inspectionActionIdGetSignalE(OAIInspectionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldingActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPendingGetSignalE(OAIInspectionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void loadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void loadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void unloadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); + + void inspectionActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionHoldingActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void inspectionPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void loadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + void unloadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); + + void abortRequestsSignal(); + void allPendingRequestsCompleted(); +}; + +} // namespace OpenAPI +#endif diff --git a/ext/pdclient/OAIEnum.h b/ext/pdclient/OAIEnum.h new file mode 100644 index 000000000..9177a8d38 --- /dev/null +++ b/ext/pdclient/OAIEnum.h @@ -0,0 +1,63 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_ENUM_H +#define OAI_ENUM_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIEnum { +public: + OAIEnum() {} + + OAIEnum(QString jsonString) { + fromJson(jsonString); + } + + virtual ~OAIEnum() {} + + virtual QJsonValue asJsonValue() const { + return QJsonValue(jstr); + } + + virtual QString asJson() const { + return jstr; + } + + virtual void fromJson(QString jsonString) { + jstr = jsonString; + } + + virtual void fromJsonValue(QJsonValue jval) { + jstr = jval.toString(); + } + + virtual bool isSet() const { + return false; + } + + virtual bool isValid() const { + return true; + } + +private: + QString jstr; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIEnum) + +#endif // OAI_ENUM_H diff --git a/ext/pdclient/OAIHelpers.cpp b/ext/pdclient/OAIHelpers.cpp new file mode 100644 index 000000000..aced612b3 --- /dev/null +++ b/ext/pdclient/OAIHelpers.cpp @@ -0,0 +1,426 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include "OAIHelpers.h" + +namespace OpenAPI { + +class OAISerializerSettings { +public: + struct CustomDateTimeFormat{ + bool isStringSet = false; + QString formatString; + bool isEnumSet = false; + Qt::DateFormat formatEnum; + }; + + static CustomDateTimeFormat getCustomDateTimeFormat() { + return getInstance()->customDateTimeFormat; + } + + static void setDateTimeFormatString(const QString &dtFormat){ + getInstance()->customDateTimeFormat.isStringSet = true; + getInstance()->customDateTimeFormat.isEnumSet = false; + getInstance()->customDateTimeFormat.formatString = dtFormat; + } + + static void setDateTimeFormatEnum(const Qt::DateFormat &dtFormat){ + getInstance()->customDateTimeFormat.isEnumSet = true; + getInstance()->customDateTimeFormat.isStringSet = false; + getInstance()->customDateTimeFormat.formatEnum = dtFormat; + } + + static OAISerializerSettings *getInstance(){ + if(instance == nullptr){ + instance = new OAISerializerSettings(); + } + return instance; + } + +private: + explicit OAISerializerSettings(){ + instance = this; + customDateTimeFormat.isStringSet = false; + customDateTimeFormat.isEnumSet = false; + } + static OAISerializerSettings *instance; + CustomDateTimeFormat customDateTimeFormat; +}; + +OAISerializerSettings * OAISerializerSettings::instance = nullptr; + +bool setDateTimeFormat(const QString &dateTimeFormat){ + bool success = false; + auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); + if (dt.isValid()) { + success = true; + OAISerializerSettings::setDateTimeFormatString(dateTimeFormat); + } + return success; +} + +bool setDateTimeFormat(const Qt::DateFormat &dateTimeFormat){ + bool success = false; + auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); + if (dt.isValid()) { + success = true; + OAISerializerSettings::setDateTimeFormatEnum(dateTimeFormat); + } + return success; +} + +QString toStringValue(const QString &value) { + return value; +} + +QString toStringValue(const QDateTime &value) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } + + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } + + // ISO 8601 + return value.toString(Qt::ISODate); +} + +QString toStringValue(const QByteArray &value) { + return QString(value); +} + +QString toStringValue(const QDate &value) { + // ISO 8601 + return value.toString(Qt::DateFormat::ISODate); +} + +QString toStringValue(const qint32 &value) { + return QString::number(value); +} + +QString toStringValue(const qint64 &value) { + return QString::number(value); +} + +QString toStringValue(const bool &value) { + return QString(value ? "true" : "false"); +} + +QString toStringValue(const float &value) { + return QString::number(static_cast(value)); +} + +QString toStringValue(const double &value) { + return QString::number(value); +} + +QString toStringValue(const OAIObject &value) { + return value.asJson(); +} + +QString toStringValue(const OAIEnum &value) { + return value.asJson(); +} + +QString toStringValue(const OAIHttpFileElement &value) { + return value.asJson(); +} + +QJsonValue toJsonValue(const QString &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const QDateTime &value) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString)); + } + + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum)); + } + + // ISO 8601 + return QJsonValue(value.toString(Qt::ISODate)); +} + +QJsonValue toJsonValue(const QByteArray &value) { + return QJsonValue(QString(value.toBase64())); +} + +QJsonValue toJsonValue(const QDate &value) { + return QJsonValue(value.toString(Qt::ISODate)); +} + +QJsonValue toJsonValue(const qint32 &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const qint64 &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const bool &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const float &value) { + return QJsonValue(static_cast(value)); +} + +QJsonValue toJsonValue(const double &value) { + return QJsonValue(value); +} + +QJsonValue toJsonValue(const OAIObject &value) { + return value.asJsonObject(); +} + +QJsonValue toJsonValue(const OAIEnum &value) { + return value.asJsonValue(); +} + +QJsonValue toJsonValue(const OAIHttpFileElement &value) { + return value.asJsonValue(); +} + +bool fromStringValue(const QString &inStr, QString &value) { + value.clear(); + value.append(inStr); + return !inStr.isEmpty(); +} + +bool fromStringValue(const QString &inStr, QDateTime &value) { + if (inStr.isEmpty()) { + return false; + } else { + QDateTime dateTime; + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } else { + dateTime = QDateTime::fromString(inStr, Qt::ISODate); + } + + if (dateTime.isValid()) { + value.setDate(dateTime.date()); + value.setTime(dateTime.time()); + } else { + qDebug() << "DateTime is invalid"; + } + return dateTime.isValid(); + } +} + +bool fromStringValue(const QString &inStr, QByteArray &value) { + if (inStr.isEmpty()) { + return false; + } else { + value.clear(); + value.append(inStr.toUtf8()); + return value.count() > 0; + } +} + +bool fromStringValue(const QString &inStr, QDate &value) { + if (inStr.isEmpty()) { + return false; + } else { + auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); + if (date.isValid()) { + value.setDate(date.year(), date.month(), date.day()); + } else { + qDebug() << "Date is invalid"; + } + return date.isValid(); + } +} + +bool fromStringValue(const QString &inStr, qint32 &value) { + bool ok = false; + value = QVariant(inStr).toInt(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, qint64 &value) { + bool ok = false; + value = QVariant(inStr).toLongLong(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, bool &value) { + value = QVariant(inStr).toBool(); + return ((inStr == "true") || (inStr == "false")); +} + +bool fromStringValue(const QString &inStr, float &value) { + bool ok = false; + value = QVariant(inStr).toFloat(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, double &value) { + bool ok = false; + value = QVariant(inStr).toDouble(&ok); + return ok; +} + +bool fromStringValue(const QString &inStr, OAIObject &value) +{ + QJsonParseError err; + QJsonDocument::fromJson(inStr.toUtf8(),&err); + if ( err.error == QJsonParseError::NoError ){ + value.fromJson(inStr); + return true; + } + return false; +} + +bool fromStringValue(const QString &inStr, OAIEnum &value) { + value.fromJson(inStr); + return true; +} + +bool fromStringValue(const QString &inStr, OAIHttpFileElement &value) { + return value.fromStringValue(inStr); +} + +bool fromJsonValue(QString &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull()) { + if (jval.isString()) { + value = jval.toString(); + } else if (jval.isBool()) { + value = jval.toBool() ? "true" : "false"; + } else if (jval.isDouble()) { + value = QString::number(jval.toDouble()); + } else { + ok = false; + } + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { + value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); + } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { + value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); + } else { + value = QDateTime::fromString(jval.toString(), Qt::ISODate); + } + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + value = QByteArray::fromBase64(QByteArray::fromStdString(jval.toString().toStdString())); + ok = value.size() > 0; + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(QDate &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { + value = QDate::fromString(jval.toString(), Qt::ISODate); + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(qint32 &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { + value = jval.toInt(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(qint64 &value, const QJsonValue &jval) { + bool ok = true; + if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { + value = jval.toVariant().toLongLong(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(bool &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isBool()) { + value = jval.toBool(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(float &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isDouble()) { + value = static_cast(jval.toDouble()); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(double &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isDouble()) { + value = jval.toDouble(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(OAIObject &value, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + value.fromJsonObject(jval.toObject()); + ok = value.isValid(); + } else { + ok = false; + } + return ok; +} + +bool fromJsonValue(OAIEnum &value, const QJsonValue &jval) { + value.fromJsonValue(jval); + return true; +} + +bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval) { + return value.fromJsonValue(jval); +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHelpers.h b/ext/pdclient/OAIHelpers.h new file mode 100644 index 000000000..06fe6ff34 --- /dev/null +++ b/ext/pdclient/OAIHelpers.h @@ -0,0 +1,275 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_HELPERS_H +#define OAI_HELPERS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "OAIEnum.h" +#include "OAIHttpFileElement.h" +#include "OAIObject.h" + +namespace OpenAPI { + +template +class OptionalParam { +public: + T m_Value; + bool m_hasValue; +public: + OptionalParam(){ + m_hasValue = false; + } + OptionalParam(const T &val){ + m_hasValue = true; + m_Value = val; + } + bool hasValue() const { + return m_hasValue; + } + T value() const{ + return m_Value; + } +}; + +bool setDateTimeFormat(const QString &format); +bool setDateTimeFormat(const Qt::DateFormat &format); + +template +QString toStringValue(const QList &val); + +template +QString toStringValue(const QSet &val); + +template +bool fromStringValue(const QList &inStr, QList &val); + +template +bool fromStringValue(const QSet &inStr, QList &val); + +template +bool fromStringValue(const QMap &inStr, QMap &val); + +template +QJsonValue toJsonValue(const QList &val); + +template +QJsonValue toJsonValue(const QSet &val); + +template +QJsonValue toJsonValue(const QMap &val); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval); + +template +bool fromJsonValue(QSet &val, const QJsonValue &jval); + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval); + +QString toStringValue(const QString &value); +QString toStringValue(const QDateTime &value); +QString toStringValue(const QByteArray &value); +QString toStringValue(const QDate &value); +QString toStringValue(const qint32 &value); +QString toStringValue(const qint64 &value); +QString toStringValue(const bool &value); +QString toStringValue(const float &value); +QString toStringValue(const double &value); +QString toStringValue(const OAIObject &value); +QString toStringValue(const OAIEnum &value); +QString toStringValue(const OAIHttpFileElement &value); + +template +QString toStringValue(const QList &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); + } + if (val.count() > 0) { + strArray.chop(1); + } + return strArray; +} + +template +QString toStringValue(const QSet &val) { + QString strArray; + for (const auto &item : val) { + strArray.append(toStringValue(item) + ","); + } + if (val.count() > 0) { + strArray.chop(1); + } + return strArray; +} + +QJsonValue toJsonValue(const QString &value); +QJsonValue toJsonValue(const QDateTime &value); +QJsonValue toJsonValue(const QByteArray &value); +QJsonValue toJsonValue(const QDate &value); +QJsonValue toJsonValue(const qint32 &value); +QJsonValue toJsonValue(const qint64 &value); +QJsonValue toJsonValue(const bool &value); +QJsonValue toJsonValue(const float &value); +QJsonValue toJsonValue(const double &value); +QJsonValue toJsonValue(const OAIObject &value); +QJsonValue toJsonValue(const OAIEnum &value); +QJsonValue toJsonValue(const OAIHttpFileElement &value); + +template +QJsonValue toJsonValue(const QList &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); + } + return jArray; +} + +template +QJsonValue toJsonValue(const QSet &val) { + QJsonArray jArray; + for (const auto &item : val) { + jArray.append(toJsonValue(item)); + } + return jArray; +} + +template +QJsonValue toJsonValue(const QMap &val) { + QJsonObject jObject; + for (const auto &itemkey : val.keys()) { + jObject.insert(itemkey, toJsonValue(val.value(itemkey))); + } + return jObject; +} + +bool fromStringValue(const QString &inStr, QString &value); +bool fromStringValue(const QString &inStr, QDateTime &value); +bool fromStringValue(const QString &inStr, QByteArray &value); +bool fromStringValue(const QString &inStr, QDate &value); +bool fromStringValue(const QString &inStr, qint32 &value); +bool fromStringValue(const QString &inStr, qint64 &value); +bool fromStringValue(const QString &inStr, bool &value); +bool fromStringValue(const QString &inStr, float &value); +bool fromStringValue(const QString &inStr, double &value); +bool fromStringValue(const QString &inStr, OAIObject &value); +bool fromStringValue(const QString &inStr, OAIEnum &value); +bool fromStringValue(const QString &inStr, OAIHttpFileElement &value); + +template +bool fromStringValue(const QList &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); + } + return ok; +} + +template +bool fromStringValue(const QSet &inStr, QList &val) { + bool ok = (inStr.count() > 0); + for (const auto &item : inStr) { + T itemVal; + ok &= fromStringValue(item, itemVal); + val.push_back(itemVal); + } + return ok; +} + +template +bool fromStringValue(const QMap &inStr, QMap &val) { + bool ok = (inStr.count() > 0); + for (const auto &itemkey : inStr.keys()) { + T itemVal; + ok &= fromStringValue(inStr.value(itemkey), itemVal); + val.insert(itemkey, itemVal); + } + return ok; +} + +bool fromJsonValue(QString &value, const QJsonValue &jval); +bool fromJsonValue(QDateTime &value, const QJsonValue &jval); +bool fromJsonValue(QByteArray &value, const QJsonValue &jval); +bool fromJsonValue(QDate &value, const QJsonValue &jval); +bool fromJsonValue(qint32 &value, const QJsonValue &jval); +bool fromJsonValue(qint64 &value, const QJsonValue &jval); +bool fromJsonValue(bool &value, const QJsonValue &jval); +bool fromJsonValue(float &value, const QJsonValue &jval); +bool fromJsonValue(double &value, const QJsonValue &jval); +bool fromJsonValue(OAIObject &value, const QJsonValue &jval); +bool fromJsonValue(OAIEnum &value, const QJsonValue &jval); +bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval); + +template +bool fromJsonValue(QList &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.push_back(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QSet &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isArray()) { + for (const auto jitem : jval.toArray()) { + T item; + ok &= fromJsonValue(item, jitem); + val.insert(item); + } + } else { + ok = false; + } + return ok; +} + +template +bool fromJsonValue(QMap &val, const QJsonValue &jval) { + bool ok = true; + if (jval.isObject()) { + auto varmap = jval.toObject().toVariantMap(); + if (varmap.count() > 0) { + for (const auto &itemkey : varmap.keys()) { + T itemVal; + ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); + val.insert(itemkey, itemVal); + } + } + } else { + ok = false; + } + return ok; +} + +} // namespace OpenAPI + +#endif // OAI_HELPERS_H diff --git a/ext/pdclient/OAIHttpFileElement.cpp b/ext/pdclient/OAIHttpFileElement.cpp new file mode 100644 index 000000000..b2c6774dd --- /dev/null +++ b/ext/pdclient/OAIHttpFileElement.cpp @@ -0,0 +1,155 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include +#include + +#include "OAIHttpFileElement.h" + +namespace OpenAPI { + +void OAIHttpFileElement::setMimeType(const QString &mime) { + mime_type = mime; +} + +void OAIHttpFileElement::setFileName(const QString &name) { + local_filename = name; +} + +void OAIHttpFileElement::setVariableName(const QString &name) { + variable_name = name; +} + +void OAIHttpFileElement::setRequestFileName(const QString &name) { + request_filename = name; +} + +bool OAIHttpFileElement::isSet() const { + return !local_filename.isEmpty() || !request_filename.isEmpty(); +} + +QString OAIHttpFileElement::asJson() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } + return QString(bArray); +} + +QJsonValue OAIHttpFileElement::asJsonValue() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + return QJsonDocument::fromJson(bArray.data()).object(); +#else + return QJsonDocument::fromBinaryData(bArray.data()).object(); +#endif +} + +bool OAIHttpFileElement::fromStringValue(const QString &instr) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); + file.write(instr.toUtf8()); + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +bool OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + file.write(QJsonDocument(jval.toObject()).toJson()); +#else + file.write(QJsonDocument(jval.toObject()).toBinaryData()); +#endif + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +QByteArray OAIHttpFileElement::asByteArray() const { + QFile file(local_filename); + QByteArray bArray; + bool result = false; + if (file.exists()) { + result = file.open(QIODevice::ReadOnly); + bArray = file.readAll(); + file.close(); + } + if (!result) { + qDebug() << "Error opening file " << local_filename; + } + return bArray; +} + +bool OAIHttpFileElement::fromByteArray(const QByteArray &bytes) { + QFile file(local_filename); + bool result = false; + if (file.exists()) { + file.remove(); + } + result = file.open(QIODevice::WriteOnly); + file.write(bytes); + file.close(); + if (!result) { + qDebug() << "Error creating file " << local_filename; + } + return result; +} + +bool OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { + setMimeType(mime); + setFileName(localFName); + setVariableName(varName); + setRequestFileName(reqFname); + return fromByteArray(bytes); +} + +QByteArray OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { + setMimeType(mime); + setFileName(localFName); + setVariableName(varName); + setRequestFileName(reqFname); + return asByteArray(); +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpFileElement.h b/ext/pdclient/OAIHttpFileElement.h new file mode 100644 index 000000000..2f59cb8de --- /dev/null +++ b/ext/pdclient/OAIHttpFileElement.h @@ -0,0 +1,47 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_HTTP_FILE_ELEMENT_H +#define OAI_HTTP_FILE_ELEMENT_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIHttpFileElement { + +public: + QString variable_name; + QString local_filename; + QString request_filename; + QString mime_type; + void setMimeType(const QString &mime); + void setFileName(const QString &name); + void setVariableName(const QString &name); + void setRequestFileName(const QString &name); + bool isSet() const; + bool fromStringValue(const QString &instr); + bool fromJsonValue(const QJsonValue &jval); + bool fromByteArray(const QByteArray &bytes); + bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); + QString asJson() const; + QJsonValue asJsonValue() const; + QByteArray asByteArray() const; + QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime); +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement) + +#endif // OAI_HTTP_FILE_ELEMENT_H diff --git a/ext/pdclient/OAIHttpRequest.cpp b/ext/pdclient/OAIHttpRequest.cpp new file mode 100644 index 000000000..dfa70b26f --- /dev/null +++ b/ext/pdclient/OAIHttpRequest.cpp @@ -0,0 +1,505 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#else + #define SKIP_EMPTY_PARTS QString::SkipEmptyParts +#endif + +#include "OAIHttpRequest.h" + +namespace OpenAPI { + +OAIHttpRequestInput::OAIHttpRequestInput() { + initialize(); +} + +OAIHttpRequestInput::OAIHttpRequestInput(QString v_url_str, QString v_http_method) { + initialize(); + url_str = v_url_str; + http_method = v_http_method; +} + +void OAIHttpRequestInput::initialize() { + var_layout = NOT_SET; + url_str = ""; + http_method = "GET"; +} + +void OAIHttpRequestInput::add_var(QString key, QString value) { + vars[key] = value; +} + +void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { + OAIHttpFileElement file; + file.variable_name = variable_name; + file.local_filename = local_filename; + file.request_filename = request_filename; + file.mime_type = mime_type; + files.append(file); +} + +OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) + : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { + +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); +#else + qsrand(QDateTime::currentDateTime().toTime_t()); +#endif + + if (manager == nullptr) { + manager = new QNetworkAccessManager(this); + } + workingDirectory = QDir::currentPath(); + timeOutTimer.setSingleShot(true); +} + +OAIHttpRequestWorker::~OAIHttpRequestWorker() { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + timeOutTimer.stop(); + for (const auto &item : multiPartFields) { + if (item != nullptr) { + delete item; + } + } +} + +QMap OAIHttpRequestWorker::getResponseHeaders() const { + return headers; +} + +OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname) { + if (!files.isEmpty()) { + if (fieldname.isEmpty()) { + return files.first(); + } else if (files.contains(fieldname)) { + return files[fieldname]; + } + } + return OAIHttpFileElement(); +} + +QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname) { + if (!multiPartFields.isEmpty()) { + if (fieldname.isEmpty()) { + return multiPartFields.first(); + } else if (multiPartFields.contains(fieldname)) { + return multiPartFields[fieldname]; + } + } + return nullptr; +} + +void OAIHttpRequestWorker::setTimeOut(int timeOutMs) { + timeOutTimer.setInterval(timeOutMs); + if(timeOutTimer.interval() == 0) { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + } +} + +void OAIHttpRequestWorker::setWorkingDirectory(const QString &path) { + if (!path.isEmpty()) { + workingDirectory = path; + } +} + +void OAIHttpRequestWorker::setResponseCompressionEnabled(bool enable) { + isResponseCompressionEnabled = enable; +} + +void OAIHttpRequestWorker::setRequestCompressionEnabled(bool enable) { + isRequestCompressionEnabled = enable; +} + +int OAIHttpRequestWorker::getHttpResponseCode() const{ + return httpResponseCode; +} + +QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { + // result structure follows RFC 5987 + bool need_utf_encoding = false; + QString result = ""; + QByteArray input_c = input.toLocal8Bit(); + char c; + for (int i = 0; i < input_c.length(); i++) { + c = input_c.at(i); + if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { + // ignore and request utf-8 version + need_utf_encoding = true; + } else if (c == '"') { + result += "\\\""; + } else { + result += c; + } + } + + if (result.length() == 0) { + need_utf_encoding = true; + } + + if (!need_utf_encoding) { + // return simple version + return QString("%1=\"%2\"").arg(attribute_name, result); + } + + QString result_utf8 = ""; + for (int i = 0; i < input_c.length(); i++) { + c = input_c.at(i); + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { + result_utf8 += c; + } else { + result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); + } + } + + // return enhanced version with UTF-8 support + return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); +} + +void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { + + // reset variables + QNetworkReply *reply = nullptr; + QByteArray request_content = ""; + response = ""; + error_type = QNetworkReply::NoError; + error_str = ""; + bool isFormData = false; + + // decide on the variable layout + + if (input->files.length() > 0) { + input->var_layout = MULTIPART; + } + if (input->var_layout == NOT_SET) { + input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; + } + + // prepare request content + + QString boundary = ""; + + if (input->var_layout == ADDRESS || input->var_layout == URL_ENCODED) { + // variable layout is ADDRESS or URL_ENCODED + + if (input->vars.count() > 0) { + bool first = true; + isFormData = true; + foreach (QString key, input->vars.keys()) { + if (!first) { + request_content.append("&"); + } + first = false; + + request_content.append(QUrl::toPercentEncoding(key)); + request_content.append("="); + request_content.append(QUrl::toPercentEncoding(input->vars.value(key))); + } + + if (input->var_layout == ADDRESS) { + input->url_str += "?" + request_content; + request_content = ""; + } + } + } else { + // variable layout is MULTIPART + + boundary = QString("__-----------------------%1%2") + #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) + .arg(randomGenerator.generate()); + #else + .arg(QDateTime::currentDateTime().toTime_t()) + .arg(qrand()); + #endif + QString boundary_delimiter = "--"; + QString new_line = "\r\n"; + + // add variables + foreach (QString key, input->vars.keys()) { + // add boundary + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); + + // add header + request_content.append("Content-Disposition: form-data; "); + request_content.append(http_attribute_encode("name", key).toUtf8()); + request_content.append(new_line.toUtf8()); + request_content.append("Content-Type: text/plain"); + request_content.append(new_line.toUtf8()); + + // add header to body splitter + request_content.append(new_line.toUtf8()); + + // add variable content + request_content.append(input->vars.value(key).toUtf8()); + request_content.append(new_line.toUtf8()); + } + + // add files + for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { + QFileInfo fi(file_info->local_filename); + + // ensure necessary variables are available + if (file_info->local_filename == nullptr + || file_info->local_filename.isEmpty() + || file_info->variable_name == nullptr + || file_info->variable_name.isEmpty() + || !fi.exists() + || !fi.isFile() + || !fi.isReadable()) { + // silent abort for the current file + continue; + } + + QFile file(file_info->local_filename); + if (!file.open(QIODevice::ReadOnly)) { + // silent abort for the current file + continue; + } + + // ensure filename for the request + if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { + file_info->request_filename = fi.fileName(); + if (file_info->request_filename.isEmpty()) { + file_info->request_filename = "file"; + } + } + + // add boundary + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(new_line.toUtf8()); + + // add header + request_content.append( + QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); + request_content.append(new_line.toUtf8()); + + if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { + request_content.append("Content-Type: "); + request_content.append(file_info->mime_type.toUtf8()); + request_content.append(new_line.toUtf8()); + } + + request_content.append("Content-Transfer-Encoding: binary"); + request_content.append(new_line.toUtf8()); + + // add header to body splitter + request_content.append(new_line.toUtf8()); + + // add file content + request_content.append(file.readAll()); + request_content.append(new_line.toUtf8()); + + file.close(); + } + + // add end of body + request_content.append(boundary_delimiter.toUtf8()); + request_content.append(boundary.toUtf8()); + request_content.append(boundary_delimiter.toUtf8()); + } + + if (input->request_body.size() > 0) { + qDebug() << "got a request body"; + request_content.clear(); + if(!isFormData && (input->var_layout != MULTIPART) && isRequestCompressionEnabled){ + request_content.append(compress(input->request_body, 7, OAICompressionType::Gzip)); + } else { + request_content.append(input->request_body); + } + } + // prepare connection + + QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); + if (OAIHttpRequestWorker::sslDefaultConfiguration != nullptr) { + request.setSslConfiguration(*OAIHttpRequestWorker::sslDefaultConfiguration); + } + request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt"); + foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); } + + if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { + if (!input->headers.contains("Content-Type")) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + } else { + request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); + } + if(isRequestCompressionEnabled){ + request.setRawHeader("Content-Encoding", "gzip"); + } + } else if (input->var_layout == URL_ENCODED) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + } else if (input->var_layout == MULTIPART) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); + } + + if(isResponseCompressionEnabled){ + request.setRawHeader("Accept-Encoding", "gzip"); + } else { + request.setRawHeader("Accept-Encoding", "identity"); + } + + if (input->http_method == "GET") { + reply = manager->get(request); + } else if (input->http_method == "POST") { + reply = manager->post(request, request_content); + } else if (input->http_method == "PUT") { + reply = manager->put(request, request_content); + } else if (input->http_method == "HEAD") { + reply = manager->head(request); + } else if (input->http_method == "DELETE") { + reply = manager->deleteResource(request); + } else { +#if (QT_VERSION >= 0x050800) + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); +#else + QBuffer *buffer = new QBuffer; + buffer->setData(request_content); + buffer->open(QIODevice::ReadOnly); + + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + buffer->setParent(reply); +#endif + } + if (reply != nullptr) { + reply->setParent(this); + connect(reply, &QNetworkReply::finished, [this, reply] { + on_reply_finished(reply); + }); + } + if (timeOutTimer.interval() > 0) { + QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { + on_reply_timeout(reply); + }); + timeOutTimer.start(); + } +} + +void OAIHttpRequestWorker::on_reply_finished(QNetworkReply *reply) { + bool codeSts = false; + if(timeOutTimer.isActive()) { + QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); + timeOutTimer.stop(); + } + error_type = reply->error(); + error_str = reply->errorString(); + if (reply->rawHeaderPairs().count() > 0) { + for (const auto &item : reply->rawHeaderPairs()) { + headers.insert(item.first, item.second); + } + } + auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); + if(codeSts){ + httpResponseCode = rescode; + } else{ + httpResponseCode = -1; + } + process_response(reply); + reply->deleteLater(); + emit on_execution_finished(this); +} + +void OAIHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { + error_type = QNetworkReply::TimeoutError; + response = ""; + error_str = "Timed out waiting for response"; + disconnect(reply, nullptr, nullptr, nullptr); + reply->abort(); + reply->deleteLater(); + emit on_execution_finished(this); +} + +void OAIHttpRequestWorker::process_response(QNetworkReply *reply) { + QString contentDispositionHdr; + QString contentTypeHdr; + QString contentEncodingHdr; + + for(auto hdr: getResponseHeaders().keys()){ + if(hdr.compare(QString("Content-Disposition"), Qt::CaseInsensitive) == 0){ + contentDispositionHdr = getResponseHeaders().value(hdr); + } + if(hdr.compare(QString("Content-Type"), Qt::CaseInsensitive) == 0){ + contentTypeHdr = getResponseHeaders().value(hdr); + } + if(hdr.compare(QString("Content-Encoding"), Qt::CaseInsensitive) == 0){ + contentEncodingHdr = getResponseHeaders().value(hdr); + } + } + + if (!contentDispositionHdr.isEmpty()) { + auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentType = + !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); + if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { + QString filename = QUuid::createUuid().toString(); + for (const auto &file : contentDisposition) { + if (file.contains(QString("filename"))) { + filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); + break; + } + } + OAIHttpFileElement felement; + felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, reply->readAll()); + files.insert(filename, felement); + } + + } else if (!contentTypeHdr.isEmpty()) { + auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); + if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { + // TODO : Handle Multipart responses + } else { + if(!contentEncodingHdr.isEmpty()){ + auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); + if(encoding.count() > 0){ + auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); + if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ + response = decompress(reply->readAll()); + } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ + response = reply->readAll(); + } + } + } + else { + response = reply->readAll(); + } + } + } +} + +QByteArray OAIHttpRequestWorker::decompress(const QByteArray& data){ + + Q_UNUSED(data); + return QByteArray(); +} + +QByteArray OAIHttpRequestWorker::compress(const QByteArray& input, int level, OAICompressionType compressType) { + + Q_UNUSED(input); + Q_UNUSED(level); + Q_UNUSED(compressType); + return QByteArray(); +} + +QSslConfiguration *OAIHttpRequestWorker::sslDefaultConfiguration; + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpRequest.h b/ext/pdclient/OAIHttpRequest.h new file mode 100644 index 000000000..cda089bf2 --- /dev/null +++ b/ext/pdclient/OAIHttpRequest.h @@ -0,0 +1,113 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Based on http://www.creativepulse.gr/en/blog/2014/restful-api-requests-using-qt-cpp-for-linux-mac-osx-ms-windows + * By Alex Stylianos + * + **/ + +#ifndef OAI_HTTPREQUESTWORKER_H +#define OAI_HTTPREQUESTWORKER_H + +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + #include +#endif + +#include "OAIHttpFileElement.h" + +namespace OpenAPI { + +enum OAIHttpRequestVarLayout { + NOT_SET, + ADDRESS, + URL_ENCODED, + MULTIPART +}; + +class OAIHttpRequestInput { + +public: + QString url_str; + QString http_method; + OAIHttpRequestVarLayout var_layout; + QMap vars; + QMap headers; + QList files; + QByteArray request_body; + + OAIHttpRequestInput(); + OAIHttpRequestInput(QString v_url_str, QString v_http_method); + void initialize(); + void add_var(QString key, QString value); + void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); +}; + +class OAIHttpRequestWorker : public QObject { + Q_OBJECT + +public: + explicit OAIHttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); + virtual ~OAIHttpRequestWorker(); + + QByteArray response; + QNetworkReply::NetworkError error_type; + QString error_str; + + QMap getResponseHeaders() const; + QString http_attribute_encode(QString attribute_name, QString input); + void execute(OAIHttpRequestInput *input); + static QSslConfiguration *sslDefaultConfiguration; + void setTimeOut(int timeOutMs); + void setWorkingDirectory(const QString &path); + OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString()); + QByteArray *getMultiPartField(const QString &fieldname = QString()); + void setResponseCompressionEnabled(bool enable); + void setRequestCompressionEnabled(bool enable); + int getHttpResponseCode() const; + +signals: + void on_execution_finished(OAIHttpRequestWorker *worker); + +private: + enum OAICompressionType{ + Zlib, + Gzip + }; + QNetworkAccessManager *manager; + QMap headers; + QMap files; + QMap multiPartFields; + QString workingDirectory; + QTimer timeOutTimer; + bool isResponseCompressionEnabled; + bool isRequestCompressionEnabled; + int httpResponseCode; +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QRandomGenerator randomGenerator; +#endif + + void on_reply_timeout(QNetworkReply *reply); + void on_reply_finished(QNetworkReply *reply); + void process_response(QNetworkReply *reply); + QByteArray decompress(const QByteArray& data); + QByteArray compress(const QByteArray& input, int level, OAICompressionType compressType); +}; + +} // namespace OpenAPI + +#endif // OAI_HTTPREQUESTWORKER_H diff --git a/ext/pdclient/OAIInspectionRequest.cpp b/ext/pdclient/OAIInspectionRequest.cpp new file mode 100644 index 000000000..161d4cdfd --- /dev/null +++ b/ext/pdclient/OAIInspectionRequest.cpp @@ -0,0 +1,160 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionRequest.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionRequest::OAIInspectionRequest(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionRequest::OAIInspectionRequest() { + this->initializeModel(); +} + +OAIInspectionRequest::~OAIInspectionRequest() {} + +void OAIInspectionRequest::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; +} + +void OAIInspectionRequest::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionRequest::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; +} + +QString OAIInspectionRequest::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionRequest::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + return obj; +} + +QString OAIInspectionRequest::getVehicleId() const { + return vehicle_id; +} +void OAIInspectionRequest::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIInspectionRequest::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIInspectionRequest::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIInspectionRequest::getContainerId() const { + return container_id; +} +void OAIInspectionRequest::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIInspectionRequest::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIInspectionRequest::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIInspectionRequest::getActionId() const { + return action_id; +} +void OAIInspectionRequest::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIInspectionRequest::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIInspectionRequest::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +bool OAIInspectionRequest::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionRequest::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionRequest.h b/ext/pdclient/OAIInspectionRequest.h new file mode 100644 index 000000000..2270d3c18 --- /dev/null +++ b/ext/pdclient/OAIInspectionRequest.h @@ -0,0 +1,79 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionRequest.h + * + * + */ + +#ifndef OAIInspectionRequest_H +#define OAIInspectionRequest_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionRequest : public OAIObject { +public: + OAIInspectionRequest(); + OAIInspectionRequest(QString json); + ~OAIInspectionRequest() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionRequest) + +#endif // OAIInspectionRequest_H diff --git a/ext/pdclient/OAIInspectionStatus.cpp b/ext/pdclient/OAIInspectionStatus.cpp new file mode 100644 index 000000000..101fd0a41 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatus.cpp @@ -0,0 +1,250 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionStatus.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionStatus::OAIInspectionStatus(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionStatus::OAIInspectionStatus() { + this->initializeModel(); +} + +OAIInspectionStatus::~OAIInspectionStatus() {} + +void OAIInspectionStatus::initializeModel() { + + m_vehicle_id_isSet = false; + m_vehicle_id_isValid = false; + + m_container_id_isSet = false; + m_container_id_isValid = false; + + m_action_id_isSet = false; + m_action_id_isValid = false; + + m_status_isSet = false; + m_status_isValid = false; + + m_requested_isSet = false; + m_requested_isValid = false; + + m_completed_isSet = false; + m_completed_isValid = false; +} + +void OAIInspectionStatus::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionStatus::fromJsonObject(QJsonObject json) { + + m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); + m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; + + m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); + m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; + + m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); + m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; + + m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; + + m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); + m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; + + m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); + m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; +} + +QString OAIInspectionStatus::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionStatus::asJsonObject() const { + QJsonObject obj; + if (m_vehicle_id_isSet) { + obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); + } + if (m_container_id_isSet) { + obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); + } + if (m_action_id_isSet) { + obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); + } + if (m_status_isSet) { + obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + } + if (m_requested_isSet) { + obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); + } + if (m_completed_isSet) { + obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); + } + return obj; +} + +QString OAIInspectionStatus::getVehicleId() const { + return vehicle_id; +} +void OAIInspectionStatus::setVehicleId(const QString &vehicle_id) { + this->vehicle_id = vehicle_id; + this->m_vehicle_id_isSet = true; +} + +bool OAIInspectionStatus::is_vehicle_id_Set() const{ + return m_vehicle_id_isSet; +} + +bool OAIInspectionStatus::is_vehicle_id_Valid() const{ + return m_vehicle_id_isValid; +} + +QString OAIInspectionStatus::getContainerId() const { + return container_id; +} +void OAIInspectionStatus::setContainerId(const QString &container_id) { + this->container_id = container_id; + this->m_container_id_isSet = true; +} + +bool OAIInspectionStatus::is_container_id_Set() const{ + return m_container_id_isSet; +} + +bool OAIInspectionStatus::is_container_id_Valid() const{ + return m_container_id_isValid; +} + +QString OAIInspectionStatus::getActionId() const { + return action_id; +} +void OAIInspectionStatus::setActionId(const QString &action_id) { + this->action_id = action_id; + this->m_action_id_isSet = true; +} + +bool OAIInspectionStatus::is_action_id_Set() const{ + return m_action_id_isSet; +} + +bool OAIInspectionStatus::is_action_id_Valid() const{ + return m_action_id_isValid; +} + +QString OAIInspectionStatus::getStatus() const { + return status; +} +void OAIInspectionStatus::setStatus(const QString &status) { + this->status = status; + this->m_status_isSet = true; +} + +bool OAIInspectionStatus::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIInspectionStatus::is_status_Valid() const{ + return m_status_isValid; +} + +qint64 OAIInspectionStatus::getRequested() const { + return requested; +} +void OAIInspectionStatus::setRequested(const qint64 &requested) { + this->requested = requested; + this->m_requested_isSet = true; +} + +bool OAIInspectionStatus::is_requested_Set() const{ + return m_requested_isSet; +} + +bool OAIInspectionStatus::is_requested_Valid() const{ + return m_requested_isValid; +} + +qint64 OAIInspectionStatus::getCompleted() const { + return completed; +} +void OAIInspectionStatus::setCompleted(const qint64 &completed) { + this->completed = completed; + this->m_completed_isSet = true; +} + +bool OAIInspectionStatus::is_completed_Set() const{ + return m_completed_isSet; +} + +bool OAIInspectionStatus::is_completed_Valid() const{ + return m_completed_isValid; +} + +bool OAIInspectionStatus::isSet() const { + bool isObjectUpdated = false; + do { + if (m_vehicle_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_container_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_action_id_isSet) { + isObjectUpdated = true; + break; + } + + if (m_status_isSet) { + isObjectUpdated = true; + break; + } + + if (m_requested_isSet) { + isObjectUpdated = true; + break; + } + + if (m_completed_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionStatus::isValid() const { + // only required properties are required for the object to be considered valid + return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatus.h b/ext/pdclient/OAIInspectionStatus.h new file mode 100644 index 000000000..aee5d535d --- /dev/null +++ b/ext/pdclient/OAIInspectionStatus.h @@ -0,0 +1,106 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionStatus.h + * + * + */ + +#ifndef OAIInspectionStatus_H +#define OAIInspectionStatus_H + +#include + +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionStatus : public OAIObject { +public: + OAIInspectionStatus(); + OAIInspectionStatus(QString json); + ~OAIInspectionStatus() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QString getVehicleId() const; + void setVehicleId(const QString &vehicle_id); + bool is_vehicle_id_Set() const; + bool is_vehicle_id_Valid() const; + + QString getContainerId() const; + void setContainerId(const QString &container_id); + bool is_container_id_Set() const; + bool is_container_id_Valid() const; + + QString getActionId() const; + void setActionId(const QString &action_id); + bool is_action_id_Set() const; + bool is_action_id_Valid() const; + + QString getStatus() const; + void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; + + qint64 getRequested() const; + void setRequested(const qint64 &requested); + bool is_requested_Set() const; + bool is_requested_Valid() const; + + qint64 getCompleted() const; + void setCompleted(const qint64 &completed); + bool is_completed_Set() const; + bool is_completed_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QString vehicle_id; + bool m_vehicle_id_isSet; + bool m_vehicle_id_isValid; + + QString container_id; + bool m_container_id_isSet; + bool m_container_id_isValid; + + QString action_id; + bool m_action_id_isSet; + bool m_action_id_isValid; + + QString status; + bool m_status_isSet; + bool m_status_isValid; + + qint64 requested; + bool m_requested_isSet; + bool m_requested_isValid; + + qint64 completed; + bool m_completed_isSet; + bool m_completed_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatus) + +#endif // OAIInspectionStatus_H diff --git a/ext/pdclient/OAIInspectionStatusList.cpp b/ext/pdclient/OAIInspectionStatusList.cpp new file mode 100644 index 000000000..7145b1dd1 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatusList.cpp @@ -0,0 +1,100 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#include "OAIInspectionStatusList.h" + +#include +#include +#include +#include + +#include "OAIHelpers.h" + +namespace OpenAPI { + +OAIInspectionStatusList::OAIInspectionStatusList(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +OAIInspectionStatusList::OAIInspectionStatusList() { + this->initializeModel(); +} + +OAIInspectionStatusList::~OAIInspectionStatusList() {} + +void OAIInspectionStatusList::initializeModel() { + + m_inspections_isSet = false; + m_inspections_isValid = false; +} + +void OAIInspectionStatusList::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void OAIInspectionStatusList::fromJsonObject(QJsonObject json) { + + m_inspections_isValid = ::OpenAPI::fromJsonValue(inspections, json[QString("inspections")]); + m_inspections_isSet = !json[QString("inspections")].isNull() && m_inspections_isValid; +} + +QString OAIInspectionStatusList::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject OAIInspectionStatusList::asJsonObject() const { + QJsonObject obj; + if (inspections.size() > 0) { + obj.insert(QString("inspections"), ::OpenAPI::toJsonValue(inspections)); + } + return obj; +} + +QList OAIInspectionStatusList::getInspections() const { + return inspections; +} +void OAIInspectionStatusList::setInspections(const QList &inspections) { + this->inspections = inspections; + this->m_inspections_isSet = true; +} + +bool OAIInspectionStatusList::is_inspections_Set() const{ + return m_inspections_isSet; +} + +bool OAIInspectionStatusList::is_inspections_Valid() const{ + return m_inspections_isValid; +} + +bool OAIInspectionStatusList::isSet() const { + bool isObjectUpdated = false; + do { + if (inspections.size() > 0) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool OAIInspectionStatusList::isValid() const { + // only required properties are required for the object to be considered valid + return true; +} + +} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatusList.h b/ext/pdclient/OAIInspectionStatusList.h new file mode 100644 index 000000000..8849ffcf5 --- /dev/null +++ b/ext/pdclient/OAIInspectionStatusList.h @@ -0,0 +1,62 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * OAIInspectionStatusList.h + * + * + */ + +#ifndef OAIInspectionStatusList_H +#define OAIInspectionStatusList_H + +#include + +#include "OAIInspectionStatus.h" +#include + +#include "OAIEnum.h" +#include "OAIObject.h" + +namespace OpenAPI { + +class OAIInspectionStatusList : public OAIObject { +public: + OAIInspectionStatusList(); + OAIInspectionStatusList(QString json); + ~OAIInspectionStatusList() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QList getInspections() const; + void setInspections(const QList &inspections); + bool is_inspections_Set() const; + bool is_inspections_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QList inspections; + bool m_inspections_isSet; + bool m_inspections_isValid; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatusList) + +#endif // OAIInspectionStatusList_H diff --git a/ext/pdclient/OAIObject.h b/ext/pdclient/OAIObject.h new file mode 100644 index 000000000..68e114afe --- /dev/null +++ b/ext/pdclient/OAIObject.h @@ -0,0 +1,65 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef OAI_OBJECT_H +#define OAI_OBJECT_H + +#include +#include +#include + +namespace OpenAPI { + +class OAIObject { +public: + OAIObject() {} + + OAIObject(QString jsonString) { + fromJson(jsonString); + } + + virtual ~OAIObject() {} + + virtual QJsonObject asJsonObject() const { + return jObj; + } + + virtual QString asJson() const { + QJsonDocument doc(jObj); + return doc.toJson(QJsonDocument::Compact); + } + + virtual void fromJson(QString jsonString) { + QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8()); + jObj = doc.object(); + } + + virtual void fromJsonObject(QJsonObject json) { + jObj = json; + } + + virtual bool isSet() const { + return false; + } + + virtual bool isValid() const { + return true; + } + +private: + QJsonObject jObj; +}; + +} // namespace OpenAPI + +Q_DECLARE_METATYPE(OpenAPI::OAIObject) + +#endif // OAI_OBJECT_H diff --git a/ext/pdclient/OAIServerConfiguration.h b/ext/pdclient/OAIServerConfiguration.h new file mode 100644 index 000000000..8d33862a8 --- /dev/null +++ b/ext/pdclient/OAIServerConfiguration.h @@ -0,0 +1,82 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Representing a Server configuration. + */ +#ifndef OAI_SERVERVCONFIGURATION_H +#define OAI_SERVERVCONFIGURATION_H + +#include +#include +#include +#include +#include +#include "OAIServerVariable.h" + +namespace OpenAPI { + +class OAIServerConfiguration { +public: + /** + * @param url A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + OAIServerConfiguration(const QUrl &url, const QString &description, const QMap &variables) + : _description(description), + _variables(variables), + _url(url){} + OAIServerConfiguration(){} + ~OAIServerConfiguration(){} + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + QString URL() { + QString url = _url.toString(); + if(!_variables.empty()){ + // go through variables and replace placeholders + for (auto const& v : _variables.keys()) { + QString name = v; + OAIServerVariable serverVariable = _variables.value(v); + QString value = serverVariable._defaultValue; + + if (!serverVariable._enumValues.empty() && !serverVariable._enumValues.contains(value)) { + throw std::runtime_error(QString("The variable " + name + " in the server URL has invalid value " + value + ".").toUtf8()); + } + QRegularExpression regex(QString("\\{" + name + "\\}")); + url = url.replace(regex, value); + + } + return url; + } + return url; + } + + int setDefaultValue(const QString &variable,const QString &value){ + if(_variables.contains(variable)) + return _variables[variable].setDefaultValue(value); + return -1; + } + + QString _description; + QMap _variables; + QUrl _url; + +}; + +} // namespace OpenAPI + +#endif // OAI_SERVERVCONFIGURATION_H diff --git a/ext/pdclient/OAIServerVariable.h b/ext/pdclient/OAIServerVariable.h new file mode 100644 index 000000000..9930343ca --- /dev/null +++ b/ext/pdclient/OAIServerVariable.h @@ -0,0 +1,58 @@ +/** + * Port Drayage Web Service. + * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + * + * The version of the OpenAPI document: 1.0 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Representing a Server Variable for server URL template substitution. + */ +#ifndef OAI_SERVERVARIABLE_H +#define OAI_SERVERVARIABLE_H +#include +#include + +namespace OpenAPI { + +class OAIServerVariable { +public: + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + OAIServerVariable(const QString &description, const QString &defaultValue, const QSet &enumValues) + : _defaultValue(defaultValue), + _description(description), + _enumValues(enumValues){} + + OAIServerVariable(){} + ~OAIServerVariable(){} + + int setDefaultValue(const QString& value){ + if( _enumValues.contains(value)){ + _defaultValue = value; + return 0; + } + return -2; + } + + QString getDefaultValue(){return _defaultValue;} + QSet getEnumValues(){return _enumValues;} + + + QString _defaultValue; + QString _description; + QSet _enumValues; + +}; + +} // namespace OpenAPI + +#endif // OAI_SERVERVARIABLE_H diff --git a/ext/pdclient/client.pri b/ext/pdclient/client.pri new file mode 100644 index 000000000..1a7c42bf9 --- /dev/null +++ b/ext/pdclient/client.pri @@ -0,0 +1,35 @@ +QT += network + +HEADERS += \ +# Models + $${PWD}/OAIActionStatusList.h \ + $${PWD}/OAIContainerActionStatus.h \ + $${PWD}/OAIContainerRequest.h \ + $${PWD}/OAIInspectionRequest.h \ + $${PWD}/OAIInspectionStatus.h \ + $${PWD}/OAIInspectionStatusList.h \ +# APIs + $${PWD}/OAIDefaultApi.h \ +# Others + $${PWD}/OAIHelpers.h \ + $${PWD}/OAIHttpRequest.h \ + $${PWD}/OAIObject.h \ + $${PWD}/OAIEnum.h \ + $${PWD}/OAIHttpFileElement.h \ + $${PWD}/OAIServerConfiguration.h \ + $${PWD}/OAIServerVariable.h + +SOURCES += \ +# Models + $${PWD}/OAIActionStatusList.cpp \ + $${PWD}/OAIContainerActionStatus.cpp \ + $${PWD}/OAIContainerRequest.cpp \ + $${PWD}/OAIInspectionRequest.cpp \ + $${PWD}/OAIInspectionStatus.cpp \ + $${PWD}/OAIInspectionStatusList.cpp \ +# APIs + $${PWD}/OAIDefaultApi.cpp \ +# Others + $${PWD}/OAIHelpers.cpp \ + $${PWD}/OAIHttpRequest.cpp \ + $${PWD}/OAIHttpFileElement.cpp diff --git a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp index cc75299a6..88609ec81 100644 --- a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp +++ b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp @@ -340,7 +340,6 @@ class J2735MessageFactory int msgIdindex=0; // msgId = DD if (bytes[0] == 0x00) { - std::cout<<"No Extended bytes found\n"; return 0; } if(bytes[0] == 0x03){ // extended bytes present @@ -354,7 +353,6 @@ class J2735MessageFactory else // 64 < length < 128 bytes [0380XX00DD] msgIdindex = 3; } - std::cout<<"Extended bytes found\n"; } bytes.erase(bytes.begin(),bytes.begin()+msgIdindex); diff --git a/src/tmx/TmxCore/src/ivpcore.cpp b/src/tmx/TmxCore/src/ivpcore.cpp index 50dd49d96..84eb3cf8f 100644 --- a/src/tmx/TmxCore/src/ivpcore.cpp +++ b/src/tmx/TmxCore/src/ivpcore.cpp @@ -133,7 +133,7 @@ std::string GetPwd(){ pwd = std::getenv(EnvVar); if(pwd == NULL){ - LOG_ERROR("Unable to set MYSQL_ROOT_PASSWORD)"); + LOG_ERROR("Unable to set MYSQL_PASSWORD)"); return ""; } else{ diff --git a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp index ca80c112c..888546b99 100644 --- a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp @@ -525,19 +525,5 @@ bool TmxControl::remove(pluginlist &plugins, ...) } -// static std::string TmxControl::GetPwd(){ -// const char* EnvVar = "MYSQL_ROOT_PASSWORD"; -// const char* psw; -// psw = std::getenv(EnvVar); - -// if(psw == NULL){ -// PLOG(logERROR) << "Unable to set MYSQL_ROOT_PASSWORD)"; -// return ""; -// } -// else{ -// std::string PswStr(psw); -// return PswStr; -// } -// } } /* namespace tmxctl */ diff --git a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp index 28bbb0bb3..1d12472ba 100644 --- a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp @@ -87,7 +87,8 @@ bool TmxControl::list(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -173,7 +174,8 @@ bool TmxControl::state(pluginlist &plugins, ...) PLOG(logDEBUG) << "Executing query " << query; _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) { @@ -215,7 +217,8 @@ bool TmxControl::max_message_interval(pluginlist &plugins, ...) PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -269,7 +272,8 @@ bool TmxControl::args(pluginlist &plugins, ...) { PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -298,7 +302,8 @@ bool TmxControl::messages(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -380,7 +385,8 @@ bool TmxControl::events(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); @@ -434,7 +440,8 @@ bool TmxControl::system_config(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -476,7 +483,8 @@ bool TmxControl::clear_event_log(pluginlist &, ...) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->executeUpdate(); //unique_ptr stmt(conn.Get()->createStatement()); @@ -511,7 +519,8 @@ bool TmxControl::user_info(bool showPassword) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); unique_ptr rs(stmt->executeQuery()); @@ -566,7 +575,8 @@ bool TmxControl::all_users_info(bool showPassword) _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -631,7 +641,8 @@ bool TmxControl::user_add() PLOG(logDEBUG1) << "Executing query (?1 = " << username << ", ?2 = " << password << ", ?3 = " << access_level << ", ?4 = " << username << "): " << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt.reset(conn.Get()->prepareStatement(query)); stmt->setString(1, username); @@ -699,7 +710,8 @@ bool TmxControl::user_update() query += " WHERE username = ?"; PLOG(logDEBUG1) << "Executing query : " << query; - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); if (havePassword) { @@ -754,7 +766,8 @@ bool TmxControl::user_delete() _output.get_storage().get_tree().clear(); - DbConnection conn = _pool.Connection(); + std::string pwd = _pool.GetPwd(); + DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); int deleted = stmt->executeUpdate(); diff --git a/src/tmx/TmxCtl/src/lib/TmxControl.h b/src/tmx/TmxCtl/src/lib/TmxControl.h index 2c65e1b94..77169d205 100644 --- a/src/tmx/TmxCtl/src/lib/TmxControl.h +++ b/src/tmx/TmxCtl/src/lib/TmxControl.h @@ -88,8 +88,7 @@ class TmxControl: public tmx::utils::Runnable { void DisablePermissionCheck(); std::string GetOutput(TmxControlOutputFormat format, bool pretty); tmx::message_container_type* GetOutput(); - // Method for getting credentials - // std::string GetPwd(); + private: boost::program_options::variables_map *_opts; diff --git a/src/tmx/TmxUtils/src/Logger.h b/src/tmx/TmxUtils/src/Logger.h index 855146577..51c3af4f3 100644 --- a/src/tmx/TmxUtils/src/Logger.h +++ b/src/tmx/TmxUtils/src/Logger.h @@ -9,11 +9,11 @@ #define SRC_LOGGER_H_ #ifndef LOGGER_MAX_LEVEL -#define LOGGER_MAX_LEVEL tmx::utils::logERROR +#define LOGGER_MAX_LEVEL tmx::utils::logDEBUG4 #endif #ifndef DEFAULT_LOG_LEVEL -#define DEFAULT_LOG_LEVEL "DEBUG" +#define DEFAULT_LOG_LEVEL "ERROR" #endif #define UNKNOWN_SOURCE "Unknown source" diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json index 34316088a..993db59b3 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json @@ -9,7 +9,7 @@ "configuration": [ { "key": "Messages_Destination_1", - "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }", + "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }", "description": "JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1." }, { diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp index b0a93deb8..bd0aed219 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp @@ -71,7 +71,8 @@ void DsrcMessageManagerPlugin::OnMessageReceived(IvpMessage *msg) { // Uncomment this line to call the base method, which prints the message received to cout. //PluginClient::OnMessageReceived(msg); - + PLOG(logDEBUG) << "Message Received " << + "Type: " << msg->type << ", Subtype: " << msg->subtype; if (!_configRead) { PLOG(logWARNING) << "Config not read yet. Message Ignored: " << diff --git a/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt b/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt deleted file mode 100644 index bb2ae8805..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -PROJECT ( MobilityOperationPlugin VERSION 5.0 LANGUAGES CXX ) - -BuildTmxPlugin ( ) - -TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils) \ No newline at end of file diff --git a/src/v2i-hub/MobilityOperationPlugin/manifest.json b/src/v2i-hub/MobilityOperationPlugin/manifest.json deleted file mode 100644 index 87f553c28..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/manifest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name":"MobilityOperationPlugin", - "description":"...", - "version":"@PROJECT_VERSION@", - "exeLocation":"/bin/MobilityOperationPlugin", - "coreIpAddr":"127.0.0.1", - "corePort":24601, - "messageTypes":[ - { - "type":"J2735", - "subtype":"TMSG03-P", - "description":"In development" - } - ], - "configuration":[ - { - "key":"...", - "default":"...", - "description":"..." - } - - ] -} diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp deleted file mode 100644 index e445d6c11..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================ -// Name : MobilityOperationPlugin.cpp -// Author : Paul Bourelly -// Version : 5.0 -// Copyright : Your copyright notice -// Description : Hello World in C++, Ansi-style -//============================================================================ - -#include "MobilityOperationPlugin.h" - - -namespace MobilityOperationPlugin { - - - -/** - * Construct a new MobililtyOperationPlugin with the given name. - * - * @param name The name to give the plugin for identification purposes - */ -MobilityOperationPlugin::MobilityOperationPlugin(string name) : - PluginClient(name) { - - FILELog::ReportingLevel() = FILELog::FromString("INFO"); - AddMessageFilter < tsm3Message > (this, &MobilityOperationPlugin::HandleMobilityOperationMessage); - SubscribeToMessages(); - -} - -MobilityOperationPlugin::~MobilityOperationPlugin() { -} - -void MobilityOperationPlugin::UpdateConfigSettings() { - -} - -void MobilityOperationPlugin::OnConfigChanged(const char *key, const char *value) { - PluginClient::OnConfigChanged(key, value); - UpdateConfigSettings(); -} - - -void MobilityOperationPlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { - auto mobilityOperation = msg.get_j2735_data(); - // FILE_LOG(logDEBUG) << "Checking log level : " << FILELog::ReportingLevel(); - PLOG(logDEBUG) << "Received MobilityOperation message (encoded) : " << routeableMsg.get_payload_str(); - PLOG(logDEBUG) << "Header Host BSM ID : " << mobilityOperation->header.hostBSMId.buf; - PLOG(logDEBUG) << "Header Host Static ID : " << mobilityOperation->header.hostStaticId.buf; - PLOG(logDEBUG) << "Header Plan ID : " << mobilityOperation->header.planId.buf; - PLOG(logDEBUG) << "Header Target Static ID : " << mobilityOperation->header.targetStaticId.buf; - PLOG(logDEBUG) << "Header Timestamp : " << mobilityOperation->header.timestamp.buf; - PLOG(logDEBUG) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf; - PLOG(logDEBUG) << "Body Strategy : " << mobilityOperation->body.strategy.buf; - - -} - -void MobilityOperationPlugin::OnStateChange(IvpPluginState state) { - PluginClient::OnStateChange(state); - - if (state == IvpPluginState_registered) { - UpdateConfigSettings(); - } -} - - -int MobilityOperationPlugin::Main() { - FILE_LOG(logINFO) << "Starting plugin."; - - uint64_t lastSendTime = 0; - - while (_plugin->state != IvpPluginState_error) { - - - - usleep(100000); //sleep for microseconds set from config. - } - - return (EXIT_SUCCESS); -} -} - -int main(int argc, char *argv[]) { - return run_plugin < MobilityOperationPlugin::MobilityOperationPlugin > ("MobilityOperationPlugin", argc, argv); -} - diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h deleted file mode 100644 index 6d704e3b0..000000000 --- a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SRC_MOBILITYOPERATIONPLUGIN_H_ -#define SRC_MOBILITYOPERATIONPLUGIN_H_ -#include "PluginClient.h" -#include - - -using namespace std; -using namespace tmx; -using namespace tmx::utils; -using namespace tmx::messages; - -namespace MobilityOperationPlugin { - -class MobilityOperationPlugin: public PluginClient { -public: - MobilityOperationPlugin(std::string); - virtual ~MobilityOperationPlugin(); - int Main(); -protected: - - void UpdateConfigSettings(); - - // Virtual method overrides. - void OnConfigChanged(const char *key, const char *value); - - void OnStateChange(IvpPluginState state); - - void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); - -private: -}; -} -#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt b/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt new file mode 100644 index 000000000..8a8883b35 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt @@ -0,0 +1,24 @@ +PROJECT ( PortDrayagePlugin VERSION 5.0 LANGUAGES CXX ) + +SET (TMX_PLUGIN_NAME "PortDrayage") +set(CMAKE_AUTOMOC ON) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") + +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) + + +include_directories( "/usr/local/include/pdclient") + + + +message(CMAKE MODULE : ${CMAKE_MODULE_PATH} ) + + +BuildTmxPlugin ( ) + +target_link_libraries(${PROJECT_NAME} PRIVATE pdclient ) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ssl crypto ) +target_link_libraries(${PROJECT_NAME} PUBLIC tmxutils) + diff --git a/src/v2i-hub/PortDrayagePlugin/manifest.json b/src/v2i-hub/PortDrayagePlugin/manifest.json new file mode 100644 index 000000000..a3ee8f40c --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/manifest.json @@ -0,0 +1,78 @@ +{ + "name":"PortDrayagePlugin", + "description":"PortDrayagePlugin for sending freight trucks automated actions in a port.", + "version":"@PROJECT_VERSION@", + "exeLocation":"/bin/PortDrayagePlugin", + "coreIpAddr":"127.0.0.1", + "corePort":24601, + "messageTypes":[ + { + "type":"J2735", + "subtype":"TMSG03-P", + "description":"MobilityOperation message is a prototyping message with a configurable payload." + } + ], + "configuration":[ + { + "key":"Database_IP", + "default":"127.0.0.1", + "description":"IP address of database" + }, + { + "key":"Database_Port", + "default":"3306", + "description":"Port of database" + }, + { + "key":"Database_Username", + "default":"root", + "description":"Username for database" + }, + { + "key":"Database_Password", + "default":"ivp", + "description":"Password for database" + }, + { + "key":"Database_Name", + "default":"PORT_DRAYAGE", + "description":"Name of database." + }, + { + "key":"LogLevel", + "default":"INFO", + "description":"The log level for this plugin" + }, + { + "key":"Webservice_Host", + "default":"127.0.0.1", + "description":"PortDrayage Webservice Host Address" + }, + { + "key":"Webservice_Port", + "default": "8090", + "description": "PortDrayage WebService Port" + }, + { + "key":"Webservice_Secure", + "default": "false", + "description": "Boolean flag set to true for HTTPS communication" + }, + { + "key":"Webservice_Polling_Frequency", + "default": "5", + "description": "Polling Frequency for PortDrayage Webservice action status in seconds" + }, + { + "key":"Holding_Lat", + "default":"45.45", + "description":"Latitude Coordinate for Holding Area GPS Location in Degrees(-90,90)." + }, + { + "key":"Holding_Lon", + "default":"-45.45", + "description":"Longitude Coordinate for Holding Area GPS Location in Degrees(-180,180)." + } + + ] +} diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp new file mode 100644 index 000000000..da15930d0 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp @@ -0,0 +1,491 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +#include "PortDrayagePlugin.h" + + + +namespace PortDrayagePlugin { + +PortDrayagePlugin::PortDrayagePlugin(string name) : + PluginClient(name) { + // Plugin Handles MobilityOperation Messages + AddMessageFilter < tsm3Message > (this, &PortDrayagePlugin::HandleMobilityOperationMessage); + SubscribeToMessages(); + +} + +PortDrayagePlugin::~PortDrayagePlugin() { +} + +void PortDrayagePlugin::UpdateConfigSettings() { + + lock_guard lock(_cfgLock); + + std::string _database_username; + std::string _database_password; + uint16_t _database_port; + std::string _database_ip; + std::string _database_name; + // Database configuration + GetConfigValue("Database_Username", _database_username); + GetConfigValue("Database_Password", _database_password); + GetConfigValue("Database_IP",_database_ip); + GetConfigValue("Database_Port",_database_port); + GetConfigValue("Database_Name", _database_name); + // Port Drayage Web Service Configuration + uint16_t polling_frequency; + uint16_t polling_timeout; + std::string host; + uint16_t port; + bool secure; + // Host address + GetConfigValue("Webservice_Host", host); + // Host Port + GetConfigValue("Webservice_Port", port); + // True for HTTPS + GetConfigValue("Webservice_Secure", secure); + // Polling Frequency in seconds + GetConfigValue("Webservice_Polling_Frequency", polling_frequency); + + client = std::make_shared( host, port, secure, polling_frequency ); + // Port Holding Area Configurable location + GetConfigValue("Holding_Lat", _holding_lat); + GetConfigValue("Holding_Lon", _holding_lon); + PLOG(logDEBUG) << "Holding Area set : (" << _holding_lat << ", " << _holding_lon << ")" << std::endl; + + // Create DB connection + std::string connection_string = "tcp://" + _database_ip + ":" + std::to_string(_database_port); + try { + driver = get_driver_instance(); + con = driver->connect(connection_string,_database_username,_database_password); + con->setSchema(_database_name); + // Initialize PreparedStatements for MySQL + // Get next_action for given action_id + next_action_id = con->prepareStatement("SELECT next_action FROM freight WHERE action_id = ? "); + // Get current action for given action_id + current_action = con->prepareStatement("SELECT * FROM freight WHERE action_id = ? "); + // Get first action for vehicle + first_action = con->prepareStatement("SELECT * FROM first_action WHERE cmv_id = ? " ); + // Insert action into freight table + insert_action = con->prepareStatement("INSERT INTO freight VALUES(?,?,?,?,?, UUID(), ?)"); + // Get action_id of the previous action given action_id + get_action_id_for_previous_action = con->prepareStatement("SELECT action_id FROM freight WHERE next_action = ? and operation = ? "); + // Update next_action for an action with given action_id + update_current_action = con->prepareStatement("UPDATE freight SET next_action = ? WHERE action_id = ?"); + + } + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + } + +} + +void PortDrayagePlugin::OnConfigChanged(const char *key, const char *value) { + PluginClient::OnConfigChanged(key, value); + UpdateConfigSettings(); +} + + +void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { + + // Retrieve J2735 Message + auto mobilityOperation = msg.get_j2735_data(); + + // String Stream for strategy and operationParams + std::stringstream strat; + std::stringstream payload; + + // Create ptree object for json + ptree pr; + + // Create new PortDrayage_Object pointer + std::unique_ptr pd( new PortDrayage_Object()); + + // Read strategy and operationParams + strat << mobilityOperation->body.strategy.buf; + payload << mobilityOperation->body.operationParams.buf; + + // Compare strategy to PortDrayage strategy + std::string strategy = strat.str(); + if ( strategy.compare(PORT_DRAYAGE_STRATEGY) == 0 ){ + try { + PLOG(logINFO) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf + << std::endl << "Body Strategy : " << mobilityOperation->body.strategy.buf; + // Convert JSON payload to PortDrayage_Object + read_json(payload, pr); + *pd = readPortDrayageJson( pr ); + } + catch( const ptree_error &e ) { + PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; + } + // Handle actions that require PortDrayage WebService Input + if ( pd->operation.compare(operation_to_string(Operation::PICKUP)) == 0 ) { + client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + } + else if ( pd->operation.compare(operation_to_string(Operation::DROPOFF)) == 0) { + client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); + } + else if ( pd->operation.compare(operation_to_string(Operation::CHECKPOINT)) == 0) { + // If holding == 1 insert HOLDING action into table + int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); + if ( holding == 1 ) { + insert_holding_action_into_table( *pd ); + } + } + else if ( pd->operation.compare(operation_to_string(Operation::HOLDING)) == 0) { + string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); + client->request_holding( previous_checkpoint_id ); + } + + + PLOG(logDEBUG) << "Port Drayage Message" << std::endl << + "cmv_id : " << pd->cmv_id << std::endl << + "cargo_id : " << pd->cargo_id << std::endl << + "cargo : " << pd->cargo << std::endl << + "operation : " << pd->operation << std::endl << + "location_lat : " << pd->location_lat << std::endl << + "location_long : " << pd->location_long << std::endl << + "destination_lat : " << pd->destination_lat << std::endl << + "destination_long : " << pd->destination_long << std::endl << + "action_id : " << pd->action_id << std::endl << + "next_action : " << pd->next_action << std::endl; + + + try{ + // Retrieve first or next action + PortDrayage_Object *new_action = new PortDrayage_Object(); + if ( pd->action_id.empty() ) { + PLOG(logDEBUG) << "Retrieving first action." << std::endl; + *new_action = retrieveFirstAction( pd->cmv_id ); + } + else { + PLOG(logDEBUG) << "Retrieving next action." << std::endl; + *new_action = retrieveNextAction( pd->action_id ); + } + + if ( !new_action->action_id.empty()) { + // Initializer vars + tsm3Message mob_msg; + tsm3EncodedMessage mobilityENC; + tmx::message_container_type container; + std::unique_ptr msg; + + // Create operationParams payload json + ptree payload = createPortDrayageJson( *new_action ); + + // Create XML MobilityOperationMessage + ptree message = createMobilityOperationXml( payload ); + std::stringstream content; + write_xml(content, message); + try { + // Uper encode message + container.load(content); + mob_msg.set_contents(container.get_storage().get_tree()); + mobilityENC.encode_j2735_message( mob_msg); + msg.reset(); + msg.reset(dynamic_cast(factory.NewMessage(api::MSGSUBTYPE_TESTMESSAGE03_STRING))); + string enc = mobilityENC.get_encoding(); + PLOG(logDEBUG) << "Encoded outgoing message : " << std::endl << mobilityENC.get_payload_str(); + msg->refresh_timestamp(); + msg->set_payload(mobilityENC.get_payload_str()); + msg->set_encoding(enc); + msg->set_flags(IvpMsgFlags_RouteDSRC); + msg->addDsrcMetadata(172,0xBFEE); + msg->refresh_timestamp(); + routeable_message *rMsg = dynamic_cast(msg.get()); + BroadcastMessage(*rMsg); + } + catch ( const J2735Exception &e) { + PLOG(logERROR) << "Error occurred during message encoding " << std::endl << e.what() << std::endl; + } + } + else { + PLOG(logWARNING) << "Could not find action!" << std::endl; + } + + } + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + } + } +} + + +ptree PortDrayagePlugin::createPortDrayageJson( const PortDrayage_Object &pd_obj) { + ptree json_payload; + json_payload.put("cmv_id", pd_obj.cmv_id ); + json_payload.put("cargo_id", pd_obj.cargo_id ); + ptree destination; + destination.put("latitude", pd_obj.destination_lat); + destination.put("longitude", pd_obj.destination_long); + json_payload.put_child("destination",destination); + json_payload.put("operation", pd_obj.operation ); + json_payload.put("action_id", pd_obj.action_id ); + return json_payload; +} + + +ptree PortDrayagePlugin::createMobilityOperationXml( const ptree &json_payload ) { + ptree mobilityOperationXml; + std::stringstream pl; + write_json( pl, json_payload); + // Create XML MobilityOperationMessage + ptree message; + ptree header; + ptree body; + body.put("strategy",PORT_DRAYAGE_STRATEGY); + body.put("operationParams", pl.str()); + header.put("hostStaticId", "UNSET"); + header.put("targetStaticId", "UNSET"); + header.put("hostBSMId", "00000000"); + header.put("planId", "00000000-0000-0000-0000-000000000000"); + header.put("timestamp", "0000000000000000000"); + message.put_child("header", header); + message.put_child("body",body); + mobilityOperationXml.put_child( "TestMessage03", message); + return mobilityOperationXml; +} + + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction(const std::string &action_id ) { + std::unique_ptr rtn( new PortDrayage_Object()); + try{ + // Set action_id + next_action_id->setString(1,action_id); + // Get current action + sql::ResultSet *cur_action = next_action_id->executeQuery(); + if ( cur_action->first() ) { + std::string next = cur_action->getString("next_action"); + // Set action_id to next_action + current_action->setString(1,next); + // Retrieve next action + sql::ResultSet *cur_action = current_action->executeQuery(); + // Create PortDrayage_Object + if ( cur_action->first() ) { + rtn->cmv_id = cur_action->getString("cmv_id"); + rtn->operation = cur_action->getString("operation"); + rtn->action_id = cur_action->getString("action_id"); + rtn->cargo_id = cur_action->getString("cargo_id"); + rtn->destination_long = cur_action->getDouble("destination_long"); + rtn->destination_lat = cur_action->getDouble("destination_lat"); + rtn->next_action = cur_action->getString("next_action"); + + PLOG(logDEBUG) << "Port Drayage Message : " << std::endl << + "cmv_id : " << rtn->cmv_id << std::endl << + "cargo_id : " << rtn->cargo_id << std::endl << + "operation : " << rtn->operation << std::endl << + "destination_lat : " << rtn->destination_lat << std::endl << + "destination_long : " << rtn->destination_long << std::endl << + "action_id : " << rtn->action_id << std::endl << + "next_action : " << rtn->next_action << std::endl; + } + else { + // If we are able to retrieve the current action but not it's next_action we can + // assume it was the last action in the DB. + PLOG(logINFO) << "Last action completed! No action found with action id " << next << std::endl; + + } + } + } + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + } + return *rtn; +} + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( const std::string &cmv_id ) { + std::unique_ptr rtn( new PortDrayage_Object()); + try{ + // Set cmv_id + first_action->setString(1,cmv_id); + // Retrieve first action of first_action table + sql::ResultSet *cur_action = first_action->executeQuery(); + if ( cur_action->first() ) { + // Create Port Drayage object + rtn->cmv_id = cur_action->getString("cmv_id"); + rtn->operation = cur_action->getString("operation"); + rtn->action_id = cur_action->getString("action_id"); + rtn->cargo_id = cur_action->getString("cargo_id"); + rtn->destination_long = cur_action->getDouble("destination_long"); + rtn->destination_lat = cur_action->getDouble("destination_lat"); + rtn->next_action =cur_action->getString("next_action"); + PLOG(logDEBUG) << "Port Drayage Message" << std::endl << + "cmv_id : " << rtn->cmv_id << std::endl << + "cargo_id : " << rtn->cargo_id << std::endl << + "operation : " << rtn->operation << std::endl << + "destination_lat : " << rtn->destination_lat << std::endl << + "destination_long : " << rtn->destination_long << std::endl << + "action_id : " << rtn->action_id << std::endl << + "next_action : " << rtn->next_action << std::endl; + return *rtn; + } + else { + PLOG(logERROR) << "No first action for cmv_id : " << cmv_id << " found!"; + return *rtn; + } + + + } + catch ( const sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + return *rtn; + } + +} + + +PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( const ptree &pr ) { + std::unique_ptr pd( new PortDrayage_Object()); + try { + pd->cmv_id = pr.get_child("cmv_id").get_value(); + boost::optional child = pr.get_child_optional( "action_id" ); + if( !child ) + { + PLOG(logINFO) << "No action_id present! This is the vehicle's first action" << std::endl; + } + else { + pd->action_id = child.get_ptr()->get_value(); + // For eventually tracking of completed actions + pd->operation = pr.get_child("operation").get_value(); + child = pr.get_child_optional("cargo_id"); + if ( child ) { + pd->cargo_id = pr.get_child("cargo_id").get_value(); + } + child = pr.get_child_optional("location"); + if ( child ) { + ptree location = pr.get_child("location"); + pd->location_lat =location.get_child("latitude").get_value(); + pd->location_long = location.get_child("longitude").get_value(); + } + + + } + return *pd.get(); + + } + catch( const ptree_error &e ) { + PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; + return *pd.get(); + } +} + +void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Object ¤t_action ) { + std::unique_ptr next_action( new PortDrayage_Object()); + try{ + + *next_action = retrieveNextAction(current_action.action_id); + PLOG(logDEBUG1) << "Insert Holding action between " << current_action.action_id << " and " + << next_action->action_id << "." << std::endl; + //INSERT INTO FREIGHT VALUES(cmv_id,cargo_id,_holding_lat,_holding_lon,HOLDING, UUID(), next_action->action_id) + insert_action->setString(1,current_action.cmv_id); + insert_action->setString(2,current_action.cargo_id); + insert_action->setDouble(3,_holding_lat); + insert_action->setDouble(4,_holding_lon); + insert_action->setString(5, "HOLDING_AREA"); + insert_action->setString(6, next_action->action_id); + PLOG(logDEBUG) << "Query : INSERT INTO FREIGHT VALUES(" + << current_action.cmv_id << ", " << current_action.cargo_id << ", " + << _holding_lat << ", " << _holding_lon << ", UUID(), HOLDING_AREA )" << std::endl; + sql::ResultSet *res = insert_action->executeQuery(); + + // SELECT action_id FROM freight WHERE next_action = ? and operation = ? + get_action_id_for_previous_action->setString(1, next_action->action_id); + get_action_id_for_previous_action->setString(2, "HOLDING_AREA"); + PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " + << next_action->action_id << " and operation = HOLDING_AREA " << std::endl; + + res = get_action_id_for_previous_action->executeQuery(); + res->first(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; + } + std::string action_id = res->getString("action_id"); + + // UPDATE freight SET next_action = ? WHERE action_id = ? + update_current_action->setString( 1, action_id); + update_current_action->setString( 2, current_action.action_id); + PLOG(logDEBUG) << "Query : UPDATE freight SET next_action = " + << action_id << " WHERE action_id = " << current_action.action_id << std::endl; + res = update_current_action->executeQuery(); + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + } +} + +std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( const std::string &action_id ) { + try{ + get_action_id_for_previous_action->setString(1, action_id); + get_action_id_for_previous_action->setString(2, "PORT_CHECKPOINT"); + PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " + << action_id << " and operation = PORT_CHECKPOINT " << std::endl; + + sql::ResultSet *res = get_action_id_for_previous_action->executeQuery(); + res->first(); + if ( res->isFirst() ) { + PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; + } + std::string action_id = res->getString("action_id"); + return action_id; + } + catch ( sql::SQLException &e ) { + PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl + << "Error code " << e.getErrorCode() << std::endl + << "Error status " << e.getSQLState() << std::endl; + return ""; + } +} + +/** + * Trigger when Plugin state changes + * + * @param state IvpPluginState + */ +void PortDrayagePlugin::OnStateChange(IvpPluginState state) { + PluginClient::OnStateChange(state); + + if (state == IvpPluginState_registered) { + UpdateConfigSettings(); + } +} + + +int PortDrayagePlugin::Main() { + uint64_t lastSendTime = 0; + while (_plugin->state != IvpPluginState_error) { + usleep(100000); //sleep for microseconds set from config. + } + return (EXIT_SUCCESS); +} +} + +int main(int argc, char *argv[]) { + // Qt HttpClient setup + QCoreApplication a(argc, argv); + return run_plugin < PortDrayagePlugin::PortDrayagePlugin > ("PortDrayagePlugin", argc, argv); +} + diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h new file mode 100644 index 000000000..c823ac3b3 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h @@ -0,0 +1,223 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +#ifndef SRC_PortDrayagePlugin_H_ +#define SRC_PortDrayagePlugin_H_ +#include "PluginClient.h" +#include +#include +#include +#include +#include "mysql_connection.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "WebServiceClient.h" + +using namespace std; +using namespace tmx; +using namespace tmx::utils; +using namespace tmx::messages; +using namespace boost::property_tree; +using namespace OpenAPI; + +namespace PortDrayagePlugin { +// constant for MobilityOperation strategy +static CONSTEXPR const char *PORT_DRAYAGE_STRATEGY = "carma/port_drayage"; + +// Enumeration for different operations +enum Operation { + PICKUP,DROPOFF,CHECKPOINT,HOLDING,ENTER_STAGING,EXIT_STAGING,ENTER_PORT,EXIT_PORT +}; + +std::string operation_to_string( Operation operation ) { + switch(operation) { + case PICKUP: + return "PICKUP"; + case DROPOFF: + return "DROPOFF"; + case CHECKPOINT: + return "PORT_CHECKPOINT"; + case HOLDING: + return "HOLDING_AREA"; + case ENTER_STAGING: + return "ENTER_STAGING_AREA"; + case EXIT_STAGING: + return "EXIT_STAGING_AREA"; + case ENTER_PORT: + return "ENTER_PORT"; + case EXIT_PORT: + return "EXIT_PORT"; + default: + return "INVALID_OPERATION"; + } +} +/** + * PortDrayagePlugin is a V2X-Hub plugin for automating Freight truck interactions for + * moving containers between and Port and a Staging Area. The plugin process MobilityOperation + * messages with the strategy PORT_DRAYAGE_STRATEGY. The payload of this MobilityOperation + * message is a JSON object consisting of mainly : + * action_id : unique identifier for the action + * vehicle_id : unique static identifier for the vehicle (NOT BSMID) + * operation : string enumeration describing the action that is to take place + * This Plugin requires a MySQL database with two table to store all vehicle action (table name: freight) and + * to store the first action for any given vehicle (table name : first_action). Upon initial communication + * with V2X-Hub the vehicle will just send an ENTER_STAGING_AREA actions with no action ID. When this initial + * message is received by V2X-Hub it will query the first_action table for the vehicle first action. Every action + * in the database is linked to a next action. Once the vehicle completes an action it notifies V2X-Hub of completion + * by sending out the action it just completed. V2X-Hub will then query the database for the next linked action + * + * @author Paul Bourelly + * @version 6.2 + */ +class PortDrayagePlugin: public PluginClient { +public: + struct PortDrayage_Object { + std::string cmv_id; + std::string cargo_id; + bool cargo; + std::string operation; + double location_lat; + double location_long; + double destination_lat; + double destination_long; + std::string action_id; + std::string next_action; + }; + /** + * Construct a new MobililtyOperationPlugin with the given name. + * + * @param name The name to give the plugin for identification purposes + */ + PortDrayagePlugin(std::string); + /** + * Constructor without paramaters + */ + virtual ~PortDrayagePlugin(); + int Main(); +protected: + /** + * Update Configuration + */ + void UpdateConfigSettings(); + + // Virtual method overrides. + /** + * Method triggers UpdateConfigSettings() on configuration changes + */ + void OnConfigChanged(const char *key, const char *value); + + void OnStateChange(IvpPluginState state); + /** + * Method to create port drayage payload JSON ptree using a PortDrayage_Object. + * + * @param pd_obj Port Drayage object. + * @return json ptree + */ + ptree createPortDrayageJson( const PortDrayage_Object &pd_obj); + /** + * Method to create MobilityOperation XML ptree. + * + * @param ptree json payload + * @return MobilityOperation message XML ptree + */ + ptree createMobilityOperationXml( const ptree &json_payload); + + /** + * Handle MobilityOperation message. + * + * @param tsm3Message J2735 MobilityOperation message + * @param routeableMsg JSON MobilityOperation message + */ + void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); + /** + * Retrieve next action from freight table using action_id + * + * @param action_id string + */ + PortDrayage_Object retrieveNextAction( const std::string &action_id ); + /** + * Retrieve first action from first_action table using cmv_id. + * + * @param cmv_id + * @return PortDrayage_Object of first action + */ + PortDrayage_Object retrieveFirstAction( const std::string &cmv_id ); + + /** + * Create PortDrayage_Object from ptree JSON. + * + * @param pr PortDrayage JSON + * @return PortDrayage_Object + */ + PortDrayage_Object readPortDrayageJson( const ptree &pr ); + + /** + * Dynamically inserts HOLDING_AREA action into mysql table between + * current_action and next_action. Current action should be PORT_CHECKPOINT + * and next_action should be EXIT_PORT + * + * @param current_action PORT_CHECKPOINT action + */ + void insert_holding_action_into_table(const PortDrayage_Object ¤t_action ); + + /** + * Retrieves HOLDING_AREA action when provided with PORT_CHECKPOINT action + * from mysql freight table. + * + * @return action_id of HOLDING_AREA action + */ + std::string retrieve_holding_inspection_action_id( const std::string &action_id ); + + +private: + // Database configuration values + + + + sql::Driver *driver; + sql::Connection *con; + + // Prepared Statements + sql::PreparedStatement *next_action_id; + sql::PreparedStatement *current_action; + sql::PreparedStatement *first_action; + sql::PreparedStatement *insert_action; + sql::PreparedStatement *get_action_id_for_previous_action; + sql::PreparedStatement *update_current_action; + + // Message Factory for J2735 messages + J2735MessageFactory factory; + + // Web Service Client + std::shared_ptr client; + + // Port HOLDING_AREA Configuration + double _holding_lat; + double _holding_lon; + +}; +std::mutex _cfgLock; + +} +#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp new file mode 100644 index 000000000..9227946ac --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp @@ -0,0 +1,284 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +#include "WebServiceClient.h" + + +WebServiceClient::WebServiceClient() { + initialize(DEF_HOST, DEF_PORT, DEF_SECURITY, DEF_POLLING_FREQ); +} + +WebServiceClient::WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ) { + initialize(host, port, secure, polling_frequency); +} +void WebServiceClient::initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency) { + this->polling_frequency = polling_frequency; + + // Create URL + std::unique_ptr url( new QUrl()); + url.get()->setHost(QString::fromStdString(host)); + url.get()->setPort(port); + if ( secure ) { + url.get()->setScheme(QString::fromStdString("https")); + } + else { + url.get()->setScheme(QString::fromStdString("http")); + + } + PLOG(logINFO) << "Setting API URL as " << url.get()->toString().toStdString() << std::endl; + // Initialize API + api = std::make_shared(0); + // Setup server config + api.get()->setNewServerForAllOperations( + *url.get(), + QString::fromStdString("V2X-Hub Configured PortDrayage WebService"), + QMap() + ); + +} + +void WebServiceClient::request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { + std::unique_ptr req(new OAIContainerRequest ()); + std::unique_ptr loop( new QEventLoop()); + + // Disconnect duplicate signals + disconnect(api.get(), &OAIDefaultApi::loadingPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::loadingPostSignalE, nullptr, nullptr); + + // Call back for POST /loading/ + connect(api.get(), &OAIDefaultApi::loadingPostSignal, this, [&]() { + PLOG(logINFO) << "Success /loading POST"; + loop->quit(); + }); + // Error call back for POST /loading/ + connect(api.get(), &OAIDefaultApi::loadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure /loading POST : " << error_str.toStdString() << std::endl << "Error Code" << error_code; + loop->exit(1); + }); + + // Setup request + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); + + PLOG(logINFO) << "Sending loading request : " << req->asJson().toStdString(); + api->loadingPost( *req.get() ); + loop->exec(); + // Poll loading action until complete + pollLoadingAction( req->getActionId() ); + + +} + +void WebServiceClient::request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { + std::unique_ptr req(new OAIContainerRequest ()); + std::unique_ptr loop( new QEventLoop()); + + // Disconnect duplicate signals + disconnect(api.get(), &OAIDefaultApi::unloadingPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::unloadingPostSignalE, nullptr, nullptr); + + // Call back for POST /unloading/ + connect(api.get(), &OAIDefaultApi::unloadingPostSignal, this, [&]() { + PLOG(logINFO) << "Success /unloading POST"; + loop->quit(); + }); + // Error call back for POST /unloading/ + connect(api.get(), &OAIDefaultApi::unloadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; + loop->exit(1); + }); + + // Setup request + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); + + PLOG(logINFO) << "Sending unloading request : " << req->asJson().toStdString(); + api->unloadingPost( *req.get() ); + loop->exec(); + + // Polling unloading action until complete + pollUnloadingAction( req->getActionId() ); + +} + +int WebServiceClient::request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id ) { + std::unique_ptr req(new OAIInspectionRequest()); + std::unique_ptr loop( new QEventLoop()); + + // Disconnect all duplicate signals + disconnect(api.get(),&OAIDefaultApi::inspectionPostSignal, nullptr, nullptr ); + disconnect(api.get(),&OAIDefaultApi::inspectionPostSignalE, nullptr, nullptr ); + + // Call back for POST /inspection/ + connect(api.get(), &OAIDefaultApi::inspectionPostSignal, this, [&]() { + PLOG(logINFO) << "Success /inspection POST"; + loop->quit(); + }); + // Error call back for POST /inspection/ + connect(api.get(), &OAIDefaultApi::inspectionPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString() << std::endl << "Error Code :" << error_code; + loop->exit(1); + }); + + // Setup request + req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; + req->setContainerId( QString::fromStdString( container_id ) ); + req->setActionId( QString::fromStdString( action_id ) ); + + PLOG(logINFO) << "Sending inspection request : " << req->asJson().toStdString(); + api->inspectionPost( *req.get() ); + loop->exec(); + + // Poll inspection status until complete or proceed to holding + return pollInspectionAction( req->getActionId() ); +} + +void WebServiceClient::request_holding( const std::string &action_id ) { + std::unique_ptr loop( new QEventLoop()); + + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, nullptr, nullptr); + + // Call back for POST /inspection/ + connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { + PLOG(logINFO) << "Success /inspection/holding/{action_id} POST"; + loop->quit(); + }); + // Error call back for POST /inspection/ + connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString()<< std::endl << "Error Code : " << error_code; + loop->exit(1); + }); + PLOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; + api.get()->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); + loop->exec(); + // Poll inspection action until complete + pollInspectionAction( QString::fromStdString( action_id ) ); + +} + +void WebServiceClient::pollLoadingAction( QString action_id ) { + PLOG(logDEBUG) << "Starting loading action Polling"; + std::unique_ptr loop( new QEventLoop()); + bool badResponse = true; + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, nullptr, nullptr); + + // Call back for Get /loading/{action_id} + connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, this, [&](OAIContainerActionStatus loading_action) { + loading_status.reset( new OAIContainerActionStatus( loading_action.asJson( ) ) ); + PLOG(logINFO) << "Success /loading/{action_id} GET : " << loading_status->asJson().toStdString(); + badResponse = false; + loop->quit(); + }); + // Error call back for Get /loading/{action_id} + connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, this, + [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; + badResponse = true; + loop->exit(1); + }); + // Flag to continue polling until receiving a non error response from server + do { + api->loadingActionIdGet( action_id ); + loop->exec(); + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + } + while ( badResponse || loading_status->getStatus() != QString::fromStdString( "LOADED") ) ; + +} + +void WebServiceClient::pollUnloadingAction( QString action_id) { + PLOG(logDEBUG) << "Starting unloading action Polling"; + std::unique_ptr loop( new QEventLoop()); + + bool badResponse = true; + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, nullptr, nullptr); + // Call back for Get /unloading/{action_id} + connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, this, [&](OAIContainerActionStatus unloading_action) { + unloading_status.reset( new OAIContainerActionStatus( unloading_action.asJson() ) ); + PLOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); + badResponse = false; + loop->quit(); + }); + // Error call back for Get /unloading/{action_id} + connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, this, + [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; + badResponse = true; + loop->exit(1); + }); + // Flag to continue polling until receiving a non error response from server + do { + api->unloadingActionIdGet( action_id ); + loop->exec(); + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + + } + while( badResponse || unloading_status->getStatus() != QString::fromStdString( "UNLOADED") ); +} + +int WebServiceClient::pollInspectionAction( QString action_id ) { + PLOG(logDEBUG) << "Starting inspection action Polling"; + std::unique_ptr loop( new QEventLoop()); + bool badResponse = true; + + // Disconnect all duplicate signals + disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, nullptr, nullptr); + disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, nullptr, nullptr); + + // Call back for GET /inspection/{action_id} + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, this , [&](OAIInspectionStatus inspection) { + inspection_status.reset( new OAIInspectionStatus( inspection.asJson() ) ); + PLOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; + badResponse = false; + loop->quit(); + }); + // Error call back for /inspection/{action_id} + connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, this, + [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { + PLOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; + badResponse = true; + loop->exit(1); + }); + do { + api->inspectionActionIdGet( action_id ); + loop->exec(); + + if (inspection_status->getStatus() == QString::fromStdString( "PASSED")){ + return 0; + } + else if (inspection_status->getStatus() == QString::fromStdString( "PROCEED_TO_HOLDING")) { + return 1; + } + // usleep coversion from seconds to microseconds + usleep( polling_frequency * 1e6 ); + + + } + while( badResponse || (inspection_status->getStatus() != QString::fromStdString( "PASSED") && + inspection_status->getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); + return -1; +} + + diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h new file mode 100644 index 000000000..f0f835259 --- /dev/null +++ b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h @@ -0,0 +1,144 @@ +/** + * Copyright (C) 2019 LEIDOS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +#pragma once +#include +#include +#include "PluginLog.h" +#include +#include +#include +#include + +using namespace OpenAPI; +using namespace tmx::utils; + +// Default values for no arg constructor +static CONSTEXPR const char *DEF_HOST = "127.0.0.1"; +static CONSTEXPR const uint16_t DEF_PORT = 8090; +static CONSTEXPR const uint16_t DEF_POLLING_FREQ = 5; +static CONSTEXPR const bool DEF_SECURITY = false; + +/** + * WebService REST Client using OpenAPI codegen library pdclient found under V2X-Hub/ext/pdclient. Contains several method to + * send POST requests for loading, unloading, and inspection actions and poll the action status. + * + * @author Paul Bourelly + */ +class WebServiceClient : public QObject +{ + Q_OBJECT +public slots: + +private: + // Stored in Seconds + uint16_t polling_frequency; + + + // OAIDefaultApi pointer + std::shared_ptr api; + std::shared_ptr loading_status; + std::shared_ptr unloading_status; + std::shared_ptr inspection_status; + /** + * Method to poll the status of a loading action with a given action id. + * + * @param action_id of the loading action to be polled + */ + void pollLoadingAction(QString action_id); + + /** + * Method to poll the status of a unloading action with a given action id. + * + * @param action_id of the unloading action to be polled + */ + void pollUnloadingAction(QString action_id); + + /** + * Method to poll the status of a inspection with a given action id. + * + * @param action_id of the inspection to be polled + * @return 0 if inspection is passed and 1 if further inspection at the holding area is requested + */ + int pollInspectionAction(QString action_id); + + /** + * Method to initialize server configuration and polling frequency + * + * @param host string host name of server + * @param port uint16_t port of server + * @param secure bool flag set to true for using HTTPS + * @param polling_frequency + */ + void initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency); + + +public: + + /** + * Constructor without parameters + */ + WebServiceClient(); + + /** + * Constructor for WebServiceClient + * + * @param host string webservice host URL + * @param port uint8_t webservice port + * @param secure boolean flag set to true when using HTTPS + * @param int polling frequency in seconds for action status + * + */ + WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ); + + /** + * Method to request a loading action. Sends a HTTP POST call to the loading endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once loading action is completed. + * + * @param vehicle_id static unique identifier for vehicle + * @param container_id static unique identifier for container + * @param action_id static unique identifier for action + */ + void request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); + /** + * Method to request an unloading action. Sends a HTTP POST call to the unloading endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once unloading action is completed. + * + * @param vehicle_id static unique identifier for the vehicle + * @param container_id static unique identifier for the container + * @param action_id static unique identifier for the action + */ + void request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); + /** + * Method to request an inspection action. Sends a HTTP POST call to the inspection endpoint of the PortDrayage Webservice and then + * polls the status of the request every 5 seconds. Method will exit once inspection action is completed or operator indicates the + * vehicle requires further inspection at the Holding area + * + * @param vehicle_id static unique identifier for the vehicle + * @param container_id static unique identifier for container + * @param action_id static unique identifier for the action + */ + int request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); + /** + * Method request further inspection at the Holding area. Sends a HTTP POST call to inspection holding endpoint of the PortDrayage Webservice + * and then poll the status of the request every 5 seconds. Method will exit once inspection action is completed. + * + * @param action_id static unique identifier for action + */ + void request_holding(const std::string &action_id); + + +}; diff --git a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp index a495dddd7..e82dff414 100644 --- a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp +++ b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp @@ -105,11 +105,7 @@ void PreemptionPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_messa bsmTmpID = (int32_t)((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]); - //std::vector::iterator it = std::find(allowedList.begin(),allowedList.end(),bsmTmpID); - - //if( it != allowedList.end()) - //{ - if (bsm->partII != NULL) { + if (bsm->partII != NULL) { if (bsm->partII[0].list.count >= partII_Value_PR_SpecialVehicleExtensions ) { try { if(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.vehicleAlerts != NULL){ @@ -125,9 +121,7 @@ void PreemptionPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_messa PLOG(logDEBUG)<<"Standard Exception:; Vehicle alerts Unavailable"; } } - } - //} - + } } int PreemptionPlugin::Main() diff --git a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp index c3731e1e5..b52d18814 100644 --- a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp +++ b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp @@ -43,7 +43,7 @@ class PreemptionPlugin: public PluginClient } // PreemptionPlugin(PreemptionPlugin &&fp) noexcept { // } - PreemptionPlugin const & operator=(PreemptionPlugin &&fp) { + PreemptionPlugin const & operator=(PreemptionPlugin &&fp) noexcept{ } diff --git a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp index 91894ad1a..3ccf07216 100644 --- a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp +++ b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp @@ -7,60 +7,58 @@ //========================================================================== #include "PreemptionPluginWorker.hpp" - +#include using namespace std; namespace PreemptionPlugin { - void PreemptionPluginWorker::ProcessMapMessageFile(std::string path){ + void PreemptionPluginWorker::ProcessMapMessageFile(const std::string &path){ if(path != ""){ try { boost::property_tree::read_json(path, geofence_data); BOOST_FOREACH( boost::property_tree::ptree::value_type const& v, geofence_data.get_child( "data" ) ) { - assert(v.first.empty()); // array elements have no names boost::property_tree::ptree subtree = v.second; list geox; list geoy; BOOST_FOREACH( boost::property_tree::ptree::value_type const& u, subtree.get_child( "geox" ) ) { - assert(u.first.empty()); // array elements have no names - // std::cout << u.second.get("") << std::endl; double d = u.second.get(""); geox.push_back(d); } BOOST_FOREACH( boost::property_tree::ptree::value_type const& u, subtree.get_child( "geoy" ) ) { - assert(u.first.empty()); // array elements have no names double d = u.second.get(""); geoy.push_back(d); } - GeofenceObject* geofenceObject = new GeofenceObject(geox,geoy,subtree.get("PreemptCall"),subtree.get("HeadingMin"),subtree.get("HeadingMax")); + GeofenceObject geofenceObject(geox,geoy, static_cast(subtree.get("PreemptCall")),static_cast(subtree.get("HeadingMin")),static_cast(subtree.get("HeadingMax"))); - GeofenceSet.push_back(geofenceObject); + GeofenceSet.push_back(&geofenceObject); } } catch(...) { - std::cout << "Caught exception from reading a file"; + PLUGIN_LOG(logERROR, "Preemptionworker") << "Caught exception from reading a file"; } } - } - bool PreemptionPluginWorker::CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners) { - int i, j=GeoCorners-1 ; - bool oddNodes ; + bool PreemptionPluginWorker::CarInGeofence(long double x,long double y, std::vector geox, std::vector geoy, long GeoCorners) const{ + long i = 0 ; + long j = GeoCorners-1; + bool oddNodes = false; for (i=0; i=y - || geoy[j]< y && geoy[i]>=y) - && (geox[i]<=x || geox[j]<=x)) { - oddNodes^=(geox[i]+(y-geoy[i])/(geoy[j]-geoy[i])*(geox[j]-geox[i])=y + || geoy.at(j)< y && geoy.at(i)>=y) + && (geox.at(i)<=x || geox.at(j)<=x) && (geox.at(i)+(y-geoy.at(i))/(geoy.at(j)-geoy.at(i))*(geox.at(j)-geox.at(i))(); + auto vehicle_coordinate = std::make_shared(); auto bsm = msg->get_j2735_data(); int32_t bsmTmpID; @@ -84,16 +81,14 @@ namespace PreemptionPlugin { for (auto const& it: GeofenceSet) { - double geox[it->geox.size()]; - int k = 0; + std::vector geox; for (double const &i: it->geox) { - geox[k++] = i; + geox.push_back(i); } - double geoy[it->geoy.size()]; - k = 0; + std::vector geoy; for (double const &i: it->geoy) { - geoy[k++] = i; + geoy.push_back(i); } bool in_geo = CarInGeofence(vehicle_coordinate->lon, vehicle_coordinate->lat, geoy, geox, it->geox.size()); @@ -119,7 +114,7 @@ namespace PreemptionPlugin { }; - void PreemptionPluginWorker::PreemptionPlaner(PreemptionObject* po){ + void PreemptionPluginWorker::PreemptionPlaner(std::shared_ptr po){ if(po->approach == "1") { @@ -146,7 +141,7 @@ namespace PreemptionPlugin { std::cout << " Finished PreemptionPlaner" << std::endl; }; - void PreemptionPluginWorker::TurnOnPreemption(PreemptionObject* po){ + void PreemptionPluginWorker::TurnOnPreemption(std::shared_ptr po){ std::string preemption_plan_flag = "1"; std::asctime(std::localtime(&(po->time))); @@ -163,7 +158,7 @@ namespace PreemptionPlugin { } } - void PreemptionPluginWorker::TurnOffPreemption(PreemptionObject* po){ + void PreemptionPluginWorker::TurnOffPreemption(std::shared_ptr po){ std::string preemption_plan, preemption_plan_flag = ""; preemption_plan = preemption_map[po ->vehicle_id].preemption_plan; preemption_plan_flag = "0"; diff --git a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp index cf76814eb..73d719568 100644 --- a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp +++ b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp @@ -40,9 +40,9 @@ namespace PreemptionPlugin { public: struct PreemptionObject { - std::string approach; // 0: egress 1: ingress - std::string preemption_plan; - int vehicle_id; + std::string approach = ""; // 0: egress 1: ingress + std::string preemption_plan = ""; + int vehicle_id = 0; std::time_t time = std::time(nullptr); }; @@ -72,12 +72,12 @@ namespace PreemptionPlugin { std::map preemption_map; - void ProcessMapMessageFile(std::string path); + void ProcessMapMessageFile(const std::string &path); void VehicleLocatorWorker(BsmMessage* msg); - void PreemptionPlaner(PreemptionObject* po); - void TurnOnPreemption(PreemptionObject* po); - void TurnOffPreemption(PreemptionObject* po); - bool CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners); + void PreemptionPlaner(std::shared_ptr po); + void TurnOnPreemption(std::shared_ptr po); + void TurnOffPreemption(std::shared_ptr po); + bool CarInGeofence(long double x, long double y, std::vector geox, std::vector geoy, long GeoCorners) const; std::string ip_with_port; int snmp_version = SNMP_VERSION_1; diff --git a/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp b/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp index aa86baf4d..56e7b0347 100644 --- a/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp +++ b/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp @@ -45,7 +45,7 @@ class PreemptionTest : public testing::Test bool CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners) { int i, j=GeoCorners-1 ; - bool oddNodes ; + bool oddNodes = 0 ; for (i=0; i=y diff --git a/tools/port-drayage-webservice/.dockerignore b/tools/port-drayage-webservice/.dockerignore new file mode 100644 index 000000000..b2be670ee --- /dev/null +++ b/tools/port-drayage-webservice/.dockerignore @@ -0,0 +1,9 @@ +src/ +target/classes/ +target/generated-soures/ +target/generated-test-sources/ +target/maven-archiver/ +target/site/ +target/surefire-reports/ +target/test-classes/ +target/jacoco.exec diff --git a/tools/port-drayage-webservice/Dockerfile b/tools/port-drayage-webservice/Dockerfile new file mode 100644 index 000000000..f10c360d8 --- /dev/null +++ b/tools/port-drayage-webservice/Dockerfile @@ -0,0 +1,5 @@ +FROM adoptopenjdk/openjdk11:alpine-jre +RUN mkdir ~/port-drayage-webservice/ +COPY ./target/port-drayage-webservice-0.0.1-SNAPSHOT.jar ~/port-drayage-webservice/ +WORKDIR ~/port-drayage-webservice/ +ENTRYPOINT ["java","-jar","port-drayage-webservice-0.0.1-SNAPSHOT.jar"] \ No newline at end of file diff --git a/tools/port-drayage-webservice/pom.xml b/tools/port-drayage-webservice/pom.xml new file mode 100644 index 000000000..f3df86964 --- /dev/null +++ b/tools/port-drayage-webservice/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + + com.leidos + port-drayage-webservice + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 2.5.5 + + + + + org.springframework.boot + spring-boot-starter-web + + + io.springfox + springfox-boot-starter + 3.0.0 + + + org.openapitools + jackson-databind-nullable + 0.2.1 + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-validation + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.fasterxml.jackson.core + jackson-core + + + + org.webjars + bootstrap + 4.0.0-2 + + + org.webjars + webjars-locator + 0.30 + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + + org.openapitools + openapi-generator-maven-plugin + 5.1.0 + + + + generate + + + + ${project.basedir}/src/main/resources/port-drayage-webservice.yml + + spring + spring-boot + com.baeldung.openapi.api + com.baeldung.openapi.model + true + + ApiUtil.java + + + true + true + + + + + + + + org.jacoco + jacoco-maven-plugin + + + + com/baeldung/openapi/** + + + + + + prepare-agent + + + + report + test + + report + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java b/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java new file mode 100644 index 000000000..2b6d3f403 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java @@ -0,0 +1,25 @@ +package com.leidos; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Main class for SpringBoot application. {@link EnableAutoConfiguration} annotation allow spring to scan all sub-directories for defined beans. + * + * @author Paul Bourelly + */ + +@EnableAutoConfiguration +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + + +} \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java b/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java new file mode 100644 index 000000000..3b70bdc7e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java @@ -0,0 +1,27 @@ +package com.leidos.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class WebApplicationConfiguration { + + /** + * Allow Cross Origin Resource Sharing (CORS) for all endpoints. + * @return + */ + @Bean + public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } + }; + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java new file mode 100644 index 000000000..df1694509 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java @@ -0,0 +1,123 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.InspectionApi; +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatusList; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.leidos.inspection.InspectionActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + +/** + * {@link RestController} for all inspection/ REST endpoints. Implements + * {@link InspectionApi} generated by openapi-generator-maven-plugin (see + * pom.xml), which configures endpoint content type, response type and path. + * + * @author Paul Bourelly + */ +@RestController +public class InspectionController implements InspectionApi { + + private static Logger logger = LoggerFactory.getLogger(InspectionController.class); + + // Injected InspectionActions spring bean + @Autowired + private InspectionActions inspectionActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionPendingGet() { + return ResponseEntity.ok(inspectionActions.getPendingInspections()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionActionIdGet(String actionId) { + logger.debug(String.format("Received GET inspection/%s .", actionId)); + InspectionStatus status = inspectionActions.getInspectionStatus(actionId); + if (status != null) + return ResponseEntity.ok(status); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionPost(InspectionRequest request) { + logger.debug(String.format("Received POST inspection/ with payload : %s .", request)); + // Assure there is not current inspection with action_id + if (inspectionActions.getInspectionStatus(request.getActionId()) == null) { + inspectionActions.requestInspectionAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionHoldingActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/holding/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + // Check that action is current action and that status is PROCEED_TO_HOLDING + if (cur != null && cur.getActionId().equals(actionId) + && cur.getStatus().equals(StatusEnum.PROCEED_TO_HOLDING)) { + inspectionActions.requestHolding(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format( + "Action ID %s is not current inspection %s or does not have a status of PROCEED_TO_HOLDING AREA.\n Discarding potential duplicate request.", + actionId, inspectionActions.getCurrentInspection().toString())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/complete/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + if (cur != null && cur.getActionId().equals(actionId)) { + inspectionActions.completeInspection(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity inspectionHoldActionIdPost(String actionId) { + logger.debug(String.format("Received POST inspection/hold/%s .", actionId)); + InspectionStatus cur = inspectionActions.getCurrentInspection(); + if (cur != null && cur.getActionId().equals(actionId)) { + inspectionActions.proceedToHolding(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java new file mode 100644 index 000000000..f0f92230a --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java @@ -0,0 +1,105 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.LoadingApi; +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.leidos.loading.LoadingActions; + +import org.springframework.web.bind.annotation.RestController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +/** + * {@link RestController} for all /loading REST API endpoints. Implements + * {@link LoadingApi} interface generated by openapi codegen to define methods + * of endpoint responses. + * + * @author Paul Bourelly + */ +@RestController +public class LoadingController implements LoadingApi { + + private static Logger logger = LoggerFactory.getLogger(LoadingController.class); + + /** + * Injected {@link LoadingActions} Spring Bean + */ + @Autowired + private LoadingActions loadingActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingPendingGet() { + return ResponseEntity.ok(loadingActions.getPendingActions()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingActionIdGet(String actionId) { + logger.debug(String.format("Received GET loading/%s .", actionId)); + ContainerActionStatus action = loadingActions.getContainerActionStatus(actionId); + if (action != null) + return ResponseEntity.ok(action); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingPost(ContainerRequest request) { + logger.debug(String.format("Received POST loading/ with payload : %s .", request)); + // Check no action already exists for given action ID + if (loadingActions.getContainerActionStatus(request.getActionId()) == null) { + loadingActions.requestLoadingAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingStartActionIdPost(String actionId) { + logger.debug(String.format("Received POST loading/start/%s .", actionId)); + ContainerActionStatus cur = loadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + loadingActions.startCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity loadingCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST loading/complete/%s .", actionId)); + ContainerActionStatus cur = loadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + loadingActions.completeCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java new file mode 100644 index 000000000..f054d9f03 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java @@ -0,0 +1,50 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.ResetApi; +import com.leidos.inspection.InspectionActions; +import com.leidos.loading.LoadingActions; +import com.leidos.unloading.UnloadingActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +public class ResetController implements ResetApi { + + private static Logger logger = LoggerFactory.getLogger(ResetController.class); + + /** + * Injected {@link LoadingActions} Spring Bean + */ + @Autowired + private LoadingActions loadingActions; + + /** + * Injected {@link UnloadingActions} Spring Bean + */ + @Autowired + private UnloadingActions unloadingActions; + + /** + * Injected {@link InspectionActions} Spring Bean + */ + @Autowired + private InspectionActions inspectionActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity resetPost() { + inspectionActions.clear(); + unloadingActions.clear(); + loadingActions.clear(); + logger.warn("Web Service Actions were cleared!"); + return new ResponseEntity(HttpStatus.OK); + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java new file mode 100644 index 000000000..2559a67c1 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java @@ -0,0 +1,104 @@ +package com.leidos.controller; + +import com.baeldung.openapi.api.UnloadingApi; +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.leidos.unloading.UnloadingActions; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + +/** + * {@link RestController} for all /unloading REST API endpoints. Implements + * {@link Unloading} interface generated by openapi codegen to define methods of + * endpoint responses. + * + * @author Paul Bourelly + */ +@RestController +public class UnloadingController implements UnloadingApi { + + Logger logger = LoggerFactory.getLogger(UnloadingController.class); + + /** + * Injected {@link UnloadingActions} Spring Bean + */ + @Autowired + UnloadingActions unloadingActions; + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingPendingGet() { + return ResponseEntity.ok(unloadingActions.getPendingActions()); + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingActionIdGet(String actionId) { + logger.debug(String.format("Received GET unloading/%s .", actionId)); + ContainerActionStatus action = unloadingActions.getContainerActionStatus(actionId); + if (action != null) + return ResponseEntity.ok(action); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingPost(ContainerRequest request) { + logger.debug(String.format("Received POST unloading/ with payload : %s .", request)); + // Check no action already exists for given action ID + if (unloadingActions.getContainerActionStatus(request.getActionId()) == null) { + unloadingActions.requestUnloadingAction(request); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", + request.getActionId())); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingStartActionIdPost(String actionId) { + logger.debug(String.format("Received POST unloading/start/%s .", actionId)); + ContainerActionStatus cur = unloadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + unloadingActions.startCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity unloadingCompleteActionIdPost(String actionId) { + logger.debug(String.format("Received POST unloading/complete/%s .", actionId)); + ContainerActionStatus cur = unloadingActions.getCurrentAction(); + if (cur != null && cur.getActionId().equals(actionId)) { + unloadingActions.completeCurrentAction(); + return new ResponseEntity<>(HttpStatus.CREATED); + } else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java new file mode 100644 index 000000000..daa9b4ddd --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java @@ -0,0 +1,32 @@ +package com.leidos.controller; + + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class UserInterfaceController { + + + @GetMapping("/") + public String main( Model model) { + return "index"; + } + + @GetMapping("/loading") + public String loading() { + return "_loading"; + + } + @GetMapping("/unloading") + public String unloading() { + return "_unloading"; + + } + @GetMapping("/inspection") + public String inspection() { + return "_inspection"; + + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java new file mode 100644 index 000000000..fb7c90140 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java @@ -0,0 +1,205 @@ +package com.leidos.inspection; + +import com.baeldung.openapi.api.InspectionApi; +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.baeldung.openapi.model.InspectionStatusList; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link InspectionActions} is a spring bean for managing inspections. Only + * allows for a single inspection to be in progress at a time and is stored as + * the {@link InspectionActions#currentInspection}. Any inspections requested + * while the current inspection is not yet completed will be added to + * {@link InspectionActions#pendingInspections} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link InspectionActions#completedInspections} list. + * + * @author Paul Bourelly + */ +@Component +public class InspectionActions { + + private static Logger logger = LoggerFactory.getLogger(InspectionActions.class); + + // List of pending inspection statuses + private InspectionStatusList pendingInspections = new InspectionStatusList(); + + // List of completed inspections + private InspectionStatusList completedInspections = new InspectionStatusList(); + + // Current in progress action + private InspectionStatus currentInspection; + + /** + * Empty Constructor + */ + public InspectionActions() { + } + + /** + * Getter for pending inspection. + * + * @return {@link InspectionStatusList} list of pending inspection. + */ + public InspectionStatusList getPendingInspections() { + return pendingInspections; + } + + /** + * Getter for completed inspections. + * + * @return {@link InspectionStatusList} list of completed inspection. + */ + public InspectionStatusList getCompletedInspections() { + return completedInspections; + } + + /** + * Getter for current action. + * + * @return {@link InspectionStatus} current action. + */ + public InspectionStatus getCurrentInspection() { + return currentInspection; + } + + /** + * Create {@link InspectionStatus} for valid {@link InspectionRequest}s. Valid + * requests require vehicleId and containerId. Set as current inspection if none + * already exists or added to list of pending inspections if current inspection + * is still in progress. + * + * @param request {@link InspectionRequest} Request to load container. + */ + public void requestInspectionAction(InspectionRequest request) { + if (request != null) { + InspectionStatus inspectionStatus = new InspectionStatus(); + inspectionStatus.setContainerId(request.getContainerId()); + inspectionStatus.setVehicleId(request.getVehicleId()); + inspectionStatus.setActionId(request.getActionId()); + inspectionStatus.setStatus(StatusEnum.PENDING); + inspectionStatus.setRequested(System.currentTimeMillis()); + + // If no current action set as current action + if (currentInspection == null) { + currentInspection = inspectionStatus; + } + + // else add to list of pending action + else { + pendingInspections.addInspectionsItem(inspectionStatus); + } + } else { + logger.warn("Attempted to add null InspectionRequest!"); + } + + } + + /** + * Searches all inspections ( pending, current and completed ) for a given + * actionId and returns {@link InspectionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public InspectionStatus getInspectionStatus(String actionId) { + if (actionId != null) { + // Pending actions ( null check since arraylist is initially null ) + if (pendingInspections.getInspections() != null) { + for (InspectionStatus inspectionStatus : pendingInspections.getInspections()) { + if (actionId.equals(inspectionStatus.getActionId())) { + return inspectionStatus; + } + } + } + // Current action + if (currentInspection != null && actionId.equals(currentInspection.getActionId())) { + return currentInspection; + } + // Completed actions ( null check since arraylist is initially null ) + if (completedInspections.getInspections() != null) { + for (InspectionStatus inspectionStatus : completedInspections.getInspections()) { + if (actionId.equals(inspectionStatus.getActionId())) { + return inspectionStatus; + } + } + } + logger.warn(String.format("No inspection action with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * To complete inspection set {@link InspectionActions#currentInspection} status + * to {@link StatusEnum#PASSED}. Current inspection is then added to the + * completed inspections list and the first pending action , if any are present + * is set as the new current action. If no pending actions are present the + * current action is set to null. + * + */ + public void completeInspection() { + if (currentInspection != null) { + // Set current inspection to PASSED + currentInspection.setStatus(StatusEnum.PASSED); + currentInspection.setCompleted(System.currentTimeMillis()); + completedInspections.addInspectionsItem(currentInspection); + // If there are any pending actions set them to current + if (pendingInspections.getInspections() != null && !pendingInspections.getInspections().isEmpty()) { + currentInspection = pendingInspections.getInspections().remove(0); + } + // else set current to null + else { + currentInspection = null; + } + + } else + logger.warn("No current inspection in progress!"); + } + + /** + * To indicate that the vehicle under inspection is required to proceed to the + * holding area for further inspection an operator will use this request to set + * {@link InspectionActions#currentInspection} status to. + * {@link StatusEnum#PROCEED_TO_HOLDING}. + */ + public void proceedToHolding() { + if (currentInspection != null) { + currentInspection.setStatus(StatusEnum.PROCEED_TO_HOLDING); + } else + logger.warn("No current inspection in progress!"); + } + + /** + * Vehicle under current inspection, which has been instructed to proceed to + * holding area by operator will indicate it has arrived at the holding area and + * is prepared for further inspection with this request which sets the status of + * the {@link InspectionActions#currentInspection} to + * {@link StatusEnum#HOLDING}. + */ + public void requestHolding() { + if (currentInspection != null) { + currentInspection.setStatus(StatusEnum.HOLDING); + } else + logger.warn("No current inspection in progress!"); + } + + /** + * Clear all inspection actions + */ + public void clear() { + if ( pendingInspections.getInspections() != null ) + pendingInspections.getInspections().clear(); + if ( completedInspections.getInspections() != null ) + completedInspections.getInspections().clear(); + currentInspection = null; + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java new file mode 100644 index 000000000..97c3683ac --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java @@ -0,0 +1,185 @@ +package com.leidos.loading; + +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link LoadingActions} is a spring bean for managing loading actions. Only + * allows for a single loading action to be in progress at a time and is stored + * as the {@link LoadingActions#currentAction}. Any loading actions requested + * while the current action is not yet completed will be added to + * {@link LoadingActions#pendingActions} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link LoadingActions#completedActions} list. + * + * @author Paul Bourelly + */ +@Component +public class LoadingActions { + + private static Logger logger = LoggerFactory.getLogger(LoadingActions.class); + + // List of all pending loading actions + private ActionStatusList pendingActions = new ActionStatusList(); + + // List of completed loading actions + private ActionStatusList completedActions = new ActionStatusList(); + + // Current Loading Action + private ContainerActionStatus currentAction; + + /** + * Empty Constructor. + */ + public LoadingActions() { + + } + + /** + * Getter for pending loading actions. + * + * @return {@link ActionStatusList} list of pending loading actions + */ + public ActionStatusList getPendingActions() { + return pendingActions; + } + + /** + * Getter for completed Actions. + * + * @return {@link ActionStatusList} list of completed actions + */ + public ActionStatusList getCompletedActions() { + return completedActions; + } + + /** + * Getter for current Action. + * + * @return {@link ContainerActionStatus} current in progress loading + */ + public ContainerActionStatus getCurrentAction() { + return currentAction; + } + + /** + * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. + * Valid requests require vehicleId and containerId. Valid request will be set + * as {@link LoadingActions#currentAction} if no current action is present or + * added to list of pending actions. + * + * @param request {@link ContainerRequest} Request to load container. + */ + public void requestLoadingAction(ContainerRequest request) { + if (request != null) { + ContainerActionStatus requestedAction = new ContainerActionStatus(); + requestedAction.setContainerId(request.getContainerId()); + requestedAction.setVehicleId(request.getVehicleId()); + requestedAction.setActionId(request.getActionId()); + requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); + requestedAction.setRequested(System.currentTimeMillis()); + // Add action to list of pending actions if an + // action is already in progress. Otherwise set + // as current action + if (currentAction != null) + pendingActions.addActionsItem(requestedAction); + else + currentAction = requestedAction; + } else { + logger.warn("Attempted to add null ContainerRequest!"); + } + + } + + /** + * Searches all loading actions ( pending, current and completed ) for a given + * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public ContainerActionStatus getContainerActionStatus(String actionId) { + if (actionId != null) { + // First search pending loading actions ( null check since actions array is null + // before adding values ) + if (pendingActions.getActions() != null) { + for (ContainerActionStatus containerAction : pendingActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + // search current action + if (currentAction != null && actionId.equals(currentAction.getActionId())) { + return currentAction; + } + // Search completed loading actions ( null check since actions array is null + // before adding values ) + if (completedActions.getActions() != null) { + for (ContainerActionStatus containerAction : completedActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + logger.warn(String.format("No loading actions exist with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * Mark {@link LoadingActions#currentAction} as in progress by setting the + * {@link ContainerActionStatus#status} to {@link StatusEnum#LOADING}. + */ + public void startCurrentAction() { + if (currentAction != null) { + logger.debug(String.format("Starting loading for action %s", currentAction.toString())); + currentAction.setStatus(StatusEnum.LOADING); + } else + logger.warn("There is no current action!"); + } + + /** + * Mark {@link LoadingActions#currentAction} as complete and move it to the + * completedActions list. If there are pending actions, set the next pending + * action to current action, else set current action to null. + */ + public void completeCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(ContainerActionStatus.StatusEnum.LOADED); + currentAction.setCompleted(System.currentTimeMillis()); + logger.debug(String.format("Complete loading for action %s", currentAction.toString())); + logger.debug(String.format("Complete loading for action %s", currentAction.toString())); + completedActions.addActionsItem(currentAction); + // Remove first item in list of pending actions and set it to current action + if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { + currentAction = pendingActions.getActions().remove(0); + } else { + currentAction = null; + } + } else + logger.warn("There is no current action!"); + + } + + /** + * Clear all loading actions + */ + public void clear() { + if ( pendingActions.getActions() != null ) + pendingActions.getActions().clear(); + if ( completedActions.getActions() != null ) + completedActions.getActions().clear(); + currentAction = null; + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java new file mode 100644 index 000000000..29692e0e1 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java @@ -0,0 +1,180 @@ +package com.leidos.unloading; + +import com.baeldung.openapi.model.ActionStatusList; +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link UnloadingActions} is a spring bean for managing unloading actions. + * Only allows for a single unloading action to be in progress at a time and is + * stored as the {@link UnloadingActions#currentAction}. Any unloading actions + * requested while the current action is not yet completed will be added to + * {@link UnloadingActions#pendingActions} list. This list is then used to + * populate the current action after an action is completed. Each completed + * action is stored in the {@link UnloadingActions#completedActions} list. + * + * @author Paul Bourelly + */ +@Component +public class UnloadingActions { + + private static Logger logger = LoggerFactory.getLogger(UnloadingActions.class); + // List of all pending unloading actions + private ActionStatusList pendingActions = new ActionStatusList(); + + // List of completed unloading actions + private ActionStatusList completedActions = new ActionStatusList(); + + // Current unloading Action + private ContainerActionStatus currentAction; + + /** + * Empty Constructor + */ + public UnloadingActions() { + } + + /** + * Getter for pending unloading actions + * + * @return {@link ActionStatusList} list of pending unloading actions + */ + public ActionStatusList getPendingActions() { + return pendingActions; + } + + /** + * Getter for completed Actions + * + * @return {@link ActionStatusList} list of completed actions + */ + public ActionStatusList getCompletedActions() { + return completedActions; + } + + /** + * Getter for current Action + * + * @return {@link ContainerActionStatus} current in progress unloading + */ + public ContainerActionStatus getCurrentAction() { + return currentAction; + } + + /** + * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. + * Valid requests require vehicleId and containerId. Valid request will be set + * as {@link UnloadingActions#currentAction} if no current action is present or + * added list of pending actions. + * + * @param request {@link ContainerRequest} Request to load container on to a + * vehicle + */ + public void requestUnloadingAction(ContainerRequest request) { + if (request != null) { + ContainerActionStatus requestedAction = new ContainerActionStatus(); + requestedAction.setContainerId(request.getContainerId()); + requestedAction.setVehicleId(request.getVehicleId()); + requestedAction.setActionId(request.getActionId()); + requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); + requestedAction.setRequested(System.currentTimeMillis()); + // Add action to list of pending actions if an + // action is already in progress. Otherwise set + // as current action + if (currentAction != null) + pendingActions.addActionsItem(requestedAction); + else + currentAction = requestedAction; + } else { + logger.warn("Attempted to add null ContainerRequest!"); + } + + } + + /** + * Searches all unloading actions ( pending, current and completed ) for a given + * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. + * + * @param actionId unique string to identify action + * @return {@link InspectionStatus} for given action. Null if no action is found + * or null action id is provided. + */ + public ContainerActionStatus getContainerActionStatus(String actionId) { + if (actionId != null) { + // First search pending loading actions ( null check since actions array is null + // before adding values ) + if (pendingActions.getActions() != null) { + for (ContainerActionStatus containerAction : pendingActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + // search current action + if (currentAction != null && actionId.equals(currentAction.getActionId())) { + return currentAction; + } + // Search completed loading actions ( null check since actions array is null + // before adding values ) + if (completedActions.getActions() != null) { + for (ContainerActionStatus containerAction : completedActions.getActions()) { + if (actionId.equals(containerAction.getActionId())) { + return containerAction; + } + } + } + logger.warn(String.format("No unloading actions exist with action ID %s !", actionId)); + return null; + } + logger.warn("Null action id is not valid!"); + return null; + } + + /** + * Mark {@link UnloadingActions#currentAction} as in progress by setting the + * {@link ContainerActionStatus#status} to {@link StatusEnum#UNLOADING}. + */ + public void startCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(StatusEnum.UNLOADING); + } else + logger.warn("There is no current action!"); + } + + /** + * Mark {@link UnloadingActions#currentAction} as complete and move it to the + * completedActions list. If there are pending actions, set the next pending + * action to current action, else set current action to null. + */ + public void completeCurrentAction() { + if (currentAction != null) { + currentAction.setStatus(StatusEnum.UNLOADED); + currentAction.setCompleted(System.currentTimeMillis()); + completedActions.addActionsItem(currentAction); + // Remove first item in list of pending actions and set it to current action + if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { + currentAction = pendingActions.getActions().remove(0); + } else { + currentAction = null; + } + } else + logger.warn("There is no current action!"); + + } + + /** + * Clear all unloading actions + */ + public void clear() { + if ( pendingActions.getActions() != null ) + pendingActions.getActions().clear(); + if ( completedActions.getActions() != null ) + completedActions.getActions().clear(); + currentAction = null; + } +} diff --git a/tools/port-drayage-webservice/src/main/resources/application.properties b/tools/port-drayage-webservice/src/main/resources/application.properties new file mode 100644 index 000000000..d01b3f16d --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/application.properties @@ -0,0 +1,30 @@ +# +# Keystore properties for SSL HTTPS hosting. Requires a java key store which can be generated using JDK with the following command : +# keytool -genkey -keyalg RSA -alias tutorial -keystore tutorial.jks -storepass password -validity 365 -keysize 4096 -storetype pkcs12 + +# server.ssl.key-store=src/main/resources/tutorial.jks +# server.ssl.key-store-type=pkcs12 +# server.ssl.key-store-password=password +# server.ssl.key-password=password +# server.ssl.key-alias=tutorial + +# Set UI and REST API server port +server.port=8090 + +# Spring boot actuator properties allow for rest endpoint exposure for monitoring spring bean status for debuging. Should be disable for production +# Documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html +management.endpoints.web.exposure.include=* + + +# Logging configuration + +# Set output log file +#logging.file=log/application.log + +# Set class/package level log level +#logging.level.com.leidos.loading.LoadingActions=DEBUG + +# Set root log level +#logging.level.root=INFO + + diff --git a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml new file mode 100755 index 000000000..c8a30edfe --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml @@ -0,0 +1,427 @@ +openapi: 3.0.0 +info: + title: Port Drayage Web Service. + description: Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. + version: "1.0" +servers: + - url: http://127.0.0.1:8090 + description: Unsecured hosting for development + - url: https://127.0.0.1:8443 + description: Secured hosting for deployment +paths: + /reset: + post: + summary: Clear Web Service Actions + description: + Request will clear all actions in InspectionActions, LoadingActions, and UnloadingActions. + responses: + "201": + description: Created + /loading: + post: + summary: Request a container is loaded on to freight vehicle. + description: + Provide ContainerRequest JSON to request a container with a given id be loaded on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID, Vehicle ID and an Action ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerRequest" + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/pending: + get: + summary: List of all pending loading actions. + description: + Provides a list of ContainerActionStatus JSON objects describing the loading actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ActionStatusList" + /loading/start/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Start a loading action. + description: + Will attempt to start current loading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a loading action has started. Will return 400 if provided action id is not \ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete a loading action. + description: + Will attempt to complete current loading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a loading action has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /loading/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerActionStatus" + "400": + description: Bad Request + /unloading: + post: + summary: Request a container is unloaded on to freight Vehicle. + description: + Provide ContainerRequest JSON to request a container with a given id be unloaded on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID, Vehicle ID and an Action ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerRequest" + responses: + "201": + description: Created + /unloading/pending: + get: + summary: List of all pending unloading actions and status. + description: + Provides a list of ContainerActionStatus JSON describing the unloading actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ActionStatusList" + /unloading/start/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Start an unloading action. + description: + Will attempt to start current unloading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate a unloading action has started. Will return 400 if provided action id is not current\ + action. + responses: + "201": + description: Created + "400": + description: Bad Request + /unloading/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete an unloading action. + description: + Will attempt to complete current unloading action. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate an unloading action has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /unloading/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerActionStatus" + "400": + description: Bad Request + /inspection: + post: + summary: Request a container is inspected on to Freight Vehicle. + description: + Provide InspectionRequest JSON to request a container with a given id be inspected on a vehicle with a given id.\ + Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ + request will be discarded as duplicate and result in 400 response. + requestBody: + description: Request contains container ID and Vehicle ID + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionRequest" + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/holding/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Vehicle has arrive at Holding area an is waiting on inspection. + description: + After being instructed to proceed to holding area and navigating to holding area, vehicle will request further inspection at holding\ + area. This request will be sent from the PortDrayage V2X-Hub Plugin after receiving a vehicles arrival message at the holding area.\ + Will return 400 if not current action or status is not PROCEED_TO_HOLDING and discard request. + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/pending: + get: + summary: List of all pending inspection actions and status. + description: + Provides a list of InspectionStatus JSON objects describing the inspection actions waiting to be started.\ + Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ + replace the current action after it is completed in a first-in first-out order. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionStatusList" + /inspection/complete/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Complete an inspection action. + description: + Will attempt to complete current inspection. This REST endpoint is only intended for UI form submission. Will\ + be triggered on UI interaction to indicate an inspection has been completed. Will return 400 if provided action id is not\ + current action. + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/hold/{action_id}: + post: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Request vehicle proceed to holding area for further inspection + description: Will attempt to request vehicle proceed to holding area for further inspection. Will return 400 if no current action + responses: + "201": + description: Created + "400": + description: Bad Request + /inspection/{action_id}: + get: + parameters: + - in: path + name: action_id + schema: + type: string + required: true + description: ID of action + summary: Returns action with given ID + description: Returns action with given ID. If non is found returns 400. Intended for polling inspection status. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/InspectionStatus" + "400": + description: Bad Request +components: + schemas: + ContainerRequest: + title: Container Request + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + required: + - vehicle_id + - container_id + - action_id + ContainerActionStatus: + title: Container Action Status + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + status: + type: string + enum: + - LOADING + - UNLOADING + - LOADED + - UNLOADED + - PENDING + - ABORTED + requested: + type: integer + format: int64 + completed: + type: integer + format: int64 + required: + - vehicle_id + - container_id + - action_id + - status + - requested + ActionStatusList: + title: List of Container Action Status elements + type: object + properties: + actions: + type: array + items: + type: object + $ref: "#/components/schemas/ContainerActionStatus" + InspectionRequest: + title: Inspection Request + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + required: + - vehicle_id + - container_id + - action_id + InspectionStatus: + title: Inspection Status + type: object + properties: + vehicle_id: + type: string + description: ID of vehicle + container_id: + type: string + description: ID of container + action_id: + type: string + description: ID of action + status: + type: string + enum: + - PENDING + - PROCEED_TO_HOLDING + - PASSED + - FAILED + - HOLDING + requested: + type: integer + format: int64 + completed: + type: integer + format: int64 + required: + - vehicle_id + - container_id + - action_id + - status + - requested + InspectionStatusList: + title: List of Container Action Status elements + type: object + properties: + inspections: + type: array + items: + type: object + $ref: "#/components/schemas/InspectionStatus" diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/main.css b/tools/port-drayage-webservice/src/main/resources/static/css/main.css new file mode 100644 index 000000000..e69de29bb diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html b/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html new file mode 100644 index 000000000..b92f5ad73 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html @@ -0,0 +1,117 @@ +
+

Requested Inspection

+

+ Inspection for vehicle : + + with container : + +

+
+

+

+ + + +

Vehicle is proceeding to Holding Area.
+

+
+

Pending Inspections

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested
No Pending Inspections
+ +

Completed Inspections

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_loading.html b/tools/port-drayage-webservice/src/main/resources/templates/_loading.html new file mode 100644 index 000000000..cfa8f880e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_loading.html @@ -0,0 +1,115 @@ +
+

Requested Loading Action

+

+ Load vehicle : + + with container : + +

+
+

+

+ + + +

+
+

Pending Loading Actions

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Actions ID Requested
No Pending Actions
+ +

Completed Loading Actions

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html b/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html new file mode 100644 index 000000000..6bc7f9b21 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html @@ -0,0 +1,114 @@ +
+

Requested Unloading Action

+

+ Unload vehicle : + + with container : + +

+
+

+

+ + + + +

+
+

Pending Unloading Actions

+ + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested
No Pending Actions
+ +

Completed Unloading Actions

+ + + + + + + + + + + + + + + + + + + + + + + +
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
+ + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/index.html b/tools/port-drayage-webservice/src/main/resources/templates/index.html new file mode 100644 index 000000000..bc02e3020 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/index.html @@ -0,0 +1,115 @@ + + + + + + + CARMA Freight Web Service + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+
+ + + + + +
+
+ +
+ + + + + + +
+ + + + + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java new file mode 100644 index 000000000..9b8afb1d1 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java @@ -0,0 +1,212 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.inspection.InspectionActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +/** + * Test class for Inspection {@link RestController} bean + */ +@WebMvcTest(controllers = { InspectionController.class }) +public class InspectionControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private InspectionActions mockInspectionActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /inspection {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetInspection() throws Exception { + + mvc.perform(MockMvcRequestBuilders.get("/inspection/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /inspection responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testPostInspection() throws Exception { + + // Test response for valid payload + InspectionRequest request = new InspectionRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock duplicate request + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock already existing action for action ID + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test POST /inspection/holding responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testPostInspectionHolding() throws Exception { + + // Mock inspectionAction to have current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock current inspection + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus("actionId")).thenReturn(responseStatus); + + // Test response for valid payload + InspectionRequest request = new InspectionRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + // Correct + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for non current action ( both incorrect vehicle and container + // id) + request.setActionId("wrong"); + mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /inspection/{vehicleId} responses from {@link InspectionController}. + * + * @throws Exception + */ + @Test + public void testInspectionVehicleIdGet() throws Exception { + + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setStatus(InspectionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockInspectionActions.getInspectionStatus("vehicleId")).thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) + .andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/inspection/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test inspection/complete/{action_id} POST + */ + @Test + public void testInspectionCompleteActionIdPost() throws Exception { + // Create current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test inspection/hold/{action_id} POST + */ + @Test + public void testInspectionHoldActionIdPost() throws Exception { + // Create current action + InspectionStatus responseStatus = new InspectionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); + Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java new file mode 100644 index 000000000..d37a5f68d --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java @@ -0,0 +1,159 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.loading.LoadingActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +@WebMvcTest(controllers = { LoadingController.class }) +public class LoadingControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private LoadingActions mockLoadingActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /loading {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetLoading() throws Exception { + + mvc.perform(MockMvcRequestBuilders.get("/loading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /loading responses from {@link LoadingController}. + * + * @throws Exception + */ + @Test + public void testPostLoading() throws Exception { + + // Test response for valid payload + ContainerRequest request = new ContainerRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock already existing duplicate action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); + responseStatus.setRequested(System.currentTimeMillis()); + Mockito.when(mockLoadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /loading/{vehicleId} responses from {@link LoadingController}. + * + * @throws Exception + */ + @Test + public void testLoadingVehicleIdGet() throws Exception { + + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockLoadingActions.getContainerActionStatus("vehicleId")).thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")).andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/loading/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test loading/complete/{action_id} POST + */ + @Test + public void testLoadingCompleteActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test unloading/start/{action_id} POST + */ + @Test + public void testUnloadingStartActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java new file mode 100644 index 000000000..9ae3e4751 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java @@ -0,0 +1,160 @@ +package com.leidos.controller; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.leidos.unloading.UnloadingActions; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; + +@WebMvcTest(controllers = { UnloadingController.class }) +public class UnloadingControllerTest { + + @Autowired + private MockMvc mvc; + + @MockBean + private UnloadingActions mockUnloadingActions; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * Test GET /unloading {@link HttpStatus} is always OK. + * + * @throws Exception + */ + @Test + public void testGetUnloading() throws Exception { + mvc.perform(MockMvcRequestBuilders.get("/unloading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); + } + + /** + * Test POST /unloading responses from {@link UnloadingController}. + * + * @throws Exception + */ + @Test + public void testPostUnloading() throws Exception { + + // Test response for valid payload + ContainerRequest request = new ContainerRequest(); + request.setVehicleId("vehicleId"); + request.setContainerId("containerId"); + request.setActionId("actionId"); + + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); + + // Test response for empty post + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON).content("")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Test response for invalid post + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + // Mock already existing duplicate action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); + responseStatus.setRequested(System.currentTimeMillis()); + Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) + .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test GET /unloading/{vehicleId} responses from {@link UnloadingController}. + * + * @throws Exception + */ + @Test + public void testUnloadingVehicleIdGet() throws Exception { + + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); + responseStatus.setRequested(System.currentTimeMillis()); + + Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) + .thenReturn(responseStatus); + + // Test response for get loading/{vehicleId} for existing request + mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) + .andExpect(MockMvcResultMatchers.status().isOk()); + mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); + + // Test response for get loading/{vehicleId} for non-existent request + mvc.perform(MockMvcRequestBuilders.get("/unloading/no-existent")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + } + + /** + * Test unloading/complete/{action_id} POST + */ + @Test + public void testUnloadingCompleteActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + + /** + * Test unloading/start/{action_id} POST + */ + @Test + public void testUnloadingStartActionIdPost() throws Exception { + // Create current action + ContainerActionStatus responseStatus = new ContainerActionStatus(); + responseStatus.setContainerId("containerId"); + responseStatus.setVehicleId("vehicleId"); + responseStatus.setActionId("actionId"); + responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); + responseStatus.setRequested(System.currentTimeMillis()); + + // Mock return responseStatus as current action + Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); + + // Assert 201 response when current action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", responseStatus.getActionId())) + .andExpect(MockMvcResultMatchers.status().isCreated()); + + // Assert 400 response when incorrect action ID is provided + mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", "wrong")) + .andExpect(MockMvcResultMatchers.status().isBadRequest()); + + } + +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java new file mode 100644 index 000000000..304a5c5f2 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java @@ -0,0 +1,194 @@ +package com.leidos.inspection; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.InspectionRequest; +import com.baeldung.openapi.model.InspectionStatus; +import com.baeldung.openapi.model.InspectionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; + +/** + * Test Class to test {@link InspectionActions} class. + * + * @author Paul Bourelly + */ +public class InspectionActionsTest { + + private InspectionActions inspectionActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + inspectionActions = new InspectionActions(); + } + + /** + * Test case to test {@link InspectionActions#getInspectionStatus(String)} and + * {@link InspectionActions#requestInspectionAction(InspectionRequest)} for + * different possible inputs. + */ + @Test + public void requestInspectionTest() { + // Returns null when provided null vehicleId + assertNull(inspectionActions.getInspectionStatus(null)); + + // requestInspectionAction does not throw exceptions for null parameters + inspectionActions.requestInspectionAction(null); + + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("inspectionA"); + + // Returns null before inspection is requested + assertNull(inspectionActions.getInspectionStatus(req1.getActionId())); + assertNull(inspectionActions.getCurrentInspection()); + + // Current action and inspection status returns action after inspection is + // requested + inspectionActions.requestInspectionAction(req1); + assertEquals(req1.getVehicleId(), inspectionActions.getCurrentInspection().getVehicleId()); + assertEquals(req1.getContainerId(), inspectionActions.getCurrentInspection().getContainerId()); + assertEquals(req1.getVehicleId(), inspectionActions.getInspectionStatus(req1.getActionId()).getVehicleId()); + assertEquals(req1.getContainerId(), inspectionActions.getInspectionStatus(req1.getActionId()).getContainerId()); + + // Attempt to request new inspection while another inspection is in progress + InspectionRequest req2 = new InspectionRequest(); + req2.setVehicleId("vehicleC"); + req2.setContainerId("containerC"); + req2.setActionId("inspectionC"); + inspectionActions.requestInspectionAction(req2); + InspectionStatus status = inspectionActions.getCurrentInspection(); + + // Current Action is still first request + assertEquals(req1.getContainerId(), status.getContainerId()); + assertEquals(req1.getVehicleId(), status.getVehicleId()); + + // New inspection request is in pending inspection list + InspectionStatus pending = inspectionActions.getPendingInspections().getInspections().get(0); + assertEquals(req2.getVehicleId(), pending.getVehicleId()); + assertEquals(req2.getContainerId(), pending.getContainerId()); + } + + /** + * Test case to test {@link InspectionActions#completeInspection()} for + * different possible parameters. + */ + @Test + public void completeInspectionTest() { + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("inspectionA"); + + InspectionRequest req2 = new InspectionRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("inspectionB"); + + InspectionRequest req3 = new InspectionRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("inspectionC"); + + // Calling complete inspection with no current inspection does not add any + // inspection to completed list + inspectionActions.completeInspection(); + assertNull(inspectionActions.getCompletedInspections().getInspections()); + + inspectionActions.requestInspectionAction(req1); + inspectionActions.requestInspectionAction(req2); + inspectionActions.requestInspectionAction(req3); + + // Completed Inspections is empty before completing any inspection but + // inspection is in inspectionActions list of in progress inspections + assertNull(inspectionActions.getCompletedInspections().getInspections()); + + InspectionStatus req1Status = inspectionActions.getInspectionStatus(req1.getActionId()); + InspectionStatus req2Status = inspectionActions.getInspectionStatus(req2.getActionId()); + InspectionStatus req3Status = inspectionActions.getInspectionStatus(req3.getActionId()); + + // First request becomes current action and additional requests are added to + // pending inspections + assertEquals(req1Status, inspectionActions.getCurrentInspection()); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req2Status)); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); + + // Complete inspection adds current inspection to completedInspections list and + // sets next pending action as currentAction + inspectionActions.completeInspection(); + + assertTrue(inspectionActions.getCompletedInspections().getInspections().contains(req1Status)); + assertEquals(req2Status, inspectionActions.getCurrentInspection()); + assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(InspectionStatus.StatusEnum.PASSED, req1Status.getStatus()); + + // Completing inspection when no pending actions are left sets current action to + // null + // req2Status + inspectionActions.completeInspection(); + + // req3Status + inspectionActions.completeInspection(); + + assertNull(inspectionActions.getCurrentInspection()); + assertEquals(3, inspectionActions.getCompletedInspections().getInspections().size()); + + // Get InspectionStatus will return most recent inspection even when it is completed + // for a given vehicleID + assertEquals(req3Status, inspectionActions.getInspectionStatus(req3.getActionId())); + } + + /** + * Test case to test {@link InspectionActions#requestHolding()} method and + * holding vehicle interactions. + */ + @Test + public void requestHoldingTest() { + // Populate Inspection actions with inspection requests + InspectionRequest req1 = new InspectionRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + + // Call proceed to holding with no current action + assertNull(inspectionActions.getCurrentInspection()); + inspectionActions.proceedToHolding(); + + // Call request holding with to current action + inspectionActions.requestHolding(); + assertNull(inspectionActions.getCurrentInspection()); + + // Request Inspection + inspectionActions.requestInspectionAction(req1); + InspectionStatus req1Status = inspectionActions.getCurrentInspection(); + + assertEquals(StatusEnum.PENDING, req1Status.getStatus() ); + + // Proceed To Holding + inspectionActions.proceedToHolding(); + + assertEquals(StatusEnum.PROCEED_TO_HOLDING, req1Status.getStatus() ); + + // Request Holding + inspectionActions.requestHolding(); + + assertEquals(StatusEnum.HOLDING, req1Status.getStatus() ); + + // Complete + inspectionActions.completeInspection(); + assertEquals(StatusEnum.PASSED, req1Status.getStatus() ); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java new file mode 100644 index 000000000..dae1c3400 --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java @@ -0,0 +1,155 @@ +package com.leidos.loading; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class LoadingActionsTest { + + public LoadingActions loadingActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + loadingActions = new LoadingActions(); + } + + /** + * Test case to test {@link LoadingActions#getContainerActionStatus(String)} and + * {@link LoadingActions#requestLoadingAction(ContainerRequest)} for different + * possible inputs. + */ + @Test + public void requestLoadingActionTest() { + // Returns null when provided null vehicleId + assertNull(loadingActions.getContainerActionStatus(null)); + + // requestLoadingAction does not throw exceptions for null parameters + loadingActions.requestLoadingAction(null); + + // Populate Loading actions with Loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + // Returns null before loading action is requested + assertNull(loadingActions.getContainerActionStatus(req1.getActionId())); + assertNull(loadingActions.getCurrentAction()); + + // Returns action after loading action is requested + loadingActions.requestLoadingAction(req1); + assertEquals(req1.getVehicleId(), loadingActions.getCurrentAction().getVehicleId()); + assertEquals(req1.getContainerId(), loadingActions.getCurrentAction().getContainerId()); + + // Attempt to request new loading action for vehicle with already pending + // loading action + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleA"); + req2.setContainerId("containerC"); + req2.setActionId("actionC"); + loadingActions.requestLoadingAction(req2); + ContainerActionStatus status = loadingActions.getCurrentAction(); + assertEquals(req1.getContainerId(), status.getContainerId()); + } + + /** + * Test case to test + * {@link LoadingAction#completeCurrentAction(com.baeldung.openapi.model.ContainerActionStatus)} + * for different possible parameters. + */ + @Test + public void completeLoadingTest() { + // Populate loading actions with loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("actionB"); + + ContainerRequest req3 = new ContainerRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("actionC"); + + // Run completeCurrentAction with no current action + assertNull(loadingActions.getCurrentAction()); + loadingActions.completeCurrentAction(); + + // Run startCurrentAction with no current action + assertNull(loadingActions.getCurrentAction()); + loadingActions.startCurrentAction(); + + loadingActions.requestLoadingAction(req1); + loadingActions.requestLoadingAction(req2); + loadingActions.requestLoadingAction(req3); + + // Completed actions is empty before completing any loading action but + // loading action is in loadingActions list of in progress actions + assertNull(loadingActions.getCompletedActions().getActions()); + ContainerActionStatus req1Status = loadingActions.getContainerActionStatus(req1.getActionId()); + ContainerActionStatus req2Status = loadingActions.getContainerActionStatus(req2.getActionId()); + ContainerActionStatus req3Status = loadingActions.getContainerActionStatus(req3.getActionId()); + + // First requested action becomes current action and each action requested after + // is added to + // pending actions + assertEquals(req1Status, loadingActions.getCurrentAction()); + assertTrue(loadingActions.getPendingActions().getActions().contains(req2Status)); + assertTrue(loadingActions.getPendingActions().getActions().contains(req3Status)); + + + + // Start current action sets status to LOADING + assertEquals(StatusEnum.PENDING, loadingActions.getCurrentAction().getStatus()); + loadingActions.startCurrentAction(); + assertEquals(StatusEnum.LOADING, loadingActions.getCurrentAction().getStatus()); + + // Current action status is set to LOADED and added to completedActions list. + // Current action is replaced with next action in pending actions + // Complete req1 + loadingActions.completeCurrentAction(); + + assertTrue(loadingActions.getCompletedActions().getActions().contains(req1Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.LOADED, req1Status.getStatus()); + assertEquals(req2Status, loadingActions.getCurrentAction()); + + // Complete req2 + loadingActions.completeCurrentAction(); + + assertTrue(loadingActions.getCompletedActions().getActions().contains(req2Status)); + assertNotNull(req2Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.LOADED, req2Status.getStatus()); + assertEquals(req3Status, loadingActions.getCurrentAction()); + assertTrue(loadingActions.getPendingActions().getActions().isEmpty()); + + // Complete req3 + loadingActions.completeCurrentAction(); + + assertNull(loadingActions.getCurrentAction()); + assertEquals(3, loadingActions.getCompletedActions().getActions().size()); + + // Get ContainerActionStatus will return most recent action even when it is + // completed + // for a given vehicleID + assertEquals(req3Status, loadingActions.getContainerActionStatus(req3.getActionId())); + + } +} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java new file mode 100644 index 000000000..edb0e47ce --- /dev/null +++ b/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java @@ -0,0 +1,150 @@ +package com.leidos.unloading; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.baeldung.openapi.model.ContainerActionStatus; +import com.baeldung.openapi.model.ContainerRequest; +import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class UnloadingActionsTest { + public UnloadingActions unloadingActions; + + /** + * Init to run before each test + */ + @BeforeEach + public void init() { + // Initialize Inspection Action Bean + unloadingActions = new UnloadingActions(); + } + + /** + * Test case to test {@link UnloadingActions#getContainerActionStatus(String)} + * and {@link UnloadingActions#requestUnloadingAction(ContainerRequest)} for + * different possible inputs. + */ + @Test + public void requestLoadingActionTest() { + // Returns null when provided null vehicleId + assertNull(unloadingActions.getContainerActionStatus(null)); + + // requestLoadingAction does not throw exceptions for null parameters + unloadingActions.requestUnloadingAction(null); + + // Populate unloading actions with unloading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + // Returns null before unloading action is requested + assertNull(unloadingActions.getContainerActionStatus(req1.getActionId())); + + // Returns action after unloading action is requested + unloadingActions.requestUnloadingAction(req1); + assertEquals(req1.getVehicleId(), unloadingActions.getCurrentAction().getVehicleId()); + assertEquals(req1.getContainerId(), unloadingActions.getCurrentAction().getContainerId()); + + // Attempt to request new unloading action with already pending + // unloading action + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleC"); + req2.setContainerId("containerC"); + req2.setActionId("actionC"); + unloadingActions.requestUnloadingAction(req2); + ContainerActionStatus status = unloadingActions.getCurrentAction(); + assertEquals(req1.getContainerId(), status.getContainerId()); + } + + /** + * Test case to test + * {@link LoadingAction#completeCurrentAction(ContainerActionStatus)} for + * different possible parameters. + */ + @Test + public void completeLoadingTest() { + // Populate loading actions with loading requests + ContainerRequest req1 = new ContainerRequest(); + req1.setVehicleId("vehicleA"); + req1.setContainerId("containerA"); + req1.setActionId("actionA"); + + ContainerRequest req2 = new ContainerRequest(); + req2.setVehicleId("vehicleB"); + req2.setContainerId("containerB"); + req2.setActionId("actionB"); + + ContainerRequest req3 = new ContainerRequest(); + req3.setVehicleId("vehicleC"); + req3.setContainerId("containerC"); + req3.setActionId("actionC"); + + // Run completeCurrentAction with no current action + assertNull(unloadingActions.getCurrentAction()); + unloadingActions.completeCurrentAction(); + + // Run startCurrentAction with no current action + assertNull(unloadingActions.getCurrentAction()); + unloadingActions.startCurrentAction(); + + unloadingActions.requestUnloadingAction(req1); + unloadingActions.requestUnloadingAction(req2); + unloadingActions.requestUnloadingAction(req3); + + // Completed actions is empty before completing any loading action but + // loading action is in unloadingActions list of in progress actions + assertNull(unloadingActions.getCompletedActions().getActions()); + ContainerActionStatus req1Status = unloadingActions.getContainerActionStatus(req1.getActionId()); + ContainerActionStatus req2Status = unloadingActions.getContainerActionStatus(req2.getActionId()); + ContainerActionStatus req3Status = unloadingActions.getContainerActionStatus(req3.getActionId()); + + // First requested action becomes current action and each action requested after + // is added to + // pending actions + assertEquals(req1Status, unloadingActions.getCurrentAction()); + assertTrue(unloadingActions.getPendingActions().getActions().contains(req2Status)); + assertTrue(unloadingActions.getPendingActions().getActions().contains(req3Status)); + + // Start current action sets status to UNLOADING + assertEquals(StatusEnum.PENDING, unloadingActions.getCurrentAction().getStatus()); + unloadingActions.startCurrentAction(); + assertEquals(StatusEnum.UNLOADING, unloadingActions.getCurrentAction().getStatus()); + + // Current action status is set to UNLOADED and added to completedActions list. + // Current action is replaced with next action in pending actions + // Complete req1 + unloadingActions.completeCurrentAction(); + + assertTrue(unloadingActions.getCompletedActions().getActions().contains(req1Status)); + assertNotNull(req1Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req1Status.getStatus()); + assertEquals(req2Status, unloadingActions.getCurrentAction()); + + // Complete req2 + unloadingActions.completeCurrentAction(); + + assertTrue(unloadingActions.getCompletedActions().getActions().contains(req2Status)); + assertNotNull(req2Status.getCompleted()); + assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req2Status.getStatus()); + assertEquals(req3Status, unloadingActions.getCurrentAction()); + assertTrue(unloadingActions.getPendingActions().getActions().isEmpty()); + + // Complete req3 + unloadingActions.completeCurrentAction(); + + assertNull(unloadingActions.getCurrentAction()); + assertEquals(3, unloadingActions.getCompletedActions().getActions().size()); + + // Get ContainerActionStatus will return most recent action even when it is + // completed + // for a given vehicleID + assertEquals(req3Status, unloadingActions.getContainerActionStatus(req3.getActionId())); + } +} From b8d4b68bdc6aef0ebd6948e6d30e7881165eeadd Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Mon, 6 Dec 2021 10:34:00 -0500 Subject: [PATCH 14/17] Revert "V2xrelease 6.2 (#283)" This reverts commit 93ac2e6e6671a427809f942c5ea2e0d10ef1d509. --- .circleci/config.yml | 51 - .gitignore | 8 +- .sonarqube/sonar-scanner.properties | 7 +- Dockerfile | 9 +- configuration/amd64/docker-compose.yml | 7 +- configuration/amd64/mysql/localhost.sql | 32 +- configuration/amd64/mysql/port_drayage.sql | 91 -- .../mysql/suntrax/port_area_operations.sql | 90 -- .../mysql/suntrax/staging_area_operations.sql | 91 -- configuration/arm64/docker-compose.yml | 9 +- configuration/arm64/mysql/localhost.sql | 32 +- configuration/arm64/mysql/port_drayage.sql | 91 -- container/service.sh | 2 +- docker/Dockerfile-depl | 12 +- ext/pdclient/CMakeLists.txt | 42 - ext/pdclient/OAIActionStatusList.cpp | 100 -- ext/pdclient/OAIActionStatusList.h | 62 - ext/pdclient/OAIContainerActionStatus.cpp | 250 ---- ext/pdclient/OAIContainerActionStatus.h | 106 -- ext/pdclient/OAIContainerRequest.cpp | 160 --- ext/pdclient/OAIContainerRequest.h | 79 -- ext/pdclient/OAIDefaultApi.cpp | 1175 ----------------- ext/pdclient/OAIDefaultApi.h | 244 ---- ext/pdclient/OAIEnum.h | 63 - ext/pdclient/OAIHelpers.cpp | 426 ------ ext/pdclient/OAIHelpers.h | 275 ---- ext/pdclient/OAIHttpFileElement.cpp | 155 --- ext/pdclient/OAIHttpFileElement.h | 47 - ext/pdclient/OAIHttpRequest.cpp | 505 ------- ext/pdclient/OAIHttpRequest.h | 113 -- ext/pdclient/OAIInspectionRequest.cpp | 160 --- ext/pdclient/OAIInspectionRequest.h | 79 -- ext/pdclient/OAIInspectionStatus.cpp | 250 ---- ext/pdclient/OAIInspectionStatus.h | 106 -- ext/pdclient/OAIInspectionStatusList.cpp | 100 -- ext/pdclient/OAIInspectionStatusList.h | 62 - ext/pdclient/OAIObject.h | 65 - ext/pdclient/OAIServerConfiguration.h | 82 -- ext/pdclient/OAIServerVariable.h | 58 - ext/pdclient/client.pri | 35 - .../j2735_messages/J2735MessageFactory.hpp | 2 + src/tmx/TmxCore/src/ivpcore.cpp | 2 +- src/tmx/TmxCtl/src/lib/PluginConfig.cpp | 14 + src/tmx/TmxCtl/src/lib/PluginStatus.cpp | 39 +- src/tmx/TmxCtl/src/lib/TmxControl.h | 3 +- src/tmx/TmxUtils/src/Logger.h | 4 +- .../DsrcImmediateForwardPlugin/manifest.json | 2 +- .../src/DsrcMessageManagerPlugin.cpp | 3 +- .../MobilityOperationPlugin/CMakeLists.txt | 5 + .../MobilityOperationPlugin/manifest.json | 23 + .../src/MobilityOperationPlugin.cpp | 86 ++ .../src/MobilityOperationPlugin.h | 33 + src/v2i-hub/PortDrayagePlugin/CMakeLists.txt | 24 - src/v2i-hub/PortDrayagePlugin/manifest.json | 78 -- .../src/PortDrayagePlugin.cpp | 491 ------- .../PortDrayagePlugin/src/PortDrayagePlugin.h | 223 ---- .../src/WebServiceClient.cpp | 284 ---- .../PortDrayagePlugin/src/WebServiceClient.h | 144 -- .../PreemptionPlugin/src/PreemptionPlugin.cpp | 10 +- .../PreemptionPlugin/src/PreemptionPlugin.hpp | 2 +- .../src/include/PreemptionPluginWorker.cpp | 57 +- .../src/include/PreemptionPluginWorker.hpp | 16 +- .../PreemptionPlugin/test/PreemptionTest.cpp | 2 +- tools/port-drayage-webservice/.dockerignore | 9 - tools/port-drayage-webservice/Dockerfile | 5 - tools/port-drayage-webservice/pom.xml | 140 -- .../src/main/java/com/leidos/Application.java | 25 - .../WebApplicationConfiguration.java | 27 - .../controller/InspectionController.java | 123 -- .../leidos/controller/LoadingController.java | 105 -- .../leidos/controller/ResetController.java | 50 - .../controller/UnloadingController.java | 104 -- .../controller/UserInterfaceController.java | 32 - .../leidos/inspection/InspectionActions.java | 205 --- .../com/leidos/loading/LoadingActions.java | 185 --- .../leidos/unloading/UnloadingActions.java | 180 --- .../src/main/resources/application.properties | 30 - .../resources/port-drayage-webservice.yml | 427 ------ .../src/main/resources/static/css/main.css | 0 .../main/resources/templates/_inspection.html | 117 -- .../main/resources/templates/_loading.html | 115 -- .../main/resources/templates/_unloading.html | 114 -- .../src/main/resources/templates/index.html | 115 -- .../controller/InspectionControllerTest.java | 212 --- .../controller/LoadingControllerTest.java | 159 --- .../controller/UnloadingControllerTest.java | 160 --- .../inspection/InspectionActionsTest.java | 194 --- .../leidos/loading/LoadingActionsTest.java | 155 --- .../unloading/UnloadingActionsTest.java | 150 --- 89 files changed, 277 insertions(+), 9739 deletions(-) delete mode 100644 configuration/amd64/mysql/port_drayage.sql delete mode 100644 configuration/amd64/mysql/suntrax/port_area_operations.sql delete mode 100644 configuration/amd64/mysql/suntrax/staging_area_operations.sql delete mode 100644 configuration/arm64/mysql/port_drayage.sql delete mode 100644 ext/pdclient/CMakeLists.txt delete mode 100644 ext/pdclient/OAIActionStatusList.cpp delete mode 100644 ext/pdclient/OAIActionStatusList.h delete mode 100644 ext/pdclient/OAIContainerActionStatus.cpp delete mode 100644 ext/pdclient/OAIContainerActionStatus.h delete mode 100644 ext/pdclient/OAIContainerRequest.cpp delete mode 100644 ext/pdclient/OAIContainerRequest.h delete mode 100644 ext/pdclient/OAIDefaultApi.cpp delete mode 100644 ext/pdclient/OAIDefaultApi.h delete mode 100644 ext/pdclient/OAIEnum.h delete mode 100644 ext/pdclient/OAIHelpers.cpp delete mode 100644 ext/pdclient/OAIHelpers.h delete mode 100644 ext/pdclient/OAIHttpFileElement.cpp delete mode 100644 ext/pdclient/OAIHttpFileElement.h delete mode 100644 ext/pdclient/OAIHttpRequest.cpp delete mode 100644 ext/pdclient/OAIHttpRequest.h delete mode 100644 ext/pdclient/OAIInspectionRequest.cpp delete mode 100644 ext/pdclient/OAIInspectionRequest.h delete mode 100644 ext/pdclient/OAIInspectionStatus.cpp delete mode 100644 ext/pdclient/OAIInspectionStatus.h delete mode 100644 ext/pdclient/OAIInspectionStatusList.cpp delete mode 100644 ext/pdclient/OAIInspectionStatusList.h delete mode 100644 ext/pdclient/OAIObject.h delete mode 100644 ext/pdclient/OAIServerConfiguration.h delete mode 100644 ext/pdclient/OAIServerVariable.h delete mode 100644 ext/pdclient/client.pri create mode 100644 src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt create mode 100644 src/v2i-hub/MobilityOperationPlugin/manifest.json create mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp create mode 100644 src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h delete mode 100644 src/v2i-hub/PortDrayagePlugin/CMakeLists.txt delete mode 100644 src/v2i-hub/PortDrayagePlugin/manifest.json delete mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp delete mode 100644 src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h delete mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp delete mode 100644 src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h delete mode 100644 tools/port-drayage-webservice/.dockerignore delete mode 100644 tools/port-drayage-webservice/Dockerfile delete mode 100644 tools/port-drayage-webservice/pom.xml delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/Application.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java delete mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java delete mode 100644 tools/port-drayage-webservice/src/main/resources/application.properties delete mode 100755 tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml delete mode 100644 tools/port-drayage-webservice/src/main/resources/static/css/main.css delete mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_inspection.html delete mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_loading.html delete mode 100644 tools/port-drayage-webservice/src/main/resources/templates/_unloading.html delete mode 100644 tools/port-drayage-webservice/src/main/resources/templates/index.html delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java delete mode 100644 tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java diff --git a/.circleci/config.yml b/.circleci/config.yml index ca7e2700a..75b665fd5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -189,49 +189,6 @@ jobs: command: | echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin docker push usdotfhwaops/v2xhubarm:latest - port_drayage_webservice_build_develop : - docker: - - image: cimg/openjdk:11.0.12 - # Set working directory - working_directory: "/home/V2X-Hub" - steps: - - setup_remote_docker - - checkout - - run: - name: Maven Build JAR - # Build Port Drayage Web Service - command: | - cd tools/port-drayage-webservice/ - mvn clean install - - run: - name: Build Docker Image and Push - # Build and push Port Drayage Web Service Docker images - command: | - cd tools/port-drayage-webservice/ - docker build -t usdotfhwaops/port-drayage-webservice:latest . - echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin - docker push usdotfhwaops/port-drayage-webservice:latest - port_drayage_webservice_build : - docker: - - image: cimg/openjdk:11.0.12 - # Set working directory - steps: - - setup_remote_docker - - checkout - - run: - name: Maven Build JAR - # Build Port Drayage Web Service - command: | - cd tools/port-drayage-webservice/ - mvn clean install - - run: - name: Build Docker Image and Push - # Build and push Port Drayage Web Service Docker images - command: | - cd tools/port-drayage-webservice/ - docker build -t usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} . - echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin - docker push usdotfhwaops/port-drayage-webservice:${CIRCLE_BRANCH,,} workflows: version: 2 build: @@ -258,13 +215,5 @@ workflows: - sonar-scanner_develop: requires: - docker_build_push_develop - - port_drayage_webservice_build_develop: - filters: - branches: - only: develop - - port_drayage_webservice_build: - filters: - branches: - ignore: develop diff --git a/.gitignore b/.gitignore index c4ca36aec..642afb16f 100644 --- a/.gitignore +++ b/.gitignore @@ -76,10 +76,4 @@ Thumbs.db *.app #docker-compose variables -.env - -#Maven build directory -tools/port-drayage-webservice/target/ - -#Java PKS for HTTPS setup -tools/port-drayage-webservice/src/main/resources/tutorial.jks +.env \ No newline at end of file diff --git a/.sonarqube/sonar-scanner.properties b/.sonarqube/sonar-scanner.properties index 9bbb4a3ab..334ba3ebb 100644 --- a/.sonarqube/sonar-scanner.properties +++ b/.sonarqube/sonar-scanner.properties @@ -47,7 +47,7 @@ sonar.modules= PedestrianPlugin, \ TmxTools, \ MessageLoggerPlugin, \ CommandPlugin, \ - PortDrayagePlugin, \ + MobilityOperationPlugin, \ ODELoggerPlugin, \ DsrcImmediateForwardPlugin, \ MessageReceiverPlugin @@ -61,7 +61,7 @@ TmxUtils.sonar.projectBaseDir =/home/V2X-Hub/src/tmx/TmxUtils CARMACloudPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CARMACloudPlugin CommandPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CommandPlugin CswPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/CswPlugin -PortDrayagePlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/PortDrayagePlugin +MobilityOperationPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MobilityOperationPlugin ODELoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/ODELoggerPlugin MessageLoggerPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/MessageLoggerPlugin DmsPlugin.sonar.projectBaseDir =/home/V2X-Hub/src/v2i-hub/DmsPlugin @@ -85,7 +85,6 @@ TmxTools.sonar.sources =src TmxUtils.sonar.sources =src MessageLoggerPlugin.sonar.sources =src CswPlugin.sonar.sources =src -PortDrayagePlugin.sonar.sources =src DmsPlugin.sonar.sources =src DsrcImmediateForwardPlugin.sonar.sources =src LocationPlugin.sonar.sources =src @@ -114,7 +113,6 @@ MobilityOperationPlugin.sonar.sources =src TmxUtils.sonar.cfamily.gcov.reportsPath =coverage #MessageLoggerPlugin.sonar.cfamily.gcov.reportsPath =coverage #CswPlugin.sonar.cfamily.gcov.reportsPath =coverage -#PortDrayagePlugin.sonar.cfamily.gcov.reportsPath =coverage #DmsPlugin.sonar.cfamily.gcov.reportsPath =coverage #DsrcImmediateForwardPlugin.sonar.cfamily.gcov.reportsPath =coverage #LocationPlugin.sonar.cfamily.gcov.reportsPath =coverage @@ -140,7 +138,6 @@ TmxUtils.sonar.tests=test #TmxTools.sonar.tests=test #MessageLoggerPlugin.sonar.tests=test #CswPlugin.sonar.tests=test -#PortDrayagePlugin.sonar.tests=test #DmsPlugin.sonar.tests=test #DsrcImmediateForwardPlugin.sonar.tests=test #LocationPlugin.sonar.tests=test diff --git a/Dockerfile b/Dockerfile index e483c6e53..0085b6fb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,11 +60,6 @@ RUN make install WORKDIR /home/V2X-Hub/ext/ccserver RUN cmake . RUN make -RUN make install - -WORKDIR /home/V2X-Hub/ext/pdclient -RUN cmake . -RUN make RUN make install ### setup and install v2x-hub core and plugins @@ -106,8 +101,8 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json -RUN ln -s ../bin PortDrayagePlugin/bin -RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json +RUN ln -s ../bin MobilityOperationPlugin/bin +RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index 3e11f945e..da7f207f3 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -16,7 +16,6 @@ services: - mysql_root_password volumes: - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql - - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql php: image: usdotfhwaops/php:latest @@ -28,7 +27,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:v2xrelease_6.2 + image: usdotfhwaops/v2xhubamd:latest container_name: v2xhub network_mode: host restart: always @@ -41,10 +40,6 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP - port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 - container_name: port_drayage_webservice - network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/amd64/mysql/localhost.sql b/configuration/amd64/mysql/localhost.sql index 06d9abcf4..0430a75cf 100644 --- a/configuration/amd64/mysql/localhost.sql +++ b/configuration/amd64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) -- --- Host: 127.0.0.1 Database: IVP +-- Host: localhost Database: IVP -- ------------------------------------------------------ --- Server version 5.7.35 +-- Server version 5.7.34 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); +INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-08-25 13:36:29 +-- Dump completed on 2021-06-23 23:52:23 diff --git a/configuration/amd64/mysql/port_drayage.sql b/configuration/amd64/mysql/port_drayage.sql deleted file mode 100644 index eccdb199b..000000000 --- a/configuration/amd64/mysql/port_drayage.sql +++ /dev/null @@ -1,91 +0,0 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) --- --- Host: 127.0.0.1 Database: PORT_DRAYAGE --- ------------------------------------------------------ --- Server version 5.7.35 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Current Database: `PORT_DRAYAGE` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `PORT_DRAYAGE`; - --- --- Table structure for table `first_action` --- - -DROP TABLE IF EXISTS `first_action`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `first_action` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `first_action` --- - -LOCK TABLES `first_action` WRITE; -/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; -INSERT INTO `first_action` VALUES ("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); -/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `freight` --- - -DROP TABLE IF EXISTS `freight`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `freight` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `freight` --- - -LOCK TABLES `freight` WRITE; -/*!40000 ALTER TABLE `freight` DISABLE KEYS */; -INSERT INTO `freight` VALUES ("123",NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),("123",'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); -/*!40000 ALTER TABLE `freight` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2021-07-21 11:42:55 diff --git a/configuration/amd64/mysql/suntrax/port_area_operations.sql b/configuration/amd64/mysql/suntrax/port_area_operations.sql deleted file mode 100644 index abeb6e478..000000000 --- a/configuration/amd64/mysql/suntrax/port_area_operations.sql +++ /dev/null @@ -1,90 +0,0 @@ --- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) --- --- Host: 127.0.0.1 Database: PORT_DRAYAGE --- ------------------------------------------------------ --- Server version 5.7.36 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Current Database: `PORT_DRAYAGE` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `PORT_DRAYAGE`; - --- --- Table structure for table `first_action` --- - -DROP TABLE IF EXISTS `first_action`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `first_action` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `first_action` --- - -LOCK TABLES `first_action` WRITE; -/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; -/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `freight` --- - -DROP TABLE IF EXISTS `freight`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `freight` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `freight` --- - -LOCK TABLES `freight` WRITE; -/*!40000 ALTER TABLE `freight` DISABLE KEYS */; -INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_A',28.1119763,-81.8312035,'DROPOFF','67eadd3a-38b4-11ec-930a-000145098e4f','0bf7ebda-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1117373,-81.8309654,'PICKUP','0bf7ebda-38b5-11ec-930a-000145098e4f','9230504d-38b5-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','9230504d-38b5-11ec-930a-000145098e4f','511ad052-38b6-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','511ad052-38b6-11ec-930a-000145098e4f','fc15d52a-3c0c-11ec-b00d-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_A',28.1119763,-81.8312035,'DROPOFF','c9bba171-52c2-11ec-9105-000145098e4f','8e1d456a-52c3-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1117373,-81.8309654,'PICKUP','8e1d456a-52c3-11ec-9105-000145098e4f','744be658-52c4-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1120500,-81.8306483,'PORT_CHECKPOINT','744be658-52c4-11ec-9105-000145098e4f','a4b419b9-52c5-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1138052,-81.8317502,'EXIT_PORT','a4b419b9-52c5-11ec-9105-000145098e4f','20b546e3-52c6-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); -/*!40000 ALTER TABLE `freight` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2021-12-03 11:03:12 diff --git a/configuration/amd64/mysql/suntrax/staging_area_operations.sql b/configuration/amd64/mysql/suntrax/staging_area_operations.sql deleted file mode 100644 index 7332feb90..000000000 --- a/configuration/amd64/mysql/suntrax/staging_area_operations.sql +++ /dev/null @@ -1,91 +0,0 @@ --- MySQL dump 10.13 Distrib 5.7.36, for Linux (x86_64) --- --- Host: 127.0.0.1 Database: PORT_DRAYAGE --- ------------------------------------------------------ --- Server version 5.7.36 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Current Database: `PORT_DRAYAGE` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `PORT_DRAYAGE`; - --- --- Table structure for table `first_action` --- - -DROP TABLE IF EXISTS `first_action`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `first_action` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `first_action` --- - -LOCK TABLES `first_action` WRITE; -/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; -INSERT INTO `first_action` VALUES ('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'); -/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `freight` --- - -DROP TABLE IF EXISTS `freight`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `freight` ( - `cmv_id` varchar(20) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `freight` --- - -LOCK TABLES `freight` WRITE; -/*!40000 ALTER TABLE `freight` DISABLE KEYS */; -INSERT INTO `freight` VALUES ('DOT-80550',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),('DOT-80550','CARGO_A',28.1249788,-81.8348897,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'),('DOT-80550',NULL,28.1128156,-81.8314745,'ENTER_PORT','4ace39e6-ee36-11eb-9a03-0242ac130003','67eadd3a-38b4-11ec-930a-000145098e4f'),('DOT-80550','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','fc15d52a-3c0c-11ec-b00d-000145098e4f','5ceaab82-515c-11ec-9e2c-000145098e47'),('DOT-10004','CARGO_A',28.1249788,-81.8348897,'PICKUP','66bba4a0-52c1-11ec-9105-000145098e4f','66bba4cb-52c1-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1232195,-81.8348278,'EXIT_STAGING_AREA','66bba4cb-52c1-11ec-9105-000145098e4f','84f6b797-52c2-11ec-9105-000145098e4f'),('DOT-10004',NULL,28.1128156,-81.8314745,'ENTER_PORT','84f6b797-52c2-11ec-9105-000145098e4f','c9bba171-52c2-11ec-9105-000145098e4f'),('DOT-10004','CARGO_B',28.1232336,-81.8347566,'ENTER_STAGING_AREA','20b546e3-52c6-11ec-9105-000145098e4f','53875eba-52c7-11ec-9105-000145098e4f'); -/*!40000 ALTER TABLE `freight` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2021-12-03 11:25:03 diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index d00bc28f6..cab2e4176 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -15,8 +15,7 @@ services: - mysql_password - mysql_root_password volumes: - - "mysql_db:/var/lib/mysql" - - ./mysql/:/docker-entrypoint-initdb.d/ + - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql php: image: php:7.2.2-apache @@ -30,7 +29,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubarm:v2xrelease_6.2 + image: usdotfhwaops/v2xhubarm:latest container_name: v2xhub network_mode: host restart: always @@ -43,10 +42,6 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP - port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 - container_name: port_drayage_webservice - network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/arm64/mysql/localhost.sql b/configuration/arm64/mysql/localhost.sql index 12b072cc7..0430a75cf 100644 --- a/configuration/arm64/mysql/localhost.sql +++ b/configuration/arm64/mysql/localhost.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.35, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) -- --- Host: 127.0.0.1 Database: IVP +-- Host: localhost Database: IVP -- ------------------------------------------------------ --- Server version 5.7.35 +-- Server version 5.7.34 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -38,7 +38,7 @@ CREATE TABLE `eventLog` ( `logLevel` enum('Debug','Info','Warning','Error','Fatal') NOT NULL COMMENT 'The type of event being logged, one of - Debug - Info - Warn - Error', `uploaded` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records events generated by every IVP core component and plugin in the IVP platform. '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78,7 +78,7 @@ CREATE TABLE `installedPlugin` ( LOCK TABLES `installedPlugin` WRITE; /*!40000 ALTER TABLE `installedPlugin` DISABLE KEYS */; -INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',1,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/PortDrayagePlugin','/bin/PortDrayagePlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); +INSERT INTO `installedPlugin` VALUES (1,1,'/var/www/plugins/CommandPlugin','/bin/CommandPlugin','manifest.json','',0,500000),(2,2,'/var/www/plugins/CswPlugin','/bin/CswPlugin','manifest.json','',0,500000),(3,3,'/var/www/plugins/DmsPlugin','/bin/DmsPlugin','manifest.json','',0,500000),(4,4,'/var/www/plugins/DsrcImmediateForwardPlugin','/bin/DsrcImmediateForwardPlugin','manifest.json','',0,500000),(5,5,'/var/www/plugins/LocationPlugin','/bin/LocationPlugin','manifest.json','',0,500000),(6,6,'/var/www/plugins/MapPlugin','/bin/MapPlugin','manifest.json','',0,500000),(7,7,'/var/www/plugins/MessageReceiverPlugin','/bin/MessageReceiverPlugin','manifest.json','',0,500000),(8,8,'/var/www/plugins/ODEPlugin','/bin/ODEPlugin','manifest.json','',0,500000),(9,9,'/var/www/plugins/RtcmPlugin','/bin/RtcmPlugin','manifest.json','',0,500000),(10,10,'/var/www/plugins/SpatPlugin','/bin/SpatPlugin','manifest.json','',0,500000),(11,11,'/var/www/plugins/PreemptionPlugin','/bin/PreemptionPlugin','manifest.json','',0,500000),(12,12,'/var/www/plugins/SPaTLoggerPlugin','/bin/SPaTLoggerPlugin','manifest.json','',0,500000),(13,13,'/var/www/plugins/MessageLoggerPlugin','/bin/MessageLoggerPlugin','manifest.json','',0,500000),(14,14,'/var/www/plugins/PedestrianPlugin','/bin/PedestrianPlugin','manifest.json','',0,500000),(15,15,'/var/www/plugins/TimPlugin','/bin/TimPlugin','manifest.json','',0,500000),(16,16,'/var/www/plugins/CARMACloudPlugin','/bin/CARMACloudPlugin','manifest.json','',0,500000),(17,17,'/var/www/plugins/MobilityOperationPlugin','/bin/MobilityOperationPlugin','manifest.json','',0,500000),(18,18,'/var/www/plugins/ODELoggerPlugin','/bin/ODELoggerPlugin','manifest.json','',0,500000); /*!40000 ALTER TABLE `installedPlugin` ENABLE KEYS */; UNLOCK TABLES; @@ -102,7 +102,7 @@ CREATE TABLE `messageActivity` ( KEY `pluginId` (`pluginId`), CONSTRAINT `messageActivity_ibfk_1` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `messageActivity_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table records the most recent message activity of each active plugin in the IVP system. The data in this table is updated by the IVP plugin monitor core component for every message the plugin monitor receives.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -155,7 +155,7 @@ CREATE TABLE `plugin` ( `version` text, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COMMENT='This table lists the plugins loaded and available to run on the IVP platform.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -164,7 +164,7 @@ CREATE TABLE `plugin` ( LOCK TABLES `plugin` WRITE; /*!40000 ALTER TABLE `plugin` DISABLE KEYS */; -INSERT INTO `plugin` VALUES (0,'Plugin System','The global configuration for all TMX plugins','4.0'),(1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','3.0.0'),(17,'PortDrayagePlugin','PortDrayagePlugin for sending freight trucks automated actions in a port.','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'),(19,'ivpcore.PluginMonitor','Core element that is responsible for starting/stopping installed plugins and monitoring the status of the plugins','3.2.0'),(20,'ivpcore.MessageProfiler','Core element that is responsible for profiling the statistics of received messages','3.2.0'),(21,'ivpcore.HistoryManager','Core element that is responsible for purging old log and history data','3.2.0'); +INSERT INTO `plugin` VALUES (1,'CommandPlugin','Listens for websocket connections from the TMX admin portal and processes commands','5.0'),(2,'CSW','Provides Curve Speed Warning (CSW).','5.0'),(3,'DynamicMessageSign','Provides communication to a dynamic message sign.','5.0'),(4,'DSRCMessageManager','Plugin that listens for TMX messages and forwards them to the DSRC Radio (i.e. the RSU).','5.0'),(5,'Location','Plugin used to send out Location Messages using data from GPSD','5.0'),(6,'MAP','Plugin that reads intersection geometry from a configuration file and publishes a J2735 MAP message.','5.0'),(7,'MessageReceiver','Plugin to receive messages from an external DSRC radio or other source','5.0'),(8,'ODEPlugin','Plugin to forward messages to the Florida ODEPlugin network','5.0'),(9,'RTCM','Plugin to listen for RTCM messages from an NTRIP caster and route those messages over DSRC','5.0'),(10,'SPAT','Plugin that reads PTLM data from a configuration file, receives live data from the signal controller, and publishes a J2735 SPAT message.','5.0'),(11,'Preemption','Preemption plugin for the IVP system.','5.0'),(12,'SPaTLoggerPlugin','Listens for SPaT messages and logs them in a file in CSV format.','5.0'),(13,'MessageLoggerPlugin','Listens for J2735 messages and logs them in a file in JSON format.','5.0'),(14,'Pedestrian','Pedestrian plugin for the IVP system.','5.0'),(15,'TIM','Provides Traveller Information Message (TIM).','5.0'),(16,'CARMACloud','CARMA cloud plugin for making websocket connection with CARMA cloud .','5.0'),(17,'MobilityOperationPlugin','In development','5.0'),(18,'ODELoggerPlugin','Listens for J2735 messages and realtime forwards them to ODE.','5.0'); /*!40000 ALTER TABLE `plugin` ENABLE KEYS */; UNLOCK TABLES; @@ -217,7 +217,7 @@ CREATE TABLE `pluginConfigurationParameter` ( UNIQUE KEY `pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginConfigurationParameter_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -226,7 +226,7 @@ CREATE TABLE `pluginConfigurationParameter` ( LOCK TABLES `pluginConfigurationParameter` WRITE; /*!40000 ALTER TABLE `pluginConfigurationParameter` DISABLE KEYS */; -INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'Database_IP','127.0.0.1','127.0.0.1','IP address of database'),(88,17,'Database_Port','3306','3306','Port of database'),(89,17,'Database_Username','root','root','Username for database'),(90,17,'Database_Password','ivp','ivp','Password for database'),(91,17,'Database_Name','PORT_DRAYAGE','PORT_DRAYAGE','Name of database'),(92,17,'LogLevel','INFO','INFO','The log level for this plugin'),(93,18,'instance','1','1','instance of the application'),(94,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(95,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(96,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(97,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(98,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(99,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'),(100,19,'Startup Delay (ms)','10000','10000','Delay in milliseconds before starting any plugins.'),(101,19,'Monitor Check Interval (ms)','5000','5000','Delay in milliseconds between monitor checks.'),(102,19,'Max Startup Time (ms)','15000','15000','Maximum allowed startup time of a plugin before it is rebooted.'),(103,20,'Database Refresh Interval (ms)','2000','2000','The interval (in milliseconds) between uploads of message statistics to the database.'),(104,20,'Message Averaging Window (ms)','20000','20000','The averaging window (in milliseconds) that the profiler measures average interval.'),(105,21,'Purge Intervals (sec)','120','120','Interval between purges of history items'),(106,21,'Max Event Log Size','2000','2000','Maximum number of event log entries to keep. A value of zero will result in no purging of event log entries'); +INSERT INTO `pluginConfigurationParameter` VALUES (1,1,'SleepMS','100','100','The length of milliseconds to sleep between processing all messages.'),(2,1,'SSLEnabled','true','true','Enable secure connection using SSL.'),(3,1,'SSLPath','/var/www/plugins/.ssl','/var/www/plugins/.ssl','The path to the directory containing the SSL key and certificate files.'),(4,1,'EventRowLimit','50','50','The maximum number of rows returned for the initial Event Log query.'),(5,1,'DownloadPath','/var/www/download','/var/www/download','The path to the directory where downloaded files will be saved.'),(6,1,'LogLevel','ERROR','ERROR','The log level for this plugin'),(7,2,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(8,2,'MapFile','IVP_GF_CSW.xml','IVP_GF_CSW.xml',''),(9,2,'Snap Interval','300','300','The interval in milliseconds to keep a vehicle within a zone before allowing it to transition out of all zones.'),(10,2,'Vehicle Timeout','2000','2000','Timeout in milliseconds when a vehicle is removed from all zones if a BSM has not been received.'),(11,3,'DMS IP Address','192.168.25.30','192.168.25.30','The IP address of the NTCIP Dynamic Message Sign.'),(12,3,'DMS Port','9090','9090','The port of the NTCIP Dynamic Message Sign.'),(13,3,'Enable DMS','True','True','If true all messages are sent to the Dynamic Message Sign using NTCIP 1203.'),(14,3,'Enable Sign Simulator','True','True','If true all messages are sent to the Sign Simulator using UDP.'),(15,3,'Force Message ID','-1','-1','Immediately activates the message ID specified, then resets back to -1.'),(16,3,'Message 01','','','The text to display on the sign for ID 01 with any formatting (see NTCIP 1203).'),(17,3,'Message 02','[jl3][pt15o0]25[np]MPH','[jl3][pt15o0]25[np]MPH','The text to display on the sign for ID 02 with any formatting (see NTCIP 1203).'),(18,3,'Message 03','[jl3][pt15o0]SLOW[np]DOWN','[jl3][pt15o0]SLOW[np]DOWN','The text to display on the sign for ID 03 with any formatting (see NTCIP 1203).'),(19,3,'Message 04','[jl3][pt15o0]CRVE[np]AHED','[jl3][pt15o0]CRVE[np]AHED','The text to display on the sign for ID 04 with any formatting (see NTCIP 1203).'),(20,3,'Sign Sim IP Address','192.168.25.31','192.168.25.31','The IP address of the Sign Simulator that is the receipient of UDP messages.'),(21,3,'Sign Sim Port','9090','9090','The UDP port of the Sign Simulator that is the receipient of UDP messages.'),(22,4,'Messages_Destination_1','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1.'),(23,4,'Messages_Destination_2','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 2.'),(24,4,'Messages_Destination_3','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 3.'),(25,4,'Messages_Destination_4','{ \"Messages\": [ ] }','{ \"Messages\": [ ] }','JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 4.'),(26,4,'Destination_1','127.0.0.1:1516','127.0.0.1:1516','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_1.'),(27,4,'Destination_2','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_2.'),(28,4,'Destination_3','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_3.'),(29,4,'Destination_4','0','0','The destination UDP server(s) and port number(s) on the DSRC radio for all messages specified by Messages_Destination_4.'),(30,4,'Signature','False','False','True or False value indicating whether to sign the messages.'),(31,5,'Frequency','500','500','Rate to send Location Message in milliseconds'),(32,5,'LatchHeadingSpeed','2.5','2.5','Speed at which the heading parameter should be latched, in mph. Set to 0 to disable latching.'),(33,5,'GPSSource','localhost','localhost','Host where the GPSd is running'),(34,5,'SendRawNMEA','true','true','Route the raw NMEA strings from GPSd through TMX'),(35,6,'Frequency','1000','1000','The frequency to send the MAP message in milliseconds.'),(36,6,'MAP_Files','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','{ \"MapFiles\": [\n {\"Action\":0, \"FilePath\":\"GID_Telegraph-Twelve_Mile_withEgress.xml\"}\n] }','JSON data defining a list of map files. One map file for each action set specified by the TSC.'),(37,7,'IP','127.0.0.1','127.0.0.1','IP address for the incoming message network connection.'),(38,7,'Port','26789','26789','Port for the incoming message network connection.'),(39,7,'RouteDSRC','false','false','Set the flag to route a received J2735 message over DSRC.'),(40,7,'EnableSimulatedBSM','true','true','Accept and route incoming BSM messages from a V2I Hub simulator.'),(41,7,'EnableSimulatedSRM','true','true','Accept and route incoming SRM messages from a V2I Hub simulator.'),(42,7,'EnableSimulatedLocation','true','true','Accept and route incoming GPS location messages from a V2I Hub simulator.'),(43,8,'ODEIP','127.0.0.1','127.0.0.1','IP address for the ODE network connection.'),(44,8,'ODEPort','26789','26789','Port for the ODE network connection.'),(45,9,'Endpoint IP','156.63.133.118','156.63.133.118','NTRIP caster endpoint IP address'),(46,9,'Endpoint Port','2101','2101','NTRIP caster endpoint port'),(47,9,'Username','username','username','NTRIP caster authentication username'),(48,9,'Password','password','password','NTRIP caster authentication password'),(49,9,'Mountpoint','ODOT_RTCM23','ODOT_RTCM23','NTRIP caster mountpoint'),(50,9,'RTCM Version','Unknown','Unknown','Specify the expected RTCM message version (2.3 or 3.3) coming from the caster. Use Unknown to auto detect the version, which is done using trial and error, thus may be slow.'),(51,9,'Route RTCM','false','false','Route the RTCM messages created from NTRIP internally for use by other plugins.'),(52,10,'Intersection_Id','1','1','The intersection id for SPAT generated by this plugin.'),(53,10,'Intersection_Name','Intersection','Intersection','The intersection name for SPAT generated by this plugin.'),(54,10,'SignalGroupMapping','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','{\"SignalGroups\":[{\"SignalGroupId\":1,\"Phase\":1,\"Type\":\"vehicle\"},{\"SignalGroupId\":2,\"Phase\":2,\"Type\":\"vehicle\"},{\"SignalGroupId\":3,\"Phase\":3,\"Type\":\"vehicle\"},{\"SignalGroupId\":4,\"Phase\":4,\"Type\":\"vehicle\"},{\"SignalGroupId\":5,\"Phase\":5,\"Type\":\"vehicle\"},{\"SignalGroupId\":6,\"Phase\":6,\"Type\":\"vehicle\"},{\"SignalGroupId\":7,\"Phase\":7,\"Type\":\"vehicle\"},{\"SignalGroupId\":8,\"Phase\":8,\"Type\":\"vehicle\"},{\"SignalGroupId\":22,\"Phase\":2,\"Type\":\"pedestrian\"},{\"SignalGroupId\":24,\"Phase\":4,\"Type\":\"pedestrian\"},{\"SignalGroupId\":26,\"Phase\":6,\"Type\":\"pedestrian\"},{\"SignalGroupId\":28,\"Phase\":8,\"Type\":\"pedestrian\"}]}','JSON data defining a list of SignalGroups and phases.'),(55,10,'Local_IP','','','The IPv4 address of the local computer for receiving Traffic Signal Controller Broadcast Messages.'),(56,10,'Local_UDP_Port','local port','local port','The local UDP port for reception of Traffic Signal Controller Broadcast Messages from the TSC.'),(57,10,'TSC_IP','','','The IPv4 address of the destination Traffic Signal Controller (TSC).'),(58,10,'TSC_Remote_SNMP_Port','','','The destination port on the Traffic Signal Controller (TSC) for SNMP NTCIP communication.'),(59,11,'Instance','0','0','The instance of Preemption plugin.'),(60,11,'BasePreemptionOid','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','.1.3.6.1.4.1.1206.4.2.1.6.3.1.2.','The BasePreemptionOid of Preemption plugin.'),(61,11,'ipwithport',':',':','The ipwithport of Preemption plugin.'),(62,11,'snmp_community','public','public','The snmp_community of Preemption plugin.'),(63,11,'map_path','/geo.json','/geo.json','The map_path for Preemption plugin.'),(64,11,'allowedList','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','{\"validVehicles\":[\"292710445\",\"123456789\",\"2345678\"]}','List of vehicles BSM id that are allowed'),(65,12,'File Size In MB','100','100','Maximum size of the SPaT log file in mb.'),(66,12,'Filename','spatTx','spatTx','Default name of the SPaT log file.'),(67,12,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(68,13,'File Size In MB','100','100','Maximum size of the BSM log file in mb.'),(69,13,'Filename','bsmTx','bsmTx','Default name of the BSM log file.'),(70,13,'File Location','/var/log/tmx','/var/log/tmx','The location where the log files are stored. DO NOT edit while using docker deployment of V2X-Hub!'),(71,14,'Frequency','1000','1000','The frequency to send the PSM in milliseconds.'),(72,14,'Instance','0','0','The instance of Pedestrian plugin.'),(73,14,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(74,14,'WebServicePort','9000','9000','Port at which Web service exists'),(75,15,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(76,15,'MapFile','/var/www/plugins/MAP/IVP_GF_TIM.xml','/var/www/plugins/MAP/IVP_GF_TIM.xml',''),(77,15,'Start_Broadcast_Date','01-01-2019','01-01-2019','The Start Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(78,15,'Stop_Broadcast_Date','12-31-2020','12-31-2020','The Stop Broadcast Date for the TIM message in the (mm-dd-YYYY) format.'),(79,15,'Start_Broadcast_Time','06:00:00','06:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(80,15,'Stop_Broadcast_Time','21:00:00','21:00:00','The Start Broadcast Time for the TIM message in the (HH:MM:SS) format.'),(81,15,'WebServiceIP','127.0.0.1','127.0.0.1','IP address at which the web service exists'),(82,15,'WebServicePort','10000','10000','Port at which Web service exists'),(83,16,'Frequency','1000','1000','The frequency to send the TIM in milliseconds.'),(84,16,'Instance','0','0','The instance of this plugin.'),(85,16,'WebServiceIP','127.0.0.1','127.0.0.1','Server IP address for V2X hub'),(86,16,'WebServicePort','22222','22222','Server Port for V2X hub'),(87,17,'...','...','...','...'),(88,18,'instance','1','1','instance of the application'),(89,18,'schedule_frequency','1','1','sample of incoming messages to forward, 1 = forwards every message'),(90,18,'ForwardMSG','1','1','Enable Forwarding of BSM'),(91,18,'BSMKafkaTopic','topic.OdeRawEncodedBSMJson','topic.OdeRawEncodedBSMJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(92,18,'SPaTKafkaTopic','topic.OdeRawEncodedSPATJson','topic.OdeRawEncodedSPATJson','(Cond: ForwardMSG == True) Topic to use for forwarding BSM'),(93,18,'KafkaBrokerIp','172.31.55.238','172.31.55.238','IP address to be used for KAFKA broker'),(94,18,'KafkaBrokerPort','9092','9092','Port number to be used for KAFKA broker'); /*!40000 ALTER TABLE `pluginConfigurationParameter` ENABLE KEYS */; UNLOCK TABLES; @@ -247,7 +247,7 @@ CREATE TABLE `pluginMessageMap` ( KEY `messageTypeId` (`messageTypeId`), CONSTRAINT `pluginMessageMap_ibfk_1` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `pluginMessageMap_ibfk_2` FOREIGN KEY (`messageTypeId`) REFERENCES `messageType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1592 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; +) ENGINE=InnoDB AUTO_INCREMENT=1362 DEFAULT CHARSET=latin1 COMMENT='This table identifies the types of messages generated by each plugin.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -256,7 +256,7 @@ CREATE TABLE `pluginMessageMap` ( LOCK TABLES `pluginMessageMap` WRITE; /*!40000 ALTER TABLE `pluginMessageMap` DISABLE KEYS */; -INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15),(1538,15,14),(1435,17,30); +INSERT INTO `pluginMessageMap` VALUES (1,1,15),(1361,7,1),(70,7,15),(75,13,15); /*!40000 ALTER TABLE `pluginMessageMap` ENABLE KEYS */; UNLOCK TABLES; @@ -276,7 +276,7 @@ CREATE TABLE `pluginStatus` ( UNIQUE KEY `UQ_pluginId_key` (`pluginId`,`key`), KEY `pluginId` (`pluginId`), CONSTRAINT `pluginStatus_ibfk_2` FOREIGN KEY (`pluginId`) REFERENCES `plugin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -302,7 +302,7 @@ CREATE TABLE `systemConfigurationParameter` ( `defaultValue` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='This table lists the IVP system configuration parameters used by both core components and plugins to control the behavior of the system.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -330,7 +330,7 @@ CREATE TABLE `user` ( PRIMARY KEY (`id`), UNIQUE KEY `UQ_user_id` (`id`), UNIQUE KEY `UQ_user_username` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COMMENT='The list of accounts that can access the IVP platform via the administrative portal is held in the users table.'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -351,4 +351,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-08-25 13:36:29 +-- Dump completed on 2021-06-23 23:52:23 diff --git a/configuration/arm64/mysql/port_drayage.sql b/configuration/arm64/mysql/port_drayage.sql deleted file mode 100644 index 71c93e51f..000000000 --- a/configuration/arm64/mysql/port_drayage.sql +++ /dev/null @@ -1,91 +0,0 @@ --- MySQL dump 10.13 Distrib 5.7.34, for Linux (x86_64) --- --- Host: 127.0.0.1 Database: PORT_DRAYAGE --- ------------------------------------------------------ --- Server version 5.7.35 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Current Database: `PORT_DRAYAGE` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `PORT_DRAYAGE`; - --- --- Table structure for table `first_action` --- - -DROP TABLE IF EXISTS `first_action`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `first_action` ( - `cmv_id` int(4) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `first_action` --- - -LOCK TABLES `first_action` WRITE; -/*!40000 ALTER TABLE `first_action` DISABLE KEYS */; -INSERT INTO `first_action` VALUES (123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); -/*!40000 ALTER TABLE `first_action` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `freight` --- - -DROP TABLE IF EXISTS `freight`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `freight` ( - `cmv_id` int(4) NOT NULL, - `cargo_id` varchar(20) DEFAULT NULL, - `destination_lat` decimal(9,7) NOT NULL, - `destination_long` decimal(9,7) NOT NULL, - `operation` varchar(20) NOT NULL, - `action_id` varchar(36) NOT NULL, - `next_action` varchar(36) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `freight` --- - -LOCK TABLES `freight` WRITE; -/*!40000 ALTER TABLE `freight` DISABLE KEYS */; -INSERT INTO `freight` VALUES (123,NULL,38.9549780,-77.1475790,'EXIT_STAGING_AREA','32320c8a-e422-11eb-a8cc-000c29ae389d','4ace39e6-ee36-11eb-9a03-0242ac130003'),(123,'SOME_CARGO',38.9548890,-77.1481430,'PICKUP','4bea1c45-e421-11eb-a8cc-000c29ae389d','32320c8a-e422-11eb-a8cc-000c29ae389d'); -/*!40000 ALTER TABLE `freight` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2021-07-21 11:42:55 diff --git a/container/service.sh b/container/service.sh index ad8da583b..808754dad 100755 --- a/container/service.sh +++ b/container/service.sh @@ -19,8 +19,8 @@ tmxctl --plugin-install MessageLoggerPlugin.zip tmxctl --plugin-install PedestrianPlugin.zip tmxctl --plugin-install TimPlugin.zip tmxctl --plugin-install CARMACloudPlugin.zip +tmxctl --plugin-install MobilityOperationPlugin.zip tmxctl --plugin-install ODELoggerPlugin.zip -tmxctl --plugin-install PortDrayagePlugin.zip tmxctl --plugin CommandPlugin --enable /usr/local/bin/tmxcore diff --git a/docker/Dockerfile-depl b/docker/Dockerfile-depl index 6be0a8170..caeae84a1 100644 --- a/docker/Dockerfile-depl +++ b/docker/Dockerfile-depl @@ -70,11 +70,9 @@ RUN cmake . RUN make RUN make install WORKDIR /home/V2X-Hub/ext/ccserver +RUN rm -rf /home/V2X-Hub/ext/ + -WORKDIR /home/V2X-Hub/ext/pdclient -RUN cmake . -RUN make -RUN make install WORKDIR /home/V2X-Hub/src/v2i-hub/ RUN cmake . -DqserverPedestrian_DIR=/usr/local/share/qserverPedestrian/cmake -Dv2xhubWebAPI_DIR=/usr/local/share/v2xhubWebAPI/cmake/ @@ -112,10 +110,8 @@ RUN ln -s ../bin TimPlugin/bin RUN zip TimPlugin.zip TimPlugin/bin/TimPlugin TimPlugin/manifest.json RUN ln -s ../bin CARMACloudPlugin/bin RUN zip CARMACloudPlugin.zip CARMACloudPlugin/bin/CARMACloudPlugin CARMACloudPlugin/manifest.json - -RUN ln -s ../bin PortDrayagePlugin/bin -RUN zip PortDrayagePlugin.zip PortDrayagePlugin/bin/PortDrayagePlugin PortDrayagePlugin/manifest.json - +RUN ln -s ../bin MobilityOperationPlugin/bin +RUN zip MobilityOperationPlugin.zip MobilityOperationPlugin/bin/MobilityOperationPlugin MobilityOperationPlugin/manifest.json RUN ln -s ../bin ODELoggerPlugin/bin RUN zip ODELoggerPlugin.zip ODELoggerPlugin/bin/ODELoggerPlugin ODELoggerPlugin/manifest.json diff --git a/ext/pdclient/CMakeLists.txt b/ext/pdclient/CMakeLists.txt deleted file mode 100644 index 562b24523..000000000 --- a/ext/pdclient/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -cmake_minimum_required(VERSION 3.2) - -project(pdclient) -set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) - -if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") -else () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") -endif () - -find_package(Qt5Core REQUIRED) -find_package(Qt5Network REQUIRED) - -add_library(${PROJECT_NAME} - OAIActionStatusList.cpp - OAIContainerActionStatus.cpp - OAIContainerRequest.cpp - OAIInspectionRequest.cpp - OAIInspectionStatus.cpp - OAIInspectionStatusList.cpp - OAIDefaultApi.cpp - OAIHelpers.cpp - OAIHttpRequest.cpp - OAIHttpFileElement.cpp -) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ) - -if(NOT APPLE) - target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto) -endif() - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) - -install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - -FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -INSTALL(FILES ${files} DESTINATION /usr/local/include/${PROJECT_NAME} ) diff --git a/ext/pdclient/OAIActionStatusList.cpp b/ext/pdclient/OAIActionStatusList.cpp deleted file mode 100644 index eff61e965..000000000 --- a/ext/pdclient/OAIActionStatusList.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIActionStatusList.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIActionStatusList::OAIActionStatusList(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIActionStatusList::OAIActionStatusList() { - this->initializeModel(); -} - -OAIActionStatusList::~OAIActionStatusList() {} - -void OAIActionStatusList::initializeModel() { - - m_actions_isSet = false; - m_actions_isValid = false; -} - -void OAIActionStatusList::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIActionStatusList::fromJsonObject(QJsonObject json) { - - m_actions_isValid = ::OpenAPI::fromJsonValue(actions, json[QString("actions")]); - m_actions_isSet = !json[QString("actions")].isNull() && m_actions_isValid; -} - -QString OAIActionStatusList::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIActionStatusList::asJsonObject() const { - QJsonObject obj; - if (actions.size() > 0) { - obj.insert(QString("actions"), ::OpenAPI::toJsonValue(actions)); - } - return obj; -} - -QList OAIActionStatusList::getActions() const { - return actions; -} -void OAIActionStatusList::setActions(const QList &actions) { - this->actions = actions; - this->m_actions_isSet = true; -} - -bool OAIActionStatusList::is_actions_Set() const{ - return m_actions_isSet; -} - -bool OAIActionStatusList::is_actions_Valid() const{ - return m_actions_isValid; -} - -bool OAIActionStatusList::isSet() const { - bool isObjectUpdated = false; - do { - if (actions.size() > 0) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIActionStatusList::isValid() const { - // only required properties are required for the object to be considered valid - return true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIActionStatusList.h b/ext/pdclient/OAIActionStatusList.h deleted file mode 100644 index 2447f1cfa..000000000 --- a/ext/pdclient/OAIActionStatusList.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIActionStatusList.h - * - * - */ - -#ifndef OAIActionStatusList_H -#define OAIActionStatusList_H - -#include - -#include "OAIContainerActionStatus.h" -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIActionStatusList : public OAIObject { -public: - OAIActionStatusList(); - OAIActionStatusList(QString json); - ~OAIActionStatusList() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QList getActions() const; - void setActions(const QList &actions); - bool is_actions_Set() const; - bool is_actions_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QList actions; - bool m_actions_isSet; - bool m_actions_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIActionStatusList) - -#endif // OAIActionStatusList_H diff --git a/ext/pdclient/OAIContainerActionStatus.cpp b/ext/pdclient/OAIContainerActionStatus.cpp deleted file mode 100644 index 6b7f2a3a3..000000000 --- a/ext/pdclient/OAIContainerActionStatus.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIContainerActionStatus.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIContainerActionStatus::OAIContainerActionStatus(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIContainerActionStatus::OAIContainerActionStatus() { - this->initializeModel(); -} - -OAIContainerActionStatus::~OAIContainerActionStatus() {} - -void OAIContainerActionStatus::initializeModel() { - - m_vehicle_id_isSet = false; - m_vehicle_id_isValid = false; - - m_container_id_isSet = false; - m_container_id_isValid = false; - - m_action_id_isSet = false; - m_action_id_isValid = false; - - m_status_isSet = false; - m_status_isValid = false; - - m_requested_isSet = false; - m_requested_isValid = false; - - m_completed_isSet = false; - m_completed_isValid = false; -} - -void OAIContainerActionStatus::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIContainerActionStatus::fromJsonObject(QJsonObject json) { - - m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); - m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; - - m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); - m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; - - m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); - m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; - - m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); - m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; - - m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); - m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; - - m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); - m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; -} - -QString OAIContainerActionStatus::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIContainerActionStatus::asJsonObject() const { - QJsonObject obj; - if (m_vehicle_id_isSet) { - obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); - } - if (m_container_id_isSet) { - obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); - } - if (m_action_id_isSet) { - obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); - } - if (m_status_isSet) { - obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); - } - if (m_requested_isSet) { - obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); - } - if (m_completed_isSet) { - obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); - } - return obj; -} - -QString OAIContainerActionStatus::getVehicleId() const { - return vehicle_id; -} -void OAIContainerActionStatus::setVehicleId(const QString &vehicle_id) { - this->vehicle_id = vehicle_id; - this->m_vehicle_id_isSet = true; -} - -bool OAIContainerActionStatus::is_vehicle_id_Set() const{ - return m_vehicle_id_isSet; -} - -bool OAIContainerActionStatus::is_vehicle_id_Valid() const{ - return m_vehicle_id_isValid; -} - -QString OAIContainerActionStatus::getContainerId() const { - return container_id; -} -void OAIContainerActionStatus::setContainerId(const QString &container_id) { - this->container_id = container_id; - this->m_container_id_isSet = true; -} - -bool OAIContainerActionStatus::is_container_id_Set() const{ - return m_container_id_isSet; -} - -bool OAIContainerActionStatus::is_container_id_Valid() const{ - return m_container_id_isValid; -} - -QString OAIContainerActionStatus::getActionId() const { - return action_id; -} -void OAIContainerActionStatus::setActionId(const QString &action_id) { - this->action_id = action_id; - this->m_action_id_isSet = true; -} - -bool OAIContainerActionStatus::is_action_id_Set() const{ - return m_action_id_isSet; -} - -bool OAIContainerActionStatus::is_action_id_Valid() const{ - return m_action_id_isValid; -} - -QString OAIContainerActionStatus::getStatus() const { - return status; -} -void OAIContainerActionStatus::setStatus(const QString &status) { - this->status = status; - this->m_status_isSet = true; -} - -bool OAIContainerActionStatus::is_status_Set() const{ - return m_status_isSet; -} - -bool OAIContainerActionStatus::is_status_Valid() const{ - return m_status_isValid; -} - -qint64 OAIContainerActionStatus::getRequested() const { - return requested; -} -void OAIContainerActionStatus::setRequested(const qint64 &requested) { - this->requested = requested; - this->m_requested_isSet = true; -} - -bool OAIContainerActionStatus::is_requested_Set() const{ - return m_requested_isSet; -} - -bool OAIContainerActionStatus::is_requested_Valid() const{ - return m_requested_isValid; -} - -qint64 OAIContainerActionStatus::getCompleted() const { - return completed; -} -void OAIContainerActionStatus::setCompleted(const qint64 &completed) { - this->completed = completed; - this->m_completed_isSet = true; -} - -bool OAIContainerActionStatus::is_completed_Set() const{ - return m_completed_isSet; -} - -bool OAIContainerActionStatus::is_completed_Valid() const{ - return m_completed_isValid; -} - -bool OAIContainerActionStatus::isSet() const { - bool isObjectUpdated = false; - do { - if (m_vehicle_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_container_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_action_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_status_isSet) { - isObjectUpdated = true; - break; - } - - if (m_requested_isSet) { - isObjectUpdated = true; - break; - } - - if (m_completed_isSet) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIContainerActionStatus::isValid() const { - // only required properties are required for the object to be considered valid - return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerActionStatus.h b/ext/pdclient/OAIContainerActionStatus.h deleted file mode 100644 index e117d287c..000000000 --- a/ext/pdclient/OAIContainerActionStatus.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIContainerActionStatus.h - * - * - */ - -#ifndef OAIContainerActionStatus_H -#define OAIContainerActionStatus_H - -#include - -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIContainerActionStatus : public OAIObject { -public: - OAIContainerActionStatus(); - OAIContainerActionStatus(QString json); - ~OAIContainerActionStatus() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QString getVehicleId() const; - void setVehicleId(const QString &vehicle_id); - bool is_vehicle_id_Set() const; - bool is_vehicle_id_Valid() const; - - QString getContainerId() const; - void setContainerId(const QString &container_id); - bool is_container_id_Set() const; - bool is_container_id_Valid() const; - - QString getActionId() const; - void setActionId(const QString &action_id); - bool is_action_id_Set() const; - bool is_action_id_Valid() const; - - QString getStatus() const; - void setStatus(const QString &status); - bool is_status_Set() const; - bool is_status_Valid() const; - - qint64 getRequested() const; - void setRequested(const qint64 &requested); - bool is_requested_Set() const; - bool is_requested_Valid() const; - - qint64 getCompleted() const; - void setCompleted(const qint64 &completed); - bool is_completed_Set() const; - bool is_completed_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QString vehicle_id; - bool m_vehicle_id_isSet; - bool m_vehicle_id_isValid; - - QString container_id; - bool m_container_id_isSet; - bool m_container_id_isValid; - - QString action_id; - bool m_action_id_isSet; - bool m_action_id_isValid; - - QString status; - bool m_status_isSet; - bool m_status_isValid; - - qint64 requested; - bool m_requested_isSet; - bool m_requested_isValid; - - qint64 completed; - bool m_completed_isSet; - bool m_completed_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIContainerActionStatus) - -#endif // OAIContainerActionStatus_H diff --git a/ext/pdclient/OAIContainerRequest.cpp b/ext/pdclient/OAIContainerRequest.cpp deleted file mode 100644 index 616f75f7d..000000000 --- a/ext/pdclient/OAIContainerRequest.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIContainerRequest.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIContainerRequest::OAIContainerRequest(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIContainerRequest::OAIContainerRequest() { - this->initializeModel(); -} - -OAIContainerRequest::~OAIContainerRequest() {} - -void OAIContainerRequest::initializeModel() { - - m_vehicle_id_isSet = false; - m_vehicle_id_isValid = false; - - m_container_id_isSet = false; - m_container_id_isValid = false; - - m_action_id_isSet = false; - m_action_id_isValid = false; -} - -void OAIContainerRequest::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIContainerRequest::fromJsonObject(QJsonObject json) { - - m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); - m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; - - m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); - m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; - - m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); - m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; -} - -QString OAIContainerRequest::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIContainerRequest::asJsonObject() const { - QJsonObject obj; - if (m_vehicle_id_isSet) { - obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); - } - if (m_container_id_isSet) { - obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); - } - if (m_action_id_isSet) { - obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); - } - return obj; -} - -QString OAIContainerRequest::getVehicleId() const { - return vehicle_id; -} -void OAIContainerRequest::setVehicleId(const QString &vehicle_id) { - this->vehicle_id = vehicle_id; - this->m_vehicle_id_isSet = true; -} - -bool OAIContainerRequest::is_vehicle_id_Set() const{ - return m_vehicle_id_isSet; -} - -bool OAIContainerRequest::is_vehicle_id_Valid() const{ - return m_vehicle_id_isValid; -} - -QString OAIContainerRequest::getContainerId() const { - return container_id; -} -void OAIContainerRequest::setContainerId(const QString &container_id) { - this->container_id = container_id; - this->m_container_id_isSet = true; -} - -bool OAIContainerRequest::is_container_id_Set() const{ - return m_container_id_isSet; -} - -bool OAIContainerRequest::is_container_id_Valid() const{ - return m_container_id_isValid; -} - -QString OAIContainerRequest::getActionId() const { - return action_id; -} -void OAIContainerRequest::setActionId(const QString &action_id) { - this->action_id = action_id; - this->m_action_id_isSet = true; -} - -bool OAIContainerRequest::is_action_id_Set() const{ - return m_action_id_isSet; -} - -bool OAIContainerRequest::is_action_id_Valid() const{ - return m_action_id_isValid; -} - -bool OAIContainerRequest::isSet() const { - bool isObjectUpdated = false; - do { - if (m_vehicle_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_container_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_action_id_isSet) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIContainerRequest::isValid() const { - // only required properties are required for the object to be considered valid - return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIContainerRequest.h b/ext/pdclient/OAIContainerRequest.h deleted file mode 100644 index 712b00534..000000000 --- a/ext/pdclient/OAIContainerRequest.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIContainerRequest.h - * - * - */ - -#ifndef OAIContainerRequest_H -#define OAIContainerRequest_H - -#include - -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIContainerRequest : public OAIObject { -public: - OAIContainerRequest(); - OAIContainerRequest(QString json); - ~OAIContainerRequest() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QString getVehicleId() const; - void setVehicleId(const QString &vehicle_id); - bool is_vehicle_id_Set() const; - bool is_vehicle_id_Valid() const; - - QString getContainerId() const; - void setContainerId(const QString &container_id); - bool is_container_id_Set() const; - bool is_container_id_Valid() const; - - QString getActionId() const; - void setActionId(const QString &action_id); - bool is_action_id_Set() const; - bool is_action_id_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QString vehicle_id; - bool m_vehicle_id_isSet; - bool m_vehicle_id_isValid; - - QString container_id; - bool m_container_id_isSet; - bool m_container_id_isValid; - - QString action_id; - bool m_action_id_isSet; - bool m_action_id_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIContainerRequest) - -#endif // OAIContainerRequest_H diff --git a/ext/pdclient/OAIDefaultApi.cpp b/ext/pdclient/OAIDefaultApi.cpp deleted file mode 100644 index 3b257c2b4..000000000 --- a/ext/pdclient/OAIDefaultApi.cpp +++ /dev/null @@ -1,1175 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIDefaultApi.h" -#include "OAIServerConfiguration.h" -#include -#include - -namespace OpenAPI { - -OAIDefaultApi::OAIDefaultApi(const int timeOut) - : _timeOut(timeOut), - _manager(nullptr), - _isResponseCompressionEnabled(false), - _isRequestCompressionEnabled(false) { - initializeServerConfigs(); -} - -OAIDefaultApi::~OAIDefaultApi() { -} - -void OAIDefaultApi::initializeServerConfigs() { - //Default server - QList defaultConf = QList(); - //varying endpoint server - defaultConf.append(OAIServerConfiguration( - QUrl("http://127.0.0.1:8080"), - "Unsecured hosting for development", - QMap())); - defaultConf.append(OAIServerConfiguration( - QUrl("https://127.0.0.1:8443"), - "Secured hosting for deployment", - QMap())); - _serverConfigs.insert("inspectionActionIdGet", defaultConf); - _serverIndices.insert("inspectionActionIdGet", 0); - _serverConfigs.insert("inspectionCompleteActionIdPost", defaultConf); - _serverIndices.insert("inspectionCompleteActionIdPost", 0); - _serverConfigs.insert("inspectionHoldActionIdPost", defaultConf); - _serverIndices.insert("inspectionHoldActionIdPost", 0); - _serverConfigs.insert("inspectionHoldingActionIdPost", defaultConf); - _serverIndices.insert("inspectionHoldingActionIdPost", 0); - _serverConfigs.insert("inspectionPendingGet", defaultConf); - _serverIndices.insert("inspectionPendingGet", 0); - _serverConfigs.insert("inspectionPost", defaultConf); - _serverIndices.insert("inspectionPost", 0); - _serverConfigs.insert("loadingActionIdGet", defaultConf); - _serverIndices.insert("loadingActionIdGet", 0); - _serverConfigs.insert("loadingCompleteActionIdPost", defaultConf); - _serverIndices.insert("loadingCompleteActionIdPost", 0); - _serverConfigs.insert("loadingPendingGet", defaultConf); - _serverIndices.insert("loadingPendingGet", 0); - _serverConfigs.insert("loadingPost", defaultConf); - _serverIndices.insert("loadingPost", 0); - _serverConfigs.insert("loadingStartActionIdPost", defaultConf); - _serverIndices.insert("loadingStartActionIdPost", 0); - _serverConfigs.insert("unloadingActionIdGet", defaultConf); - _serverIndices.insert("unloadingActionIdGet", 0); - _serverConfigs.insert("unloadingCompleteActionIdPost", defaultConf); - _serverIndices.insert("unloadingCompleteActionIdPost", 0); - _serverConfigs.insert("unloadingPendingGet", defaultConf); - _serverIndices.insert("unloadingPendingGet", 0); - _serverConfigs.insert("unloadingPost", defaultConf); - _serverIndices.insert("unloadingPost", 0); - _serverConfigs.insert("unloadingStartActionIdPost", defaultConf); - _serverIndices.insert("unloadingStartActionIdPost", 0); -} - -/** -* returns 0 on success and -1, -2 or -3 on failure. -* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found -*/ -int OAIDefaultApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) { - auto it = _serverConfigs.find(operation); - if (it != _serverConfigs.end() && serverIndex < it.value().size()) { - return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value); - } - return -3; -} -void OAIDefaultApi::setServerIndex(const QString &operation, int serverIndex) { - if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) { - _serverIndices[operation] = serverIndex; - } -} - -void OAIDefaultApi::setApiKey(const QString &apiKeyName, const QString &apiKey) { - _apiKeys.insert(apiKeyName,apiKey); -} - -void OAIDefaultApi::setBearerToken(const QString &token) { - _bearerToken = token; -} - -void OAIDefaultApi::setUsername(const QString &username) { - _username = username; -} - -void OAIDefaultApi::setPassword(const QString &password) { - _password = password; -} - - -void OAIDefaultApi::setTimeOut(const int timeOut) { - _timeOut = timeOut; -} - -void OAIDefaultApi::setWorkingDirectory(const QString &path) { - _workingDirectory = path; -} - -void OAIDefaultApi::setNetworkAccessManager(QNetworkAccessManager* manager) { - _manager = manager; -} - -/** - * Appends a new ServerConfiguration to the config map for a specific operation. - * @param operation The id to the target operation. - * @param url A string that contains the URL of the server - * @param description A String that describes the server - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - * returns the index of the new server config on success and -1 if the operation is not found - */ -int OAIDefaultApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { - if (_serverConfigs.contains(operation)) { - _serverConfigs[operation].append(OAIServerConfiguration( - url, - description, - variables)); - return _serverConfigs[operation].size()-1; - } else { - return -1; - } -} - -/** - * Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server. - * @param url A string that contains the URL of the server - * @param description A String that describes the server - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ -void OAIDefaultApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { - setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); - } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif -} - -/** - * Appends a new ServerConfiguration to the config map for an operations and sets the index to that server. - * @param URL A string that contains the URL of the server - * @param description A String that describes the server - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ -void OAIDefaultApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap &variables) { - setServerIndex(operation, addServerConfiguration(operation, url, description, variables)); -} - -void OAIDefaultApi::addHeaders(const QString &key, const QString &value) { - _defaultHeaders.insert(key, value); -} - -void OAIDefaultApi::enableRequestCompression() { - _isRequestCompressionEnabled = true; -} - -void OAIDefaultApi::enableResponseCompression() { - _isResponseCompressionEnabled = true; -} - -void OAIDefaultApi::abortRequests() { - emit abortRequestsSignal(); -} - -QString OAIDefaultApi::getParamStylePrefix(const QString &style) { - if (style == "matrix") { - return ";"; - } else if (style == "label") { - return "."; - } else if (style == "form") { - return "&"; - } else if (style == "simple") { - return ""; - } else if (style == "spaceDelimited") { - return "&"; - } else if (style == "pipeDelimited") { - return "&"; - } else { - return "none"; - } -} - -QString OAIDefaultApi::getParamStyleSuffix(const QString &style) { - if (style == "matrix") { - return "="; - } else if (style == "label") { - return ""; - } else if (style == "form") { - return "="; - } else if (style == "simple") { - return ""; - } else if (style == "spaceDelimited") { - return "="; - } else if (style == "pipeDelimited") { - return "="; - } else { - return "none"; - } -} - -QString OAIDefaultApi::getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode) { - - if (style == "matrix") { - return (isExplode) ? ";" + name + "=" : ","; - - } else if (style == "label") { - return (isExplode) ? "." : ","; - - } else if (style == "form") { - return (isExplode) ? "&" + name + "=" : ","; - - } else if (style == "simple") { - return ","; - } else if (style == "spaceDelimited") { - return (isExplode) ? "&" + name + "=" : " "; - - } else if (style == "pipeDelimited") { - return (isExplode) ? "&" + name + "=" : "|"; - - } else if (style == "deepObject") { - return (isExplode) ? "&" : "none"; - - } else { - return "none"; - } -} - -void OAIDefaultApi::inspectionActionIdGet(const QString &action_id) { - QString fullPath = QString(_serverConfigs["inspectionActionIdGet"][_serverIndices.value("inspectionActionIdGet")].URL()+"/inspection/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionActionIdGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionActionIdGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIInspectionStatus output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionActionIdGetSignal(output); - emit inspectionActionIdGetSignalFull(worker, output); - } else { - emit inspectionActionIdGetSignalE(output, error_type, error_str); - emit inspectionActionIdGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::inspectionCompleteActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["inspectionCompleteActionIdPost"][_serverIndices.value("inspectionCompleteActionIdPost")].URL()+"/inspection/complete/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionCompleteActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionCompleteActionIdPostSignal(); - emit inspectionCompleteActionIdPostSignalFull(worker); - } else { - emit inspectionCompleteActionIdPostSignalE(error_type, error_str); - emit inspectionCompleteActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::inspectionHoldActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["inspectionHoldActionIdPost"][_serverIndices.value("inspectionHoldActionIdPost")].URL()+"/inspection/hold/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionHoldActionIdPostSignal(); - emit inspectionHoldActionIdPostSignalFull(worker); - } else { - emit inspectionHoldActionIdPostSignalE(error_type, error_str); - emit inspectionHoldActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::inspectionHoldingActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["inspectionHoldingActionIdPost"][_serverIndices.value("inspectionHoldingActionIdPost")].URL()+"/inspection/holding/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionHoldingActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionHoldingActionIdPostSignal(); - emit inspectionHoldingActionIdPostSignalFull(worker); - } else { - emit inspectionHoldingActionIdPostSignalE(error_type, error_str); - emit inspectionHoldingActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::inspectionPendingGet() { - QString fullPath = QString(_serverConfigs["inspectionPendingGet"][_serverIndices.value("inspectionPendingGet")].URL()+"/inspection/pending"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPendingGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionPendingGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIInspectionStatusList output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionPendingGetSignal(output); - emit inspectionPendingGetSignalFull(worker, output); - } else { - emit inspectionPendingGetSignalE(output, error_type, error_str); - emit inspectionPendingGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::inspectionPost(const OAIInspectionRequest &oai_inspection_request) { - QString fullPath = QString(_serverConfigs["inspectionPost"][_serverIndices.value("inspectionPost")].URL()+"/inspection"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - { - - QByteArray output = oai_inspection_request.asJson().toUtf8(); - input.request_body.append(output); - } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::inspectionPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::inspectionPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit inspectionPostSignal(); - emit inspectionPostSignalFull(worker); - } else { - emit inspectionPostSignalE(error_type, error_str); - emit inspectionPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::loadingActionIdGet(const QString &action_id) { - QString fullPath = QString(_serverConfigs["loadingActionIdGet"][_serverIndices.value("loadingActionIdGet")].URL()+"/loading/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingActionIdGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::loadingActionIdGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIContainerActionStatus output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit loadingActionIdGetSignal(output); - emit loadingActionIdGetSignalFull(worker, output); - } else { - emit loadingActionIdGetSignalE(output, error_type, error_str); - emit loadingActionIdGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::loadingCompleteActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["loadingCompleteActionIdPost"][_serverIndices.value("loadingCompleteActionIdPost")].URL()+"/loading/complete/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingCompleteActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit loadingCompleteActionIdPostSignal(); - emit loadingCompleteActionIdPostSignalFull(worker); - } else { - emit loadingCompleteActionIdPostSignalE(error_type, error_str); - emit loadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::loadingPendingGet() { - QString fullPath = QString(_serverConfigs["loadingPendingGet"][_serverIndices.value("loadingPendingGet")].URL()+"/loading/pending"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPendingGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::loadingPendingGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIActionStatusList output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit loadingPendingGetSignal(output); - emit loadingPendingGetSignalFull(worker, output); - } else { - emit loadingPendingGetSignalE(output, error_type, error_str); - emit loadingPendingGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::loadingPost(const OAIContainerRequest &oai_container_request) { - QString fullPath = QString(_serverConfigs["loadingPost"][_serverIndices.value("loadingPost")].URL()+"/loading"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - { - - QByteArray output = oai_container_request.asJson().toUtf8(); - input.request_body.append(output); - } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::loadingPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit loadingPostSignal(); - emit loadingPostSignalFull(worker); - } else { - emit loadingPostSignalE(error_type, error_str); - emit loadingPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::loadingStartActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["loadingStartActionIdPost"][_serverIndices.value("loadingStartActionIdPost")].URL()+"/loading/start/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::loadingStartActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit loadingStartActionIdPostSignal(); - emit loadingStartActionIdPostSignalFull(worker); - } else { - emit loadingStartActionIdPostSignalE(error_type, error_str); - emit loadingStartActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::unloadingActionIdGet(const QString &action_id) { - QString fullPath = QString(_serverConfigs["unloadingActionIdGet"][_serverIndices.value("unloadingActionIdGet")].URL()+"/unloading/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingActionIdGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::unloadingActionIdGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIContainerActionStatus output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit unloadingActionIdGetSignal(output); - emit unloadingActionIdGetSignalFull(worker, output); - } else { - emit unloadingActionIdGetSignalE(output, error_type, error_str); - emit unloadingActionIdGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::unloadingCompleteActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["unloadingCompleteActionIdPost"][_serverIndices.value("unloadingCompleteActionIdPost")].URL()+"/unloading/complete/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingCompleteActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit unloadingCompleteActionIdPostSignal(); - emit unloadingCompleteActionIdPostSignalFull(worker); - } else { - emit unloadingCompleteActionIdPostSignalE(error_type, error_str); - emit unloadingCompleteActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::unloadingPendingGet() { - QString fullPath = QString(_serverConfigs["unloadingPendingGet"][_serverIndices.value("unloadingPendingGet")].URL()+"/unloading/pending"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPendingGetCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::unloadingPendingGetCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - OAIActionStatusList output(QString(worker->response)); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit unloadingPendingGetSignal(output); - emit unloadingPendingGetSignalFull(worker, output); - } else { - emit unloadingPendingGetSignalE(output, error_type, error_str); - emit unloadingPendingGetSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::unloadingPost(const OAIContainerRequest &oai_container_request) { - QString fullPath = QString(_serverConfigs["unloadingPost"][_serverIndices.value("unloadingPost")].URL()+"/unloading"); - - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - { - - QByteArray output = oai_container_request.asJson().toUtf8(); - input.request_body.append(output); - } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::unloadingPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit unloadingPostSignal(); - emit unloadingPostSignalFull(worker); - } else { - emit unloadingPostSignalE(error_type, error_str); - emit unloadingPostSignalEFull(worker, error_type, error_str); - } -} - -void OAIDefaultApi::unloadingStartActionIdPost(const QString &action_id) { - QString fullPath = QString(_serverConfigs["unloadingStartActionIdPost"][_serverIndices.value("unloadingStartActionIdPost")].URL()+"/unloading/start/{action_id}"); - - - { - QString action_idPathParam("{"); - action_idPathParam.append("action_id").append("}"); - QString pathPrefix, pathSuffix, pathDelimiter; - QString pathStyle = "simple"; - if (pathStyle == "") - pathStyle = "simple"; - pathPrefix = getParamStylePrefix(pathStyle); - pathSuffix = getParamStyleSuffix(pathStyle); - pathDelimiter = getParamStyleDelimiter(pathStyle, "action_id", false); - QString paramString = (pathStyle == "matrix") ? pathPrefix+"action_id"+pathSuffix : pathPrefix; - fullPath.replace(action_idPathParam, paramString+QUrl::toPercentEncoding(::OpenAPI::toStringValue(action_id))); - } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this, _manager); - worker->setTimeOut(_timeOut); - worker->setWorkingDirectory(_workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { - input.headers.insert(keyValueIt->first, keyValueIt->second); - } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif - - connect(worker, &OAIHttpRequestWorker::on_execution_finished, this, &OAIDefaultApi::unloadingStartActionIdPostCallback); - connect(this, &OAIDefaultApi::abortRequestsSignal, worker, &QObject::deleteLater); - connect(worker, &QObject::destroyed, this, [this]() { - if (findChildren().count() == 0) { - emit allPendingRequestsCompleted(); - } - }); - - worker->execute(&input); -} - -void OAIDefaultApi::unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker) { - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type != QNetworkReply::NoError) { - error_str = QString("%1, %2").arg(worker->error_str, QString(worker->response)); - } - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit unloadingStartActionIdPostSignal(); - emit unloadingStartActionIdPostSignalFull(worker); - } else { - emit unloadingStartActionIdPostSignalE(error_type, error_str); - emit unloadingStartActionIdPostSignalEFull(worker, error_type, error_str); - } -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIDefaultApi.h b/ext/pdclient/OAIDefaultApi.h deleted file mode 100644 index 35f77a407..000000000 --- a/ext/pdclient/OAIDefaultApi.h +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_OAIDefaultApi_H -#define OAI_OAIDefaultApi_H - -#include "OAIHelpers.h" -#include "OAIHttpRequest.h" -#include "OAIServerConfiguration.h" - -#include "OAIActionStatusList.h" -#include "OAIContainerActionStatus.h" -#include "OAIContainerRequest.h" -#include "OAIInspectionRequest.h" -#include "OAIInspectionStatus.h" -#include "OAIInspectionStatusList.h" -#include - -#include -#include -#include -#include -#include - -namespace OpenAPI { - -class OAIDefaultApi : public QObject { - Q_OBJECT - -public: - OAIDefaultApi(const int timeOut = 0); - ~OAIDefaultApi(); - - void initializeServerConfigs(); - int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val); - void setServerIndex(const QString &operation, int serverIndex); - void setApiKey(const QString &apiKeyName, const QString &apiKey); - void setBearerToken(const QString &token); - void setUsername(const QString &username); - void setPassword(const QString &password); - void setTimeOut(const int timeOut); - void setWorkingDirectory(const QString &path); - void setNetworkAccessManager(QNetworkAccessManager* manager); - int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); - void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables = QMap()); - void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap()); - void addHeaders(const QString &key, const QString &value); - void enableRequestCompression(); - void enableResponseCompression(); - void abortRequests(); - QString getParamStylePrefix(const QString &style); - QString getParamStyleSuffix(const QString &style); - QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode); - - /** - * @param[in] action_id QString [required] - */ - void inspectionActionIdGet(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void inspectionCompleteActionIdPost(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void inspectionHoldActionIdPost(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void inspectionHoldingActionIdPost(const QString &action_id); - - - void inspectionPendingGet(); - - /** - * @param[in] oai_inspection_request OAIInspectionRequest [required] - */ - void inspectionPost(const OAIInspectionRequest &oai_inspection_request); - - /** - * @param[in] action_id QString [required] - */ - void loadingActionIdGet(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void loadingCompleteActionIdPost(const QString &action_id); - - - void loadingPendingGet(); - - /** - * @param[in] oai_container_request OAIContainerRequest [required] - */ - void loadingPost(const OAIContainerRequest &oai_container_request); - - /** - * @param[in] action_id QString [required] - */ - void loadingStartActionIdPost(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void unloadingActionIdGet(const QString &action_id); - - /** - * @param[in] action_id QString [required] - */ - void unloadingCompleteActionIdPost(const QString &action_id); - - - void unloadingPendingGet(); - - /** - * @param[in] oai_container_request OAIContainerRequest [required] - */ - void unloadingPost(const OAIContainerRequest &oai_container_request); - - /** - * @param[in] action_id QString [required] - */ - void unloadingStartActionIdPost(const QString &action_id); - - -private: - QMap _serverIndices; - QMap> _serverConfigs; - QMap _apiKeys; - QString _bearerToken; - QString _username; - QString _password; - int _timeOut; - QString _workingDirectory; - QNetworkAccessManager* _manager; - QMap _defaultHeaders; - bool _isResponseCompressionEnabled; - bool _isRequestCompressionEnabled; - - void inspectionActionIdGetCallback(OAIHttpRequestWorker *worker); - void inspectionCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); - void inspectionHoldActionIdPostCallback(OAIHttpRequestWorker *worker); - void inspectionHoldingActionIdPostCallback(OAIHttpRequestWorker *worker); - void inspectionPendingGetCallback(OAIHttpRequestWorker *worker); - void inspectionPostCallback(OAIHttpRequestWorker *worker); - void loadingActionIdGetCallback(OAIHttpRequestWorker *worker); - void loadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); - void loadingPendingGetCallback(OAIHttpRequestWorker *worker); - void loadingPostCallback(OAIHttpRequestWorker *worker); - void loadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); - void unloadingActionIdGetCallback(OAIHttpRequestWorker *worker); - void unloadingCompleteActionIdPostCallback(OAIHttpRequestWorker *worker); - void unloadingPendingGetCallback(OAIHttpRequestWorker *worker); - void unloadingPostCallback(OAIHttpRequestWorker *worker); - void unloadingStartActionIdPostCallback(OAIHttpRequestWorker *worker); - -signals: - - void inspectionActionIdGetSignal(OAIInspectionStatus summary); - void inspectionCompleteActionIdPostSignal(); - void inspectionHoldActionIdPostSignal(); - void inspectionHoldingActionIdPostSignal(); - void inspectionPendingGetSignal(OAIInspectionStatusList summary); - void inspectionPostSignal(); - void loadingActionIdGetSignal(OAIContainerActionStatus summary); - void loadingCompleteActionIdPostSignal(); - void loadingPendingGetSignal(OAIActionStatusList summary); - void loadingPostSignal(); - void loadingStartActionIdPostSignal(); - void unloadingActionIdGetSignal(OAIContainerActionStatus summary); - void unloadingCompleteActionIdPostSignal(); - void unloadingPendingGetSignal(OAIActionStatusList summary); - void unloadingPostSignal(); - void unloadingStartActionIdPostSignal(); - - void inspectionActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatus summary); - void inspectionCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void inspectionHoldActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void inspectionHoldingActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void inspectionPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIInspectionStatusList summary); - void inspectionPostSignalFull(OAIHttpRequestWorker *worker); - void loadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); - void loadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void loadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); - void loadingPostSignalFull(OAIHttpRequestWorker *worker); - void loadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void unloadingActionIdGetSignalFull(OAIHttpRequestWorker *worker, OAIContainerActionStatus summary); - void unloadingCompleteActionIdPostSignalFull(OAIHttpRequestWorker *worker); - void unloadingPendingGetSignalFull(OAIHttpRequestWorker *worker, OAIActionStatusList summary); - void unloadingPostSignalFull(OAIHttpRequestWorker *worker); - void unloadingStartActionIdPostSignalFull(OAIHttpRequestWorker *worker); - - void inspectionActionIdGetSignalE(OAIInspectionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void inspectionHoldActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void inspectionHoldingActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void inspectionPendingGetSignalE(OAIInspectionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void loadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); - void loadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void loadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); - void loadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void loadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void unloadingActionIdGetSignalE(OAIContainerActionStatus summary, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingCompleteActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void unloadingPendingGetSignalE(OAIActionStatusList summary, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void unloadingStartActionIdPostSignalE(QNetworkReply::NetworkError error_type, QString error_str); - - void inspectionActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionHoldActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionHoldingActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void inspectionPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void loadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void loadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void loadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void loadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void loadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingActionIdGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingCompleteActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingPendingGetSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - void unloadingStartActionIdPostSignalEFull(OAIHttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str); - - void abortRequestsSignal(); - void allPendingRequestsCompleted(); -}; - -} // namespace OpenAPI -#endif diff --git a/ext/pdclient/OAIEnum.h b/ext/pdclient/OAIEnum.h deleted file mode 100644 index 9177a8d38..000000000 --- a/ext/pdclient/OAIEnum.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_ENUM_H -#define OAI_ENUM_H - -#include -#include -#include - -namespace OpenAPI { - -class OAIEnum { -public: - OAIEnum() {} - - OAIEnum(QString jsonString) { - fromJson(jsonString); - } - - virtual ~OAIEnum() {} - - virtual QJsonValue asJsonValue() const { - return QJsonValue(jstr); - } - - virtual QString asJson() const { - return jstr; - } - - virtual void fromJson(QString jsonString) { - jstr = jsonString; - } - - virtual void fromJsonValue(QJsonValue jval) { - jstr = jval.toString(); - } - - virtual bool isSet() const { - return false; - } - - virtual bool isValid() const { - return true; - } - -private: - QString jstr; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIEnum) - -#endif // OAI_ENUM_H diff --git a/ext/pdclient/OAIHelpers.cpp b/ext/pdclient/OAIHelpers.cpp deleted file mode 100644 index aced612b3..000000000 --- a/ext/pdclient/OAIHelpers.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include -#include -#include "OAIHelpers.h" - -namespace OpenAPI { - -class OAISerializerSettings { -public: - struct CustomDateTimeFormat{ - bool isStringSet = false; - QString formatString; - bool isEnumSet = false; - Qt::DateFormat formatEnum; - }; - - static CustomDateTimeFormat getCustomDateTimeFormat() { - return getInstance()->customDateTimeFormat; - } - - static void setDateTimeFormatString(const QString &dtFormat){ - getInstance()->customDateTimeFormat.isStringSet = true; - getInstance()->customDateTimeFormat.isEnumSet = false; - getInstance()->customDateTimeFormat.formatString = dtFormat; - } - - static void setDateTimeFormatEnum(const Qt::DateFormat &dtFormat){ - getInstance()->customDateTimeFormat.isEnumSet = true; - getInstance()->customDateTimeFormat.isStringSet = false; - getInstance()->customDateTimeFormat.formatEnum = dtFormat; - } - - static OAISerializerSettings *getInstance(){ - if(instance == nullptr){ - instance = new OAISerializerSettings(); - } - return instance; - } - -private: - explicit OAISerializerSettings(){ - instance = this; - customDateTimeFormat.isStringSet = false; - customDateTimeFormat.isEnumSet = false; - } - static OAISerializerSettings *instance; - CustomDateTimeFormat customDateTimeFormat; -}; - -OAISerializerSettings * OAISerializerSettings::instance = nullptr; - -bool setDateTimeFormat(const QString &dateTimeFormat){ - bool success = false; - auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); - if (dt.isValid()) { - success = true; - OAISerializerSettings::setDateTimeFormatString(dateTimeFormat); - } - return success; -} - -bool setDateTimeFormat(const Qt::DateFormat &dateTimeFormat){ - bool success = false; - auto dt = QDateTime::fromString(QDateTime::currentDateTime().toString(dateTimeFormat), dateTimeFormat); - if (dt.isValid()) { - success = true; - OAISerializerSettings::setDateTimeFormatEnum(dateTimeFormat); - } - return success; -} - -QString toStringValue(const QString &value) { - return value; -} - -QString toStringValue(const QDateTime &value) { - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { - return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); - } - - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { - return value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); - } - - // ISO 8601 - return value.toString(Qt::ISODate); -} - -QString toStringValue(const QByteArray &value) { - return QString(value); -} - -QString toStringValue(const QDate &value) { - // ISO 8601 - return value.toString(Qt::DateFormat::ISODate); -} - -QString toStringValue(const qint32 &value) { - return QString::number(value); -} - -QString toStringValue(const qint64 &value) { - return QString::number(value); -} - -QString toStringValue(const bool &value) { - return QString(value ? "true" : "false"); -} - -QString toStringValue(const float &value) { - return QString::number(static_cast(value)); -} - -QString toStringValue(const double &value) { - return QString::number(value); -} - -QString toStringValue(const OAIObject &value) { - return value.asJson(); -} - -QString toStringValue(const OAIEnum &value) { - return value.asJson(); -} - -QString toStringValue(const OAIHttpFileElement &value) { - return value.asJson(); -} - -QJsonValue toJsonValue(const QString &value) { - return QJsonValue(value); -} - -QJsonValue toJsonValue(const QDateTime &value) { - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { - return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString)); - } - - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { - return QJsonValue(value.toString(OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum)); - } - - // ISO 8601 - return QJsonValue(value.toString(Qt::ISODate)); -} - -QJsonValue toJsonValue(const QByteArray &value) { - return QJsonValue(QString(value.toBase64())); -} - -QJsonValue toJsonValue(const QDate &value) { - return QJsonValue(value.toString(Qt::ISODate)); -} - -QJsonValue toJsonValue(const qint32 &value) { - return QJsonValue(value); -} - -QJsonValue toJsonValue(const qint64 &value) { - return QJsonValue(value); -} - -QJsonValue toJsonValue(const bool &value) { - return QJsonValue(value); -} - -QJsonValue toJsonValue(const float &value) { - return QJsonValue(static_cast(value)); -} - -QJsonValue toJsonValue(const double &value) { - return QJsonValue(value); -} - -QJsonValue toJsonValue(const OAIObject &value) { - return value.asJsonObject(); -} - -QJsonValue toJsonValue(const OAIEnum &value) { - return value.asJsonValue(); -} - -QJsonValue toJsonValue(const OAIHttpFileElement &value) { - return value.asJsonValue(); -} - -bool fromStringValue(const QString &inStr, QString &value) { - value.clear(); - value.append(inStr); - return !inStr.isEmpty(); -} - -bool fromStringValue(const QString &inStr, QDateTime &value) { - if (inStr.isEmpty()) { - return false; - } else { - QDateTime dateTime; - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { - dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); - } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { - dateTime = QDateTime::fromString(inStr, OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); - } else { - dateTime = QDateTime::fromString(inStr, Qt::ISODate); - } - - if (dateTime.isValid()) { - value.setDate(dateTime.date()); - value.setTime(dateTime.time()); - } else { - qDebug() << "DateTime is invalid"; - } - return dateTime.isValid(); - } -} - -bool fromStringValue(const QString &inStr, QByteArray &value) { - if (inStr.isEmpty()) { - return false; - } else { - value.clear(); - value.append(inStr.toUtf8()); - return value.count() > 0; - } -} - -bool fromStringValue(const QString &inStr, QDate &value) { - if (inStr.isEmpty()) { - return false; - } else { - auto date = QDate::fromString(inStr, Qt::DateFormat::ISODate); - if (date.isValid()) { - value.setDate(date.year(), date.month(), date.day()); - } else { - qDebug() << "Date is invalid"; - } - return date.isValid(); - } -} - -bool fromStringValue(const QString &inStr, qint32 &value) { - bool ok = false; - value = QVariant(inStr).toInt(&ok); - return ok; -} - -bool fromStringValue(const QString &inStr, qint64 &value) { - bool ok = false; - value = QVariant(inStr).toLongLong(&ok); - return ok; -} - -bool fromStringValue(const QString &inStr, bool &value) { - value = QVariant(inStr).toBool(); - return ((inStr == "true") || (inStr == "false")); -} - -bool fromStringValue(const QString &inStr, float &value) { - bool ok = false; - value = QVariant(inStr).toFloat(&ok); - return ok; -} - -bool fromStringValue(const QString &inStr, double &value) { - bool ok = false; - value = QVariant(inStr).toDouble(&ok); - return ok; -} - -bool fromStringValue(const QString &inStr, OAIObject &value) -{ - QJsonParseError err; - QJsonDocument::fromJson(inStr.toUtf8(),&err); - if ( err.error == QJsonParseError::NoError ){ - value.fromJson(inStr); - return true; - } - return false; -} - -bool fromStringValue(const QString &inStr, OAIEnum &value) { - value.fromJson(inStr); - return true; -} - -bool fromStringValue(const QString &inStr, OAIHttpFileElement &value) { - return value.fromStringValue(inStr); -} - -bool fromJsonValue(QString &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull()) { - if (jval.isString()) { - value = jval.toString(); - } else if (jval.isBool()) { - value = jval.toBool() ? "true" : "false"; - } else if (jval.isDouble()) { - value = QString::number(jval.toDouble()); - } else { - ok = false; - } - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(QDateTime &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { - if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isStringSet) { - value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatString); - } else if (OAISerializerSettings::getInstance()->getCustomDateTimeFormat().isEnumSet) { - value = QDateTime::fromString(jval.toString(), OAISerializerSettings::getInstance()->getCustomDateTimeFormat().formatEnum); - } else { - value = QDateTime::fromString(jval.toString(), Qt::ISODate); - } - ok = value.isValid(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(QByteArray &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { - value = QByteArray::fromBase64(QByteArray::fromStdString(jval.toString().toStdString())); - ok = value.size() > 0; - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(QDate &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull() && jval.isString()) { - value = QDate::fromString(jval.toString(), Qt::ISODate); - ok = value.isValid(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(qint32 &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { - value = jval.toInt(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(qint64 &value, const QJsonValue &jval) { - bool ok = true; - if (!jval.isUndefined() && !jval.isNull() && !jval.isObject() && !jval.isArray()) { - value = jval.toVariant().toLongLong(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(bool &value, const QJsonValue &jval) { - bool ok = true; - if (jval.isBool()) { - value = jval.toBool(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(float &value, const QJsonValue &jval) { - bool ok = true; - if (jval.isDouble()) { - value = static_cast(jval.toDouble()); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(double &value, const QJsonValue &jval) { - bool ok = true; - if (jval.isDouble()) { - value = jval.toDouble(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(OAIObject &value, const QJsonValue &jval) { - bool ok = true; - if (jval.isObject()) { - value.fromJsonObject(jval.toObject()); - ok = value.isValid(); - } else { - ok = false; - } - return ok; -} - -bool fromJsonValue(OAIEnum &value, const QJsonValue &jval) { - value.fromJsonValue(jval); - return true; -} - -bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval) { - return value.fromJsonValue(jval); -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIHelpers.h b/ext/pdclient/OAIHelpers.h deleted file mode 100644 index 06fe6ff34..000000000 --- a/ext/pdclient/OAIHelpers.h +++ /dev/null @@ -1,275 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_HELPERS_H -#define OAI_HELPERS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "OAIEnum.h" -#include "OAIHttpFileElement.h" -#include "OAIObject.h" - -namespace OpenAPI { - -template -class OptionalParam { -public: - T m_Value; - bool m_hasValue; -public: - OptionalParam(){ - m_hasValue = false; - } - OptionalParam(const T &val){ - m_hasValue = true; - m_Value = val; - } - bool hasValue() const { - return m_hasValue; - } - T value() const{ - return m_Value; - } -}; - -bool setDateTimeFormat(const QString &format); -bool setDateTimeFormat(const Qt::DateFormat &format); - -template -QString toStringValue(const QList &val); - -template -QString toStringValue(const QSet &val); - -template -bool fromStringValue(const QList &inStr, QList &val); - -template -bool fromStringValue(const QSet &inStr, QList &val); - -template -bool fromStringValue(const QMap &inStr, QMap &val); - -template -QJsonValue toJsonValue(const QList &val); - -template -QJsonValue toJsonValue(const QSet &val); - -template -QJsonValue toJsonValue(const QMap &val); - -template -bool fromJsonValue(QList &val, const QJsonValue &jval); - -template -bool fromJsonValue(QSet &val, const QJsonValue &jval); - -template -bool fromJsonValue(QMap &val, const QJsonValue &jval); - -QString toStringValue(const QString &value); -QString toStringValue(const QDateTime &value); -QString toStringValue(const QByteArray &value); -QString toStringValue(const QDate &value); -QString toStringValue(const qint32 &value); -QString toStringValue(const qint64 &value); -QString toStringValue(const bool &value); -QString toStringValue(const float &value); -QString toStringValue(const double &value); -QString toStringValue(const OAIObject &value); -QString toStringValue(const OAIEnum &value); -QString toStringValue(const OAIHttpFileElement &value); - -template -QString toStringValue(const QList &val) { - QString strArray; - for (const auto &item : val) { - strArray.append(toStringValue(item) + ","); - } - if (val.count() > 0) { - strArray.chop(1); - } - return strArray; -} - -template -QString toStringValue(const QSet &val) { - QString strArray; - for (const auto &item : val) { - strArray.append(toStringValue(item) + ","); - } - if (val.count() > 0) { - strArray.chop(1); - } - return strArray; -} - -QJsonValue toJsonValue(const QString &value); -QJsonValue toJsonValue(const QDateTime &value); -QJsonValue toJsonValue(const QByteArray &value); -QJsonValue toJsonValue(const QDate &value); -QJsonValue toJsonValue(const qint32 &value); -QJsonValue toJsonValue(const qint64 &value); -QJsonValue toJsonValue(const bool &value); -QJsonValue toJsonValue(const float &value); -QJsonValue toJsonValue(const double &value); -QJsonValue toJsonValue(const OAIObject &value); -QJsonValue toJsonValue(const OAIEnum &value); -QJsonValue toJsonValue(const OAIHttpFileElement &value); - -template -QJsonValue toJsonValue(const QList &val) { - QJsonArray jArray; - for (const auto &item : val) { - jArray.append(toJsonValue(item)); - } - return jArray; -} - -template -QJsonValue toJsonValue(const QSet &val) { - QJsonArray jArray; - for (const auto &item : val) { - jArray.append(toJsonValue(item)); - } - return jArray; -} - -template -QJsonValue toJsonValue(const QMap &val) { - QJsonObject jObject; - for (const auto &itemkey : val.keys()) { - jObject.insert(itemkey, toJsonValue(val.value(itemkey))); - } - return jObject; -} - -bool fromStringValue(const QString &inStr, QString &value); -bool fromStringValue(const QString &inStr, QDateTime &value); -bool fromStringValue(const QString &inStr, QByteArray &value); -bool fromStringValue(const QString &inStr, QDate &value); -bool fromStringValue(const QString &inStr, qint32 &value); -bool fromStringValue(const QString &inStr, qint64 &value); -bool fromStringValue(const QString &inStr, bool &value); -bool fromStringValue(const QString &inStr, float &value); -bool fromStringValue(const QString &inStr, double &value); -bool fromStringValue(const QString &inStr, OAIObject &value); -bool fromStringValue(const QString &inStr, OAIEnum &value); -bool fromStringValue(const QString &inStr, OAIHttpFileElement &value); - -template -bool fromStringValue(const QList &inStr, QList &val) { - bool ok = (inStr.count() > 0); - for (const auto &item : inStr) { - T itemVal; - ok &= fromStringValue(item, itemVal); - val.push_back(itemVal); - } - return ok; -} - -template -bool fromStringValue(const QSet &inStr, QList &val) { - bool ok = (inStr.count() > 0); - for (const auto &item : inStr) { - T itemVal; - ok &= fromStringValue(item, itemVal); - val.push_back(itemVal); - } - return ok; -} - -template -bool fromStringValue(const QMap &inStr, QMap &val) { - bool ok = (inStr.count() > 0); - for (const auto &itemkey : inStr.keys()) { - T itemVal; - ok &= fromStringValue(inStr.value(itemkey), itemVal); - val.insert(itemkey, itemVal); - } - return ok; -} - -bool fromJsonValue(QString &value, const QJsonValue &jval); -bool fromJsonValue(QDateTime &value, const QJsonValue &jval); -bool fromJsonValue(QByteArray &value, const QJsonValue &jval); -bool fromJsonValue(QDate &value, const QJsonValue &jval); -bool fromJsonValue(qint32 &value, const QJsonValue &jval); -bool fromJsonValue(qint64 &value, const QJsonValue &jval); -bool fromJsonValue(bool &value, const QJsonValue &jval); -bool fromJsonValue(float &value, const QJsonValue &jval); -bool fromJsonValue(double &value, const QJsonValue &jval); -bool fromJsonValue(OAIObject &value, const QJsonValue &jval); -bool fromJsonValue(OAIEnum &value, const QJsonValue &jval); -bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval); - -template -bool fromJsonValue(QList &val, const QJsonValue &jval) { - bool ok = true; - if (jval.isArray()) { - for (const auto jitem : jval.toArray()) { - T item; - ok &= fromJsonValue(item, jitem); - val.push_back(item); - } - } else { - ok = false; - } - return ok; -} - -template -bool fromJsonValue(QSet &val, const QJsonValue &jval) { - bool ok = true; - if (jval.isArray()) { - for (const auto jitem : jval.toArray()) { - T item; - ok &= fromJsonValue(item, jitem); - val.insert(item); - } - } else { - ok = false; - } - return ok; -} - -template -bool fromJsonValue(QMap &val, const QJsonValue &jval) { - bool ok = true; - if (jval.isObject()) { - auto varmap = jval.toObject().toVariantMap(); - if (varmap.count() > 0) { - for (const auto &itemkey : varmap.keys()) { - T itemVal; - ok &= fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); - val.insert(itemkey, itemVal); - } - } - } else { - ok = false; - } - return ok; -} - -} // namespace OpenAPI - -#endif // OAI_HELPERS_H diff --git a/ext/pdclient/OAIHttpFileElement.cpp b/ext/pdclient/OAIHttpFileElement.cpp deleted file mode 100644 index b2c6774dd..000000000 --- a/ext/pdclient/OAIHttpFileElement.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include -#include -#include -#include - -#include "OAIHttpFileElement.h" - -namespace OpenAPI { - -void OAIHttpFileElement::setMimeType(const QString &mime) { - mime_type = mime; -} - -void OAIHttpFileElement::setFileName(const QString &name) { - local_filename = name; -} - -void OAIHttpFileElement::setVariableName(const QString &name) { - variable_name = name; -} - -void OAIHttpFileElement::setRequestFileName(const QString &name) { - request_filename = name; -} - -bool OAIHttpFileElement::isSet() const { - return !local_filename.isEmpty() || !request_filename.isEmpty(); -} - -QString OAIHttpFileElement::asJson() const { - QFile file(local_filename); - QByteArray bArray; - bool result = false; - if (file.exists()) { - result = file.open(QIODevice::ReadOnly); - bArray = file.readAll(); - file.close(); - } - if (!result) { - qDebug() << "Error opening file " << local_filename; - } - return QString(bArray); -} - -QJsonValue OAIHttpFileElement::asJsonValue() const { - QFile file(local_filename); - QByteArray bArray; - bool result = false; - if (file.exists()) { - result = file.open(QIODevice::ReadOnly); - bArray = file.readAll(); - file.close(); - } - if (!result) { - qDebug() << "Error opening file " << local_filename; - } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - return QJsonDocument::fromJson(bArray.data()).object(); -#else - return QJsonDocument::fromBinaryData(bArray.data()).object(); -#endif -} - -bool OAIHttpFileElement::fromStringValue(const QString &instr) { - QFile file(local_filename); - bool result = false; - if (file.exists()) { - file.remove(); - } - result = file.open(QIODevice::WriteOnly); - file.write(instr.toUtf8()); - file.close(); - if (!result) { - qDebug() << "Error creating file " << local_filename; - } - return result; -} - -bool OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { - QFile file(local_filename); - bool result = false; - if (file.exists()) { - file.remove(); - } - result = file.open(QIODevice::WriteOnly); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - file.write(QJsonDocument(jval.toObject()).toJson()); -#else - file.write(QJsonDocument(jval.toObject()).toBinaryData()); -#endif - file.close(); - if (!result) { - qDebug() << "Error creating file " << local_filename; - } - return result; -} - -QByteArray OAIHttpFileElement::asByteArray() const { - QFile file(local_filename); - QByteArray bArray; - bool result = false; - if (file.exists()) { - result = file.open(QIODevice::ReadOnly); - bArray = file.readAll(); - file.close(); - } - if (!result) { - qDebug() << "Error opening file " << local_filename; - } - return bArray; -} - -bool OAIHttpFileElement::fromByteArray(const QByteArray &bytes) { - QFile file(local_filename); - bool result = false; - if (file.exists()) { - file.remove(); - } - result = file.open(QIODevice::WriteOnly); - file.write(bytes); - file.close(); - if (!result) { - qDebug() << "Error creating file " << local_filename; - } - return result; -} - -bool OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray &bytes) { - setMimeType(mime); - setFileName(localFName); - setVariableName(varName); - setRequestFileName(reqFname); - return fromByteArray(bytes); -} - -QByteArray OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime) { - setMimeType(mime); - setFileName(localFName); - setVariableName(varName); - setRequestFileName(reqFname); - return asByteArray(); -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpFileElement.h b/ext/pdclient/OAIHttpFileElement.h deleted file mode 100644 index 2f59cb8de..000000000 --- a/ext/pdclient/OAIHttpFileElement.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_HTTP_FILE_ELEMENT_H -#define OAI_HTTP_FILE_ELEMENT_H - -#include -#include -#include - -namespace OpenAPI { - -class OAIHttpFileElement { - -public: - QString variable_name; - QString local_filename; - QString request_filename; - QString mime_type; - void setMimeType(const QString &mime); - void setFileName(const QString &name); - void setVariableName(const QString &name); - void setRequestFileName(const QString &name); - bool isSet() const; - bool fromStringValue(const QString &instr); - bool fromJsonValue(const QJsonValue &jval); - bool fromByteArray(const QByteArray &bytes); - bool saveToFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime, const QByteArray &bytes); - QString asJson() const; - QJsonValue asJsonValue() const; - QByteArray asByteArray() const; - QByteArray loadFromFile(const QString &variable_name, const QString &local_filename, const QString &request_filename, const QString &mime); -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement) - -#endif // OAI_HTTP_FILE_ELEMENT_H diff --git a/ext/pdclient/OAIHttpRequest.cpp b/ext/pdclient/OAIHttpRequest.cpp deleted file mode 100644 index dfa70b26f..000000000 --- a/ext/pdclient/OAIHttpRequest.cpp +++ /dev/null @@ -1,505 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts -#else - #define SKIP_EMPTY_PARTS QString::SkipEmptyParts -#endif - -#include "OAIHttpRequest.h" - -namespace OpenAPI { - -OAIHttpRequestInput::OAIHttpRequestInput() { - initialize(); -} - -OAIHttpRequestInput::OAIHttpRequestInput(QString v_url_str, QString v_http_method) { - initialize(); - url_str = v_url_str; - http_method = v_http_method; -} - -void OAIHttpRequestInput::initialize() { - var_layout = NOT_SET; - url_str = ""; - http_method = "GET"; -} - -void OAIHttpRequestInput::add_var(QString key, QString value) { - vars[key] = value; -} - -void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { - OAIHttpFileElement file; - file.variable_name = variable_name; - file.local_filename = local_filename; - file.request_filename = request_filename; - file.mime_type = mime_type; - files.append(file); -} - -OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) - : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); -#else - qsrand(QDateTime::currentDateTime().toTime_t()); -#endif - - if (manager == nullptr) { - manager = new QNetworkAccessManager(this); - } - workingDirectory = QDir::currentPath(); - timeOutTimer.setSingleShot(true); -} - -OAIHttpRequestWorker::~OAIHttpRequestWorker() { - QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); - timeOutTimer.stop(); - for (const auto &item : multiPartFields) { - if (item != nullptr) { - delete item; - } - } -} - -QMap OAIHttpRequestWorker::getResponseHeaders() const { - return headers; -} - -OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname) { - if (!files.isEmpty()) { - if (fieldname.isEmpty()) { - return files.first(); - } else if (files.contains(fieldname)) { - return files[fieldname]; - } - } - return OAIHttpFileElement(); -} - -QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname) { - if (!multiPartFields.isEmpty()) { - if (fieldname.isEmpty()) { - return multiPartFields.first(); - } else if (multiPartFields.contains(fieldname)) { - return multiPartFields[fieldname]; - } - } - return nullptr; -} - -void OAIHttpRequestWorker::setTimeOut(int timeOutMs) { - timeOutTimer.setInterval(timeOutMs); - if(timeOutTimer.interval() == 0) { - QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); - } -} - -void OAIHttpRequestWorker::setWorkingDirectory(const QString &path) { - if (!path.isEmpty()) { - workingDirectory = path; - } -} - -void OAIHttpRequestWorker::setResponseCompressionEnabled(bool enable) { - isResponseCompressionEnabled = enable; -} - -void OAIHttpRequestWorker::setRequestCompressionEnabled(bool enable) { - isRequestCompressionEnabled = enable; -} - -int OAIHttpRequestWorker::getHttpResponseCode() const{ - return httpResponseCode; -} - -QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { - // result structure follows RFC 5987 - bool need_utf_encoding = false; - QString result = ""; - QByteArray input_c = input.toLocal8Bit(); - char c; - for (int i = 0; i < input_c.length(); i++) { - c = input_c.at(i); - if (c == '\\' || c == '/' || c == '\0' || c < ' ' || c > '~') { - // ignore and request utf-8 version - need_utf_encoding = true; - } else if (c == '"') { - result += "\\\""; - } else { - result += c; - } - } - - if (result.length() == 0) { - need_utf_encoding = true; - } - - if (!need_utf_encoding) { - // return simple version - return QString("%1=\"%2\"").arg(attribute_name, result); - } - - QString result_utf8 = ""; - for (int i = 0; i < input_c.length(); i++) { - c = input_c.at(i); - if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - result_utf8 += c; - } else { - result_utf8 += "%" + QString::number(static_cast(input_c.at(i)), 16).toUpper(); - } - } - - // return enhanced version with UTF-8 support - return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); -} - -void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { - - // reset variables - QNetworkReply *reply = nullptr; - QByteArray request_content = ""; - response = ""; - error_type = QNetworkReply::NoError; - error_str = ""; - bool isFormData = false; - - // decide on the variable layout - - if (input->files.length() > 0) { - input->var_layout = MULTIPART; - } - if (input->var_layout == NOT_SET) { - input->var_layout = input->http_method == "GET" || input->http_method == "HEAD" ? ADDRESS : URL_ENCODED; - } - - // prepare request content - - QString boundary = ""; - - if (input->var_layout == ADDRESS || input->var_layout == URL_ENCODED) { - // variable layout is ADDRESS or URL_ENCODED - - if (input->vars.count() > 0) { - bool first = true; - isFormData = true; - foreach (QString key, input->vars.keys()) { - if (!first) { - request_content.append("&"); - } - first = false; - - request_content.append(QUrl::toPercentEncoding(key)); - request_content.append("="); - request_content.append(QUrl::toPercentEncoding(input->vars.value(key))); - } - - if (input->var_layout == ADDRESS) { - input->url_str += "?" + request_content; - request_content = ""; - } - } - } else { - // variable layout is MULTIPART - - boundary = QString("__-----------------------%1%2") - #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) - .arg(randomGenerator.generate()); - #else - .arg(QDateTime::currentDateTime().toTime_t()) - .arg(qrand()); - #endif - QString boundary_delimiter = "--"; - QString new_line = "\r\n"; - - // add variables - foreach (QString key, input->vars.keys()) { - // add boundary - request_content.append(boundary_delimiter.toUtf8()); - request_content.append(boundary.toUtf8()); - request_content.append(new_line.toUtf8()); - - // add header - request_content.append("Content-Disposition: form-data; "); - request_content.append(http_attribute_encode("name", key).toUtf8()); - request_content.append(new_line.toUtf8()); - request_content.append("Content-Type: text/plain"); - request_content.append(new_line.toUtf8()); - - // add header to body splitter - request_content.append(new_line.toUtf8()); - - // add variable content - request_content.append(input->vars.value(key).toUtf8()); - request_content.append(new_line.toUtf8()); - } - - // add files - for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { - QFileInfo fi(file_info->local_filename); - - // ensure necessary variables are available - if (file_info->local_filename == nullptr - || file_info->local_filename.isEmpty() - || file_info->variable_name == nullptr - || file_info->variable_name.isEmpty() - || !fi.exists() - || !fi.isFile() - || !fi.isReadable()) { - // silent abort for the current file - continue; - } - - QFile file(file_info->local_filename); - if (!file.open(QIODevice::ReadOnly)) { - // silent abort for the current file - continue; - } - - // ensure filename for the request - if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) { - file_info->request_filename = fi.fileName(); - if (file_info->request_filename.isEmpty()) { - file_info->request_filename = "file"; - } - } - - // add boundary - request_content.append(boundary_delimiter.toUtf8()); - request_content.append(boundary.toUtf8()); - request_content.append(new_line.toUtf8()); - - // add header - request_content.append( - QString("Content-Disposition: form-data; %1; %2").arg(http_attribute_encode("name", file_info->variable_name), http_attribute_encode("filename", file_info->request_filename)).toUtf8()); - request_content.append(new_line.toUtf8()); - - if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) { - request_content.append("Content-Type: "); - request_content.append(file_info->mime_type.toUtf8()); - request_content.append(new_line.toUtf8()); - } - - request_content.append("Content-Transfer-Encoding: binary"); - request_content.append(new_line.toUtf8()); - - // add header to body splitter - request_content.append(new_line.toUtf8()); - - // add file content - request_content.append(file.readAll()); - request_content.append(new_line.toUtf8()); - - file.close(); - } - - // add end of body - request_content.append(boundary_delimiter.toUtf8()); - request_content.append(boundary.toUtf8()); - request_content.append(boundary_delimiter.toUtf8()); - } - - if (input->request_body.size() > 0) { - qDebug() << "got a request body"; - request_content.clear(); - if(!isFormData && (input->var_layout != MULTIPART) && isRequestCompressionEnabled){ - request_content.append(compress(input->request_body, 7, OAICompressionType::Gzip)); - } else { - request_content.append(input->request_body); - } - } - // prepare connection - - QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); - if (OAIHttpRequestWorker::sslDefaultConfiguration != nullptr) { - request.setSslConfiguration(*OAIHttpRequestWorker::sslDefaultConfiguration); - } - request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt"); - foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); } - - if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) { - if (!input->headers.contains("Content-Type")) { - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - } else { - request.setHeader(QNetworkRequest::ContentTypeHeader, input->headers.value("Content-Type")); - } - if(isRequestCompressionEnabled){ - request.setRawHeader("Content-Encoding", "gzip"); - } - } else if (input->var_layout == URL_ENCODED) { - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - } else if (input->var_layout == MULTIPART) { - request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + boundary); - } - - if(isResponseCompressionEnabled){ - request.setRawHeader("Accept-Encoding", "gzip"); - } else { - request.setRawHeader("Accept-Encoding", "identity"); - } - - if (input->http_method == "GET") { - reply = manager->get(request); - } else if (input->http_method == "POST") { - reply = manager->post(request, request_content); - } else if (input->http_method == "PUT") { - reply = manager->put(request, request_content); - } else if (input->http_method == "HEAD") { - reply = manager->head(request); - } else if (input->http_method == "DELETE") { - reply = manager->deleteResource(request); - } else { -#if (QT_VERSION >= 0x050800) - reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); -#else - QBuffer *buffer = new QBuffer; - buffer->setData(request_content); - buffer->open(QIODevice::ReadOnly); - - reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); - buffer->setParent(reply); -#endif - } - if (reply != nullptr) { - reply->setParent(this); - connect(reply, &QNetworkReply::finished, [this, reply] { - on_reply_finished(reply); - }); - } - if (timeOutTimer.interval() > 0) { - QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { - on_reply_timeout(reply); - }); - timeOutTimer.start(); - } -} - -void OAIHttpRequestWorker::on_reply_finished(QNetworkReply *reply) { - bool codeSts = false; - if(timeOutTimer.isActive()) { - QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); - timeOutTimer.stop(); - } - error_type = reply->error(); - error_str = reply->errorString(); - if (reply->rawHeaderPairs().count() > 0) { - for (const auto &item : reply->rawHeaderPairs()) { - headers.insert(item.first, item.second); - } - } - auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); - if(codeSts){ - httpResponseCode = rescode; - } else{ - httpResponseCode = -1; - } - process_response(reply); - reply->deleteLater(); - emit on_execution_finished(this); -} - -void OAIHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { - error_type = QNetworkReply::TimeoutError; - response = ""; - error_str = "Timed out waiting for response"; - disconnect(reply, nullptr, nullptr, nullptr); - reply->abort(); - reply->deleteLater(); - emit on_execution_finished(this); -} - -void OAIHttpRequestWorker::process_response(QNetworkReply *reply) { - QString contentDispositionHdr; - QString contentTypeHdr; - QString contentEncodingHdr; - - for(auto hdr: getResponseHeaders().keys()){ - if(hdr.compare(QString("Content-Disposition"), Qt::CaseInsensitive) == 0){ - contentDispositionHdr = getResponseHeaders().value(hdr); - } - if(hdr.compare(QString("Content-Type"), Qt::CaseInsensitive) == 0){ - contentTypeHdr = getResponseHeaders().value(hdr); - } - if(hdr.compare(QString("Content-Encoding"), Qt::CaseInsensitive) == 0){ - contentEncodingHdr = getResponseHeaders().value(hdr); - } - } - - if (!contentDispositionHdr.isEmpty()) { - auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); - auto contentType = - !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); - if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { - QString filename = QUuid::createUuid().toString(); - for (const auto &file : contentDisposition) { - if (file.contains(QString("filename"))) { - filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); - break; - } - } - OAIHttpFileElement felement; - felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, reply->readAll()); - files.insert(filename, felement); - } - - } else if (!contentTypeHdr.isEmpty()) { - auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); - if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { - // TODO : Handle Multipart responses - } else { - if(!contentEncodingHdr.isEmpty()){ - auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); - if(encoding.count() > 0){ - auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); - if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ - response = decompress(reply->readAll()); - } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ - response = reply->readAll(); - } - } - } - else { - response = reply->readAll(); - } - } - } -} - -QByteArray OAIHttpRequestWorker::decompress(const QByteArray& data){ - - Q_UNUSED(data); - return QByteArray(); -} - -QByteArray OAIHttpRequestWorker::compress(const QByteArray& input, int level, OAICompressionType compressType) { - - Q_UNUSED(input); - Q_UNUSED(level); - Q_UNUSED(compressType); - return QByteArray(); -} - -QSslConfiguration *OAIHttpRequestWorker::sslDefaultConfiguration; - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIHttpRequest.h b/ext/pdclient/OAIHttpRequest.h deleted file mode 100644 index cda089bf2..000000000 --- a/ext/pdclient/OAIHttpRequest.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/** - * Based on http://www.creativepulse.gr/en/blog/2014/restful-api-requests-using-qt-cpp-for-linux-mac-osx-ms-windows - * By Alex Stylianos - * - **/ - -#ifndef OAI_HTTPREQUESTWORKER_H -#define OAI_HTTPREQUESTWORKER_H - -#include -#include -#include -#include -#include -#include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #include -#endif - -#include "OAIHttpFileElement.h" - -namespace OpenAPI { - -enum OAIHttpRequestVarLayout { - NOT_SET, - ADDRESS, - URL_ENCODED, - MULTIPART -}; - -class OAIHttpRequestInput { - -public: - QString url_str; - QString http_method; - OAIHttpRequestVarLayout var_layout; - QMap vars; - QMap headers; - QList files; - QByteArray request_body; - - OAIHttpRequestInput(); - OAIHttpRequestInput(QString v_url_str, QString v_http_method); - void initialize(); - void add_var(QString key, QString value); - void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); -}; - -class OAIHttpRequestWorker : public QObject { - Q_OBJECT - -public: - explicit OAIHttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); - virtual ~OAIHttpRequestWorker(); - - QByteArray response; - QNetworkReply::NetworkError error_type; - QString error_str; - - QMap getResponseHeaders() const; - QString http_attribute_encode(QString attribute_name, QString input); - void execute(OAIHttpRequestInput *input); - static QSslConfiguration *sslDefaultConfiguration; - void setTimeOut(int timeOutMs); - void setWorkingDirectory(const QString &path); - OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString()); - QByteArray *getMultiPartField(const QString &fieldname = QString()); - void setResponseCompressionEnabled(bool enable); - void setRequestCompressionEnabled(bool enable); - int getHttpResponseCode() const; - -signals: - void on_execution_finished(OAIHttpRequestWorker *worker); - -private: - enum OAICompressionType{ - Zlib, - Gzip - }; - QNetworkAccessManager *manager; - QMap headers; - QMap files; - QMap multiPartFields; - QString workingDirectory; - QTimer timeOutTimer; - bool isResponseCompressionEnabled; - bool isRequestCompressionEnabled; - int httpResponseCode; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - QRandomGenerator randomGenerator; -#endif - - void on_reply_timeout(QNetworkReply *reply); - void on_reply_finished(QNetworkReply *reply); - void process_response(QNetworkReply *reply); - QByteArray decompress(const QByteArray& data); - QByteArray compress(const QByteArray& input, int level, OAICompressionType compressType); -}; - -} // namespace OpenAPI - -#endif // OAI_HTTPREQUESTWORKER_H diff --git a/ext/pdclient/OAIInspectionRequest.cpp b/ext/pdclient/OAIInspectionRequest.cpp deleted file mode 100644 index 161d4cdfd..000000000 --- a/ext/pdclient/OAIInspectionRequest.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIInspectionRequest.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIInspectionRequest::OAIInspectionRequest(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIInspectionRequest::OAIInspectionRequest() { - this->initializeModel(); -} - -OAIInspectionRequest::~OAIInspectionRequest() {} - -void OAIInspectionRequest::initializeModel() { - - m_vehicle_id_isSet = false; - m_vehicle_id_isValid = false; - - m_container_id_isSet = false; - m_container_id_isValid = false; - - m_action_id_isSet = false; - m_action_id_isValid = false; -} - -void OAIInspectionRequest::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIInspectionRequest::fromJsonObject(QJsonObject json) { - - m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); - m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; - - m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); - m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; - - m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); - m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; -} - -QString OAIInspectionRequest::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIInspectionRequest::asJsonObject() const { - QJsonObject obj; - if (m_vehicle_id_isSet) { - obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); - } - if (m_container_id_isSet) { - obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); - } - if (m_action_id_isSet) { - obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); - } - return obj; -} - -QString OAIInspectionRequest::getVehicleId() const { - return vehicle_id; -} -void OAIInspectionRequest::setVehicleId(const QString &vehicle_id) { - this->vehicle_id = vehicle_id; - this->m_vehicle_id_isSet = true; -} - -bool OAIInspectionRequest::is_vehicle_id_Set() const{ - return m_vehicle_id_isSet; -} - -bool OAIInspectionRequest::is_vehicle_id_Valid() const{ - return m_vehicle_id_isValid; -} - -QString OAIInspectionRequest::getContainerId() const { - return container_id; -} -void OAIInspectionRequest::setContainerId(const QString &container_id) { - this->container_id = container_id; - this->m_container_id_isSet = true; -} - -bool OAIInspectionRequest::is_container_id_Set() const{ - return m_container_id_isSet; -} - -bool OAIInspectionRequest::is_container_id_Valid() const{ - return m_container_id_isValid; -} - -QString OAIInspectionRequest::getActionId() const { - return action_id; -} -void OAIInspectionRequest::setActionId(const QString &action_id) { - this->action_id = action_id; - this->m_action_id_isSet = true; -} - -bool OAIInspectionRequest::is_action_id_Set() const{ - return m_action_id_isSet; -} - -bool OAIInspectionRequest::is_action_id_Valid() const{ - return m_action_id_isValid; -} - -bool OAIInspectionRequest::isSet() const { - bool isObjectUpdated = false; - do { - if (m_vehicle_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_container_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_action_id_isSet) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIInspectionRequest::isValid() const { - // only required properties are required for the object to be considered valid - return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionRequest.h b/ext/pdclient/OAIInspectionRequest.h deleted file mode 100644 index 2270d3c18..000000000 --- a/ext/pdclient/OAIInspectionRequest.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIInspectionRequest.h - * - * - */ - -#ifndef OAIInspectionRequest_H -#define OAIInspectionRequest_H - -#include - -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIInspectionRequest : public OAIObject { -public: - OAIInspectionRequest(); - OAIInspectionRequest(QString json); - ~OAIInspectionRequest() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QString getVehicleId() const; - void setVehicleId(const QString &vehicle_id); - bool is_vehicle_id_Set() const; - bool is_vehicle_id_Valid() const; - - QString getContainerId() const; - void setContainerId(const QString &container_id); - bool is_container_id_Set() const; - bool is_container_id_Valid() const; - - QString getActionId() const; - void setActionId(const QString &action_id); - bool is_action_id_Set() const; - bool is_action_id_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QString vehicle_id; - bool m_vehicle_id_isSet; - bool m_vehicle_id_isValid; - - QString container_id; - bool m_container_id_isSet; - bool m_container_id_isValid; - - QString action_id; - bool m_action_id_isSet; - bool m_action_id_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIInspectionRequest) - -#endif // OAIInspectionRequest_H diff --git a/ext/pdclient/OAIInspectionStatus.cpp b/ext/pdclient/OAIInspectionStatus.cpp deleted file mode 100644 index 101fd0a41..000000000 --- a/ext/pdclient/OAIInspectionStatus.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIInspectionStatus.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIInspectionStatus::OAIInspectionStatus(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIInspectionStatus::OAIInspectionStatus() { - this->initializeModel(); -} - -OAIInspectionStatus::~OAIInspectionStatus() {} - -void OAIInspectionStatus::initializeModel() { - - m_vehicle_id_isSet = false; - m_vehicle_id_isValid = false; - - m_container_id_isSet = false; - m_container_id_isValid = false; - - m_action_id_isSet = false; - m_action_id_isValid = false; - - m_status_isSet = false; - m_status_isValid = false; - - m_requested_isSet = false; - m_requested_isValid = false; - - m_completed_isSet = false; - m_completed_isValid = false; -} - -void OAIInspectionStatus::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIInspectionStatus::fromJsonObject(QJsonObject json) { - - m_vehicle_id_isValid = ::OpenAPI::fromJsonValue(vehicle_id, json[QString("vehicle_id")]); - m_vehicle_id_isSet = !json[QString("vehicle_id")].isNull() && m_vehicle_id_isValid; - - m_container_id_isValid = ::OpenAPI::fromJsonValue(container_id, json[QString("container_id")]); - m_container_id_isSet = !json[QString("container_id")].isNull() && m_container_id_isValid; - - m_action_id_isValid = ::OpenAPI::fromJsonValue(action_id, json[QString("action_id")]); - m_action_id_isSet = !json[QString("action_id")].isNull() && m_action_id_isValid; - - m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); - m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; - - m_requested_isValid = ::OpenAPI::fromJsonValue(requested, json[QString("requested")]); - m_requested_isSet = !json[QString("requested")].isNull() && m_requested_isValid; - - m_completed_isValid = ::OpenAPI::fromJsonValue(completed, json[QString("completed")]); - m_completed_isSet = !json[QString("completed")].isNull() && m_completed_isValid; -} - -QString OAIInspectionStatus::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIInspectionStatus::asJsonObject() const { - QJsonObject obj; - if (m_vehicle_id_isSet) { - obj.insert(QString("vehicle_id"), ::OpenAPI::toJsonValue(vehicle_id)); - } - if (m_container_id_isSet) { - obj.insert(QString("container_id"), ::OpenAPI::toJsonValue(container_id)); - } - if (m_action_id_isSet) { - obj.insert(QString("action_id"), ::OpenAPI::toJsonValue(action_id)); - } - if (m_status_isSet) { - obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); - } - if (m_requested_isSet) { - obj.insert(QString("requested"), ::OpenAPI::toJsonValue(requested)); - } - if (m_completed_isSet) { - obj.insert(QString("completed"), ::OpenAPI::toJsonValue(completed)); - } - return obj; -} - -QString OAIInspectionStatus::getVehicleId() const { - return vehicle_id; -} -void OAIInspectionStatus::setVehicleId(const QString &vehicle_id) { - this->vehicle_id = vehicle_id; - this->m_vehicle_id_isSet = true; -} - -bool OAIInspectionStatus::is_vehicle_id_Set() const{ - return m_vehicle_id_isSet; -} - -bool OAIInspectionStatus::is_vehicle_id_Valid() const{ - return m_vehicle_id_isValid; -} - -QString OAIInspectionStatus::getContainerId() const { - return container_id; -} -void OAIInspectionStatus::setContainerId(const QString &container_id) { - this->container_id = container_id; - this->m_container_id_isSet = true; -} - -bool OAIInspectionStatus::is_container_id_Set() const{ - return m_container_id_isSet; -} - -bool OAIInspectionStatus::is_container_id_Valid() const{ - return m_container_id_isValid; -} - -QString OAIInspectionStatus::getActionId() const { - return action_id; -} -void OAIInspectionStatus::setActionId(const QString &action_id) { - this->action_id = action_id; - this->m_action_id_isSet = true; -} - -bool OAIInspectionStatus::is_action_id_Set() const{ - return m_action_id_isSet; -} - -bool OAIInspectionStatus::is_action_id_Valid() const{ - return m_action_id_isValid; -} - -QString OAIInspectionStatus::getStatus() const { - return status; -} -void OAIInspectionStatus::setStatus(const QString &status) { - this->status = status; - this->m_status_isSet = true; -} - -bool OAIInspectionStatus::is_status_Set() const{ - return m_status_isSet; -} - -bool OAIInspectionStatus::is_status_Valid() const{ - return m_status_isValid; -} - -qint64 OAIInspectionStatus::getRequested() const { - return requested; -} -void OAIInspectionStatus::setRequested(const qint64 &requested) { - this->requested = requested; - this->m_requested_isSet = true; -} - -bool OAIInspectionStatus::is_requested_Set() const{ - return m_requested_isSet; -} - -bool OAIInspectionStatus::is_requested_Valid() const{ - return m_requested_isValid; -} - -qint64 OAIInspectionStatus::getCompleted() const { - return completed; -} -void OAIInspectionStatus::setCompleted(const qint64 &completed) { - this->completed = completed; - this->m_completed_isSet = true; -} - -bool OAIInspectionStatus::is_completed_Set() const{ - return m_completed_isSet; -} - -bool OAIInspectionStatus::is_completed_Valid() const{ - return m_completed_isValid; -} - -bool OAIInspectionStatus::isSet() const { - bool isObjectUpdated = false; - do { - if (m_vehicle_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_container_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_action_id_isSet) { - isObjectUpdated = true; - break; - } - - if (m_status_isSet) { - isObjectUpdated = true; - break; - } - - if (m_requested_isSet) { - isObjectUpdated = true; - break; - } - - if (m_completed_isSet) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIInspectionStatus::isValid() const { - // only required properties are required for the object to be considered valid - return m_vehicle_id_isValid && m_container_id_isValid && m_action_id_isValid && m_status_isValid && m_requested_isValid && true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatus.h b/ext/pdclient/OAIInspectionStatus.h deleted file mode 100644 index aee5d535d..000000000 --- a/ext/pdclient/OAIInspectionStatus.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIInspectionStatus.h - * - * - */ - -#ifndef OAIInspectionStatus_H -#define OAIInspectionStatus_H - -#include - -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIInspectionStatus : public OAIObject { -public: - OAIInspectionStatus(); - OAIInspectionStatus(QString json); - ~OAIInspectionStatus() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QString getVehicleId() const; - void setVehicleId(const QString &vehicle_id); - bool is_vehicle_id_Set() const; - bool is_vehicle_id_Valid() const; - - QString getContainerId() const; - void setContainerId(const QString &container_id); - bool is_container_id_Set() const; - bool is_container_id_Valid() const; - - QString getActionId() const; - void setActionId(const QString &action_id); - bool is_action_id_Set() const; - bool is_action_id_Valid() const; - - QString getStatus() const; - void setStatus(const QString &status); - bool is_status_Set() const; - bool is_status_Valid() const; - - qint64 getRequested() const; - void setRequested(const qint64 &requested); - bool is_requested_Set() const; - bool is_requested_Valid() const; - - qint64 getCompleted() const; - void setCompleted(const qint64 &completed); - bool is_completed_Set() const; - bool is_completed_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QString vehicle_id; - bool m_vehicle_id_isSet; - bool m_vehicle_id_isValid; - - QString container_id; - bool m_container_id_isSet; - bool m_container_id_isValid; - - QString action_id; - bool m_action_id_isSet; - bool m_action_id_isValid; - - QString status; - bool m_status_isSet; - bool m_status_isValid; - - qint64 requested; - bool m_requested_isSet; - bool m_requested_isValid; - - qint64 completed; - bool m_completed_isSet; - bool m_completed_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatus) - -#endif // OAIInspectionStatus_H diff --git a/ext/pdclient/OAIInspectionStatusList.cpp b/ext/pdclient/OAIInspectionStatusList.cpp deleted file mode 100644 index 7145b1dd1..000000000 --- a/ext/pdclient/OAIInspectionStatusList.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#include "OAIInspectionStatusList.h" - -#include -#include -#include -#include - -#include "OAIHelpers.h" - -namespace OpenAPI { - -OAIInspectionStatusList::OAIInspectionStatusList(QString json) { - this->initializeModel(); - this->fromJson(json); -} - -OAIInspectionStatusList::OAIInspectionStatusList() { - this->initializeModel(); -} - -OAIInspectionStatusList::~OAIInspectionStatusList() {} - -void OAIInspectionStatusList::initializeModel() { - - m_inspections_isSet = false; - m_inspections_isValid = false; -} - -void OAIInspectionStatusList::fromJson(QString jsonString) { - QByteArray array(jsonString.toStdString().c_str()); - QJsonDocument doc = QJsonDocument::fromJson(array); - QJsonObject jsonObject = doc.object(); - this->fromJsonObject(jsonObject); -} - -void OAIInspectionStatusList::fromJsonObject(QJsonObject json) { - - m_inspections_isValid = ::OpenAPI::fromJsonValue(inspections, json[QString("inspections")]); - m_inspections_isSet = !json[QString("inspections")].isNull() && m_inspections_isValid; -} - -QString OAIInspectionStatusList::asJson() const { - QJsonObject obj = this->asJsonObject(); - QJsonDocument doc(obj); - QByteArray bytes = doc.toJson(); - return QString(bytes); -} - -QJsonObject OAIInspectionStatusList::asJsonObject() const { - QJsonObject obj; - if (inspections.size() > 0) { - obj.insert(QString("inspections"), ::OpenAPI::toJsonValue(inspections)); - } - return obj; -} - -QList OAIInspectionStatusList::getInspections() const { - return inspections; -} -void OAIInspectionStatusList::setInspections(const QList &inspections) { - this->inspections = inspections; - this->m_inspections_isSet = true; -} - -bool OAIInspectionStatusList::is_inspections_Set() const{ - return m_inspections_isSet; -} - -bool OAIInspectionStatusList::is_inspections_Valid() const{ - return m_inspections_isValid; -} - -bool OAIInspectionStatusList::isSet() const { - bool isObjectUpdated = false; - do { - if (inspections.size() > 0) { - isObjectUpdated = true; - break; - } - } while (false); - return isObjectUpdated; -} - -bool OAIInspectionStatusList::isValid() const { - // only required properties are required for the object to be considered valid - return true; -} - -} // namespace OpenAPI diff --git a/ext/pdclient/OAIInspectionStatusList.h b/ext/pdclient/OAIInspectionStatusList.h deleted file mode 100644 index 8849ffcf5..000000000 --- a/ext/pdclient/OAIInspectionStatusList.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/* - * OAIInspectionStatusList.h - * - * - */ - -#ifndef OAIInspectionStatusList_H -#define OAIInspectionStatusList_H - -#include - -#include "OAIInspectionStatus.h" -#include - -#include "OAIEnum.h" -#include "OAIObject.h" - -namespace OpenAPI { - -class OAIInspectionStatusList : public OAIObject { -public: - OAIInspectionStatusList(); - OAIInspectionStatusList(QString json); - ~OAIInspectionStatusList() override; - - QString asJson() const override; - QJsonObject asJsonObject() const override; - void fromJsonObject(QJsonObject json) override; - void fromJson(QString jsonString) override; - - QList getInspections() const; - void setInspections(const QList &inspections); - bool is_inspections_Set() const; - bool is_inspections_Valid() const; - - virtual bool isSet() const override; - virtual bool isValid() const override; - -private: - void initializeModel(); - - QList inspections; - bool m_inspections_isSet; - bool m_inspections_isValid; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIInspectionStatusList) - -#endif // OAIInspectionStatusList_H diff --git a/ext/pdclient/OAIObject.h b/ext/pdclient/OAIObject.h deleted file mode 100644 index 68e114afe..000000000 --- a/ext/pdclient/OAIObject.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_OBJECT_H -#define OAI_OBJECT_H - -#include -#include -#include - -namespace OpenAPI { - -class OAIObject { -public: - OAIObject() {} - - OAIObject(QString jsonString) { - fromJson(jsonString); - } - - virtual ~OAIObject() {} - - virtual QJsonObject asJsonObject() const { - return jObj; - } - - virtual QString asJson() const { - QJsonDocument doc(jObj); - return doc.toJson(QJsonDocument::Compact); - } - - virtual void fromJson(QString jsonString) { - QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8()); - jObj = doc.object(); - } - - virtual void fromJsonObject(QJsonObject json) { - jObj = json; - } - - virtual bool isSet() const { - return false; - } - - virtual bool isValid() const { - return true; - } - -private: - QJsonObject jObj; -}; - -} // namespace OpenAPI - -Q_DECLARE_METATYPE(OpenAPI::OAIObject) - -#endif // OAI_OBJECT_H diff --git a/ext/pdclient/OAIServerConfiguration.h b/ext/pdclient/OAIServerConfiguration.h deleted file mode 100644 index 8d33862a8..000000000 --- a/ext/pdclient/OAIServerConfiguration.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/** - * Representing a Server configuration. - */ -#ifndef OAI_SERVERVCONFIGURATION_H -#define OAI_SERVERVCONFIGURATION_H - -#include -#include -#include -#include -#include -#include "OAIServerVariable.h" - -namespace OpenAPI { - -class OAIServerConfiguration { -public: - /** - * @param url A URL to the target host. - * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ - OAIServerConfiguration(const QUrl &url, const QString &description, const QMap &variables) - : _description(description), - _variables(variables), - _url(url){} - OAIServerConfiguration(){} - ~OAIServerConfiguration(){} - - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - QString URL() { - QString url = _url.toString(); - if(!_variables.empty()){ - // go through variables and replace placeholders - for (auto const& v : _variables.keys()) { - QString name = v; - OAIServerVariable serverVariable = _variables.value(v); - QString value = serverVariable._defaultValue; - - if (!serverVariable._enumValues.empty() && !serverVariable._enumValues.contains(value)) { - throw std::runtime_error(QString("The variable " + name + " in the server URL has invalid value " + value + ".").toUtf8()); - } - QRegularExpression regex(QString("\\{" + name + "\\}")); - url = url.replace(regex, value); - - } - return url; - } - return url; - } - - int setDefaultValue(const QString &variable,const QString &value){ - if(_variables.contains(variable)) - return _variables[variable].setDefaultValue(value); - return -1; - } - - QString _description; - QMap _variables; - QUrl _url; - -}; - -} // namespace OpenAPI - -#endif // OAI_SERVERVCONFIGURATION_H diff --git a/ext/pdclient/OAIServerVariable.h b/ext/pdclient/OAIServerVariable.h deleted file mode 100644 index 9930343ca..000000000 --- a/ext/pdclient/OAIServerVariable.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Port Drayage Web Service. - * Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - * - * The version of the OpenAPI document: 1.0 - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -/** - * Representing a Server Variable for server URL template substitution. - */ -#ifndef OAI_SERVERVARIABLE_H -#define OAI_SERVERVARIABLE_H -#include -#include - -namespace OpenAPI { - -class OAIServerVariable { -public: - - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. - */ - OAIServerVariable(const QString &description, const QString &defaultValue, const QSet &enumValues) - : _defaultValue(defaultValue), - _description(description), - _enumValues(enumValues){} - - OAIServerVariable(){} - ~OAIServerVariable(){} - - int setDefaultValue(const QString& value){ - if( _enumValues.contains(value)){ - _defaultValue = value; - return 0; - } - return -2; - } - - QString getDefaultValue(){return _defaultValue;} - QSet getEnumValues(){return _enumValues;} - - - QString _defaultValue; - QString _description; - QSet _enumValues; - -}; - -} // namespace OpenAPI - -#endif // OAI_SERVERVARIABLE_H diff --git a/ext/pdclient/client.pri b/ext/pdclient/client.pri deleted file mode 100644 index 1a7c42bf9..000000000 --- a/ext/pdclient/client.pri +++ /dev/null @@ -1,35 +0,0 @@ -QT += network - -HEADERS += \ -# Models - $${PWD}/OAIActionStatusList.h \ - $${PWD}/OAIContainerActionStatus.h \ - $${PWD}/OAIContainerRequest.h \ - $${PWD}/OAIInspectionRequest.h \ - $${PWD}/OAIInspectionStatus.h \ - $${PWD}/OAIInspectionStatusList.h \ -# APIs - $${PWD}/OAIDefaultApi.h \ -# Others - $${PWD}/OAIHelpers.h \ - $${PWD}/OAIHttpRequest.h \ - $${PWD}/OAIObject.h \ - $${PWD}/OAIEnum.h \ - $${PWD}/OAIHttpFileElement.h \ - $${PWD}/OAIServerConfiguration.h \ - $${PWD}/OAIServerVariable.h - -SOURCES += \ -# Models - $${PWD}/OAIActionStatusList.cpp \ - $${PWD}/OAIContainerActionStatus.cpp \ - $${PWD}/OAIContainerRequest.cpp \ - $${PWD}/OAIInspectionRequest.cpp \ - $${PWD}/OAIInspectionStatus.cpp \ - $${PWD}/OAIInspectionStatusList.cpp \ -# APIs - $${PWD}/OAIDefaultApi.cpp \ -# Others - $${PWD}/OAIHelpers.cpp \ - $${PWD}/OAIHttpRequest.cpp \ - $${PWD}/OAIHttpFileElement.cpp diff --git a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp index 88609ec81..cc75299a6 100644 --- a/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp +++ b/src/tmx/TmxApi/tmx/j2735_messages/J2735MessageFactory.hpp @@ -340,6 +340,7 @@ class J2735MessageFactory int msgIdindex=0; // msgId = DD if (bytes[0] == 0x00) { + std::cout<<"No Extended bytes found\n"; return 0; } if(bytes[0] == 0x03){ // extended bytes present @@ -353,6 +354,7 @@ class J2735MessageFactory else // 64 < length < 128 bytes [0380XX00DD] msgIdindex = 3; } + std::cout<<"Extended bytes found\n"; } bytes.erase(bytes.begin(),bytes.begin()+msgIdindex); diff --git a/src/tmx/TmxCore/src/ivpcore.cpp b/src/tmx/TmxCore/src/ivpcore.cpp index 84eb3cf8f..50dd49d96 100644 --- a/src/tmx/TmxCore/src/ivpcore.cpp +++ b/src/tmx/TmxCore/src/ivpcore.cpp @@ -133,7 +133,7 @@ std::string GetPwd(){ pwd = std::getenv(EnvVar); if(pwd == NULL){ - LOG_ERROR("Unable to set MYSQL_PASSWORD)"); + LOG_ERROR("Unable to set MYSQL_ROOT_PASSWORD)"); return ""; } else{ diff --git a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp index 888546b99..ca80c112c 100644 --- a/src/tmx/TmxCtl/src/lib/PluginConfig.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginConfig.cpp @@ -525,5 +525,19 @@ bool TmxControl::remove(pluginlist &plugins, ...) } +// static std::string TmxControl::GetPwd(){ +// const char* EnvVar = "MYSQL_ROOT_PASSWORD"; +// const char* psw; +// psw = std::getenv(EnvVar); + +// if(psw == NULL){ +// PLOG(logERROR) << "Unable to set MYSQL_ROOT_PASSWORD)"; +// return ""; +// } +// else{ +// std::string PswStr(psw); +// return PswStr; +// } +// } } /* namespace tmxctl */ diff --git a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp index 1d12472ba..28bbb0bb3 100644 --- a/src/tmx/TmxCtl/src/lib/PluginStatus.cpp +++ b/src/tmx/TmxCtl/src/lib/PluginStatus.cpp @@ -87,8 +87,7 @@ bool TmxControl::list(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -174,8 +173,7 @@ bool TmxControl::state(pluginlist &plugins, ...) PLOG(logDEBUG) << "Executing query " << query; _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) { @@ -217,8 +215,7 @@ bool TmxControl::max_message_interval(pluginlist &plugins, ...) PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -272,8 +269,7 @@ bool TmxControl::args(pluginlist &plugins, ...) { PLOG(logDEBUG1) << "Executing query (?1 = " << val << ")" << query; - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, val); for (size_t i = 0; i < plugins.size(); i++) @@ -302,8 +298,7 @@ bool TmxControl::messages(pluginlist &plugins, ...) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); for (size_t i = 0; i < plugins.size(); i++) @@ -385,8 +380,7 @@ bool TmxControl::events(pluginlist &, ...) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); @@ -440,8 +434,7 @@ bool TmxControl::system_config(pluginlist &, ...) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -483,8 +476,7 @@ bool TmxControl::clear_event_log(pluginlist &, ...) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->executeUpdate(); //unique_ptr stmt(conn.Get()->createStatement()); @@ -519,8 +511,7 @@ bool TmxControl::user_info(bool showPassword) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); unique_ptr rs(stmt->executeQuery()); @@ -575,8 +566,7 @@ bool TmxControl::all_users_info(bool showPassword) _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->createStatement()); unique_ptr rs(stmt->executeQuery(query)); @@ -641,8 +631,7 @@ bool TmxControl::user_add() PLOG(logDEBUG1) << "Executing query (?1 = " << username << ", ?2 = " << password << ", ?3 = " << access_level << ", ?4 = " << username << "): " << query; - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt.reset(conn.Get()->prepareStatement(query)); stmt->setString(1, username); @@ -710,8 +699,7 @@ bool TmxControl::user_update() query += " WHERE username = ?"; PLOG(logDEBUG1) << "Executing query : " << query; - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); if (havePassword) { @@ -766,8 +754,7 @@ bool TmxControl::user_delete() _output.get_storage().get_tree().clear(); - std::string pwd = _pool.GetPwd(); - DbConnection conn = _pool.Connection("tcp://127.0.0.1:3306","IVP", pwd, "IVP"); + DbConnection conn = _pool.Connection(); unique_ptr stmt(conn.Get()->prepareStatement(query)); stmt->setString(1, (*_opts)["username"].as()); int deleted = stmt->executeUpdate(); diff --git a/src/tmx/TmxCtl/src/lib/TmxControl.h b/src/tmx/TmxCtl/src/lib/TmxControl.h index 77169d205..2c65e1b94 100644 --- a/src/tmx/TmxCtl/src/lib/TmxControl.h +++ b/src/tmx/TmxCtl/src/lib/TmxControl.h @@ -88,7 +88,8 @@ class TmxControl: public tmx::utils::Runnable { void DisablePermissionCheck(); std::string GetOutput(TmxControlOutputFormat format, bool pretty); tmx::message_container_type* GetOutput(); - + // Method for getting credentials + // std::string GetPwd(); private: boost::program_options::variables_map *_opts; diff --git a/src/tmx/TmxUtils/src/Logger.h b/src/tmx/TmxUtils/src/Logger.h index 51c3af4f3..855146577 100644 --- a/src/tmx/TmxUtils/src/Logger.h +++ b/src/tmx/TmxUtils/src/Logger.h @@ -9,11 +9,11 @@ #define SRC_LOGGER_H_ #ifndef LOGGER_MAX_LEVEL -#define LOGGER_MAX_LEVEL tmx::utils::logDEBUG4 +#define LOGGER_MAX_LEVEL tmx::utils::logERROR #endif #ifndef DEFAULT_LOG_LEVEL -#define DEFAULT_LOG_LEVEL "ERROR" +#define DEFAULT_LOG_LEVEL "DEBUG" #endif #define UNKNOWN_SOURCE "Unknown source" diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json index 993db59b3..34316088a 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json @@ -9,7 +9,7 @@ "configuration": [ { "key": "Messages_Destination_1", - "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }", + "default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" }] }", "description": "JSON data defining the message types and PSIDs for messages forwarded to the DSRC radio at destination 1." }, { diff --git a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp index bd0aed219..b0a93deb8 100644 --- a/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp +++ b/src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp @@ -71,8 +71,7 @@ void DsrcMessageManagerPlugin::OnMessageReceived(IvpMessage *msg) { // Uncomment this line to call the base method, which prints the message received to cout. //PluginClient::OnMessageReceived(msg); - PLOG(logDEBUG) << "Message Received " << - "Type: " << msg->type << ", Subtype: " << msg->subtype; + if (!_configRead) { PLOG(logWARNING) << "Config not read yet. Message Ignored: " << diff --git a/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt b/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt new file mode 100644 index 000000000..bb2ae8805 --- /dev/null +++ b/src/v2i-hub/MobilityOperationPlugin/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT ( MobilityOperationPlugin VERSION 5.0 LANGUAGES CXX ) + +BuildTmxPlugin ( ) + +TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils) \ No newline at end of file diff --git a/src/v2i-hub/MobilityOperationPlugin/manifest.json b/src/v2i-hub/MobilityOperationPlugin/manifest.json new file mode 100644 index 000000000..87f553c28 --- /dev/null +++ b/src/v2i-hub/MobilityOperationPlugin/manifest.json @@ -0,0 +1,23 @@ +{ + "name":"MobilityOperationPlugin", + "description":"...", + "version":"@PROJECT_VERSION@", + "exeLocation":"/bin/MobilityOperationPlugin", + "coreIpAddr":"127.0.0.1", + "corePort":24601, + "messageTypes":[ + { + "type":"J2735", + "subtype":"TMSG03-P", + "description":"In development" + } + ], + "configuration":[ + { + "key":"...", + "default":"...", + "description":"..." + } + + ] +} diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp new file mode 100644 index 000000000..e445d6c11 --- /dev/null +++ b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.cpp @@ -0,0 +1,86 @@ +//============================================================================ +// Name : MobilityOperationPlugin.cpp +// Author : Paul Bourelly +// Version : 5.0 +// Copyright : Your copyright notice +// Description : Hello World in C++, Ansi-style +//============================================================================ + +#include "MobilityOperationPlugin.h" + + +namespace MobilityOperationPlugin { + + + +/** + * Construct a new MobililtyOperationPlugin with the given name. + * + * @param name The name to give the plugin for identification purposes + */ +MobilityOperationPlugin::MobilityOperationPlugin(string name) : + PluginClient(name) { + + FILELog::ReportingLevel() = FILELog::FromString("INFO"); + AddMessageFilter < tsm3Message > (this, &MobilityOperationPlugin::HandleMobilityOperationMessage); + SubscribeToMessages(); + +} + +MobilityOperationPlugin::~MobilityOperationPlugin() { +} + +void MobilityOperationPlugin::UpdateConfigSettings() { + +} + +void MobilityOperationPlugin::OnConfigChanged(const char *key, const char *value) { + PluginClient::OnConfigChanged(key, value); + UpdateConfigSettings(); +} + + +void MobilityOperationPlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { + auto mobilityOperation = msg.get_j2735_data(); + // FILE_LOG(logDEBUG) << "Checking log level : " << FILELog::ReportingLevel(); + PLOG(logDEBUG) << "Received MobilityOperation message (encoded) : " << routeableMsg.get_payload_str(); + PLOG(logDEBUG) << "Header Host BSM ID : " << mobilityOperation->header.hostBSMId.buf; + PLOG(logDEBUG) << "Header Host Static ID : " << mobilityOperation->header.hostStaticId.buf; + PLOG(logDEBUG) << "Header Plan ID : " << mobilityOperation->header.planId.buf; + PLOG(logDEBUG) << "Header Target Static ID : " << mobilityOperation->header.targetStaticId.buf; + PLOG(logDEBUG) << "Header Timestamp : " << mobilityOperation->header.timestamp.buf; + PLOG(logDEBUG) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf; + PLOG(logDEBUG) << "Body Strategy : " << mobilityOperation->body.strategy.buf; + + +} + +void MobilityOperationPlugin::OnStateChange(IvpPluginState state) { + PluginClient::OnStateChange(state); + + if (state == IvpPluginState_registered) { + UpdateConfigSettings(); + } +} + + +int MobilityOperationPlugin::Main() { + FILE_LOG(logINFO) << "Starting plugin."; + + uint64_t lastSendTime = 0; + + while (_plugin->state != IvpPluginState_error) { + + + + usleep(100000); //sleep for microseconds set from config. + } + + return (EXIT_SUCCESS); +} +} + +int main(int argc, char *argv[]) { + return run_plugin < MobilityOperationPlugin::MobilityOperationPlugin > ("MobilityOperationPlugin", argc, argv); +} + diff --git a/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h new file mode 100644 index 000000000..6d704e3b0 --- /dev/null +++ b/src/v2i-hub/MobilityOperationPlugin/src/MobilityOperationPlugin.h @@ -0,0 +1,33 @@ +#ifndef SRC_MOBILITYOPERATIONPLUGIN_H_ +#define SRC_MOBILITYOPERATIONPLUGIN_H_ +#include "PluginClient.h" +#include + + +using namespace std; +using namespace tmx; +using namespace tmx::utils; +using namespace tmx::messages; + +namespace MobilityOperationPlugin { + +class MobilityOperationPlugin: public PluginClient { +public: + MobilityOperationPlugin(std::string); + virtual ~MobilityOperationPlugin(); + int Main(); +protected: + + void UpdateConfigSettings(); + + // Virtual method overrides. + void OnConfigChanged(const char *key, const char *value); + + void OnStateChange(IvpPluginState state); + + void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); + +private: +}; +} +#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt b/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt deleted file mode 100644 index 8a8883b35..000000000 --- a/src/v2i-hub/PortDrayagePlugin/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -PROJECT ( PortDrayagePlugin VERSION 5.0 LANGUAGES CXX ) - -SET (TMX_PLUGIN_NAME "PortDrayage") -set(CMAKE_AUTOMOC ON) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") - -find_package(Qt5Core REQUIRED) -find_package(Qt5Network REQUIRED) - - -include_directories( "/usr/local/include/pdclient") - - - -message(CMAKE MODULE : ${CMAKE_MODULE_PATH} ) - - -BuildTmxPlugin ( ) - -target_link_libraries(${PROJECT_NAME} PRIVATE pdclient ) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ssl crypto ) -target_link_libraries(${PROJECT_NAME} PUBLIC tmxutils) - diff --git a/src/v2i-hub/PortDrayagePlugin/manifest.json b/src/v2i-hub/PortDrayagePlugin/manifest.json deleted file mode 100644 index a3ee8f40c..000000000 --- a/src/v2i-hub/PortDrayagePlugin/manifest.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name":"PortDrayagePlugin", - "description":"PortDrayagePlugin for sending freight trucks automated actions in a port.", - "version":"@PROJECT_VERSION@", - "exeLocation":"/bin/PortDrayagePlugin", - "coreIpAddr":"127.0.0.1", - "corePort":24601, - "messageTypes":[ - { - "type":"J2735", - "subtype":"TMSG03-P", - "description":"MobilityOperation message is a prototyping message with a configurable payload." - } - ], - "configuration":[ - { - "key":"Database_IP", - "default":"127.0.0.1", - "description":"IP address of database" - }, - { - "key":"Database_Port", - "default":"3306", - "description":"Port of database" - }, - { - "key":"Database_Username", - "default":"root", - "description":"Username for database" - }, - { - "key":"Database_Password", - "default":"ivp", - "description":"Password for database" - }, - { - "key":"Database_Name", - "default":"PORT_DRAYAGE", - "description":"Name of database." - }, - { - "key":"LogLevel", - "default":"INFO", - "description":"The log level for this plugin" - }, - { - "key":"Webservice_Host", - "default":"127.0.0.1", - "description":"PortDrayage Webservice Host Address" - }, - { - "key":"Webservice_Port", - "default": "8090", - "description": "PortDrayage WebService Port" - }, - { - "key":"Webservice_Secure", - "default": "false", - "description": "Boolean flag set to true for HTTPS communication" - }, - { - "key":"Webservice_Polling_Frequency", - "default": "5", - "description": "Polling Frequency for PortDrayage Webservice action status in seconds" - }, - { - "key":"Holding_Lat", - "default":"45.45", - "description":"Latitude Coordinate for Holding Area GPS Location in Degrees(-90,90)." - }, - { - "key":"Holding_Lon", - "default":"-45.45", - "description":"Longitude Coordinate for Holding Area GPS Location in Degrees(-180,180)." - } - - ] -} diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp deleted file mode 100644 index da15930d0..000000000 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/** - * Copyright (C) 2019 LEIDOS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -#include "PortDrayagePlugin.h" - - - -namespace PortDrayagePlugin { - -PortDrayagePlugin::PortDrayagePlugin(string name) : - PluginClient(name) { - // Plugin Handles MobilityOperation Messages - AddMessageFilter < tsm3Message > (this, &PortDrayagePlugin::HandleMobilityOperationMessage); - SubscribeToMessages(); - -} - -PortDrayagePlugin::~PortDrayagePlugin() { -} - -void PortDrayagePlugin::UpdateConfigSettings() { - - lock_guard lock(_cfgLock); - - std::string _database_username; - std::string _database_password; - uint16_t _database_port; - std::string _database_ip; - std::string _database_name; - // Database configuration - GetConfigValue("Database_Username", _database_username); - GetConfigValue("Database_Password", _database_password); - GetConfigValue("Database_IP",_database_ip); - GetConfigValue("Database_Port",_database_port); - GetConfigValue("Database_Name", _database_name); - // Port Drayage Web Service Configuration - uint16_t polling_frequency; - uint16_t polling_timeout; - std::string host; - uint16_t port; - bool secure; - // Host address - GetConfigValue("Webservice_Host", host); - // Host Port - GetConfigValue("Webservice_Port", port); - // True for HTTPS - GetConfigValue("Webservice_Secure", secure); - // Polling Frequency in seconds - GetConfigValue("Webservice_Polling_Frequency", polling_frequency); - - client = std::make_shared( host, port, secure, polling_frequency ); - // Port Holding Area Configurable location - GetConfigValue("Holding_Lat", _holding_lat); - GetConfigValue("Holding_Lon", _holding_lon); - PLOG(logDEBUG) << "Holding Area set : (" << _holding_lat << ", " << _holding_lon << ")" << std::endl; - - // Create DB connection - std::string connection_string = "tcp://" + _database_ip + ":" + std::to_string(_database_port); - try { - driver = get_driver_instance(); - con = driver->connect(connection_string,_database_username,_database_password); - con->setSchema(_database_name); - // Initialize PreparedStatements for MySQL - // Get next_action for given action_id - next_action_id = con->prepareStatement("SELECT next_action FROM freight WHERE action_id = ? "); - // Get current action for given action_id - current_action = con->prepareStatement("SELECT * FROM freight WHERE action_id = ? "); - // Get first action for vehicle - first_action = con->prepareStatement("SELECT * FROM first_action WHERE cmv_id = ? " ); - // Insert action into freight table - insert_action = con->prepareStatement("INSERT INTO freight VALUES(?,?,?,?,?, UUID(), ?)"); - // Get action_id of the previous action given action_id - get_action_id_for_previous_action = con->prepareStatement("SELECT action_id FROM freight WHERE next_action = ? and operation = ? "); - // Update next_action for an action with given action_id - update_current_action = con->prepareStatement("UPDATE freight SET next_action = ? WHERE action_id = ?"); - - } - catch ( const sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error occurred in file " << __FILE__ << " on line " << __LINE__ << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - } - -} - -void PortDrayagePlugin::OnConfigChanged(const char *key, const char *value) { - PluginClient::OnConfigChanged(key, value); - UpdateConfigSettings(); -} - - -void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) { - - // Retrieve J2735 Message - auto mobilityOperation = msg.get_j2735_data(); - - // String Stream for strategy and operationParams - std::stringstream strat; - std::stringstream payload; - - // Create ptree object for json - ptree pr; - - // Create new PortDrayage_Object pointer - std::unique_ptr pd( new PortDrayage_Object()); - - // Read strategy and operationParams - strat << mobilityOperation->body.strategy.buf; - payload << mobilityOperation->body.operationParams.buf; - - // Compare strategy to PortDrayage strategy - std::string strategy = strat.str(); - if ( strategy.compare(PORT_DRAYAGE_STRATEGY) == 0 ){ - try { - PLOG(logINFO) << "Body OperationParams : " << mobilityOperation->body.operationParams.buf - << std::endl << "Body Strategy : " << mobilityOperation->body.strategy.buf; - // Convert JSON payload to PortDrayage_Object - read_json(payload, pr); - *pd = readPortDrayageJson( pr ); - } - catch( const ptree_error &e ) { - PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; - } - // Handle actions that require PortDrayage WebService Input - if ( pd->operation.compare(operation_to_string(Operation::PICKUP)) == 0 ) { - client->request_loading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - } - else if ( pd->operation.compare(operation_to_string(Operation::DROPOFF)) == 0) { - client->request_unloading_action( pd->cmv_id, pd->cargo_id, pd->action_id ); - } - else if ( pd->operation.compare(operation_to_string(Operation::CHECKPOINT)) == 0) { - // If holding == 1 insert HOLDING action into table - int holding = client->request_inspection( pd->cmv_id, pd->cargo_id, pd->action_id ); - if ( holding == 1 ) { - insert_holding_action_into_table( *pd ); - } - } - else if ( pd->operation.compare(operation_to_string(Operation::HOLDING)) == 0) { - string previous_checkpoint_id = retrieve_holding_inspection_action_id( pd->action_id ); - client->request_holding( previous_checkpoint_id ); - } - - - PLOG(logDEBUG) << "Port Drayage Message" << std::endl << - "cmv_id : " << pd->cmv_id << std::endl << - "cargo_id : " << pd->cargo_id << std::endl << - "cargo : " << pd->cargo << std::endl << - "operation : " << pd->operation << std::endl << - "location_lat : " << pd->location_lat << std::endl << - "location_long : " << pd->location_long << std::endl << - "destination_lat : " << pd->destination_lat << std::endl << - "destination_long : " << pd->destination_long << std::endl << - "action_id : " << pd->action_id << std::endl << - "next_action : " << pd->next_action << std::endl; - - - try{ - // Retrieve first or next action - PortDrayage_Object *new_action = new PortDrayage_Object(); - if ( pd->action_id.empty() ) { - PLOG(logDEBUG) << "Retrieving first action." << std::endl; - *new_action = retrieveFirstAction( pd->cmv_id ); - } - else { - PLOG(logDEBUG) << "Retrieving next action." << std::endl; - *new_action = retrieveNextAction( pd->action_id ); - } - - if ( !new_action->action_id.empty()) { - // Initializer vars - tsm3Message mob_msg; - tsm3EncodedMessage mobilityENC; - tmx::message_container_type container; - std::unique_ptr msg; - - // Create operationParams payload json - ptree payload = createPortDrayageJson( *new_action ); - - // Create XML MobilityOperationMessage - ptree message = createMobilityOperationXml( payload ); - std::stringstream content; - write_xml(content, message); - try { - // Uper encode message - container.load(content); - mob_msg.set_contents(container.get_storage().get_tree()); - mobilityENC.encode_j2735_message( mob_msg); - msg.reset(); - msg.reset(dynamic_cast(factory.NewMessage(api::MSGSUBTYPE_TESTMESSAGE03_STRING))); - string enc = mobilityENC.get_encoding(); - PLOG(logDEBUG) << "Encoded outgoing message : " << std::endl << mobilityENC.get_payload_str(); - msg->refresh_timestamp(); - msg->set_payload(mobilityENC.get_payload_str()); - msg->set_encoding(enc); - msg->set_flags(IvpMsgFlags_RouteDSRC); - msg->addDsrcMetadata(172,0xBFEE); - msg->refresh_timestamp(); - routeable_message *rMsg = dynamic_cast(msg.get()); - BroadcastMessage(*rMsg); - } - catch ( const J2735Exception &e) { - PLOG(logERROR) << "Error occurred during message encoding " << std::endl << e.what() << std::endl; - } - } - else { - PLOG(logWARNING) << "Could not find action!" << std::endl; - } - - } - catch ( const sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - } - } -} - - -ptree PortDrayagePlugin::createPortDrayageJson( const PortDrayage_Object &pd_obj) { - ptree json_payload; - json_payload.put("cmv_id", pd_obj.cmv_id ); - json_payload.put("cargo_id", pd_obj.cargo_id ); - ptree destination; - destination.put("latitude", pd_obj.destination_lat); - destination.put("longitude", pd_obj.destination_long); - json_payload.put_child("destination",destination); - json_payload.put("operation", pd_obj.operation ); - json_payload.put("action_id", pd_obj.action_id ); - return json_payload; -} - - -ptree PortDrayagePlugin::createMobilityOperationXml( const ptree &json_payload ) { - ptree mobilityOperationXml; - std::stringstream pl; - write_json( pl, json_payload); - // Create XML MobilityOperationMessage - ptree message; - ptree header; - ptree body; - body.put("strategy",PORT_DRAYAGE_STRATEGY); - body.put("operationParams", pl.str()); - header.put("hostStaticId", "UNSET"); - header.put("targetStaticId", "UNSET"); - header.put("hostBSMId", "00000000"); - header.put("planId", "00000000-0000-0000-0000-000000000000"); - header.put("timestamp", "0000000000000000000"); - message.put_child("header", header); - message.put_child("body",body); - mobilityOperationXml.put_child( "TestMessage03", message); - return mobilityOperationXml; -} - - -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveNextAction(const std::string &action_id ) { - std::unique_ptr rtn( new PortDrayage_Object()); - try{ - // Set action_id - next_action_id->setString(1,action_id); - // Get current action - sql::ResultSet *cur_action = next_action_id->executeQuery(); - if ( cur_action->first() ) { - std::string next = cur_action->getString("next_action"); - // Set action_id to next_action - current_action->setString(1,next); - // Retrieve next action - sql::ResultSet *cur_action = current_action->executeQuery(); - // Create PortDrayage_Object - if ( cur_action->first() ) { - rtn->cmv_id = cur_action->getString("cmv_id"); - rtn->operation = cur_action->getString("operation"); - rtn->action_id = cur_action->getString("action_id"); - rtn->cargo_id = cur_action->getString("cargo_id"); - rtn->destination_long = cur_action->getDouble("destination_long"); - rtn->destination_lat = cur_action->getDouble("destination_lat"); - rtn->next_action = cur_action->getString("next_action"); - - PLOG(logDEBUG) << "Port Drayage Message : " << std::endl << - "cmv_id : " << rtn->cmv_id << std::endl << - "cargo_id : " << rtn->cargo_id << std::endl << - "operation : " << rtn->operation << std::endl << - "destination_lat : " << rtn->destination_lat << std::endl << - "destination_long : " << rtn->destination_long << std::endl << - "action_id : " << rtn->action_id << std::endl << - "next_action : " << rtn->next_action << std::endl; - } - else { - // If we are able to retrieve the current action but not it's next_action we can - // assume it was the last action in the DB. - PLOG(logINFO) << "Last action completed! No action found with action id " << next << std::endl; - - } - } - } - catch ( const sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - } - return *rtn; -} - -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::retrieveFirstAction( const std::string &cmv_id ) { - std::unique_ptr rtn( new PortDrayage_Object()); - try{ - // Set cmv_id - first_action->setString(1,cmv_id); - // Retrieve first action of first_action table - sql::ResultSet *cur_action = first_action->executeQuery(); - if ( cur_action->first() ) { - // Create Port Drayage object - rtn->cmv_id = cur_action->getString("cmv_id"); - rtn->operation = cur_action->getString("operation"); - rtn->action_id = cur_action->getString("action_id"); - rtn->cargo_id = cur_action->getString("cargo_id"); - rtn->destination_long = cur_action->getDouble("destination_long"); - rtn->destination_lat = cur_action->getDouble("destination_lat"); - rtn->next_action =cur_action->getString("next_action"); - PLOG(logDEBUG) << "Port Drayage Message" << std::endl << - "cmv_id : " << rtn->cmv_id << std::endl << - "cargo_id : " << rtn->cargo_id << std::endl << - "operation : " << rtn->operation << std::endl << - "destination_lat : " << rtn->destination_lat << std::endl << - "destination_long : " << rtn->destination_long << std::endl << - "action_id : " << rtn->action_id << std::endl << - "next_action : " << rtn->next_action << std::endl; - return *rtn; - } - else { - PLOG(logERROR) << "No first action for cmv_id : " << cmv_id << " found!"; - return *rtn; - } - - - } - catch ( const sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - return *rtn; - } - -} - - -PortDrayagePlugin::PortDrayage_Object PortDrayagePlugin::readPortDrayageJson( const ptree &pr ) { - std::unique_ptr pd( new PortDrayage_Object()); - try { - pd->cmv_id = pr.get_child("cmv_id").get_value(); - boost::optional child = pr.get_child_optional( "action_id" ); - if( !child ) - { - PLOG(logINFO) << "No action_id present! This is the vehicle's first action" << std::endl; - } - else { - pd->action_id = child.get_ptr()->get_value(); - // For eventually tracking of completed actions - pd->operation = pr.get_child("operation").get_value(); - child = pr.get_child_optional("cargo_id"); - if ( child ) { - pd->cargo_id = pr.get_child("cargo_id").get_value(); - } - child = pr.get_child_optional("location"); - if ( child ) { - ptree location = pr.get_child("location"); - pd->location_lat =location.get_child("latitude").get_value(); - pd->location_long = location.get_child("longitude").get_value(); - } - - - } - return *pd.get(); - - } - catch( const ptree_error &e ) { - PLOG(logERROR) << "Error parsing Mobility Operation payload: " << e.what() << std::endl; - return *pd.get(); - } -} - -void PortDrayagePlugin::insert_holding_action_into_table( const PortDrayage_Object ¤t_action ) { - std::unique_ptr next_action( new PortDrayage_Object()); - try{ - - *next_action = retrieveNextAction(current_action.action_id); - PLOG(logDEBUG1) << "Insert Holding action between " << current_action.action_id << " and " - << next_action->action_id << "." << std::endl; - //INSERT INTO FREIGHT VALUES(cmv_id,cargo_id,_holding_lat,_holding_lon,HOLDING, UUID(), next_action->action_id) - insert_action->setString(1,current_action.cmv_id); - insert_action->setString(2,current_action.cargo_id); - insert_action->setDouble(3,_holding_lat); - insert_action->setDouble(4,_holding_lon); - insert_action->setString(5, "HOLDING_AREA"); - insert_action->setString(6, next_action->action_id); - PLOG(logDEBUG) << "Query : INSERT INTO FREIGHT VALUES(" - << current_action.cmv_id << ", " << current_action.cargo_id << ", " - << _holding_lat << ", " << _holding_lon << ", UUID(), HOLDING_AREA )" << std::endl; - sql::ResultSet *res = insert_action->executeQuery(); - - // SELECT action_id FROM freight WHERE next_action = ? and operation = ? - get_action_id_for_previous_action->setString(1, next_action->action_id); - get_action_id_for_previous_action->setString(2, "HOLDING_AREA"); - PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " - << next_action->action_id << " and operation = HOLDING_AREA " << std::endl; - - res = get_action_id_for_previous_action->executeQuery(); - res->first(); - if ( res->isFirst() ) { - PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; - } - std::string action_id = res->getString("action_id"); - - // UPDATE freight SET next_action = ? WHERE action_id = ? - update_current_action->setString( 1, action_id); - update_current_action->setString( 2, current_action.action_id); - PLOG(logDEBUG) << "Query : UPDATE freight SET next_action = " - << action_id << " WHERE action_id = " << current_action.action_id << std::endl; - res = update_current_action->executeQuery(); - } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - } -} - -std::string PortDrayagePlugin::retrieve_holding_inspection_action_id( const std::string &action_id ) { - try{ - get_action_id_for_previous_action->setString(1, action_id); - get_action_id_for_previous_action->setString(2, "PORT_CHECKPOINT"); - PLOG(logDEBUG) << "Query : SELECT action_id FROM freight WHERE next_action = " - << action_id << " and operation = PORT_CHECKPOINT " << std::endl; - - sql::ResultSet *res = get_action_id_for_previous_action->executeQuery(); - res->first(); - if ( res->isFirst() ) { - PLOG(logDEBUG) << "Query Result: " << res->first() << std::endl; - } - std::string action_id = res->getString("action_id"); - return action_id; - } - catch ( sql::SQLException &e ) { - PLOG(logERROR) << "Error occurred during MYSQL Connection " << std::endl << e.what() << std::endl - << "Error code " << e.getErrorCode() << std::endl - << "Error status " << e.getSQLState() << std::endl; - return ""; - } -} - -/** - * Trigger when Plugin state changes - * - * @param state IvpPluginState - */ -void PortDrayagePlugin::OnStateChange(IvpPluginState state) { - PluginClient::OnStateChange(state); - - if (state == IvpPluginState_registered) { - UpdateConfigSettings(); - } -} - - -int PortDrayagePlugin::Main() { - uint64_t lastSendTime = 0; - while (_plugin->state != IvpPluginState_error) { - usleep(100000); //sleep for microseconds set from config. - } - return (EXIT_SUCCESS); -} -} - -int main(int argc, char *argv[]) { - // Qt HttpClient setup - QCoreApplication a(argc, argv); - return run_plugin < PortDrayagePlugin::PortDrayagePlugin > ("PortDrayagePlugin", argc, argv); -} - diff --git a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h b/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h deleted file mode 100644 index c823ac3b3..000000000 --- a/src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.h +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Copyright (C) 2019 LEIDOS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -#ifndef SRC_PortDrayagePlugin_H_ -#define SRC_PortDrayagePlugin_H_ -#include "PluginClient.h" -#include -#include -#include -#include -#include "mysql_connection.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "WebServiceClient.h" - -using namespace std; -using namespace tmx; -using namespace tmx::utils; -using namespace tmx::messages; -using namespace boost::property_tree; -using namespace OpenAPI; - -namespace PortDrayagePlugin { -// constant for MobilityOperation strategy -static CONSTEXPR const char *PORT_DRAYAGE_STRATEGY = "carma/port_drayage"; - -// Enumeration for different operations -enum Operation { - PICKUP,DROPOFF,CHECKPOINT,HOLDING,ENTER_STAGING,EXIT_STAGING,ENTER_PORT,EXIT_PORT -}; - -std::string operation_to_string( Operation operation ) { - switch(operation) { - case PICKUP: - return "PICKUP"; - case DROPOFF: - return "DROPOFF"; - case CHECKPOINT: - return "PORT_CHECKPOINT"; - case HOLDING: - return "HOLDING_AREA"; - case ENTER_STAGING: - return "ENTER_STAGING_AREA"; - case EXIT_STAGING: - return "EXIT_STAGING_AREA"; - case ENTER_PORT: - return "ENTER_PORT"; - case EXIT_PORT: - return "EXIT_PORT"; - default: - return "INVALID_OPERATION"; - } -} -/** - * PortDrayagePlugin is a V2X-Hub plugin for automating Freight truck interactions for - * moving containers between and Port and a Staging Area. The plugin process MobilityOperation - * messages with the strategy PORT_DRAYAGE_STRATEGY. The payload of this MobilityOperation - * message is a JSON object consisting of mainly : - * action_id : unique identifier for the action - * vehicle_id : unique static identifier for the vehicle (NOT BSMID) - * operation : string enumeration describing the action that is to take place - * This Plugin requires a MySQL database with two table to store all vehicle action (table name: freight) and - * to store the first action for any given vehicle (table name : first_action). Upon initial communication - * with V2X-Hub the vehicle will just send an ENTER_STAGING_AREA actions with no action ID. When this initial - * message is received by V2X-Hub it will query the first_action table for the vehicle first action. Every action - * in the database is linked to a next action. Once the vehicle completes an action it notifies V2X-Hub of completion - * by sending out the action it just completed. V2X-Hub will then query the database for the next linked action - * - * @author Paul Bourelly - * @version 6.2 - */ -class PortDrayagePlugin: public PluginClient { -public: - struct PortDrayage_Object { - std::string cmv_id; - std::string cargo_id; - bool cargo; - std::string operation; - double location_lat; - double location_long; - double destination_lat; - double destination_long; - std::string action_id; - std::string next_action; - }; - /** - * Construct a new MobililtyOperationPlugin with the given name. - * - * @param name The name to give the plugin for identification purposes - */ - PortDrayagePlugin(std::string); - /** - * Constructor without paramaters - */ - virtual ~PortDrayagePlugin(); - int Main(); -protected: - /** - * Update Configuration - */ - void UpdateConfigSettings(); - - // Virtual method overrides. - /** - * Method triggers UpdateConfigSettings() on configuration changes - */ - void OnConfigChanged(const char *key, const char *value); - - void OnStateChange(IvpPluginState state); - /** - * Method to create port drayage payload JSON ptree using a PortDrayage_Object. - * - * @param pd_obj Port Drayage object. - * @return json ptree - */ - ptree createPortDrayageJson( const PortDrayage_Object &pd_obj); - /** - * Method to create MobilityOperation XML ptree. - * - * @param ptree json payload - * @return MobilityOperation message XML ptree - */ - ptree createMobilityOperationXml( const ptree &json_payload); - - /** - * Handle MobilityOperation message. - * - * @param tsm3Message J2735 MobilityOperation message - * @param routeableMsg JSON MobilityOperation message - */ - void HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg); - /** - * Retrieve next action from freight table using action_id - * - * @param action_id string - */ - PortDrayage_Object retrieveNextAction( const std::string &action_id ); - /** - * Retrieve first action from first_action table using cmv_id. - * - * @param cmv_id - * @return PortDrayage_Object of first action - */ - PortDrayage_Object retrieveFirstAction( const std::string &cmv_id ); - - /** - * Create PortDrayage_Object from ptree JSON. - * - * @param pr PortDrayage JSON - * @return PortDrayage_Object - */ - PortDrayage_Object readPortDrayageJson( const ptree &pr ); - - /** - * Dynamically inserts HOLDING_AREA action into mysql table between - * current_action and next_action. Current action should be PORT_CHECKPOINT - * and next_action should be EXIT_PORT - * - * @param current_action PORT_CHECKPOINT action - */ - void insert_holding_action_into_table(const PortDrayage_Object ¤t_action ); - - /** - * Retrieves HOLDING_AREA action when provided with PORT_CHECKPOINT action - * from mysql freight table. - * - * @return action_id of HOLDING_AREA action - */ - std::string retrieve_holding_inspection_action_id( const std::string &action_id ); - - -private: - // Database configuration values - - - - sql::Driver *driver; - sql::Connection *con; - - // Prepared Statements - sql::PreparedStatement *next_action_id; - sql::PreparedStatement *current_action; - sql::PreparedStatement *first_action; - sql::PreparedStatement *insert_action; - sql::PreparedStatement *get_action_id_for_previous_action; - sql::PreparedStatement *update_current_action; - - // Message Factory for J2735 messages - J2735MessageFactory factory; - - // Web Service Client - std::shared_ptr client; - - // Port HOLDING_AREA Configuration - double _holding_lat; - double _holding_lon; - -}; -std::mutex _cfgLock; - -} -#endif \ No newline at end of file diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp deleted file mode 100644 index 9227946ac..000000000 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/** - * Copyright (C) 2019 LEIDOS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -#include "WebServiceClient.h" - - -WebServiceClient::WebServiceClient() { - initialize(DEF_HOST, DEF_PORT, DEF_SECURITY, DEF_POLLING_FREQ); -} - -WebServiceClient::WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ) { - initialize(host, port, secure, polling_frequency); -} -void WebServiceClient::initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency) { - this->polling_frequency = polling_frequency; - - // Create URL - std::unique_ptr url( new QUrl()); - url.get()->setHost(QString::fromStdString(host)); - url.get()->setPort(port); - if ( secure ) { - url.get()->setScheme(QString::fromStdString("https")); - } - else { - url.get()->setScheme(QString::fromStdString("http")); - - } - PLOG(logINFO) << "Setting API URL as " << url.get()->toString().toStdString() << std::endl; - // Initialize API - api = std::make_shared(0); - // Setup server config - api.get()->setNewServerForAllOperations( - *url.get(), - QString::fromStdString("V2X-Hub Configured PortDrayage WebService"), - QMap() - ); - -} - -void WebServiceClient::request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { - std::unique_ptr req(new OAIContainerRequest ()); - std::unique_ptr loop( new QEventLoop()); - - // Disconnect duplicate signals - disconnect(api.get(), &OAIDefaultApi::loadingPostSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::loadingPostSignalE, nullptr, nullptr); - - // Call back for POST /loading/ - connect(api.get(), &OAIDefaultApi::loadingPostSignal, this, [&]() { - PLOG(logINFO) << "Success /loading POST"; - loop->quit(); - }); - // Error call back for POST /loading/ - connect(api.get(), &OAIDefaultApi::loadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /loading POST : " << error_str.toStdString() << std::endl << "Error Code" << error_code; - loop->exit(1); - }); - - // Setup request - req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req->setContainerId( QString::fromStdString( container_id ) ); - req->setActionId( QString::fromStdString( action_id ) ); - - PLOG(logINFO) << "Sending loading request : " << req->asJson().toStdString(); - api->loadingPost( *req.get() ); - loop->exec(); - // Poll loading action until complete - pollLoadingAction( req->getActionId() ); - - -} - -void WebServiceClient::request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id) { - std::unique_ptr req(new OAIContainerRequest ()); - std::unique_ptr loop( new QEventLoop()); - - // Disconnect duplicate signals - disconnect(api.get(), &OAIDefaultApi::unloadingPostSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::unloadingPostSignalE, nullptr, nullptr); - - // Call back for POST /unloading/ - connect(api.get(), &OAIDefaultApi::unloadingPostSignal, this, [&]() { - PLOG(logINFO) << "Success /unloading POST"; - loop->quit(); - }); - // Error call back for POST /unloading/ - connect(api.get(), &OAIDefaultApi::unloadingPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /unloading POST : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; - loop->exit(1); - }); - - // Setup request - req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req->setContainerId( QString::fromStdString( container_id ) ); - req->setActionId( QString::fromStdString( action_id ) ); - - PLOG(logINFO) << "Sending unloading request : " << req->asJson().toStdString(); - api->unloadingPost( *req.get() ); - loop->exec(); - - // Polling unloading action until complete - pollUnloadingAction( req->getActionId() ); - -} - -int WebServiceClient::request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id ) { - std::unique_ptr req(new OAIInspectionRequest()); - std::unique_ptr loop( new QEventLoop()); - - // Disconnect all duplicate signals - disconnect(api.get(),&OAIDefaultApi::inspectionPostSignal, nullptr, nullptr ); - disconnect(api.get(),&OAIDefaultApi::inspectionPostSignalE, nullptr, nullptr ); - - // Call back for POST /inspection/ - connect(api.get(), &OAIDefaultApi::inspectionPostSignal, this, [&]() { - PLOG(logINFO) << "Success /inspection POST"; - loop->quit(); - }); - // Error call back for POST /inspection/ - connect(api.get(), &OAIDefaultApi::inspectionPostSignalE, this, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection POST : " << error_str.toStdString() << std::endl << "Error Code :" << error_code; - loop->exit(1); - }); - - // Setup request - req->setVehicleId( QString::fromStdString( vehicle_id ) ) ; - req->setContainerId( QString::fromStdString( container_id ) ); - req->setActionId( QString::fromStdString( action_id ) ); - - PLOG(logINFO) << "Sending inspection request : " << req->asJson().toStdString(); - api->inspectionPost( *req.get() ); - loop->exec(); - - // Poll inspection status until complete or proceed to holding - return pollInspectionAction( req->getActionId() ); -} - -void WebServiceClient::request_holding( const std::string &action_id ) { - std::unique_ptr loop( new QEventLoop()); - - // Disconnect all duplicate signals - disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, nullptr, nullptr); - - // Call back for POST /inspection/ - connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignal, [&]() { - PLOG(logINFO) << "Success /inspection/holding/{action_id} POST"; - loop->quit(); - }); - // Error call back for POST /inspection/ - connect(api.get(), &OAIDefaultApi::inspectionHoldingActionIdPostSignalE, [&](QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection/holding/{action_id} POST : " << error_str.toStdString()<< std::endl << "Error Code : " << error_code; - loop->exit(1); - }); - PLOG(logINFO) << "Sending holding request for action_id : " << action_id << std::endl; - api.get()->inspectionHoldingActionIdPost( QString::fromStdString(action_id) ); - loop->exec(); - // Poll inspection action until complete - pollInspectionAction( QString::fromStdString( action_id ) ); - -} - -void WebServiceClient::pollLoadingAction( QString action_id ) { - PLOG(logDEBUG) << "Starting loading action Polling"; - std::unique_ptr loop( new QEventLoop()); - bool badResponse = true; - // Disconnect all duplicate signals - disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, nullptr, nullptr); - - // Call back for Get /loading/{action_id} - connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignal, this, [&](OAIContainerActionStatus loading_action) { - loading_status.reset( new OAIContainerActionStatus( loading_action.asJson( ) ) ); - PLOG(logINFO) << "Success /loading/{action_id} GET : " << loading_status->asJson().toStdString(); - badResponse = false; - loop->quit(); - }); - // Error call back for Get /loading/{action_id} - connect(api.get(), &OAIDefaultApi::loadingActionIdGetSignalE, this, - [&](OAIContainerActionStatus loading_action , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure loading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; - badResponse = true; - loop->exit(1); - }); - // Flag to continue polling until receiving a non error response from server - do { - api->loadingActionIdGet( action_id ); - loop->exec(); - // usleep coversion from seconds to microseconds - usleep( polling_frequency * 1e6 ); - } - while ( badResponse || loading_status->getStatus() != QString::fromStdString( "LOADED") ) ; - -} - -void WebServiceClient::pollUnloadingAction( QString action_id) { - PLOG(logDEBUG) << "Starting unloading action Polling"; - std::unique_ptr loop( new QEventLoop()); - - bool badResponse = true; - // Disconnect all duplicate signals - disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, nullptr, nullptr); - // Call back for Get /unloading/{action_id} - connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignal, this, [&](OAIContainerActionStatus unloading_action) { - unloading_status.reset( new OAIContainerActionStatus( unloading_action.asJson() ) ); - PLOG(logINFO) << "Success /unloading/{action_id} GET : " << unloading_status->asJson().toStdString(); - badResponse = false; - loop->quit(); - }); - // Error call back for Get /unloading/{action_id} - connect(api.get(), &OAIDefaultApi::unloadingActionIdGetSignalE, this, - [&](OAIContainerActionStatus unloading_action , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure unloading/{action_id} GET :" << error_str.toStdString() << std::endl << "Error Code : " << error_code; - badResponse = true; - loop->exit(1); - }); - // Flag to continue polling until receiving a non error response from server - do { - api->unloadingActionIdGet( action_id ); - loop->exec(); - // usleep coversion from seconds to microseconds - usleep( polling_frequency * 1e6 ); - - } - while( badResponse || unloading_status->getStatus() != QString::fromStdString( "UNLOADED") ); -} - -int WebServiceClient::pollInspectionAction( QString action_id ) { - PLOG(logDEBUG) << "Starting inspection action Polling"; - std::unique_ptr loop( new QEventLoop()); - bool badResponse = true; - - // Disconnect all duplicate signals - disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, nullptr, nullptr); - disconnect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, nullptr, nullptr); - - // Call back for GET /inspection/{action_id} - connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignal, this , [&](OAIInspectionStatus inspection) { - inspection_status.reset( new OAIInspectionStatus( inspection.asJson() ) ); - PLOG(logINFO) << "Success /inspection/{action_id} GET : " << inspection_status->asJson().toStdString() << std::endl; - badResponse = false; - loop->quit(); - }); - // Error call back for /inspection/{action_id} - connect(api.get(), &OAIDefaultApi::inspectionActionIdGetSignalE, this, - [&](OAIInspectionStatus inspection , QNetworkReply::NetworkError error_code, QString error_str) { - PLOG(logERROR) << "Failure /inspection/{action_id} GET : " << error_str.toStdString() << std::endl << "Error Code : " << error_code; - badResponse = true; - loop->exit(1); - }); - do { - api->inspectionActionIdGet( action_id ); - loop->exec(); - - if (inspection_status->getStatus() == QString::fromStdString( "PASSED")){ - return 0; - } - else if (inspection_status->getStatus() == QString::fromStdString( "PROCEED_TO_HOLDING")) { - return 1; - } - // usleep coversion from seconds to microseconds - usleep( polling_frequency * 1e6 ); - - - } - while( badResponse || (inspection_status->getStatus() != QString::fromStdString( "PASSED") && - inspection_status->getStatus() != QString::fromStdString( "PROCEED_TO_HOLDING")) ); - return -1; -} - - diff --git a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h b/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h deleted file mode 100644 index f0f835259..000000000 --- a/src/v2i-hub/PortDrayagePlugin/src/WebServiceClient.h +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright (C) 2019 LEIDOS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -#pragma once -#include -#include -#include "PluginLog.h" -#include -#include -#include -#include - -using namespace OpenAPI; -using namespace tmx::utils; - -// Default values for no arg constructor -static CONSTEXPR const char *DEF_HOST = "127.0.0.1"; -static CONSTEXPR const uint16_t DEF_PORT = 8090; -static CONSTEXPR const uint16_t DEF_POLLING_FREQ = 5; -static CONSTEXPR const bool DEF_SECURITY = false; - -/** - * WebService REST Client using OpenAPI codegen library pdclient found under V2X-Hub/ext/pdclient. Contains several method to - * send POST requests for loading, unloading, and inspection actions and poll the action status. - * - * @author Paul Bourelly - */ -class WebServiceClient : public QObject -{ - Q_OBJECT -public slots: - -private: - // Stored in Seconds - uint16_t polling_frequency; - - - // OAIDefaultApi pointer - std::shared_ptr api; - std::shared_ptr loading_status; - std::shared_ptr unloading_status; - std::shared_ptr inspection_status; - /** - * Method to poll the status of a loading action with a given action id. - * - * @param action_id of the loading action to be polled - */ - void pollLoadingAction(QString action_id); - - /** - * Method to poll the status of a unloading action with a given action id. - * - * @param action_id of the unloading action to be polled - */ - void pollUnloadingAction(QString action_id); - - /** - * Method to poll the status of a inspection with a given action id. - * - * @param action_id of the inspection to be polled - * @return 0 if inspection is passed and 1 if further inspection at the holding area is requested - */ - int pollInspectionAction(QString action_id); - - /** - * Method to initialize server configuration and polling frequency - * - * @param host string host name of server - * @param port uint16_t port of server - * @param secure bool flag set to true for using HTTPS - * @param polling_frequency - */ - void initialize(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency); - - -public: - - /** - * Constructor without parameters - */ - WebServiceClient(); - - /** - * Constructor for WebServiceClient - * - * @param host string webservice host URL - * @param port uint8_t webservice port - * @param secure boolean flag set to true when using HTTPS - * @param int polling frequency in seconds for action status - * - */ - WebServiceClient(const std::string &host, uint16_t port, bool secure , uint16_t polling_frequency ); - - /** - * Method to request a loading action. Sends a HTTP POST call to the loading endpoint of the PortDrayage Webservice and then - * polls the status of the request every 5 seconds. Method will exit once loading action is completed. - * - * @param vehicle_id static unique identifier for vehicle - * @param container_id static unique identifier for container - * @param action_id static unique identifier for action - */ - void request_loading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); - /** - * Method to request an unloading action. Sends a HTTP POST call to the unloading endpoint of the PortDrayage Webservice and then - * polls the status of the request every 5 seconds. Method will exit once unloading action is completed. - * - * @param vehicle_id static unique identifier for the vehicle - * @param container_id static unique identifier for the container - * @param action_id static unique identifier for the action - */ - void request_unloading_action(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); - /** - * Method to request an inspection action. Sends a HTTP POST call to the inspection endpoint of the PortDrayage Webservice and then - * polls the status of the request every 5 seconds. Method will exit once inspection action is completed or operator indicates the - * vehicle requires further inspection at the Holding area - * - * @param vehicle_id static unique identifier for the vehicle - * @param container_id static unique identifier for container - * @param action_id static unique identifier for the action - */ - int request_inspection(const std::string &vehicle_id, const std::string &container_id, const std::string &action_id); - /** - * Method request further inspection at the Holding area. Sends a HTTP POST call to inspection holding endpoint of the PortDrayage Webservice - * and then poll the status of the request every 5 seconds. Method will exit once inspection action is completed. - * - * @param action_id static unique identifier for action - */ - void request_holding(const std::string &action_id); - - -}; diff --git a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp index e82dff414..a495dddd7 100644 --- a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp +++ b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.cpp @@ -105,7 +105,11 @@ void PreemptionPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_messa bsmTmpID = (int32_t)((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]); - if (bsm->partII != NULL) { + //std::vector::iterator it = std::find(allowedList.begin(),allowedList.end(),bsmTmpID); + + //if( it != allowedList.end()) + //{ + if (bsm->partII != NULL) { if (bsm->partII[0].list.count >= partII_Value_PR_SpecialVehicleExtensions ) { try { if(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.vehicleAlerts != NULL){ @@ -121,7 +125,9 @@ void PreemptionPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_messa PLOG(logDEBUG)<<"Standard Exception:; Vehicle alerts Unavailable"; } } - } + } + //} + } int PreemptionPlugin::Main() diff --git a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp index b52d18814..c3731e1e5 100644 --- a/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp +++ b/src/v2i-hub/PreemptionPlugin/src/PreemptionPlugin.hpp @@ -43,7 +43,7 @@ class PreemptionPlugin: public PluginClient } // PreemptionPlugin(PreemptionPlugin &&fp) noexcept { // } - PreemptionPlugin const & operator=(PreemptionPlugin &&fp) noexcept{ + PreemptionPlugin const & operator=(PreemptionPlugin &&fp) { } diff --git a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp index 3ccf07216..91894ad1a 100644 --- a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp +++ b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.cpp @@ -7,58 +7,60 @@ //========================================================================== #include "PreemptionPluginWorker.hpp" -#include + using namespace std; namespace PreemptionPlugin { - void PreemptionPluginWorker::ProcessMapMessageFile(const std::string &path){ + void PreemptionPluginWorker::ProcessMapMessageFile(std::string path){ if(path != ""){ try { boost::property_tree::read_json(path, geofence_data); BOOST_FOREACH( boost::property_tree::ptree::value_type const& v, geofence_data.get_child( "data" ) ) { + assert(v.first.empty()); // array elements have no names boost::property_tree::ptree subtree = v.second; list geox; list geoy; BOOST_FOREACH( boost::property_tree::ptree::value_type const& u, subtree.get_child( "geox" ) ) { + assert(u.first.empty()); // array elements have no names + // std::cout << u.second.get("") << std::endl; double d = u.second.get(""); geox.push_back(d); } BOOST_FOREACH( boost::property_tree::ptree::value_type const& u, subtree.get_child( "geoy" ) ) { + assert(u.first.empty()); // array elements have no names double d = u.second.get(""); geoy.push_back(d); } - GeofenceObject geofenceObject(geox,geoy, static_cast(subtree.get("PreemptCall")),static_cast(subtree.get("HeadingMin")),static_cast(subtree.get("HeadingMax"))); + GeofenceObject* geofenceObject = new GeofenceObject(geox,geoy,subtree.get("PreemptCall"),subtree.get("HeadingMin"),subtree.get("HeadingMax")); - GeofenceSet.push_back(&geofenceObject); + GeofenceSet.push_back(geofenceObject); } } catch(...) { - PLUGIN_LOG(logERROR, "Preemptionworker") << "Caught exception from reading a file"; + std::cout << "Caught exception from reading a file"; } } + } - bool PreemptionPluginWorker::CarInGeofence(long double x,long double y, std::vector geox, std::vector geoy, long GeoCorners) const{ - long i = 0 ; - long j = GeoCorners-1; - bool oddNodes = false; + bool PreemptionPluginWorker::CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners) { + int i, j=GeoCorners-1 ; + bool oddNodes ; for (i=0; i=y - || geoy.at(j)< y && geoy.at(i)>=y) - && (geox.at(i)<=x || geox.at(j)<=x) && (geox.at(i)+(y-geoy.at(i))/(geoy.at(j)-geoy.at(i))*(geox.at(j)-geox.at(i))=y + || geoy[j]< y && geoy[i]>=y) + && (geox[i]<=x || geox[j]<=x)) { + oddNodes^=(geox[i]+(y-geoy[i])/(geoy[j]-geoy[i])*(geox[j]-geox[i])(); - auto vehicle_coordinate = std::make_shared(); + PreemptionObject* po = new PreemptionObject; + + VehicleCoordinate* vehicle_coordinate = new VehicleCoordinate; auto bsm = msg->get_j2735_data(); int32_t bsmTmpID; @@ -81,14 +84,16 @@ namespace PreemptionPlugin { for (auto const& it: GeofenceSet) { - std::vector geox; + double geox[it->geox.size()]; + int k = 0; for (double const &i: it->geox) { - geox.push_back(i); + geox[k++] = i; } - std::vector geoy; + double geoy[it->geoy.size()]; + k = 0; for (double const &i: it->geoy) { - geoy.push_back(i); + geoy[k++] = i; } bool in_geo = CarInGeofence(vehicle_coordinate->lon, vehicle_coordinate->lat, geoy, geox, it->geox.size()); @@ -114,7 +119,7 @@ namespace PreemptionPlugin { }; - void PreemptionPluginWorker::PreemptionPlaner(std::shared_ptr po){ + void PreemptionPluginWorker::PreemptionPlaner(PreemptionObject* po){ if(po->approach == "1") { @@ -141,7 +146,7 @@ namespace PreemptionPlugin { std::cout << " Finished PreemptionPlaner" << std::endl; }; - void PreemptionPluginWorker::TurnOnPreemption(std::shared_ptr po){ + void PreemptionPluginWorker::TurnOnPreemption(PreemptionObject* po){ std::string preemption_plan_flag = "1"; std::asctime(std::localtime(&(po->time))); @@ -158,7 +163,7 @@ namespace PreemptionPlugin { } } - void PreemptionPluginWorker::TurnOffPreemption(std::shared_ptr po){ + void PreemptionPluginWorker::TurnOffPreemption(PreemptionObject* po){ std::string preemption_plan, preemption_plan_flag = ""; preemption_plan = preemption_map[po ->vehicle_id].preemption_plan; preemption_plan_flag = "0"; diff --git a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp index 73d719568..cf76814eb 100644 --- a/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp +++ b/src/v2i-hub/PreemptionPlugin/src/include/PreemptionPluginWorker.hpp @@ -40,9 +40,9 @@ namespace PreemptionPlugin { public: struct PreemptionObject { - std::string approach = ""; // 0: egress 1: ingress - std::string preemption_plan = ""; - int vehicle_id = 0; + std::string approach; // 0: egress 1: ingress + std::string preemption_plan; + int vehicle_id; std::time_t time = std::time(nullptr); }; @@ -72,12 +72,12 @@ namespace PreemptionPlugin { std::map preemption_map; - void ProcessMapMessageFile(const std::string &path); + void ProcessMapMessageFile(std::string path); void VehicleLocatorWorker(BsmMessage* msg); - void PreemptionPlaner(std::shared_ptr po); - void TurnOnPreemption(std::shared_ptr po); - void TurnOffPreemption(std::shared_ptr po); - bool CarInGeofence(long double x, long double y, std::vector geox, std::vector geoy, long GeoCorners) const; + void PreemptionPlaner(PreemptionObject* po); + void TurnOnPreemption(PreemptionObject* po); + void TurnOffPreemption(PreemptionObject* po); + bool CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners); std::string ip_with_port; int snmp_version = SNMP_VERSION_1; diff --git a/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp b/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp index 56e7b0347..aa86baf4d 100644 --- a/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp +++ b/src/v2i-hub/PreemptionPlugin/test/PreemptionTest.cpp @@ -45,7 +45,7 @@ class PreemptionTest : public testing::Test bool CarInGeofence(double x, double y, double geox[], double geoy[], int GeoCorners) { int i, j=GeoCorners-1 ; - bool oddNodes = 0 ; + bool oddNodes ; for (i=0; i=y diff --git a/tools/port-drayage-webservice/.dockerignore b/tools/port-drayage-webservice/.dockerignore deleted file mode 100644 index b2be670ee..000000000 --- a/tools/port-drayage-webservice/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -src/ -target/classes/ -target/generated-soures/ -target/generated-test-sources/ -target/maven-archiver/ -target/site/ -target/surefire-reports/ -target/test-classes/ -target/jacoco.exec diff --git a/tools/port-drayage-webservice/Dockerfile b/tools/port-drayage-webservice/Dockerfile deleted file mode 100644 index f10c360d8..000000000 --- a/tools/port-drayage-webservice/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM adoptopenjdk/openjdk11:alpine-jre -RUN mkdir ~/port-drayage-webservice/ -COPY ./target/port-drayage-webservice-0.0.1-SNAPSHOT.jar ~/port-drayage-webservice/ -WORKDIR ~/port-drayage-webservice/ -ENTRYPOINT ["java","-jar","port-drayage-webservice-0.0.1-SNAPSHOT.jar"] \ No newline at end of file diff --git a/tools/port-drayage-webservice/pom.xml b/tools/port-drayage-webservice/pom.xml deleted file mode 100644 index f3df86964..000000000 --- a/tools/port-drayage-webservice/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - 4.0.0 - - com.leidos - port-drayage-webservice - 0.0.1-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-parent - 2.5.5 - - - - - org.springframework.boot - spring-boot-starter-web - - - io.springfox - springfox-boot-starter - 3.0.0 - - - org.openapitools - jackson-databind-nullable - 0.2.1 - - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-validation - - - - org.springframework.boot - spring-boot-starter-actuator - - - - com.fasterxml.jackson.core - jackson-core - - - - org.webjars - bootstrap - 4.0.0-2 - - - org.webjars - webjars-locator - 0.30 - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - - - - - - org.openapitools - openapi-generator-maven-plugin - 5.1.0 - - - - generate - - - - ${project.basedir}/src/main/resources/port-drayage-webservice.yml - - spring - spring-boot - com.baeldung.openapi.api - com.baeldung.openapi.model - true - - ApiUtil.java - - - true - true - - - - - - - - org.jacoco - jacoco-maven-plugin - - - - com/baeldung/openapi/** - - - - - - prepare-agent - - - - report - test - - report - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java b/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java deleted file mode 100644 index 2b6d3f403..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/Application.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.leidos; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * Main class for SpringBoot application. {@link EnableAutoConfiguration} annotation allow spring to scan all sub-directories for defined beans. - * - * @author Paul Bourelly - */ - -@EnableAutoConfiguration -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - - -} \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java b/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java deleted file mode 100644 index 3b70bdc7e..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/configuration/WebApplicationConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.leidos.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@Configuration -@EnableSwagger2 -public class WebApplicationConfiguration { - - /** - * Allow Cross Origin Resource Sharing (CORS) for all endpoints. - * @return - */ - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**"); - } - }; - } -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java deleted file mode 100644 index df1694509..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/InspectionController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.api.InspectionApi; -import com.baeldung.openapi.model.InspectionRequest; -import com.baeldung.openapi.model.InspectionStatus; -import com.baeldung.openapi.model.InspectionStatusList; -import com.baeldung.openapi.model.InspectionStatus.StatusEnum; -import com.leidos.inspection.InspectionActions; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; - -/** - * {@link RestController} for all inspection/ REST endpoints. Implements - * {@link InspectionApi} generated by openapi-generator-maven-plugin (see - * pom.xml), which configures endpoint content type, response type and path. - * - * @author Paul Bourelly - */ -@RestController -public class InspectionController implements InspectionApi { - - private static Logger logger = LoggerFactory.getLogger(InspectionController.class); - - // Injected InspectionActions spring bean - @Autowired - private InspectionActions inspectionActions; - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionPendingGet() { - return ResponseEntity.ok(inspectionActions.getPendingInspections()); - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionActionIdGet(String actionId) { - logger.debug(String.format("Received GET inspection/%s .", actionId)); - InspectionStatus status = inspectionActions.getInspectionStatus(actionId); - if (status != null) - return ResponseEntity.ok(status); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionPost(InspectionRequest request) { - logger.debug(String.format("Received POST inspection/ with payload : %s .", request)); - // Assure there is not current inspection with action_id - if (inspectionActions.getInspectionStatus(request.getActionId()) == null) { - inspectionActions.requestInspectionAction(request); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", - request.getActionId())); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionHoldingActionIdPost(String actionId) { - logger.debug(String.format("Received POST inspection/holding/%s .", actionId)); - InspectionStatus cur = inspectionActions.getCurrentInspection(); - // Check that action is current action and that status is PROCEED_TO_HOLDING - if (cur != null && cur.getActionId().equals(actionId) - && cur.getStatus().equals(StatusEnum.PROCEED_TO_HOLDING)) { - inspectionActions.requestHolding(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - logger.warn(String.format( - "Action ID %s is not current inspection %s or does not have a status of PROCEED_TO_HOLDING AREA.\n Discarding potential duplicate request.", - actionId, inspectionActions.getCurrentInspection().toString())); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionCompleteActionIdPost(String actionId) { - logger.debug(String.format("Received POST inspection/complete/%s .", actionId)); - InspectionStatus cur = inspectionActions.getCurrentInspection(); - if (cur != null && cur.getActionId().equals(actionId)) { - inspectionActions.completeInspection(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity inspectionHoldActionIdPost(String actionId) { - logger.debug(String.format("Received POST inspection/hold/%s .", actionId)); - InspectionStatus cur = inspectionActions.getCurrentInspection(); - if (cur != null && cur.getActionId().equals(actionId)) { - inspectionActions.proceedToHolding(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java deleted file mode 100644 index f0f92230a..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/LoadingController.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.api.LoadingApi; -import com.baeldung.openapi.model.ActionStatusList; -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.leidos.loading.LoadingActions; - -import org.springframework.web.bind.annotation.RestController; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -/** - * {@link RestController} for all /loading REST API endpoints. Implements - * {@link LoadingApi} interface generated by openapi codegen to define methods - * of endpoint responses. - * - * @author Paul Bourelly - */ -@RestController -public class LoadingController implements LoadingApi { - - private static Logger logger = LoggerFactory.getLogger(LoadingController.class); - - /** - * Injected {@link LoadingActions} Spring Bean - */ - @Autowired - private LoadingActions loadingActions; - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity loadingPendingGet() { - return ResponseEntity.ok(loadingActions.getPendingActions()); - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity loadingActionIdGet(String actionId) { - logger.debug(String.format("Received GET loading/%s .", actionId)); - ContainerActionStatus action = loadingActions.getContainerActionStatus(actionId); - if (action != null) - return ResponseEntity.ok(action); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity loadingPost(ContainerRequest request) { - logger.debug(String.format("Received POST loading/ with payload : %s .", request)); - // Check no action already exists for given action ID - if (loadingActions.getContainerActionStatus(request.getActionId()) == null) { - loadingActions.requestLoadingAction(request); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", - request.getActionId())); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity loadingStartActionIdPost(String actionId) { - logger.debug(String.format("Received POST loading/start/%s .", actionId)); - ContainerActionStatus cur = loadingActions.getCurrentAction(); - if (cur != null && cur.getActionId().equals(actionId)) { - loadingActions.startCurrentAction(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity loadingCompleteActionIdPost(String actionId) { - logger.debug(String.format("Received POST loading/complete/%s .", actionId)); - ContainerActionStatus cur = loadingActions.getCurrentAction(); - if (cur != null && cur.getActionId().equals(actionId)) { - loadingActions.completeCurrentAction(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java deleted file mode 100644 index f054d9f03..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.api.ResetApi; -import com.leidos.inspection.InspectionActions; -import com.leidos.loading.LoadingActions; -import com.leidos.unloading.UnloadingActions; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; - - -@RestController -public class ResetController implements ResetApi { - - private static Logger logger = LoggerFactory.getLogger(ResetController.class); - - /** - * Injected {@link LoadingActions} Spring Bean - */ - @Autowired - private LoadingActions loadingActions; - - /** - * Injected {@link UnloadingActions} Spring Bean - */ - @Autowired - private UnloadingActions unloadingActions; - - /** - * Injected {@link InspectionActions} Spring Bean - */ - @Autowired - private InspectionActions inspectionActions; - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity resetPost() { - inspectionActions.clear(); - unloadingActions.clear(); - loadingActions.clear(); - logger.warn("Web Service Actions were cleared!"); - return new ResponseEntity(HttpStatus.OK); - } -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java deleted file mode 100644 index 2559a67c1..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UnloadingController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.api.UnloadingApi; -import com.baeldung.openapi.model.ActionStatusList; -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.leidos.unloading.UnloadingActions; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RestController; - -/** - * {@link RestController} for all /unloading REST API endpoints. Implements - * {@link Unloading} interface generated by openapi codegen to define methods of - * endpoint responses. - * - * @author Paul Bourelly - */ -@RestController -public class UnloadingController implements UnloadingApi { - - Logger logger = LoggerFactory.getLogger(UnloadingController.class); - - /** - * Injected {@link UnloadingActions} Spring Bean - */ - @Autowired - UnloadingActions unloadingActions; - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity unloadingPendingGet() { - return ResponseEntity.ok(unloadingActions.getPendingActions()); - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity unloadingActionIdGet(String actionId) { - logger.debug(String.format("Received GET unloading/%s .", actionId)); - ContainerActionStatus action = unloadingActions.getContainerActionStatus(actionId); - if (action != null) - return ResponseEntity.ok(action); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity unloadingPost(ContainerRequest request) { - logger.debug(String.format("Received POST unloading/ with payload : %s .", request)); - // Check no action already exists for given action ID - if (unloadingActions.getContainerActionStatus(request.getActionId()) == null) { - unloadingActions.requestUnloadingAction(request); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - logger.warn(String.format("Action with action ID %s already exists! Discarding potential duplicate request", - request.getActionId())); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity unloadingStartActionIdPost(String actionId) { - logger.debug(String.format("Received POST unloading/start/%s .", actionId)); - ContainerActionStatus cur = unloadingActions.getCurrentAction(); - if (cur != null && cur.getActionId().equals(actionId)) { - unloadingActions.startCurrentAction(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public ResponseEntity unloadingCompleteActionIdPost(String actionId) { - logger.debug(String.format("Received POST unloading/complete/%s .", actionId)); - ContainerActionStatus cur = unloadingActions.getCurrentAction(); - if (cur != null && cur.getActionId().equals(actionId)) { - unloadingActions.completeCurrentAction(); - return new ResponseEntity<>(HttpStatus.CREATED); - } else { - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - - } -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java deleted file mode 100644 index daa9b4ddd..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.leidos.controller; - - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; - -@Controller -public class UserInterfaceController { - - - @GetMapping("/") - public String main( Model model) { - return "index"; - } - - @GetMapping("/loading") - public String loading() { - return "_loading"; - - } - @GetMapping("/unloading") - public String unloading() { - return "_unloading"; - - } - @GetMapping("/inspection") - public String inspection() { - return "_inspection"; - - } -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java deleted file mode 100644 index fb7c90140..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.leidos.inspection; - -import com.baeldung.openapi.api.InspectionApi; -import com.baeldung.openapi.model.InspectionRequest; -import com.baeldung.openapi.model.InspectionStatus; -import com.baeldung.openapi.model.InspectionStatus.StatusEnum; -import com.baeldung.openapi.model.InspectionStatusList; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * {@link InspectionActions} is a spring bean for managing inspections. Only - * allows for a single inspection to be in progress at a time and is stored as - * the {@link InspectionActions#currentInspection}. Any inspections requested - * while the current inspection is not yet completed will be added to - * {@link InspectionActions#pendingInspections} list. This list is then used to - * populate the current action after an action is completed. Each completed - * action is stored in the {@link InspectionActions#completedInspections} list. - * - * @author Paul Bourelly - */ -@Component -public class InspectionActions { - - private static Logger logger = LoggerFactory.getLogger(InspectionActions.class); - - // List of pending inspection statuses - private InspectionStatusList pendingInspections = new InspectionStatusList(); - - // List of completed inspections - private InspectionStatusList completedInspections = new InspectionStatusList(); - - // Current in progress action - private InspectionStatus currentInspection; - - /** - * Empty Constructor - */ - public InspectionActions() { - } - - /** - * Getter for pending inspection. - * - * @return {@link InspectionStatusList} list of pending inspection. - */ - public InspectionStatusList getPendingInspections() { - return pendingInspections; - } - - /** - * Getter for completed inspections. - * - * @return {@link InspectionStatusList} list of completed inspection. - */ - public InspectionStatusList getCompletedInspections() { - return completedInspections; - } - - /** - * Getter for current action. - * - * @return {@link InspectionStatus} current action. - */ - public InspectionStatus getCurrentInspection() { - return currentInspection; - } - - /** - * Create {@link InspectionStatus} for valid {@link InspectionRequest}s. Valid - * requests require vehicleId and containerId. Set as current inspection if none - * already exists or added to list of pending inspections if current inspection - * is still in progress. - * - * @param request {@link InspectionRequest} Request to load container. - */ - public void requestInspectionAction(InspectionRequest request) { - if (request != null) { - InspectionStatus inspectionStatus = new InspectionStatus(); - inspectionStatus.setContainerId(request.getContainerId()); - inspectionStatus.setVehicleId(request.getVehicleId()); - inspectionStatus.setActionId(request.getActionId()); - inspectionStatus.setStatus(StatusEnum.PENDING); - inspectionStatus.setRequested(System.currentTimeMillis()); - - // If no current action set as current action - if (currentInspection == null) { - currentInspection = inspectionStatus; - } - - // else add to list of pending action - else { - pendingInspections.addInspectionsItem(inspectionStatus); - } - } else { - logger.warn("Attempted to add null InspectionRequest!"); - } - - } - - /** - * Searches all inspections ( pending, current and completed ) for a given - * actionId and returns {@link InspectionStatus}. Returns null if non is found. - * - * @param actionId unique string to identify action - * @return {@link InspectionStatus} for given action. Null if no action is found - * or null action id is provided. - */ - public InspectionStatus getInspectionStatus(String actionId) { - if (actionId != null) { - // Pending actions ( null check since arraylist is initially null ) - if (pendingInspections.getInspections() != null) { - for (InspectionStatus inspectionStatus : pendingInspections.getInspections()) { - if (actionId.equals(inspectionStatus.getActionId())) { - return inspectionStatus; - } - } - } - // Current action - if (currentInspection != null && actionId.equals(currentInspection.getActionId())) { - return currentInspection; - } - // Completed actions ( null check since arraylist is initially null ) - if (completedInspections.getInspections() != null) { - for (InspectionStatus inspectionStatus : completedInspections.getInspections()) { - if (actionId.equals(inspectionStatus.getActionId())) { - return inspectionStatus; - } - } - } - logger.warn(String.format("No inspection action with action ID %s !", actionId)); - return null; - } - logger.warn("Null action id is not valid!"); - return null; - } - - /** - * To complete inspection set {@link InspectionActions#currentInspection} status - * to {@link StatusEnum#PASSED}. Current inspection is then added to the - * completed inspections list and the first pending action , if any are present - * is set as the new current action. If no pending actions are present the - * current action is set to null. - * - */ - public void completeInspection() { - if (currentInspection != null) { - // Set current inspection to PASSED - currentInspection.setStatus(StatusEnum.PASSED); - currentInspection.setCompleted(System.currentTimeMillis()); - completedInspections.addInspectionsItem(currentInspection); - // If there are any pending actions set them to current - if (pendingInspections.getInspections() != null && !pendingInspections.getInspections().isEmpty()) { - currentInspection = pendingInspections.getInspections().remove(0); - } - // else set current to null - else { - currentInspection = null; - } - - } else - logger.warn("No current inspection in progress!"); - } - - /** - * To indicate that the vehicle under inspection is required to proceed to the - * holding area for further inspection an operator will use this request to set - * {@link InspectionActions#currentInspection} status to. - * {@link StatusEnum#PROCEED_TO_HOLDING}. - */ - public void proceedToHolding() { - if (currentInspection != null) { - currentInspection.setStatus(StatusEnum.PROCEED_TO_HOLDING); - } else - logger.warn("No current inspection in progress!"); - } - - /** - * Vehicle under current inspection, which has been instructed to proceed to - * holding area by operator will indicate it has arrived at the holding area and - * is prepared for further inspection with this request which sets the status of - * the {@link InspectionActions#currentInspection} to - * {@link StatusEnum#HOLDING}. - */ - public void requestHolding() { - if (currentInspection != null) { - currentInspection.setStatus(StatusEnum.HOLDING); - } else - logger.warn("No current inspection in progress!"); - } - - /** - * Clear all inspection actions - */ - public void clear() { - if ( pendingInspections.getInspections() != null ) - pendingInspections.getInspections().clear(); - if ( completedInspections.getInspections() != null ) - completedInspections.getInspections().clear(); - currentInspection = null; - } - -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java deleted file mode 100644 index 97c3683ac..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.leidos.loading; - -import com.baeldung.openapi.model.ActionStatusList; -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * {@link LoadingActions} is a spring bean for managing loading actions. Only - * allows for a single loading action to be in progress at a time and is stored - * as the {@link LoadingActions#currentAction}. Any loading actions requested - * while the current action is not yet completed will be added to - * {@link LoadingActions#pendingActions} list. This list is then used to - * populate the current action after an action is completed. Each completed - * action is stored in the {@link LoadingActions#completedActions} list. - * - * @author Paul Bourelly - */ -@Component -public class LoadingActions { - - private static Logger logger = LoggerFactory.getLogger(LoadingActions.class); - - // List of all pending loading actions - private ActionStatusList pendingActions = new ActionStatusList(); - - // List of completed loading actions - private ActionStatusList completedActions = new ActionStatusList(); - - // Current Loading Action - private ContainerActionStatus currentAction; - - /** - * Empty Constructor. - */ - public LoadingActions() { - - } - - /** - * Getter for pending loading actions. - * - * @return {@link ActionStatusList} list of pending loading actions - */ - public ActionStatusList getPendingActions() { - return pendingActions; - } - - /** - * Getter for completed Actions. - * - * @return {@link ActionStatusList} list of completed actions - */ - public ActionStatusList getCompletedActions() { - return completedActions; - } - - /** - * Getter for current Action. - * - * @return {@link ContainerActionStatus} current in progress loading - */ - public ContainerActionStatus getCurrentAction() { - return currentAction; - } - - /** - * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. - * Valid requests require vehicleId and containerId. Valid request will be set - * as {@link LoadingActions#currentAction} if no current action is present or - * added to list of pending actions. - * - * @param request {@link ContainerRequest} Request to load container. - */ - public void requestLoadingAction(ContainerRequest request) { - if (request != null) { - ContainerActionStatus requestedAction = new ContainerActionStatus(); - requestedAction.setContainerId(request.getContainerId()); - requestedAction.setVehicleId(request.getVehicleId()); - requestedAction.setActionId(request.getActionId()); - requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); - requestedAction.setRequested(System.currentTimeMillis()); - // Add action to list of pending actions if an - // action is already in progress. Otherwise set - // as current action - if (currentAction != null) - pendingActions.addActionsItem(requestedAction); - else - currentAction = requestedAction; - } else { - logger.warn("Attempted to add null ContainerRequest!"); - } - - } - - /** - * Searches all loading actions ( pending, current and completed ) for a given - * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. - * - * @param actionId unique string to identify action - * @return {@link InspectionStatus} for given action. Null if no action is found - * or null action id is provided. - */ - public ContainerActionStatus getContainerActionStatus(String actionId) { - if (actionId != null) { - // First search pending loading actions ( null check since actions array is null - // before adding values ) - if (pendingActions.getActions() != null) { - for (ContainerActionStatus containerAction : pendingActions.getActions()) { - if (actionId.equals(containerAction.getActionId())) { - return containerAction; - } - } - } - // search current action - if (currentAction != null && actionId.equals(currentAction.getActionId())) { - return currentAction; - } - // Search completed loading actions ( null check since actions array is null - // before adding values ) - if (completedActions.getActions() != null) { - for (ContainerActionStatus containerAction : completedActions.getActions()) { - if (actionId.equals(containerAction.getActionId())) { - return containerAction; - } - } - } - logger.warn(String.format("No loading actions exist with action ID %s !", actionId)); - return null; - } - logger.warn("Null action id is not valid!"); - return null; - } - - /** - * Mark {@link LoadingActions#currentAction} as in progress by setting the - * {@link ContainerActionStatus#status} to {@link StatusEnum#LOADING}. - */ - public void startCurrentAction() { - if (currentAction != null) { - logger.debug(String.format("Starting loading for action %s", currentAction.toString())); - currentAction.setStatus(StatusEnum.LOADING); - } else - logger.warn("There is no current action!"); - } - - /** - * Mark {@link LoadingActions#currentAction} as complete and move it to the - * completedActions list. If there are pending actions, set the next pending - * action to current action, else set current action to null. - */ - public void completeCurrentAction() { - if (currentAction != null) { - currentAction.setStatus(ContainerActionStatus.StatusEnum.LOADED); - currentAction.setCompleted(System.currentTimeMillis()); - logger.debug(String.format("Complete loading for action %s", currentAction.toString())); - logger.debug(String.format("Complete loading for action %s", currentAction.toString())); - completedActions.addActionsItem(currentAction); - // Remove first item in list of pending actions and set it to current action - if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { - currentAction = pendingActions.getActions().remove(0); - } else { - currentAction = null; - } - } else - logger.warn("There is no current action!"); - - } - - /** - * Clear all loading actions - */ - public void clear() { - if ( pendingActions.getActions() != null ) - pendingActions.getActions().clear(); - if ( completedActions.getActions() != null ) - completedActions.getActions().clear(); - currentAction = null; - } - -} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java deleted file mode 100644 index 29692e0e1..000000000 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.leidos.unloading; - -import com.baeldung.openapi.model.ActionStatusList; -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * {@link UnloadingActions} is a spring bean for managing unloading actions. - * Only allows for a single unloading action to be in progress at a time and is - * stored as the {@link UnloadingActions#currentAction}. Any unloading actions - * requested while the current action is not yet completed will be added to - * {@link UnloadingActions#pendingActions} list. This list is then used to - * populate the current action after an action is completed. Each completed - * action is stored in the {@link UnloadingActions#completedActions} list. - * - * @author Paul Bourelly - */ -@Component -public class UnloadingActions { - - private static Logger logger = LoggerFactory.getLogger(UnloadingActions.class); - // List of all pending unloading actions - private ActionStatusList pendingActions = new ActionStatusList(); - - // List of completed unloading actions - private ActionStatusList completedActions = new ActionStatusList(); - - // Current unloading Action - private ContainerActionStatus currentAction; - - /** - * Empty Constructor - */ - public UnloadingActions() { - } - - /** - * Getter for pending unloading actions - * - * @return {@link ActionStatusList} list of pending unloading actions - */ - public ActionStatusList getPendingActions() { - return pendingActions; - } - - /** - * Getter for completed Actions - * - * @return {@link ActionStatusList} list of completed actions - */ - public ActionStatusList getCompletedActions() { - return completedActions; - } - - /** - * Getter for current Action - * - * @return {@link ContainerActionStatus} current in progress unloading - */ - public ContainerActionStatus getCurrentAction() { - return currentAction; - } - - /** - * Create {@link ContainerActionStatus} for valid {@link ContainerRequest}s. - * Valid requests require vehicleId and containerId. Valid request will be set - * as {@link UnloadingActions#currentAction} if no current action is present or - * added list of pending actions. - * - * @param request {@link ContainerRequest} Request to load container on to a - * vehicle - */ - public void requestUnloadingAction(ContainerRequest request) { - if (request != null) { - ContainerActionStatus requestedAction = new ContainerActionStatus(); - requestedAction.setContainerId(request.getContainerId()); - requestedAction.setVehicleId(request.getVehicleId()); - requestedAction.setActionId(request.getActionId()); - requestedAction.setStatus(ContainerActionStatus.StatusEnum.PENDING); - requestedAction.setRequested(System.currentTimeMillis()); - // Add action to list of pending actions if an - // action is already in progress. Otherwise set - // as current action - if (currentAction != null) - pendingActions.addActionsItem(requestedAction); - else - currentAction = requestedAction; - } else { - logger.warn("Attempted to add null ContainerRequest!"); - } - - } - - /** - * Searches all unloading actions ( pending, current and completed ) for a given - * actionId and returns {@link ContainerActionStatus}. Returns null if non is found. - * - * @param actionId unique string to identify action - * @return {@link InspectionStatus} for given action. Null if no action is found - * or null action id is provided. - */ - public ContainerActionStatus getContainerActionStatus(String actionId) { - if (actionId != null) { - // First search pending loading actions ( null check since actions array is null - // before adding values ) - if (pendingActions.getActions() != null) { - for (ContainerActionStatus containerAction : pendingActions.getActions()) { - if (actionId.equals(containerAction.getActionId())) { - return containerAction; - } - } - } - // search current action - if (currentAction != null && actionId.equals(currentAction.getActionId())) { - return currentAction; - } - // Search completed loading actions ( null check since actions array is null - // before adding values ) - if (completedActions.getActions() != null) { - for (ContainerActionStatus containerAction : completedActions.getActions()) { - if (actionId.equals(containerAction.getActionId())) { - return containerAction; - } - } - } - logger.warn(String.format("No unloading actions exist with action ID %s !", actionId)); - return null; - } - logger.warn("Null action id is not valid!"); - return null; - } - - /** - * Mark {@link UnloadingActions#currentAction} as in progress by setting the - * {@link ContainerActionStatus#status} to {@link StatusEnum#UNLOADING}. - */ - public void startCurrentAction() { - if (currentAction != null) { - currentAction.setStatus(StatusEnum.UNLOADING); - } else - logger.warn("There is no current action!"); - } - - /** - * Mark {@link UnloadingActions#currentAction} as complete and move it to the - * completedActions list. If there are pending actions, set the next pending - * action to current action, else set current action to null. - */ - public void completeCurrentAction() { - if (currentAction != null) { - currentAction.setStatus(StatusEnum.UNLOADED); - currentAction.setCompleted(System.currentTimeMillis()); - completedActions.addActionsItem(currentAction); - // Remove first item in list of pending actions and set it to current action - if (pendingActions.getActions() != null && !pendingActions.getActions().isEmpty()) { - currentAction = pendingActions.getActions().remove(0); - } else { - currentAction = null; - } - } else - logger.warn("There is no current action!"); - - } - - /** - * Clear all unloading actions - */ - public void clear() { - if ( pendingActions.getActions() != null ) - pendingActions.getActions().clear(); - if ( completedActions.getActions() != null ) - completedActions.getActions().clear(); - currentAction = null; - } -} diff --git a/tools/port-drayage-webservice/src/main/resources/application.properties b/tools/port-drayage-webservice/src/main/resources/application.properties deleted file mode 100644 index d01b3f16d..000000000 --- a/tools/port-drayage-webservice/src/main/resources/application.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# Keystore properties for SSL HTTPS hosting. Requires a java key store which can be generated using JDK with the following command : -# keytool -genkey -keyalg RSA -alias tutorial -keystore tutorial.jks -storepass password -validity 365 -keysize 4096 -storetype pkcs12 - -# server.ssl.key-store=src/main/resources/tutorial.jks -# server.ssl.key-store-type=pkcs12 -# server.ssl.key-store-password=password -# server.ssl.key-password=password -# server.ssl.key-alias=tutorial - -# Set UI and REST API server port -server.port=8090 - -# Spring boot actuator properties allow for rest endpoint exposure for monitoring spring bean status for debuging. Should be disable for production -# Documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html -management.endpoints.web.exposure.include=* - - -# Logging configuration - -# Set output log file -#logging.file=log/application.log - -# Set class/package level log level -#logging.level.com.leidos.loading.LoadingActions=DEBUG - -# Set root log level -#logging.level.root=INFO - - diff --git a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml deleted file mode 100755 index c8a30edfe..000000000 --- a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml +++ /dev/null @@ -1,427 +0,0 @@ -openapi: 3.0.0 -info: - title: Port Drayage Web Service. - description: Web Service for Loading/Unloading/Inspection interactions for Port Drayage Operations. - version: "1.0" -servers: - - url: http://127.0.0.1:8090 - description: Unsecured hosting for development - - url: https://127.0.0.1:8443 - description: Secured hosting for deployment -paths: - /reset: - post: - summary: Clear Web Service Actions - description: - Request will clear all actions in InspectionActions, LoadingActions, and UnloadingActions. - responses: - "201": - description: Created - /loading: - post: - summary: Request a container is loaded on to freight vehicle. - description: - Provide ContainerRequest JSON to request a container with a given id be loaded on a vehicle with a given id.\ - Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ - request will be discarded as duplicate and result in 400 response. - requestBody: - description: Request contains container ID, Vehicle ID and an Action ID - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ContainerRequest" - responses: - "201": - description: Created - "400": - description: Bad Request - /loading/pending: - get: - summary: List of all pending loading actions. - description: - Provides a list of ContainerActionStatus JSON objects describing the loading actions waiting to be started.\ - Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ - replace the current action after it is completed in a first-in first-out order. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ActionStatusList" - /loading/start/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Start a loading action. - description: - Will attempt to start current loading action. This REST endpoint is only intended for UI form submission. Will\ - be triggered on UI interaction to indicate a loading action has started. Will return 400 if provided action id is not \ - current action. - responses: - "201": - description: Created - "400": - description: Bad Request - /loading/complete/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Complete a loading action. - description: - Will attempt to complete current loading action. This REST endpoint is only intended for UI form submission. Will\ - be triggered on UI interaction to indicate a loading action has been completed. Will return 400 if provided action id is not\ - current action. - responses: - "201": - description: Created - "400": - description: Bad Request - /loading/{action_id}: - get: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Returns action with given ID - description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ContainerActionStatus" - "400": - description: Bad Request - /unloading: - post: - summary: Request a container is unloaded on to freight Vehicle. - description: - Provide ContainerRequest JSON to request a container with a given id be unloaded on a vehicle with a given id.\ - Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ - request will be discarded as duplicate and result in 400 response. - requestBody: - description: Request contains container ID, Vehicle ID and an Action ID - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ContainerRequest" - responses: - "201": - description: Created - /unloading/pending: - get: - summary: List of all pending unloading actions and status. - description: - Provides a list of ContainerActionStatus JSON describing the unloading actions waiting to be started.\ - Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ - replace the current action after it is completed in a first-in first-out order. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ActionStatusList" - /unloading/start/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Start an unloading action. - description: - Will attempt to start current unloading action. This REST endpoint is only intended for UI form submission. Will\ - be triggered on UI interaction to indicate a unloading action has started. Will return 400 if provided action id is not current\ - action. - responses: - "201": - description: Created - "400": - description: Bad Request - /unloading/complete/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Complete an unloading action. - description: - Will attempt to complete current unloading action. This REST endpoint is only intended for UI form submission. Will\ - be triggered on UI interaction to indicate an unloading action has been completed. Will return 400 if provided action id is not\ - current action. - responses: - "201": - description: Created - "400": - description: Bad Request - /unloading/{action_id}: - get: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Returns action with given ID - description: Returns action with given ID. If none is found returns 400. Intended for polling the status of a request action. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ContainerActionStatus" - "400": - description: Bad Request - /inspection: - post: - summary: Request a container is inspected on to Freight Vehicle. - description: - Provide InspectionRequest JSON to request a container with a given id be inspected on a vehicle with a given id.\ - Also requires an action id to uniquely identify the requested action. If an action already exists for a given action id\ - request will be discarded as duplicate and result in 400 response. - requestBody: - description: Request contains container ID and Vehicle ID - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/InspectionRequest" - responses: - "201": - description: Created - "400": - description: Bad Request - /inspection/holding/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Vehicle has arrive at Holding area an is waiting on inspection. - description: - After being instructed to proceed to holding area and navigating to holding area, vehicle will request further inspection at holding\ - area. This request will be sent from the PortDrayage V2X-Hub Plugin after receiving a vehicles arrival message at the holding area.\ - Will return 400 if not current action or status is not PROCEED_TO_HOLDING and discard request. - responses: - "201": - description: Created - "400": - description: Bad Request - /inspection/pending: - get: - summary: List of all pending inspection actions and status. - description: - Provides a list of InspectionStatus JSON objects describing the inspection actions waiting to be started.\ - Any action requested while there is a current action in progress will be added to this list. Actions in this list will\ - replace the current action after it is completed in a first-in first-out order. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/InspectionStatusList" - /inspection/complete/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Complete an inspection action. - description: - Will attempt to complete current inspection. This REST endpoint is only intended for UI form submission. Will\ - be triggered on UI interaction to indicate an inspection has been completed. Will return 400 if provided action id is not\ - current action. - responses: - "201": - description: Created - "400": - description: Bad Request - /inspection/hold/{action_id}: - post: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Request vehicle proceed to holding area for further inspection - description: Will attempt to request vehicle proceed to holding area for further inspection. Will return 400 if no current action - responses: - "201": - description: Created - "400": - description: Bad Request - /inspection/{action_id}: - get: - parameters: - - in: path - name: action_id - schema: - type: string - required: true - description: ID of action - summary: Returns action with given ID - description: Returns action with given ID. If non is found returns 400. Intended for polling inspection status. - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/InspectionStatus" - "400": - description: Bad Request -components: - schemas: - ContainerRequest: - title: Container Request - type: object - properties: - vehicle_id: - type: string - description: ID of vehicle - container_id: - type: string - description: ID of container - action_id: - type: string - description: ID of action - required: - - vehicle_id - - container_id - - action_id - ContainerActionStatus: - title: Container Action Status - type: object - properties: - vehicle_id: - type: string - description: ID of vehicle - container_id: - type: string - description: ID of container - action_id: - type: string - description: ID of action - status: - type: string - enum: - - LOADING - - UNLOADING - - LOADED - - UNLOADED - - PENDING - - ABORTED - requested: - type: integer - format: int64 - completed: - type: integer - format: int64 - required: - - vehicle_id - - container_id - - action_id - - status - - requested - ActionStatusList: - title: List of Container Action Status elements - type: object - properties: - actions: - type: array - items: - type: object - $ref: "#/components/schemas/ContainerActionStatus" - InspectionRequest: - title: Inspection Request - type: object - properties: - vehicle_id: - type: string - description: ID of vehicle - container_id: - type: string - description: ID of container - action_id: - type: string - description: ID of action - required: - - vehicle_id - - container_id - - action_id - InspectionStatus: - title: Inspection Status - type: object - properties: - vehicle_id: - type: string - description: ID of vehicle - container_id: - type: string - description: ID of container - action_id: - type: string - description: ID of action - status: - type: string - enum: - - PENDING - - PROCEED_TO_HOLDING - - PASSED - - FAILED - - HOLDING - requested: - type: integer - format: int64 - completed: - type: integer - format: int64 - required: - - vehicle_id - - container_id - - action_id - - status - - requested - InspectionStatusList: - title: List of Container Action Status elements - type: object - properties: - inspections: - type: array - items: - type: object - $ref: "#/components/schemas/InspectionStatus" diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/main.css b/tools/port-drayage-webservice/src/main/resources/static/css/main.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html b/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html deleted file mode 100644 index b92f5ad73..000000000 --- a/tools/port-drayage-webservice/src/main/resources/templates/_inspection.html +++ /dev/null @@ -1,117 +0,0 @@ -
-

Requested Inspection

-

- Inspection for vehicle : - - with container : - -

-
-

-

- - - -

Vehicle is proceeding to Holding Area.
-

-
-

Pending Inspections

- - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Action ID Requested
No Pending Inspections
- -

Completed Inspections

- - - - - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
- - \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_loading.html b/tools/port-drayage-webservice/src/main/resources/templates/_loading.html deleted file mode 100644 index cfa8f880e..000000000 --- a/tools/port-drayage-webservice/src/main/resources/templates/_loading.html +++ /dev/null @@ -1,115 +0,0 @@ -
-

Requested Loading Action

-

- Load vehicle : - - with container : - -

-
-

-

- - - -

-
-

Pending Loading Actions

- - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Actions ID Requested
No Pending Actions
- -

Completed Loading Actions

- - - - - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
- - \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html b/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html deleted file mode 100644 index 6bc7f9b21..000000000 --- a/tools/port-drayage-webservice/src/main/resources/templates/_unloading.html +++ /dev/null @@ -1,114 +0,0 @@ -
-

Requested Unloading Action

-

- Unload vehicle : - - with container : - -

-
-

-

- - - - -

-
-

Pending Unloading Actions

- - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Action ID Requested
No Pending Actions
- -

Completed Unloading Actions

- - - - - - - - - - - - - - - - - - - - - - - -
Vehicle ID Container ID Action ID Requested Completed
No Completed Actions
- - \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/index.html b/tools/port-drayage-webservice/src/main/resources/templates/index.html deleted file mode 100644 index bc02e3020..000000000 --- a/tools/port-drayage-webservice/src/main/resources/templates/index.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - CARMA Freight Web Service - - - - - - - - -
-
- -
-
- - -
-
-
-
-
- - - - - -
-
- -
- - - - - - -
- - - - - \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java deleted file mode 100644 index 9b8afb1d1..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/InspectionControllerTest.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.model.InspectionRequest; -import com.baeldung.openapi.model.InspectionStatus; -import com.baeldung.openapi.model.InspectionStatus.StatusEnum; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.leidos.inspection.InspectionActions; - -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; - -/** - * Test class for Inspection {@link RestController} bean - */ -@WebMvcTest(controllers = { InspectionController.class }) -public class InspectionControllerTest { - - @Autowired - private MockMvc mvc; - - @MockBean - private InspectionActions mockInspectionActions; - - private ObjectMapper mapper = new ObjectMapper(); - - /** - * Test GET /inspection {@link HttpStatus} is always OK. - * - * @throws Exception - */ - @Test - public void testGetInspection() throws Exception { - - mvc.perform(MockMvcRequestBuilders.get("/inspection/pending")).andExpect(MockMvcResultMatchers.status().isOk()); - } - - /** - * Test POST /inspection responses from {@link InspectionController}. - * - * @throws Exception - */ - @Test - public void testPostInspection() throws Exception { - - // Test response for valid payload - InspectionRequest request = new InspectionRequest(); - request.setVehicleId("vehicleId"); - request.setContainerId("containerId"); - request.setActionId("actionId"); - - mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); - - // Test response for empty post - mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON).content("")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Test response for invalid post - mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) - .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Mock duplicate request - InspectionStatus responseStatus = new InspectionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock already existing action for action ID - Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test POST /inspection/holding responses from {@link InspectionController}. - * - * @throws Exception - */ - @Test - public void testPostInspectionHolding() throws Exception { - - // Mock inspectionAction to have current action - InspectionStatus responseStatus = new InspectionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(InspectionStatus.StatusEnum.PROCEED_TO_HOLDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock current inspection - Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); - Mockito.when(mockInspectionActions.getInspectionStatus("actionId")).thenReturn(responseStatus); - - // Test response for valid payload - InspectionRequest request = new InspectionRequest(); - request.setVehicleId("vehicleId"); - request.setContainerId("containerId"); - request.setActionId("actionId"); - - // Correct - mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) - .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); - mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) - .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isCreated()); - - // Test response for non current action ( both incorrect vehicle and container - // id) - request.setActionId("wrong"); - mvc.perform(MockMvcRequestBuilders.post("/inspection/holding/" + request.getActionId()) - .contentType(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Test response for invalid post - mvc.perform(MockMvcRequestBuilders.post("/inspection").contentType(MediaType.APPLICATION_JSON) - .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test GET /inspection/{vehicleId} responses from {@link InspectionController}. - * - * @throws Exception - */ - @Test - public void testInspectionVehicleIdGet() throws Exception { - - InspectionStatus responseStatus = new InspectionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setStatus(InspectionStatus.StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - Mockito.when(mockInspectionActions.getInspectionStatus("vehicleId")).thenReturn(responseStatus); - - // Test response for get loading/{vehicleId} for existing request - mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) - .andExpect(MockMvcResultMatchers.status().isOk()); - mvc.perform(MockMvcRequestBuilders.get("/inspection/vehicleId")) - .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); - - // Test response for get loading/{vehicleId} for non-existent request - mvc.perform(MockMvcRequestBuilders.get("/inspection/no-existent")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - } - - /** - * Test inspection/complete/{action_id} POST - */ - @Test - public void testInspectionCompleteActionIdPost() throws Exception { - // Create current action - InspectionStatus responseStatus = new InspectionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); - Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/inspection/complete/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test inspection/hold/{action_id} POST - */ - @Test - public void testInspectionHoldActionIdPost() throws Exception { - // Create current action - InspectionStatus responseStatus = new InspectionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockInspectionActions.getCurrentInspection()).thenReturn(responseStatus); - Mockito.when(mockInspectionActions.getInspectionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/inspection/hold/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } -} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java deleted file mode 100644 index d37a5f68d..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/LoadingControllerTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.leidos.loading.LoadingActions; - -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; - -@WebMvcTest(controllers = { LoadingController.class }) -public class LoadingControllerTest { - - @Autowired - private MockMvc mvc; - - @MockBean - private LoadingActions mockLoadingActions; - - private ObjectMapper mapper = new ObjectMapper(); - - /** - * Test GET /loading {@link HttpStatus} is always OK. - * - * @throws Exception - */ - @Test - public void testGetLoading() throws Exception { - - mvc.perform(MockMvcRequestBuilders.get("/loading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); - } - - /** - * Test POST /loading responses from {@link LoadingController}. - * - * @throws Exception - */ - @Test - public void testPostLoading() throws Exception { - - // Test response for valid payload - ContainerRequest request = new ContainerRequest(); - request.setVehicleId("vehicleId"); - request.setContainerId("containerId"); - request.setActionId("actionId"); - - mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); - - // Test response for empty post - mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON).content("")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Test response for invalid post - mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) - .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Mock already existing duplicate action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); - responseStatus.setRequested(System.currentTimeMillis()); - Mockito.when(mockLoadingActions.getContainerActionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - mvc.perform(MockMvcRequestBuilders.post("/loading").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test GET /loading/{vehicleId} responses from {@link LoadingController}. - * - * @throws Exception - */ - @Test - public void testLoadingVehicleIdGet() throws Exception { - - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.LOADING); - responseStatus.setRequested(System.currentTimeMillis()); - - Mockito.when(mockLoadingActions.getContainerActionStatus("vehicleId")).thenReturn(responseStatus); - - // Test response for get loading/{vehicleId} for existing request - mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")).andExpect(MockMvcResultMatchers.status().isOk()); - mvc.perform(MockMvcRequestBuilders.get("/loading/vehicleId")) - .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); - - // Test response for get loading/{vehicleId} for non-existent request - mvc.perform(MockMvcRequestBuilders.get("/loading/no-existent")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - } - - /** - * Test loading/complete/{action_id} POST - */ - @Test - public void testLoadingCompleteActionIdPost() throws Exception { - // Create current action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/loading/complete/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test unloading/start/{action_id} POST - */ - @Test - public void testUnloadingStartActionIdPost() throws Exception { - // Create current action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockLoadingActions.getCurrentAction()).thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/loading/start/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - -} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java deleted file mode 100644 index 9ae3e4751..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/controller/UnloadingControllerTest.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.leidos.controller; - -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.leidos.unloading.UnloadingActions; - -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; - -@WebMvcTest(controllers = { UnloadingController.class }) -public class UnloadingControllerTest { - - @Autowired - private MockMvc mvc; - - @MockBean - private UnloadingActions mockUnloadingActions; - - private ObjectMapper mapper = new ObjectMapper(); - - /** - * Test GET /unloading {@link HttpStatus} is always OK. - * - * @throws Exception - */ - @Test - public void testGetUnloading() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/unloading/pending")).andExpect(MockMvcResultMatchers.status().isOk()); - } - - /** - * Test POST /unloading responses from {@link UnloadingController}. - * - * @throws Exception - */ - @Test - public void testPostUnloading() throws Exception { - - // Test response for valid payload - ContainerRequest request = new ContainerRequest(); - request.setVehicleId("vehicleId"); - request.setContainerId("containerId"); - request.setActionId("actionId"); - - mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isCreated()); - - // Test response for empty post - mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON).content("")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Test response for invalid post - mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) - .content("{ \"invalid\": \"json\"}")).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - // Mock already existing duplicate action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); - responseStatus.setRequested(System.currentTimeMillis()); - Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - mvc.perform(MockMvcRequestBuilders.post("/unloading").contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(request))).andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test GET /unloading/{vehicleId} responses from {@link UnloadingController}. - * - * @throws Exception - */ - @Test - public void testUnloadingVehicleIdGet() throws Exception { - - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.UNLOADING); - responseStatus.setRequested(System.currentTimeMillis()); - - Mockito.when(mockUnloadingActions.getContainerActionStatus(responseStatus.getActionId())) - .thenReturn(responseStatus); - - // Test response for get loading/{vehicleId} for existing request - mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) - .andExpect(MockMvcResultMatchers.status().isOk()); - mvc.perform(MockMvcRequestBuilders.get("/unloading/actionId")) - .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(responseStatus))); - - // Test response for get loading/{vehicleId} for non-existent request - mvc.perform(MockMvcRequestBuilders.get("/unloading/no-existent")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - } - - /** - * Test unloading/complete/{action_id} POST - */ - @Test - public void testUnloadingCompleteActionIdPost() throws Exception { - // Create current action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/unloading/complete/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - - /** - * Test unloading/start/{action_id} POST - */ - @Test - public void testUnloadingStartActionIdPost() throws Exception { - // Create current action - ContainerActionStatus responseStatus = new ContainerActionStatus(); - responseStatus.setContainerId("containerId"); - responseStatus.setVehicleId("vehicleId"); - responseStatus.setActionId("actionId"); - responseStatus.setStatus(ContainerActionStatus.StatusEnum.PENDING); - responseStatus.setRequested(System.currentTimeMillis()); - - // Mock return responseStatus as current action - Mockito.when(mockUnloadingActions.getCurrentAction()).thenReturn(responseStatus); - - // Assert 201 response when current action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", responseStatus.getActionId())) - .andExpect(MockMvcResultMatchers.status().isCreated()); - - // Assert 400 response when incorrect action ID is provided - mvc.perform(MockMvcRequestBuilders.post("/unloading/start/{actionId}", "wrong")) - .andExpect(MockMvcResultMatchers.status().isBadRequest()); - - } - -} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java deleted file mode 100644 index 304a5c5f2..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/inspection/InspectionActionsTest.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.leidos.inspection; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.baeldung.openapi.model.InspectionRequest; -import com.baeldung.openapi.model.InspectionStatus; -import com.baeldung.openapi.model.InspectionStatus.StatusEnum; - -import org.junit.jupiter.api.BeforeEach; - -/** - * Test Class to test {@link InspectionActions} class. - * - * @author Paul Bourelly - */ -public class InspectionActionsTest { - - private InspectionActions inspectionActions; - - /** - * Init to run before each test - */ - @BeforeEach - public void init() { - // Initialize Inspection Action Bean - inspectionActions = new InspectionActions(); - } - - /** - * Test case to test {@link InspectionActions#getInspectionStatus(String)} and - * {@link InspectionActions#requestInspectionAction(InspectionRequest)} for - * different possible inputs. - */ - @Test - public void requestInspectionTest() { - // Returns null when provided null vehicleId - assertNull(inspectionActions.getInspectionStatus(null)); - - // requestInspectionAction does not throw exceptions for null parameters - inspectionActions.requestInspectionAction(null); - - // Populate Inspection actions with inspection requests - InspectionRequest req1 = new InspectionRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("inspectionA"); - - // Returns null before inspection is requested - assertNull(inspectionActions.getInspectionStatus(req1.getActionId())); - assertNull(inspectionActions.getCurrentInspection()); - - // Current action and inspection status returns action after inspection is - // requested - inspectionActions.requestInspectionAction(req1); - assertEquals(req1.getVehicleId(), inspectionActions.getCurrentInspection().getVehicleId()); - assertEquals(req1.getContainerId(), inspectionActions.getCurrentInspection().getContainerId()); - assertEquals(req1.getVehicleId(), inspectionActions.getInspectionStatus(req1.getActionId()).getVehicleId()); - assertEquals(req1.getContainerId(), inspectionActions.getInspectionStatus(req1.getActionId()).getContainerId()); - - // Attempt to request new inspection while another inspection is in progress - InspectionRequest req2 = new InspectionRequest(); - req2.setVehicleId("vehicleC"); - req2.setContainerId("containerC"); - req2.setActionId("inspectionC"); - inspectionActions.requestInspectionAction(req2); - InspectionStatus status = inspectionActions.getCurrentInspection(); - - // Current Action is still first request - assertEquals(req1.getContainerId(), status.getContainerId()); - assertEquals(req1.getVehicleId(), status.getVehicleId()); - - // New inspection request is in pending inspection list - InspectionStatus pending = inspectionActions.getPendingInspections().getInspections().get(0); - assertEquals(req2.getVehicleId(), pending.getVehicleId()); - assertEquals(req2.getContainerId(), pending.getContainerId()); - } - - /** - * Test case to test {@link InspectionActions#completeInspection()} for - * different possible parameters. - */ - @Test - public void completeInspectionTest() { - // Populate Inspection actions with inspection requests - InspectionRequest req1 = new InspectionRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("inspectionA"); - - InspectionRequest req2 = new InspectionRequest(); - req2.setVehicleId("vehicleB"); - req2.setContainerId("containerB"); - req2.setActionId("inspectionB"); - - InspectionRequest req3 = new InspectionRequest(); - req3.setVehicleId("vehicleC"); - req3.setContainerId("containerC"); - req3.setActionId("inspectionC"); - - // Calling complete inspection with no current inspection does not add any - // inspection to completed list - inspectionActions.completeInspection(); - assertNull(inspectionActions.getCompletedInspections().getInspections()); - - inspectionActions.requestInspectionAction(req1); - inspectionActions.requestInspectionAction(req2); - inspectionActions.requestInspectionAction(req3); - - // Completed Inspections is empty before completing any inspection but - // inspection is in inspectionActions list of in progress inspections - assertNull(inspectionActions.getCompletedInspections().getInspections()); - - InspectionStatus req1Status = inspectionActions.getInspectionStatus(req1.getActionId()); - InspectionStatus req2Status = inspectionActions.getInspectionStatus(req2.getActionId()); - InspectionStatus req3Status = inspectionActions.getInspectionStatus(req3.getActionId()); - - // First request becomes current action and additional requests are added to - // pending inspections - assertEquals(req1Status, inspectionActions.getCurrentInspection()); - assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req2Status)); - assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); - - // Complete inspection adds current inspection to completedInspections list and - // sets next pending action as currentAction - inspectionActions.completeInspection(); - - assertTrue(inspectionActions.getCompletedInspections().getInspections().contains(req1Status)); - assertEquals(req2Status, inspectionActions.getCurrentInspection()); - assertTrue(inspectionActions.getPendingInspections().getInspections().contains(req3Status)); - assertNotNull(req1Status.getCompleted()); - assertEquals(InspectionStatus.StatusEnum.PASSED, req1Status.getStatus()); - - // Completing inspection when no pending actions are left sets current action to - // null - // req2Status - inspectionActions.completeInspection(); - - // req3Status - inspectionActions.completeInspection(); - - assertNull(inspectionActions.getCurrentInspection()); - assertEquals(3, inspectionActions.getCompletedInspections().getInspections().size()); - - // Get InspectionStatus will return most recent inspection even when it is completed - // for a given vehicleID - assertEquals(req3Status, inspectionActions.getInspectionStatus(req3.getActionId())); - } - - /** - * Test case to test {@link InspectionActions#requestHolding()} method and - * holding vehicle interactions. - */ - @Test - public void requestHoldingTest() { - // Populate Inspection actions with inspection requests - InspectionRequest req1 = new InspectionRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - - // Call proceed to holding with no current action - assertNull(inspectionActions.getCurrentInspection()); - inspectionActions.proceedToHolding(); - - // Call request holding with to current action - inspectionActions.requestHolding(); - assertNull(inspectionActions.getCurrentInspection()); - - // Request Inspection - inspectionActions.requestInspectionAction(req1); - InspectionStatus req1Status = inspectionActions.getCurrentInspection(); - - assertEquals(StatusEnum.PENDING, req1Status.getStatus() ); - - // Proceed To Holding - inspectionActions.proceedToHolding(); - - assertEquals(StatusEnum.PROCEED_TO_HOLDING, req1Status.getStatus() ); - - // Request Holding - inspectionActions.requestHolding(); - - assertEquals(StatusEnum.HOLDING, req1Status.getStatus() ); - - // Complete - inspectionActions.completeInspection(); - assertEquals(StatusEnum.PASSED, req1Status.getStatus() ); - - } -} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java deleted file mode 100644 index dae1c3400..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/loading/LoadingActionsTest.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.leidos.loading; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class LoadingActionsTest { - - public LoadingActions loadingActions; - - /** - * Init to run before each test - */ - @BeforeEach - public void init() { - // Initialize Inspection Action Bean - loadingActions = new LoadingActions(); - } - - /** - * Test case to test {@link LoadingActions#getContainerActionStatus(String)} and - * {@link LoadingActions#requestLoadingAction(ContainerRequest)} for different - * possible inputs. - */ - @Test - public void requestLoadingActionTest() { - // Returns null when provided null vehicleId - assertNull(loadingActions.getContainerActionStatus(null)); - - // requestLoadingAction does not throw exceptions for null parameters - loadingActions.requestLoadingAction(null); - - // Populate Loading actions with Loading requests - ContainerRequest req1 = new ContainerRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("actionA"); - - // Returns null before loading action is requested - assertNull(loadingActions.getContainerActionStatus(req1.getActionId())); - assertNull(loadingActions.getCurrentAction()); - - // Returns action after loading action is requested - loadingActions.requestLoadingAction(req1); - assertEquals(req1.getVehicleId(), loadingActions.getCurrentAction().getVehicleId()); - assertEquals(req1.getContainerId(), loadingActions.getCurrentAction().getContainerId()); - - // Attempt to request new loading action for vehicle with already pending - // loading action - ContainerRequest req2 = new ContainerRequest(); - req2.setVehicleId("vehicleA"); - req2.setContainerId("containerC"); - req2.setActionId("actionC"); - loadingActions.requestLoadingAction(req2); - ContainerActionStatus status = loadingActions.getCurrentAction(); - assertEquals(req1.getContainerId(), status.getContainerId()); - } - - /** - * Test case to test - * {@link LoadingAction#completeCurrentAction(com.baeldung.openapi.model.ContainerActionStatus)} - * for different possible parameters. - */ - @Test - public void completeLoadingTest() { - // Populate loading actions with loading requests - ContainerRequest req1 = new ContainerRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("actionA"); - - ContainerRequest req2 = new ContainerRequest(); - req2.setVehicleId("vehicleB"); - req2.setContainerId("containerB"); - req2.setActionId("actionB"); - - ContainerRequest req3 = new ContainerRequest(); - req3.setVehicleId("vehicleC"); - req3.setContainerId("containerC"); - req3.setActionId("actionC"); - - // Run completeCurrentAction with no current action - assertNull(loadingActions.getCurrentAction()); - loadingActions.completeCurrentAction(); - - // Run startCurrentAction with no current action - assertNull(loadingActions.getCurrentAction()); - loadingActions.startCurrentAction(); - - loadingActions.requestLoadingAction(req1); - loadingActions.requestLoadingAction(req2); - loadingActions.requestLoadingAction(req3); - - // Completed actions is empty before completing any loading action but - // loading action is in loadingActions list of in progress actions - assertNull(loadingActions.getCompletedActions().getActions()); - ContainerActionStatus req1Status = loadingActions.getContainerActionStatus(req1.getActionId()); - ContainerActionStatus req2Status = loadingActions.getContainerActionStatus(req2.getActionId()); - ContainerActionStatus req3Status = loadingActions.getContainerActionStatus(req3.getActionId()); - - // First requested action becomes current action and each action requested after - // is added to - // pending actions - assertEquals(req1Status, loadingActions.getCurrentAction()); - assertTrue(loadingActions.getPendingActions().getActions().contains(req2Status)); - assertTrue(loadingActions.getPendingActions().getActions().contains(req3Status)); - - - - // Start current action sets status to LOADING - assertEquals(StatusEnum.PENDING, loadingActions.getCurrentAction().getStatus()); - loadingActions.startCurrentAction(); - assertEquals(StatusEnum.LOADING, loadingActions.getCurrentAction().getStatus()); - - // Current action status is set to LOADED and added to completedActions list. - // Current action is replaced with next action in pending actions - // Complete req1 - loadingActions.completeCurrentAction(); - - assertTrue(loadingActions.getCompletedActions().getActions().contains(req1Status)); - assertNotNull(req1Status.getCompleted()); - assertEquals(ContainerActionStatus.StatusEnum.LOADED, req1Status.getStatus()); - assertEquals(req2Status, loadingActions.getCurrentAction()); - - // Complete req2 - loadingActions.completeCurrentAction(); - - assertTrue(loadingActions.getCompletedActions().getActions().contains(req2Status)); - assertNotNull(req2Status.getCompleted()); - assertEquals(ContainerActionStatus.StatusEnum.LOADED, req2Status.getStatus()); - assertEquals(req3Status, loadingActions.getCurrentAction()); - assertTrue(loadingActions.getPendingActions().getActions().isEmpty()); - - // Complete req3 - loadingActions.completeCurrentAction(); - - assertNull(loadingActions.getCurrentAction()); - assertEquals(3, loadingActions.getCompletedActions().getActions().size()); - - // Get ContainerActionStatus will return most recent action even when it is - // completed - // for a given vehicleID - assertEquals(req3Status, loadingActions.getContainerActionStatus(req3.getActionId())); - - } -} diff --git a/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java b/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java deleted file mode 100644 index edb0e47ce..000000000 --- a/tools/port-drayage-webservice/src/test/java/com/leidos/unloading/UnloadingActionsTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.leidos.unloading; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.baeldung.openapi.model.ContainerActionStatus; -import com.baeldung.openapi.model.ContainerRequest; -import com.baeldung.openapi.model.ContainerActionStatus.StatusEnum; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class UnloadingActionsTest { - public UnloadingActions unloadingActions; - - /** - * Init to run before each test - */ - @BeforeEach - public void init() { - // Initialize Inspection Action Bean - unloadingActions = new UnloadingActions(); - } - - /** - * Test case to test {@link UnloadingActions#getContainerActionStatus(String)} - * and {@link UnloadingActions#requestUnloadingAction(ContainerRequest)} for - * different possible inputs. - */ - @Test - public void requestLoadingActionTest() { - // Returns null when provided null vehicleId - assertNull(unloadingActions.getContainerActionStatus(null)); - - // requestLoadingAction does not throw exceptions for null parameters - unloadingActions.requestUnloadingAction(null); - - // Populate unloading actions with unloading requests - ContainerRequest req1 = new ContainerRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("actionA"); - - // Returns null before unloading action is requested - assertNull(unloadingActions.getContainerActionStatus(req1.getActionId())); - - // Returns action after unloading action is requested - unloadingActions.requestUnloadingAction(req1); - assertEquals(req1.getVehicleId(), unloadingActions.getCurrentAction().getVehicleId()); - assertEquals(req1.getContainerId(), unloadingActions.getCurrentAction().getContainerId()); - - // Attempt to request new unloading action with already pending - // unloading action - ContainerRequest req2 = new ContainerRequest(); - req2.setVehicleId("vehicleC"); - req2.setContainerId("containerC"); - req2.setActionId("actionC"); - unloadingActions.requestUnloadingAction(req2); - ContainerActionStatus status = unloadingActions.getCurrentAction(); - assertEquals(req1.getContainerId(), status.getContainerId()); - } - - /** - * Test case to test - * {@link LoadingAction#completeCurrentAction(ContainerActionStatus)} for - * different possible parameters. - */ - @Test - public void completeLoadingTest() { - // Populate loading actions with loading requests - ContainerRequest req1 = new ContainerRequest(); - req1.setVehicleId("vehicleA"); - req1.setContainerId("containerA"); - req1.setActionId("actionA"); - - ContainerRequest req2 = new ContainerRequest(); - req2.setVehicleId("vehicleB"); - req2.setContainerId("containerB"); - req2.setActionId("actionB"); - - ContainerRequest req3 = new ContainerRequest(); - req3.setVehicleId("vehicleC"); - req3.setContainerId("containerC"); - req3.setActionId("actionC"); - - // Run completeCurrentAction with no current action - assertNull(unloadingActions.getCurrentAction()); - unloadingActions.completeCurrentAction(); - - // Run startCurrentAction with no current action - assertNull(unloadingActions.getCurrentAction()); - unloadingActions.startCurrentAction(); - - unloadingActions.requestUnloadingAction(req1); - unloadingActions.requestUnloadingAction(req2); - unloadingActions.requestUnloadingAction(req3); - - // Completed actions is empty before completing any loading action but - // loading action is in unloadingActions list of in progress actions - assertNull(unloadingActions.getCompletedActions().getActions()); - ContainerActionStatus req1Status = unloadingActions.getContainerActionStatus(req1.getActionId()); - ContainerActionStatus req2Status = unloadingActions.getContainerActionStatus(req2.getActionId()); - ContainerActionStatus req3Status = unloadingActions.getContainerActionStatus(req3.getActionId()); - - // First requested action becomes current action and each action requested after - // is added to - // pending actions - assertEquals(req1Status, unloadingActions.getCurrentAction()); - assertTrue(unloadingActions.getPendingActions().getActions().contains(req2Status)); - assertTrue(unloadingActions.getPendingActions().getActions().contains(req3Status)); - - // Start current action sets status to UNLOADING - assertEquals(StatusEnum.PENDING, unloadingActions.getCurrentAction().getStatus()); - unloadingActions.startCurrentAction(); - assertEquals(StatusEnum.UNLOADING, unloadingActions.getCurrentAction().getStatus()); - - // Current action status is set to UNLOADED and added to completedActions list. - // Current action is replaced with next action in pending actions - // Complete req1 - unloadingActions.completeCurrentAction(); - - assertTrue(unloadingActions.getCompletedActions().getActions().contains(req1Status)); - assertNotNull(req1Status.getCompleted()); - assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req1Status.getStatus()); - assertEquals(req2Status, unloadingActions.getCurrentAction()); - - // Complete req2 - unloadingActions.completeCurrentAction(); - - assertTrue(unloadingActions.getCompletedActions().getActions().contains(req2Status)); - assertNotNull(req2Status.getCompleted()); - assertEquals(ContainerActionStatus.StatusEnum.UNLOADED, req2Status.getStatus()); - assertEquals(req3Status, unloadingActions.getCurrentAction()); - assertTrue(unloadingActions.getPendingActions().getActions().isEmpty()); - - // Complete req3 - unloadingActions.completeCurrentAction(); - - assertNull(unloadingActions.getCurrentAction()); - assertEquals(3, unloadingActions.getCompletedActions().getActions().size()); - - // Get ContainerActionStatus will return most recent action even when it is - // completed - // for a given vehicleID - assertEquals(req3Status, unloadingActions.getContainerActionStatus(req3.getActionId())); - } -} From 0ab59fa7c51f7b3181d55c2ed6e103d2c336e3e9 Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Mon, 13 Dec 2021 05:39:53 -0500 Subject: [PATCH 15/17] Issue-287: Update docker-compose image tags to 6.2 release (#288) --- configuration/amd64/docker-compose.yml | 6 +++--- configuration/arm64/docker-compose.yml | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index 3e11f945e..8bdd188e0 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -19,7 +19,7 @@ services: - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql php: - image: usdotfhwaops/php:latest + image: usdotfhwaops/php:6.2 container_name: php network_mode: host depends_on: @@ -28,7 +28,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:v2xrelease_6.2 + image: usdotfhwaops/v2xhubamd:6.2 container_name: v2xhub network_mode: host restart: always @@ -42,7 +42,7 @@ services: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + image: usdotfhwaops/port-drayage-webservice:6.2 container_name: port_drayage_webservice network_mode: host secrets: diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index d00bc28f6..b63d9df3f 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -19,10 +19,8 @@ services: - ./mysql/:/docker-entrypoint-initdb.d/ php: - image: php:7.2.2-apache + image: usdotfhwaops/php:6.2 container_name: php - volumes: - - ../../web/:/var/www/html/ network_mode: host depends_on: - db @@ -30,7 +28,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubarm:v2xrelease_6.2 + image: usdotfhwaops/v2xhubarm:6.2 container_name: v2xhub network_mode: host restart: always @@ -44,7 +42,7 @@ services: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice:v2xrelease_6.2 + image: usdotfhwaops/port-drayage-webservice:6.2 container_name: port_drayage_webservice network_mode: host secrets: From 5a36e37566377776efe402af5e7578c6353afce1 Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Mon, 13 Dec 2021 05:43:38 -0500 Subject: [PATCH 16/17] UI Updates for Port Drayage Web Service (#290) * UI Updates for Port Drayage Web Service * Final UI updates + Clean up css files + Added comments + Renamed main to landing page + Inspection Tab only available at PORT area --- tools/port-drayage-webservice/pom.xml | 1 - .../src/main/java/com/leidos/area/Area.java | 16 ++ .../main/java/com/leidos/area/AreaBean.java | 28 ++ ...ontroller.java => UIActionController.java} | 35 ++- .../controller/UserInterfaceController.java | 26 +- .../leidos/inspection/InspectionActions.java | 16 ++ .../com/leidos/loading/LoadingActions.java | 16 ++ .../leidos/unloading/UnloadingActions.java | 16 ++ .../resources/port-drayage-webservice.yml | 19 +- .../src/main/resources/static/css/index.css | 99 ++++++++ .../src/main/resources/static/css/landing.css | 31 +++ .../src/main/resources/static/css/main.css | 77 ++++++ .../static/images/icons/inspection.png | Bin 0 -> 4165 bytes .../resources/static/images/icons/loading.png | Bin 0 -> 4833 bytes .../static/images/icons/unloading.png | Bin 0 -> 5003 bytes .../static/images/logos/CARMA_Streets.png | Bin 0 -> 17975 bytes .../static/images/logos/FHWALogo_2.png | Bin 0 -> 18506 bytes .../resources/static/images/logos/marad.png | Bin 0 -> 23183 bytes .../main/resources/templates/_inspection.html | 64 +++-- .../main/resources/templates/_loading.html | 47 ++-- .../main/resources/templates/_unloading.html | 49 ++-- .../src/main/resources/templates/index.html | 240 +++++++++++------- .../src/main/resources/templates/landing.html | 80 ++++++ 23 files changed, 695 insertions(+), 165 deletions(-) create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/area/Area.java create mode 100644 tools/port-drayage-webservice/src/main/java/com/leidos/area/AreaBean.java rename tools/port-drayage-webservice/src/main/java/com/leidos/controller/{ResetController.java => UIActionController.java} (55%) create mode 100644 tools/port-drayage-webservice/src/main/resources/static/css/index.css create mode 100644 tools/port-drayage-webservice/src/main/resources/static/css/landing.css create mode 100755 tools/port-drayage-webservice/src/main/resources/static/images/icons/inspection.png create mode 100755 tools/port-drayage-webservice/src/main/resources/static/images/icons/loading.png create mode 100755 tools/port-drayage-webservice/src/main/resources/static/images/icons/unloading.png create mode 100644 tools/port-drayage-webservice/src/main/resources/static/images/logos/CARMA_Streets.png create mode 100644 tools/port-drayage-webservice/src/main/resources/static/images/logos/FHWALogo_2.png create mode 100644 tools/port-drayage-webservice/src/main/resources/static/images/logos/marad.png create mode 100644 tools/port-drayage-webservice/src/main/resources/templates/landing.html diff --git a/tools/port-drayage-webservice/pom.xml b/tools/port-drayage-webservice/pom.xml index f3df86964..e146696c0 100644 --- a/tools/port-drayage-webservice/pom.xml +++ b/tools/port-drayage-webservice/pom.xml @@ -92,7 +92,6 @@ spring-boot com.baeldung.openapi.api com.baeldung.openapi.model - true ApiUtil.java diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/area/Area.java b/tools/port-drayage-webservice/src/main/java/com/leidos/area/Area.java new file mode 100644 index 000000000..f1b6f2ed9 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/area/Area.java @@ -0,0 +1,16 @@ +package com.leidos.area; + +public enum Area { + STAGING_AREA("STAGING_AREA"), + PORT_AREA("PORT_AREA"); + private String name; + + Area(String name){ + this.name =name; + } + + public String getName(){ + return name; + } + +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/area/AreaBean.java b/tools/port-drayage-webservice/src/main/java/com/leidos/area/AreaBean.java new file mode 100644 index 000000000..6fcb09511 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/area/AreaBean.java @@ -0,0 +1,28 @@ +package com.leidos.area; + +import org.springframework.stereotype.Component; + +@Component +public class AreaBean { + + private Area area; + + /** + * Empty Constructor. + */ + public AreaBean() { + + } + + public void stagingArea() { + area = Area.STAGING_AREA; + } + + public void portArea() { + area = Area.PORT_AREA; + } + + public Area getArea() { + return area; + } +} diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UIActionController.java similarity index 55% rename from tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java rename to tools/port-drayage-webservice/src/main/java/com/leidos/controller/UIActionController.java index f054d9f03..708ad8695 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/ResetController.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UIActionController.java @@ -1,6 +1,8 @@ package com.leidos.controller; -import com.baeldung.openapi.api.ResetApi; +import com.baeldung.openapi.api.UiactionApi; +import com.leidos.area.Area; +import com.leidos.area.AreaBean; import com.leidos.inspection.InspectionActions; import com.leidos.loading.LoadingActions; import com.leidos.unloading.UnloadingActions; @@ -14,9 +16,9 @@ @RestController -public class ResetController implements ResetApi { +public class UIActionController implements UiactionApi { - private static Logger logger = LoggerFactory.getLogger(ResetController.class); + private static Logger logger = LoggerFactory.getLogger(UIActionController.class); /** * Injected {@link LoadingActions} Spring Bean @@ -35,16 +37,41 @@ public class ResetController implements ResetApi { */ @Autowired private InspectionActions inspectionActions; + + /** + * + */ + @Autowired + private AreaBean areaBean; /** * {@inheritDoc} */ @Override - public ResponseEntity resetPost() { + public ResponseEntity uiactionResetPost() { inspectionActions.clear(); unloadingActions.clear(); loadingActions.clear(); logger.warn("Web Service Actions were cleared!"); return new ResponseEntity(HttpStatus.OK); } + + /** + * {@inheritDoc} + */ + @Override + public ResponseEntity uiactionAreaAreaPost(String area) { + if ( area.equals(Area.STAGING_AREA.getName())) { + areaBean.stagingArea(); + return new ResponseEntity<>(HttpStatus.CREATED); + } + else if ( area.equals(Area.PORT_AREA.getName())) { + areaBean.portArea(); + return new ResponseEntity<>(HttpStatus.CREATED); + } + else { + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); + } + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java index daa9b4ddd..cf276d3a6 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/controller/UserInterfaceController.java @@ -1,6 +1,10 @@ package com.leidos.controller; +import com.leidos.area.Area; +import com.leidos.area.AreaBean; + +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -8,11 +12,18 @@ @Controller public class UserInterfaceController { + @Autowired + public AreaBean areaBean; + @GetMapping("/") public String main( Model model) { - return "index"; - } + if ( areaBean.getArea() != null ) + return "index"; + else { + return "landing"; + } + } @GetMapping("/loading") public String loading() { @@ -29,4 +40,15 @@ public String inspection() { return "_inspection"; } + + /** + * Keeping access to landing page under this URL for testing purposes. + * @return + */ + @GetMapping("/debug/landing") + public String main() { + return "landing"; + + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java index fb7c90140..b3c8c2896 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/inspection/InspectionActions.java @@ -202,4 +202,20 @@ public void clear() { currentInspection = null; } + /** + * Method to return the number of waiting actions for UI tab notification + */ + public int waitingActions() { + if ( pendingInspections.getInspections() != null && !pendingInspections.getInspections().isEmpty()) { + // plus one for current action + return pendingInspections.getInspections().size() + 1; + } + else if ( currentInspection != null ) { + return 1; + } + else { + return 0; + } + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java index 97c3683ac..fce9f187c 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/loading/LoadingActions.java @@ -182,4 +182,20 @@ public void clear() { currentAction = null; } + /** + * Method to return the number of waiting actions for UI tab notification + */ + public int waitingActions() { + if ( pendingActions.getActions() != null && !pendingActions.getActions().isEmpty() ) { + // plus one for current action + return pendingActions.getActions().size() + 1; + } + else if ( currentAction != null ) { + return 1; + } + else { + return 0; + } + } + } diff --git a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java index 29692e0e1..23255a828 100644 --- a/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java +++ b/tools/port-drayage-webservice/src/main/java/com/leidos/unloading/UnloadingActions.java @@ -177,4 +177,20 @@ public void clear() { completedActions.getActions().clear(); currentAction = null; } + + /** + * Method to return the number of waiting actions for UI tab notification + */ + public int waitingActions() { + if ( pendingActions.getActions() != null && !pendingActions.getActions().isEmpty() ) { + // plus one for current action + return pendingActions.getActions().size() + 1; + } + else if ( currentAction != null ) { + return 1; + } + else { + return 0; + } + } } diff --git a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml index c8a30edfe..403b87d28 100755 --- a/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml +++ b/tools/port-drayage-webservice/src/main/resources/port-drayage-webservice.yml @@ -9,7 +9,7 @@ servers: - url: https://127.0.0.1:8443 description: Secured hosting for deployment paths: - /reset: + /uiaction/reset: post: summary: Clear Web Service Actions description: @@ -17,6 +17,23 @@ paths: responses: "201": description: Created + /uiaction/area/{area}: + post: + parameters: + - in: path + name: area + schema: + type: string + required: true + description: Area Enumeration indicating where web service is deployed. + summary: Select Area Of Operations. + description: Indicates where the web service is deployed. Possible valid area of operations include PORT_AREA and STAGING_AREA + responses: + "201": + description: Created + "400": + description: Invalid Request + /loading: post: summary: Request a container is loaded on to freight vehicle. diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/index.css b/tools/port-drayage-webservice/src/main/resources/static/css/index.css new file mode 100644 index 000000000..dba98161e --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/static/css/index.css @@ -0,0 +1,99 @@ +/* Index Page Style Sheet */ + +/* Navigation bar holds tabs and CARMA-Streets logo*/ +.navigation-bar{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; +} +/*Overwrite bootstrap nav-tabs class stop tabs from wrapping when screen is resized*/ +.nav-tabs{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} +.carma-streets-logo{ + width: auto; + max-height: 90px; +} +/* Align icons to bottom of tab */ +.icons{ + max-height:40px; + max-width: 60px; + align-self: flex-end; +} +/* Style individual tabs */ +.tabs{ + display: flex; + clear: both; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-self: center; + width: 100%; + height: 100%; + /* overwrite some of the nav-link styling */ + border: 2px black solid !important; + border-bottom: none !important; + color: lightgray !important; +} +/* Overwrite active tab styling for green backgrould */ +.nav-link.active{ + /* Override bootstrap styling */ + background-color: hsla(120, 100%, 25%, 0.4) !important; + border: 2px black solid !important; + border-bottom: none !important; + color: black !important; + outline: none !important; + box-shadow: none !important; +} +/* Set tab label styling */ +.tab-label{ + align-self: flex-end; + margin-left: 7px; + margin-bottom: 0 !important; +} +/* Overwrite bootstrap badge style for notification badges for tabs */ +.badge { + height: fit-content; + color: black; +} + +/* Styling for Tab Content */ + +/* Add border to bootstrap tab content styling*/ +.tab-content{ + border: 2px black solid; + padding: 10px; +} +/* Overwrite bootstrap jumbotron styling for dialog popup */ +.jumbotron{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + padding: 1rem 1rem !important; +} +/* Left part of dialog popup*/ +.action-dialog-left{ + width: 60%; + height: 100%; +} +/* Right part of dialog popup*/ +.action-dialog-right{ + width: 40%; + color: darkblue; + border: 2px black dashed ; + border-radius: 5px; + display: flex; + justify-content: center; + align-items: center; + font-size: xxx-large; +} +/* Clear Actions button styling */ +.clear-button{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; +} \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/landing.css b/tools/port-drayage-webservice/src/main/resources/static/css/landing.css new file mode 100644 index 000000000..1d163e918 --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/static/css/landing.css @@ -0,0 +1,31 @@ +/* Landing Page Style Sheet */ +/* */ +.main-splash{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; +} +/* Style CARMA-Streets Description */ +.main-splash-description{ + width: 80%; +} + +/* Style CARMA-Streets Logo */ +.splash-logo{ + width: 60%; + max-height: 45%; + margin-top: 20px; +} + +/* Style container holding area selection buttons */ +.area-select{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; +} +/* Style buttons to be the same size */ +.area-select-btn{ + width: 190px; +} \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/static/css/main.css b/tools/port-drayage-webservice/src/main/resources/static/css/main.css index e69de29bb..ba236d8aa 100644 --- a/tools/port-drayage-webservice/src/main/resources/static/css/main.css +++ b/tools/port-drayage-webservice/src/main/resources/static/css/main.css @@ -0,0 +1,77 @@ +/* Main Style Sheet */ + +/*Overwrite container class from bootstrap to occupy 100% of vertical + and horizontal space. Container contains all page content including + footer.*/ +.container{ + position: relative; + min-height: 100vh; + min-width: 100%; +} + +/*Contains all context except footer. Padding at the bottom to make room +for footer.*/ +.content-wrap { + padding-bottom: 2.5rem; +} + +/*Styling for footer panel. Split into thirds for logos, version, and copyright. + Positioned at absolute bottom. Using flex-box space around to make footer + elements be left, center and right justified.*/ +.footerPanel{ + width: 100%; + clear: both; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + align-items: center; + position: absolute; + bottom: 0; + width: 100%; +} + +/*Footer element styling*/ +.marad-logo{ + max-height: 40px; + align-self: center; + margin-left: 10px; +} +/*Marad logo has approximately twice as much white space as FHWA logo */ +.fhwa-logo{ + max-height:80px; + align-self: center; + margin-right: 10px; +} +/* Container holding both FHWA and MARAD logos */ +.logos{ + display:flex; + width: 33%; +} +/* Copyright right aligned */ +.copyright{ + width: 33%; + text-align: right !important; + padding: 0px 10px; + font-family: Roboto; + font-weight: normal; + font-size: 80%; + color: #000000; + display: block; +} +/* Version text center aligned */ +.version { + width: 33%; + text-align: center !important; + padding: 0px 10px; + font-family: Roboto; + font-weight: normal; + font-size: 80%; + color: #000000; + display: block; + +} + + + + diff --git a/tools/port-drayage-webservice/src/main/resources/static/images/icons/inspection.png b/tools/port-drayage-webservice/src/main/resources/static/images/icons/inspection.png new file mode 100755 index 0000000000000000000000000000000000000000..e2353d83b4d75dd374a0a696994e50034dd3953f GIT binary patch literal 4165 zcmV-L5W4S)P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGr5dZ)e5dq33^FIIp586pYK~!i%)mv$F zl+_tV+zQs7s@=4u9xHo7AYn;z`#kU5Z|0jV^Ce6?@SOAJo9`~~eed(#``$He z91h2APG`(Me`#Ze(;53|TwL4$JS%mO2aS!5b&wH~2szi_`K68%D5WlBXU|as9_p_o zkq-9&2?Txm^i~pJXmU7Qy>x;`CP+z1b|)arnoxdJO-+sJ)-BPSfG{-icXD!)+PGo8 zZvrBiO#v`?F-vT0Oofj20@^BLV`FXl)q_VL8RT1ZT%5}%z~Qj7k^&v%3uZ8&gWP~E z3;2wWkJHg1G}vs>I$B-QL4nX({;gk|2}@*JfuRVMlh0=Wr2k9*3;@ioMLf+{NlD!m z+Qn#(qNJpxAMu%x5Pct?!GL@XE)&gcP=rK=vdH`)k+#w0a!MwmXOC2Q>S#Aiit_kG zbE$B-Y_a^!#EFSrB@@AF5R40eSCMlK>V2Goekug4+ptkhPM@Mu(CkAhFc7S2An$f& z#B;I^3Xi^h``!X2do7Bun=u2Nlre!7L2v7;v-tv4JfMGu1;3j9=?g;%EII(5Dj^3X zA_&Y%cJ3_q67N;wm?{AP6wcK@eW2S<+oHlkbpc*2BO}AD$gBjPdtYG`PX%tU5p1}(Uo@g5jToKD9Jd>Wq->Dw<{FyEb1BWu>{R3NUz z2cbA&CbR42SeT4nt)qQm;^ds}(c*|>FgO%%FH^K^;erLU;7$uI*4x-v^0;y1lxd7; z&+uj|0WRxT55g+3f{;qkPYTgWgZYmD0dGBYHeW!=M`&2{kYGS01v>kOv^*5(Zkt0* za}dfHe76()cxXAl*FkRh8-pg754H+iu9(LRLC1KUuATAhU2$=-&q(4h@HYn2xJzZF zrHXT%DO1u_cRjwss8N!@-xz#TjBM@}NM$K0Dec_h&gkaS?sB=uX_R-hsHjlc?KYK? znk)twn4Oj7F)F|qmn#;`I9}7QjK2UQzJoE#b&w@McU$_Tw+ae`iMqNvDUg^yZ=QGu zP8VN%@dXJ3I~@XyxmG~$t&pp0^Yax4i_4cUOJQa_(6^5oKkjAu4I|ucoA5UV?PW1P z2mPE`5dNf&x7lo6@0G+RK<{l(+_+--GI4Elbdv1GC8#;KPqHhhtqnxdvno2uW`PjuEmG-V9dS`Mvu3%Fb7s$$_iw)WCcF^_{Ee~My5EEMG=`ZaDk|!B#-p(J7U$)vCk8*ECQX_w z-SzzW^HMNp$O|wGYTVRZSJ32V@&^i7a`^BenTl^O+o@KsS*sp-3wr+tv`OwZY$acB>At`#I<82B3lL&mf8t{BIrPtQ;`_^bWi?G8kOaBr{BykdSa6+R;p; zJFbH*!EU!_E?>T^iiO5QCr5d14{$iyzO7h{`RM3T)ul^kb?W2^8Z$e<7;~GTCq;a< zHqbMdv4YP(|2!WB$Sg4@XOR?6)YaC?NIwJfoQ@qks1x6PM?>D1O#a5WT)vwhi2o1` zH%`A=0&Ce&-=JL1ShZwvo;JgaBS#L)NPqg&DH?J}XA3muS^?$RWCVKEvSmwk@m_EW z(g}>5J}rhE)Y;sKq%lxFkL`knaANL{ciwqhb?zLc&YnF(LxOIB2ecV}XS1LoH|S_O z#nJkw51>4c^I$GdxRd0MO8As6Fr>O#+VozX%@_X0uyFk|02ui4FdF|uzj{DJu7VNn z!mQ0-BZZq$v2U;Vl&Y$8WMrq#7KkQ{X=}`T3G}RPdVX?~JH!nrUwZlSB`{)F>)u?e zi}zyB?%kewGSZgnY{3!A7&xsyaCC0Z2+$Dtj?Vg30Oc#VGswaU3O4HEy(ll=A$~*~ zvQ1|Tjix>mKM6j~7_f32PdV!_Ktt$3*+mOB1~CMlHX4Rpym*m@6zObDqbXy!1HpHs z@$tS;p3gNj7xY`UY}UnlQL=rTuvP0eWV6l|9{$Go154agV{e8)S&8-aSCtKg6&Dw} zOE+N~Ts>Vr8TsOiFAnQ$))3AZf1te2rf0k+tjx=vMu~0g$w>EE8@$vC0Yt}3Vsm+@~A7L7f_ zm_k@aur`BUbPOWrG88o4ql`l#C2S)P_3x*)mF!SO+e&4Ve#A4+NE=~0VtZm*^L)lK zf*GTK27nB3g0y<|S{PG~wRXDf5_64BUjsu{>7=b|3v%P&$tnUUlU*8q%ktI3P8$V*oMtJY1cd0H#pY=Ii3Y?!~s%1y-|t5)3W1$ zcZ`Khgp7kk>EO_?Ld?K{QMV^1CbkbJefzfYOb1&N%^?OPjE2Zb*H>SDsg55zCW9Hm zY9PaPvOt6*299erCr@reV#7&;%N6rGomGHY<3Q-xVcfup1gsE)N{@wHAPGCMTM_WV;!PbJf zcXc;g3S);r&w0ot_?ZzpS*rkLP3Q3=H!rzM#@k-p*5!vf1~mRg4)KMzX`zRFB|ohm%#px+-LY$eHYlNa+|Qc_gl z&8Y|hcHa!)nqF$YVf{KOmwOM37v}}-G6qOiUT!XJlvc#OtCvQ(;G%(=$r)vO`mZ7@wU`<`-ux;ZAq3OBen)c<>$7yH`(XA+L-d zr>f4K)iH|WwfAPCKf)1%{@f8hWIEO*dFW0&^A0MA&qcSImXdPq!!mf_9baCgsBdVf zSF2X7gpY6tDXUhlR97stkOKz}sNTJMiBp|0;Z=3!%oz!X?g~iw%K_ntfid~oe^j8m zOauYxA!G^&e8pz7d9Ff`B!3Z_s`? z5w!$g4eY6*wla)|XSLuh>8k5O2O{-nhc&>LEKo=Pc5*m@_Yse>V z0%IzA^yqP?PT~U?eFsF&D@n+rg$u+NaJIU6^CnAOhU=eXtZ_KX%zAyMs;Tj`kS&mi zt;fO=gRbGgO!oOE)CIrPe99ZaOc`9oFc~s%nt+Mzd ziF4;>tGYT*nx$!JX?gTX=*pIN@S2Tq#L(#?z7E~xVi>7KI+)t3iVX z$|NmgdZsEZ->r&@OVosk6X9Rt#PO1#Dzu=YLJ$J-I9$)4KTlo0B$GL)lGCIgQZEQ; z_SR;z5snzss3gvpBT^{wyEDyyW~sVxp+=1w^}GzHW5$e8C1vGuq{^e!(jB|hhJsCM z=+L1;1RW|#%FS8ixpxme9KD1P1J@fdmM3_qOb1lvudEnH4o=HQ3?BhP$}o9bsz#0+ zDgS9}w?|7?>5Jd<&|NcZT+P8PFc``;ej^a53&wzjE^~ViK3@Yb<$cpXtnKRVz;ZLirTehgPdJzY3 zI{ROwVT<5D#@wc}TE=xj3?_E@96_4Xl~CE=pyDea-$MQe*$R0A;i3Nlq#3v_h`Ao| zeG$VWS_NX#bkKDVObKR?7(83=h!)D912J_s+Mzyd{uV7JMOP!jXw&BZZiG{#5ja@A P00000NkvXXu0mjf2ac>& literal 0 HcmV?d00001 diff --git a/tools/port-drayage-webservice/src/main/resources/static/images/icons/loading.png b/tools/port-drayage-webservice/src/main/resources/static/images/icons/loading.png new file mode 100755 index 0000000000000000000000000000000000000000..be53ffa13e56677e089e0a850f9b03e48b8216a2 GIT binary patch literal 4833 zcmV<75+3b|P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGr5dZ)e5dq33^FIIp5_U;MK~!i%?VAT! z7DpP#KT#B7!v+c#us{q}EWzGl#Tx6y?%852DT*aAHc&90iY3vgx#toEy8@D;XHBtO z+Id95XpFHR3W%Jj2y^d$zMaqA{pM>l#rS`o-!rrCl%3f!yF2@iL83-VXtz!(p-ug! zghK6=5Mn0Aj-4=0Y`D97Fdo?G5Fvl=bXJGZ})z@qbYSyfY&|qjB(8L%qCYZuQhYo*-@W_#)2?$9d-C*$dulIO^ z)VFUx&33QeeKgxb|5n2Mk+Tv)r<4%tN}xG{#~VUw8?lKH!nQWEkgyZ-0zgP@BTzuS zt=W)aUSQ0azcLpW7qyY?i~HOZ-y0pPPBR#$O?xwoTGEzpC@NCK$(U%AI!;@Ry?f~J z;Va6fVd0`h56R}IY$CmGSa|qDWz(u2HzOb9PwXSG10NW2BaB3=jZvehn?;ok^<}QEFCZ~WArfh;SFg$Z@~Z>e5PxIx z6bvaMJ&JB7TmdOc+iqJ@&*&)ss$e{YvP^ zp8ZNxri#Sx#wZsmyGW?VA#B60*`o=)WO)Dy4MV&*p;j>hc5MNHUa~xZD^^)Z!i5;LqwS-+;K#-7_$SW0+^)eavA2?`=3&b#9v}jSYG(8I!g{rp=cz|rd zModg>+VPX8_8{J}WlM~v{9&?hUtB6|DDH~gC}?`vD6pB%>s8M5{Hg)PW9+JB81hr<)n*C_tpuwh=s71CBfq^a9&Rx5c z6_c5^Z{L~Hy!p#0k8hz|>0N@iRH0BxG=44LDrCYLzyRS%;QD%jc&b%|_<*=Zw1$Dy zhfrUOuMqzs@OfPyh8zg{adH5QT1s3cTJWvhsSbg+6TE@+gu#M7A=LMkeZ2J2OYamZ zQiR^rU9-Hrs^0bV^vbkGg9Z&VF$`E!*|KiZvI6XJI2%e)Mvz18v&2!;^>Ix^;^sCnxhpT2oR|63>gU zbeS^JI@OT!w*vsvTaL<}7XyH-6y|RS1lzW4=Z&+bzI|VnmbC;)-+{YCniY_4%`BeR#tmS-QQDa^8XX`1s;fLAfUhH3Z682S}rJ z1|#%rm@wgWwtCH4781II)vi;=JdYKI4I9o@u8d$y!ope8rp=^zY!ML9goQ8tfY;OS z)&9~vgm#+V+sB9b`n{;mpke?1e@gAZ#nqJ!9{d++8rZpWx74mDYU_5X9Sj>jg1NZ3 zs%=_z=+KcT^wIqVpi|AKz(7VuMi@8hG;!iYp6=`GN7b zhsICpn4>7WgD0Es*hz=BLl^_b;84$A&HI*awYWvRN8m=!iS)A$*1!ygRUtz-fvJ>MFxV-)Ld+*_ z6N?G_Pqas-r?>-jBFuz8K9~Z*(YEzzXG@q}m`wbaz@>-T2TPJQ&=#nZ3#SA}3x9{K z`r^=IK9ulQHZ{u5&K^euDw{H477u^5J|(Kcppt0R148}BN(S;E??!`%hX*fM#nUt0 z)6*+MKZm2n!=rNMwd>dMPGeCK5fNFkvMMsXysD-ZD^`qQKFZtM8}D6^=)kvp%esyc z#txJ&ZT%;So-0?cDovGZ(V|7ta+YY(vX$_W5;pGnV?$pP$h*;C>o1R&8DjbSSWsY> z(4|X%D9y4@>+CrCpg`||M>Z}Wp`U*KSz2C(qyyjZE$cc;Ag^N`C{dz>(nQO;o1QK$ zYY9mQvI*IIs2b!!UdK8B>eTU7nktv9j5Q=3a0JIY0LG3RuQXSy%9X1~^IPMIbO3DF zxJhZYQJp(?k><0-6YBu@<;+>$_>d5d_ku&@z5@=v3+Wj-YP8gDFM%yu=B@*D0Hssj z1;vF6$>JM9)<9d}o5c`B$UJEZl0k&5fwtfskR`BMwQ8}@#bNO3eqt7$L^Ea>eRb?%MsP4|uT1j`Q0Jb#F&Z0T-hurGEdRi0(4Zmnv-0y}`;J{w zJAlt_?>>B`fmPsQ3-3T#8rTvUrQXI=ykR}T{jLH60zNOJ{FufsrGNeF$LNJ2p^?!s zv3FntJ9h5Mq!4~t8lNpUH@BTHzF3#%adRuj&YU@W@V&Y7B9EUqX_~56mVkVQ{1(`Z zUrH2mPM$nNn5vV$Ap(~9CbBX%|&TNaP|=0 zym|8_qtz%%GyUQs$*1%w!E_Y2@7RI2J}$ENQ2fr>^clej%|v->VU_{Wg$wy-B^TNK zYt^dF?L8IGK5J^#iaX@7x^-WoqO3M-6c%}3@oO}0GRvzcCQh7W%GiM}m$`G_=iY$A zMxT_LqpQ{`8geP%z_oDk;w7wn`3ff6^=sFyc{OugzI;VYnb6B&Wn4fe=QyOorb z@{h?=rn2hQtFsX!Mlu?Sex$l{I%%9I!aL8;g#O6F)z;=r^K<1+SapEgM}P1Im}J2G z@^j^*FzJqUBl?4n$#xIoxe7oP2sm1Rro=n~cLsmlK3D#!G-2sSAO4@grRJ&rMO)Z4 zn}{dy?H)rU5%>xE4m}Bq;b3Fc75vZOK#|)AD~2pQE8u)_lE8_?2Qfa_ zUnX+vK449~39MVkO4!&u26b*H@Y(CI#KHcGzyZO*ow;tJgu*c_>O?@31)ThoWa^93~^Ynk2&K? zggwfs?|DwxX!!KgPu*X8ZDcDaCnp^2I9FF!_^PDWtJh$|(4ixP)~)-b{@S%08Z23| ztjU4}i<>#ZoH_FXqM~+mdHC?*O-v$WXJ?-!{z)9N!9mJ?gu)b*yLmHd(})pc{bl=* z5fT#KblI|q#-i=RhmY#fv}yB@8a2EVF}Gc;STVS6?V>&p?bxwvn-wcos2z)BCjegD z)d-wKT!4;(a&Rg-MX2lDXlUQQ(^UQZd0v9GTDII;Y{^lt5l8X%_PMxz{dzG`D?0&r z_T=`NgO>^6Rv_5O*UjYS@1!jX!wJCOQQD384tah8^m={*?8L>zg|9~yU?RSD?b__x zHS4~OwzPEVQjFW0y7BXi#&Bsn9Oaof0YO1MjYq2h_02cmO55Tn&&(ZArHUu}{s;Vb z$bY^4&U9%Ta>6tB41gy=dV0F?NaeBO;=Z6E$W6N6obt>*ghLlEF&?!%(ABHga=ZrC z7IvHf{K;!b;0wHN4nVmE1m?oj_2%yh03IHd*|*<*XFQ5IP*zqpcTSSkombd#0`iOe zKLLWa?b@;A|o^w`~>tP z#M+MW;@k*_OzyZ1a{VdSMt(uh;E)JDN8SWIcQJW=oeYW6?4D*vwh8S-EoMrFE#V z?*#Ph*_$0Wc!>GEXnB2r9)JIOY&V^Z9zi{&>Gn{sUVV1x@DbLhZ$D|e40QUVkJho7 zGiOQDa|#aV#~U{Ci$RtyW8k2{e8EUHx^QLb1fDmB5h{ZjD^^CZ2@_v8vt#PHU%&or z#*AQU+${EL{{gI2N%O@O!-fs#cZA+7SiHF`9gJ$p8Li`vt=O&jSH`RX-m zWh>IKZln!iS@dSm150iY6_hC9LPOA=RHPw~T4d|8Z(m%>3okr&$Oo9YB;iEcCCcmb z*_Oz=h^h$<<#S8#P+a3pO*X%?XA{rXu3blyzgzbn?7@RfcuVA1X=&-Jnl;nTK{aaB znEi42^7m*b@(9tk6ESE0`~{l)SUItK_wE~%Rtx#;RzhOpW{mF?H9=S2BdW;k;0sY& zD@?*6D!{swl#~>!E*NT29peTJ9H^-S!(dWUl0_eXDpQTd<(uj&5Nlcv9z2YRD2wY_ ztcl7MIdbG^f>`$=!1@CzpOQHf* zjvPJqJH~r#3aVAFPH#JVQt9?yO?lb@-0IOWvFTz#lAt6#7xwQzaER2PcpSX4gfZ^{ZY zH67`~JbCIAzMwI_q8)v1+`JjHWJ!3I{&)q@-EigV)i{bfE~>cvxpU`!){lesfaO8w z&tHhAI;zmNL!vT8Q&R3k4jnd3TDLXa+}v1P+~;^swWjS{i|T2&FYfdI>4zeF7(Zbm z``^8L8z`PTQ6ripocr~sNpHMCuX>gng5`YU#!p}g35huH&B>N4Q5}_U-M+myENm(B z(hUV_oQpg2wZQb+`d=zDglu^(s&~}EgNJV6EzH@un6w?h$EPL>4_}&n=g!^jR0gYq z@>WzS*1Gq;fB*iRirJ literal 0 HcmV?d00001 diff --git a/tools/port-drayage-webservice/src/main/resources/static/images/icons/unloading.png b/tools/port-drayage-webservice/src/main/resources/static/images/icons/unloading.png new file mode 100755 index 0000000000000000000000000000000000000000..d0ebd94b3dbb8a9acc9814abfc69bbe911780d99 GIT binary patch literal 5003 zcmV;66Ljo}P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGr5dZ)e5dq33^FIIp6Cg=MK~!i%?VAgH zPDkFyLkNOK*Y3WSs%!Lh`>+z1C@qV+MqJu$(V|@qUE;R;dF}g_wl1sceoNxAREx-! zB;+cHB<|WJ_XH(av_-BG5i;-pH_tgw&U2o5o}A}-k|_22e7?`jnVB5*NqM3&%;+T20#$&J-o5*whFy7A{AJ@^*r~`vMJ)d2*$ck+PIwQnCuE z6U$PaAigA7$}pZ>c>;c-V`7n~+(EOlC- z&rB@yHBn2H2Iw<04cE&ia8mG+6eglEAt!gQ`Rj$WGKjJP?2LV+fcj7ah*GMP? z1Eog%$WY%A^24Eq>yG4Fq92GhIr=NxKAS^s0oieh#0JV-CPZXxJs({CjA4}O9%FjQ@D6Pc>96oYP%1$hG zdQ}0&s85hlE9_u|FkST*a4^z*0VGjh50vi((1Z}B1J?*q=0NAEZEw$Bd8H-y2L|!C zmH{(q1P0f^!GU$_-rXo3gocH4_tjTh@pMvnMFMB%4)n4J;QpyJVw1z|X;=;StFKnE zSzfdC;Y!~BU@~|8==}E1&dNBw^amKHZ`iO=f1HzZeFHhl#AuejlAr6-PZyR-cR-dw z<`A1RcP=X`D&7J=3F93u@}q-e>FF64A|fL1!OtTUqBQg26c-n7M?UcL2w9Y%85|II zA(0RG)5qPXHYJ=O5utpyfxH(!t+RlWL9EtrzCea=NHVPk* zGl|>8Hv}qgO6Fbxrs>$RGHG-!(V(Ii1Jioq7p>}-p=OGUJ0~-e_)87 z$`pPmQlD1K|HMQkv}4VGqB5BpNt?pvN}RoLp-Vzi()*Tx3oS1%k0fGLL?JFYHPuUW zo+(bAJ&R9l$hu09OwOb`HEF`!-1;(CS67B{vnY)@I(6#I1`HU$+O*M4>R5w4eSNsN zxUjx``?4lYUKXYyj4R>oEuNkN@y8Q{;WCRp`;19bz(!z6p;yJsm06A*ix-B2&E7uh zFhgNxn;h1tabr9gF1k<(VC+jcAog%v1`kw;(qJ`-r-_J+H27YSKcgHS9g%NSU8q3Lj2nY-kPR%_oFW0x~ z#pD!>boE-hb{*!c=&`Jee9caZ1q1}iUtLH$o(Gc1@AOJb-G}Yiv18$iMF}0=efK?{ zP{i&%d&|i+sr>vxjCO_R)~iecOIIyIoWc`yTPZpD3 zo)gm~N?)IPtNHo)`P<0-ND8)Cl#g>+S=my$j&?*+~d6A^l{t6>#BM4<_(9*gVs0M!zL6frbiU z!B}~dl$F4;ta_cPWaucg`>w3XiP?*qbX^^crAn+ILLBxa0kSCTqGVIOGua?I$uP5V&de~)KpAKT3-ngKKgMdw1RIBpf-a7 z$jh9mtU3Oh5M7`agn^t+ojbFE0|#2QNaEz=#N6E6n5%0~s}^WvTDNY)-hA^-*0EzJ zVZ4NK;Osebnb+(&`eWD)d;9vbKmM_YK{^rk_I3E)3=}Sh_37ir4upmoq^k^6-q&{v zt6jUcJ`6T#Cd|bQ0~ReZz0w2wWEWRgVVsP&@hXm_xw zSBD!WcU(NdJWOtoOaf-+r*Sd=&JEKhsp>^WFb>qT+;C56n) zY(E~TR#9;=%(Z!3<(SeCX4^{~J6EkQS0_R#F+9h{)(%Ttjwtc5M2Uj~|36G1zfcrccj81{YlztO&9`P3EoD(Y6YJD9{cfRa3?tXP^78Ty!uFTE zdPcdsqXKggZ%&k^*_t)$SS`i5=nUeH94VkU%~qR~cHV#i0}ZYLd%N!4zmHjYZK6!D z`Z*7)pX8q^1#1?a(;q9ZWo2bc$ZxeRAXWQfQ^10-PvE)-%1L726aEFOY1O|XF zR0Be10<$J{BgkMiLD+M@P}Qp&fsNYgM!+jgHrslk8WKj1uvWpUA&f%sFWFAKPz|UB z0Sh+K+xj;IEE0zEqZg`H;nU-1VjF>Vdh9@e5dyxAP7@^r*7{$l3WcX0`&_V$pGDwf z5*C42-pA+GRSB51V3R8LZ~cxKOspobPX>*K@43Z9528NtLS}@Uj`1~aI*dOs@_``; zZaRjlwhDWAT#3&KGz{{`#^1HXn}puhwHov`Q9!5%7F7)%)X{`RYDXxabl5pzv}5fK zE^CEtahS8kzbS@*MJT#D*o%xM^pg`-3g#L3*NSdjbzxF+_kykhHyz*P=*NG_2ABAU zzCyroCxZA<0{>E2C$%QD2p^Z$?tZY2Q>RY-*T^wrdeOl@h>O4b{qI?qE?usS9zFVV ze}Dhi3knK4UcP*}>&cTRdn6_%x>N^8j~;b7DhRg)TyIKBO1Im$Z+E_X_im>ZD^?75 zcX$7yd-v|ity{Nd_3GEhdnlTiHF)q~*M!rjJ2A%46+)&OLd&YU7FDdg%S`k1T!`(4 zSlbQWAI=xfuwGjeU}5{jsWU7;zksD@Wb%bOT!$!aRf2MYLPEJI5XxJ&d#0^LV+Y#e)7S}NVP>Jjx;?A-b9tE{`Spdr2{uy}>tQr3bgq1}XG z-c{8Qs7zILLt2II>QE$gS2q4TENF=8qbeE#-2}GZWMpQsTet79|J=H5KygWlbnC1W zUf6ej{K+6slyj9vRfpq_+1yP%Hw~c#H$_clX0w$EA9|tT5!4kKeszn=w}$7kAw*O~ zLxdfSpg}ZAy10JB{FFvzLPH#ih~_s;l)tTD^6y|o z^wVvKnh@Q~F~lK)8x4~S^HZ}(>0pAomsmu|Q`9w~r_vCxp1|S{3dVl*>H=km!Ycz- zfIt*i9iS|%&OIVTH>|p_Tc8RsOWSts*cV?cW`RM$>|Z-~vGp4^vNdbgvdunQn14VJ z`*!zk_Q3~}`Nj&-`L@uZ!)xq|#Yu;#+O>EVw)y$j9-sd04_U-fMWji`H z6rNv|I66AA4<=86RWdJo<7OYWdi5G|z1j91U$czi#K=+X=&^YAr$K{+@mhgh`qE|pq_X$0X3d%j)2JCbbQn9HkjO@i z7%7amh4JIZvt#kc+3?{bgz;*cH*e0iZrjc_Y}{n9S44pMhCro4L&I64MvaB>$Q)0< za(j=Gkt0Xah~yw^*wFH)bkLx|EFvNE?t^AcI?}ud-ZY~vuxQikD{VtpY8wJQHo6n%JlvE^=D_#o>WFC^7MHJhX&*5SWDSzJm?z696z3Ls&}7026^K_@bU3|lAmAbvt-E^XD{lOx=Z$_*L{3JO-ayL%X9)`u?UVQHx^;zgp- zO?)nnx`pugg1`m15Adg|ghqIEB(v^r8iSl=PqBqyck}Y-!yH?5|d73QJl$*Cl4MxSnT1!ce3em>)V%I%gNb+c+H|h z2CQDQ#%LHfd(Iq2kM}neZ(!p@$1ce!DOcOk$O?xtueNH%va_>~Q#^JgYZ9gHBicMU zW5!=8itQl`to-P>M^<+BrS|Qe4br!0(SoI>rk$dAN2IexbZ*_0wDd&mtiz$qYp=b= zl9SUeQ9P^>^`hg3#MZg<<{P93o4tJ~iuEVIWulWlT1CS$c$Huz)toBn;W37JdCg|M zdi4^%ka6)BFD755d|*9ik?5SM%fDP9B|L^qDg# z`&Bx&Nt8#+@4ox@4`^5%Drrb%W1ksz4!-l}Kl5u-rvb~Ce@WRePx4zQI=T6kAFiIC zU}l$}8gvg^w{F8C4(wK~7M0!N+O_NFCQW)@SdIuMrzXsI%T`p{rm{t%JeO{wZv~8^ zaHxg%-kZqo-1!k(Lv4N_xF{p+KmJQvdd9`|>o+`_K79szqyHOxm*F@XU(cO8p9Kep z)`Cn#*7`u=1|!*RL#4eo9jpE zuot6Rg)-=+>mL*xoI7v+-`Lo(yx=R;Cb@bjfyh{|~2i V*~+WI(P{ty002ovPDHLkV1kZ`mwEsI literal 0 HcmV?d00001 diff --git a/tools/port-drayage-webservice/src/main/resources/static/images/logos/CARMA_Streets.png b/tools/port-drayage-webservice/src/main/resources/static/images/logos/CARMA_Streets.png new file mode 100644 index 0000000000000000000000000000000000000000..a9e003b2e3f0e80932c9173ca21150f63f277aed GIT binary patch literal 17975 zcmYIwby!s07p@?kGjuZyNO!ly&|OM5(nxpb(5233an?(p5ZDf!nB_~dkz9Vf5kupen0McB>;agT@?*H zo;{-z`tJvcPyd7evuBWJN-$|%-@M~|H7ABu|3$|&v0FxF%#-)9NM_hgDZN|=(kC+p zsn;^cGzo=6!xGqn4GrUClwTz%tB1nvu`vxyxg{=!JMHT~V$3+cO`+qrGBWtgSkFNc ziO<)n35hRU$&dfi{ij_%dDo2Zr@P*wNV&RRe%0L*;@xh^s)QU3VBJ&Z+0?q*=2P9NBr!v zwb9>0Z1)zp5xAQLw*?FWVROJy|9r~3q%&5WLr(UH!}`w*NL!wj4N{i=i(pU&|D_i_ zmVrkMMwGaE7M|R{XUC*UQBaC;B*ZV0xDh{>FS~dKQA!B^GfFq8q|5~Y*@OBTv}C41 zG4NP0{r|lnp!}c7GQ^8(iAf`m4cCu5`hzg5>t9tJw5k6ZpAj{K`CsExqlqvqeu(vh>hsEB<>j1?p-lrOGr;7bVL;MDXuc z2A@1)kbt`0j2u?o-^BS`k4`R?e{KJwlSc@$8)Bt~zoHV(<8{NL>mzCS-y?i^U{Hle z3Va~xc?@9;0#|@ay*!7m)_&)6Km!Ig`KYxVpQP4sg};TvfOhBd=r`&cxS zO)=>I?uq>d1(ACic6@eio*`0LVJy*YAcumfL>2zc4Z$c(%KYP1fC?8AnoI8TSQ{FHGRh z%C!IW#nMFdVr!w?S|WLD+00$@j?e3&bwW396a@ zIr#ufue!$|;Fz{blS`}1l5JflahA~%kDFR$*FBvr`GU(_AA(|&A`TimTbw`Q8&gqH zGm7HtHZ;7{7b8i-opkQ5k~`n{Hn&4|zOi|_yDHtO2}Y6)u@bc(!#z!mdLQ`PI4xWr zyh#G|3s;rnR9e_t#MSjh`}wJh^ExU{4Iu^P3355I#F+n=mgeY~-ZhPl{Q3@GQ>pha z*-UM>(Av#1g6xjQP8PhMHuh2m-ck=Kqx5g3wCmEGN#*y8yG-725x#Bk7#v97)&qlA zr32_QUJ(rac6yp&wvOpYCsc|4X>WC1X1nR7h$T~OF<#{17uO=svq?6qbU8R|SZRP_ zN%L_e*;wte5fpazCoXmPpaJNqA=AD#O8=!!b@tc}V=ENIL^3$Q6IVJ*#^64E#N0Lc zBR8zr_l%z&%n@bf*rz`y4;2J~1v~g_mGHc*uA@yWkwdi_EO-RQ1$)}On>$-L79Ue6 z1JBLhB&f(VVSO>Z!$VtY=)XoTfg7@D%V?5XHH|8#vVZQe?({=fl0Ziu^0(LfhFal?S%Wz`_Cw(^F*&OdO^gq)R|W!TH)e#F3lToELXexT@1` z_vSK5D9ZOt3k<$^^iish@W-@bkHg?m9IkMqdk2=K1jp2Kv~F|c6sA<5WHKhJ?7EQtaA8W3u%cp9mffyFK7KTVIzAI@)m(tA>(*25EWui z{z@F{Q^FF#AUFX9<$z{}Y^B~QHs+*ILicRVbi~W_BQs6luQ+(q!&i^1r4J+FiGgq8 zp_bI$Kb4fHa{sn62;d3&;%acr=6nn@{j`hCr=Dkc7#K@O^03=(6;(U3C)yPXC(Tz=IpBZ3^bhI^LQbisT; zXtdI{|&(d-h;@53yXBCdJLV_0Sgk4L#$})mcJ@XQ_@nQJJU$-iU z_tNuut+e}@Z}wWVHf}8TEOqnGH|J{ovoz5ukz!mwAvEDIyxakvAFRgwT*W9Um|xx} zN!W(m94)Q9U0uf)iCU)Fi#wm#Qu!r1$Wdb9%?F1QM(w77;3%f{STm0K59&54d0$Z? z8=gEcUtWH{vPJr-|!-SCvuec4=ol7!)cm+Xr zk3uiUXA76Hr)7)*|hp^oHD6@N?ip%`V5=7=}Hh5gVY_D0cd4+G9`HEQ++VQut5d;U!R zYIAmLh6tZe+^1minn=ENOpRF`X3Ro0$<`d&((gHg^H#L}zJtj3+b(h0%jSVnTUHt} z7AtI;zu2n1E#Al9Wi0Y5+yh-bzaYJeE6na&%;~)$7C&zx1zGTdhNO9gT=`KW)pOwZ z^%@GJisB@Ukijyk{JbQOohxA2a80pfD&Z7=TFbU9CO`VxF?%x~l!NdWG5nbPlItK4 zbz)P#x(34+$#1h-YaIsz?&Ri4kQHbH=~?(IOEVa zH}*7(>D&{Y%Gi5MM>^;+Azn(i#>W;i60uTUhnDT;9KD)*Ddht)?ZXx3bwsCn(hCNf z$Lx9uYj^^uOpagPK~M{qqeidLxP~j8HN4FFbUfW!L&(?K^^7KaBvyKzhQ<>x=qJTi zdNWY(l{fdlZhFMtMI+RL`hL9$qlih|aFt+wa%J|6raVA>q_U1WexxA;;g{{ZxhDyk zkl7FlL-sGmDlxl?}! z)y@*5SWR%UM8lB6^8C`LPE;FBDtYZ39hO_YG8){*p1Q?Xdikr46yl~|W952eC@9$*MI1uKHckSe8}gxDi6L23;-6h~{@7f2U1mN(Aql2b;M<>O=YYC4{v?dGLFy4Kd?0lZ^bIcnevpQ8UT+cq0ZGgiH z#?Uz(oq99vxuLJS+$xE=w7tG1*ylK>g1{2mmU#CovQMZ4ZMjG#W30?&o{)$+2QPRe z_p7uo>DzC}-@5`Q=pip<|ICBY?I###Ct9Q&?} zhcHIv(BC@6Ti9}}im#%%o=c#jaSnXSW@oG7Ze16u2o7p*5MZBB_{GBPNtrdS^9zKL zTNHAm^R5O?jo|l!x`?K3(S?qc^~_K=*Z%t3mkX|WOFnT(75*fKcRy(E4A-i6C;f}r2a^tgBQ2;x(CkZkBM^w+l zL#Ku7omiJS$1l2Nfl6^wSuSJ-P8rHHcZg+Fvh&>FoFw}(Z2~*mzsRSTg3{u?!Y-MY z5+98xTx%i6BOkSXmzo~!q%&?|W9VB23A!J0QG zetH*Ksp4WG4HKq^Y-|Qq|8Zn<%FTY+zP=|~tPdib0CbVz1V&kKg*_fT8ITpuY>E? zIQk^+BPv(Q+}=z*rjVs*!`Ox26$tU$AC83|{NQnWrB_@*Ci8l6&4Mq93LY<&#oi^h zA~CXQ^IB_F@9Q5u=R=2*8%Ul@*#&jn-jASyL1CjsEN6UqU6IEi3b!u4;}I7w6b8W+!KoE z*)k2A0u}ifm?igBfvd#66YYRLV$)%)SvRi8uwfK1I6=ln@ zV$@H(^3hPUVQt^NDj^%>0!lXS9IFYa^Df1_e_2&uoQ}dP?8_2Xz9N_30@BWAg8c=+7(qO!<*^u`*w{Jld{( zG=j~nOC+CvfN)dK{6PCWi_A&A*5+utgX8_;-sU(Stkdf@Vw-h69alS>M5LENj0O{< z8JC~6pw%yORobZ3Wa)b8(WX=aLKgVmvr*q37mm$WwR>TiH;qHzK=L`hs0nOR62%f* zUM`YX{c*9=;$VhH=Y1SHTCNLG|Bhs?03+(WXNq;qN$~6J{(TgGv`SSc?o^~rjL1>9oujkzYMqVt z_REjIG01M2fo^Q;5x%q5G9P#S%;;)IpN@LN%8fTpxtzMp$fY>o>db!nrFdip$fw6_ zHEfv*KkouGn8pkG_&v%vKShmpfBw{h!vw@}&AnOSrWonw71_Z~K>?O5L~zxa?g!EN z>7ToY3^{xMEJqg2GxN)J)4OzwL+XOV=Haz;N|D9S;qGZ z8OA^d$lvjP{i-O>A!4iOFHS!_0=LA`z2S~Uc2v|eV$S}r2nqYMIP zu;H>sg!|@I6Ze8v=#M`7O2YYcI?Gk*m57mHjlUw3%*xQ*yT6gUH~< zfeLD^=6MjdA?^#e^IaG$Cf|%PH>zhcJ}Lh_Y0GIbd(kh?A}56owh=&Z@}&_!5iOQK_=kU~!<`;wq8ZkElI_ zqt4$!YNMlO(a6epakIxVXnN6#8?Ig;uqu81YJZ5^xHpmA7VHK+k1#9uD#rWz$lZEU z802Da*<9{h=k0{`{+Sn>r1rxESrB9lfLM!Keakrqo6SYI1FAw2j4J4_GA%Yeu{56- z&(zM?7DeAAcm*OA<+ceoeMg1;>=#jAF~R8HBmpC@+Nl^0>iaUCet4w_5ny%LFd{p& zu>PUxiO!fw;LD_&C@xP6Czw^zxmgy0n^)6}_ zbFUR*`U@xBGfN&);}kgKty{GHnLSZKc8wlF^)XJc;v)u~Thye>m?B+sSK5Wd)|tey z-Usv|K8z%hUKsIeOaI&pZGOfAmy_6oy@F~(QuPswtg$P9AIIFNr|93vGK)s$Dt}m8 z7zJ1q-_2D3V-a4wT^uD#78}~7kQnJrMu|GZN~uVq1qWD_O+Io#CfOL)BUG(bxcZV` zYz22de@xD_hB`kNY39*UxWuFWUOyVLM{cWT;^tZ`R^fe?UYy0Y3_x62(M5eBV zoiFi$xV0&#MOJ!sO@C|auTeKA6G~np3kJK0A5^$75aGj6SNWsJ>lfXN$Xl*h^zOvp{$ghB(QrIpJpqINKLl9lFY@7Y|?Ua1O9mP+QxBaR$pq2kixQrle5n-*|t4PBzk* z5v8lS=CPRKL&}Xt{8Zc zr7fio(oQHuY!0+prinp|Hdmg-ih7GYt;1I-3Ry(zxBKKm;gzc7mIPtkri08b>bzH8 zMj82bWPv_#Vb7U~Oij5pbQw#X5)3sV0v_$XkSlvITAh%@9+Cf+OWIop*KQaBsaO3d_>$yQ)t{3=e<2cque=ZYT< znr8ABBMiqy&1iH7Ib{bWNmkq$=Ea?z48ia{r^01q-^bB=4%soSXu@AL)onWnNTdXOSq6kp@X??hg z+V8UnUh{&2rfR!8tEG5q#<*v>2SfwBwL&NQ_btCq8P_}JS*3j=^=saYTr`p+V@j}YW1_O*gG8m1H)fmB{zcmFpYarLRi?*twHczDKpaHlpj)sP*BDW| zN`$hcGcL+x5Fc89-4{C}7$`h%MD1^IyApsMDihzASuHyARX<$bw8y)=FNdVEia!~1 zpx-{;{MiQ=R>G2g5AMpaDdaVmOuMiuboHUm-FWo!L~*JQaqua7t}O&u?{3zw4n-DzbXT7>0pnSCNUp%IoFUh903!DAw zJ3BK${xTEW zt%)75yRXU`HD6_t9gXE|@?NLeE0L9xwVO0E7lp@0)E*D_U=#qL)>7hmlnZz#dY;fG z+B7G5*O zrgPkPdIdr=&WBj^Vq=%DqWE#JFp9@LXPj8d?9oQWykgOml(pkx4D_(!scEH@21+LJ zyQ2DB9UoGoX8)K2A@cME>ffj86R1od+u_OF=UGNZrfFk{#zK3ll#ich;3=L% zZpAUz_SW8!Qt~b0eyHu&X^}a!TlbIhu6xL7{Yfui3y|y`>(k=c0g3aJSW{`C%~5Z0 zu*)Q1xei*Oc;@Ch=~nIOFcZdTM%%ufWEa+1UY%^oODZM}TMwu4uRbGFe3`jbGi7m$ zD#}q+%TY|&R}Xnl?~(W3SvLL#?b@#SbTOiy=0Kgu@p~m!`4ZPT#Bi(@sAlI%hY!@Y z#(}rrfV^S>t76~5i@dmnyqS(V2`mZg0B`MGY(XGv0E zm7^JMIUZ+!{51tWa!lL~OuRPyd$VF@osu*ijvlnOovFO?DusbxUBI-Oh?{()zx!oRdY}9Z=>}YtrYm}e25c!nHf=0} zg?IlQrNBn;j;m1P)0+&cALNZ)Q4QCqPgoXIa>fcNfH9PN{KJ5-D=o_l53RyS`01?HKv7mpss6p0a8Kr`J$xDCNs{gaXC+ln z7WgI060-Xpdti&-Ws)koc*qedNl`7Nal~lg10*)y3Q$_*ed*CMg)V*Fa+yEp-W zd(0%Z_*|KH?3QjX+0Q}?+x4yniJ*{%zSq}`e&rvdccS|mJi4>ga~M&JEjK3P38KXo zOcY8PHwEs13=ym6Wkv{PC4$!;BXNe{0AmsJ-l=pCf#|0md@kk`RF;hQN;E-v86jhH zqL-yis%}dbg?(yO4y4nVZU}C^0X&8u%`#t%#}VVIZdp`&g*>${o~)*AoI}Cd>&!&! zPck%Ta^pW7NF-NwU%6dott2Ms#)k^2pevauUnrx!6>maxpq=LxJ@%3Ex<5~s=}*sk zxDaGEKNBgwNi^~mw)lTqfa;CEP&46g{Q4uQ7cE^WZ4Er9zhCG{1^;|c@$zwLcfI53 z>&ri*O=dWf`?tYoIv*bIbtXf$9{MLAM$<{}ray>ZK2AP8OqBON{m^*IzTJKL@j=pW zjrRU*Wi9#X$|L5|?D1kmsorb(Z!YcQ(k;o;rCFBxqu1}I=*f`w1@*tiC}xL4^-tFe zArEF|tkh3F1y2a@Z%*DP&ZqsCS6%D($C)9QPr+CBr(b)YHfbepgMXL24Z6$!@U-;u zCirgUcJqCjV0I8r*{moj&o~FK+2Z>BZSPHW@BL4+du!RsnjzZ9J)_>+n2@VLBHvp6 zL(7x%zm6~)lc$}vze@^SR3V(aCW~(CFM`pW5ud=OT>g{B8NC3TT7XER%d9MC34Gzc zP;JGUql7y+P^^4bwN$J+9SQv+kcqa|eS4N>`X@Oq>ZqP*k_{Es-H_9<6C@}VUSGLf zEI@_1FZEmg=jlmQq=xayS^SiLl7DTyrmpa~qhHa&WNqX&snuc7ZvC47`a@|hlg1rs z?;m{02Lqhe>s~Rxi#+_N&i#ksw@=H!*xuEvcK6QSC2JJ;+@HRpB@gp3Rq5F-BJ1?P z5*^qLA!_Q~%Zt~jzkWD9e5Ef2i^8n!t8v-3VC<=FinDn*ouJK^r;+zxN!viw;kJakQj! zVZP}V5uo{#KGjuQSZClo|LxOxgxg`jSgamN)!KsRKG#F?y4MExnBwoA>Yc&(29Mpc z5n3v0yiI038)>hnI)Y$vm0j42f^=S3f# zLtd5nJUCbSY_p}TslZ_g^N6(f{^4osvqegvxo1oyX1sU41YZ_sPL_RWG)9NkBwa`M zJhBc_V?uZqJInH4SJD?W;Zm?4KZC7NpIM2FaaZY5KXWJ3qjzsP>e3`lS*%+rw2-xG zH~RgiqPaj5M1~M-5njLB()jR7!uG4%+K0xf`)?Xgjdj0`{?xAj30@qU1s~kVT?{M~ zR9atBl=05LLHpM9_isRNmWI&#Aik>ibsQZLtp^!>HNMzk-0y)D=FAbLQ!c5}z?IW8 zr0KY_bh3>d1kr{1l6h^;V@1C@Km7tKOH425371bVcxP*6S zZO?!?M5B$!yKI97lzxwZTwYV5Ws7ZI*Y!I#dvSExQK$N@I$A}y7z%kZr5<9ygFkbo z9X=^rP0p>YAXX@T$?gRfxXtI*27-S#)$Q8QLF?Hy5cD&nOOHRvsMDW8YAt=wz{?%!qjD5Uiu2Gwwf|p2qgV zFbHjYvH(CNqLx-_D*A2Y@Tn21Yku@(KGubpPF&1=pNJ4onTea>3y~{mNDOu7QJ6%N zRlDs;>32RM{@WZI7$>WWrc{=%Rud6OiS!5I0J*#m`f~+OquFSKBfMn~A<;Q|1huzM zqG)syRmk8|=av^H>*)~AWwMF%b#%+C@;YoiM!5s+s$7)*{Y^?s0(bhFlGm4D?r)xQ z_sD238{-X;AePmKdq!dC?c6vzzfKNPus;Z~+^BA!A_pX%oc7ka_dPHng>k`F($g)3 z$`}Sj1o6mwoyN$t48IOm zcPuG&{)@FJ`JNH2{jLySN?oBi$?oi*X!}{Lhm!DlA}AON!1yJ?o(xVO?zo2$Hc!0$ zIT2?TJYPSrw?~d%l=nMW%$)Q2CC&P}${1^}g;q8)j|2p7gTL!{4T=)zL1qbneUOee!~+(*{RQax}V-)K3V;gK%` z7ljueoLDRxl!EArrBB->B_g^X6NT07_K5pIx3>AG)gOGM1+;a&>aROU)JbIu0?Ovj z3(>9|6U|nnUzaH#^Cd$;cIXwk!_5f=`v%;TihBMUWZ&yn6GkYapTwUFdi4p5?{3Z| zl6T2+oqbP$@7!Nj1*}dxD_{GY6BT#mWg$4{9}u6=usqc+5;c5}f8qCVnUsH(L8??` z&tpuMT1L2dtNgslcEw7!&B{s3oGEx;&@@HetQQsUSf#N~1z=)CZc!pG>yOzxiim)_ z;&Y1rTLJ6eI=X;1U4W;H@;g$RzLI5{S`~w%G93bQD$C;*92AM zX9upv!Ue0U+-9qb13h;6VVKM7vN5&FBmxj4t!t2|{hR4n#(lZEu#vd~B+6*G!;cl! zwV3Hqif3X>+X1{XF(+D>3#rB ztXIaS(+*#@wVtw3ECvl!xNVgId#I@w`ted;Zr3-56u}CmRIJ4^q?GNpUWJp4SRQspN^bFX5B zO2*}c<5&HzI_(5={;2~z+~JTM4bE^Vs19(-5=&C8302>(bQo1m0~3`kF0_5M;^8t3 zxB*7IUo5`m2vEI0-~DLa{8AJxF|qv>p)qbTNVbf(GK~2<#Q=dp`rp7M)M#qc|W5T#!40I zsHUj~_ppf?OYAB;v0QTElDfE2*I5NsU79EMr7a>I5P{Lx7jmd6x&dcDVELKYpCc-uejECUFbUD zY_XS6c$a>Bu6wQdhA|t$xe^qNJ3p7Qap{mcV=?8f>F#NO&+~zBoN9ZHCU+kp!mDah zY}<%XR1k^qhkKEwF)%fZkQf5=lzm!wQQ0%jpx0&kNMV#^qj_PO`w08Lmdc`|hnw%p z0g>B4fAe0AU&J;JjgNx#mHrZUQBH*EwS_hj@>+qpgp@PZFpeSK3`Q&x^;^%u2UM(u z1ZhuCh0ELQ4qaT&@)4|4r+~K6K-a{>WokB(+ohtuZ|H!_@K>sqCK`{&OZl=CW74bo zv#|t(D$Z?CRTfgF?9*mv@EZkp)Ml zS0QVSO<%2Cn-+O?bjm^G>bV8>u%GY&h|uazr?mv^G0XTccA}oaHDuO{o4Y$Tu%A0~ z-^+lS*aH>Cup=`J(hhA(eNCcu1)NC)9FGG;iBvCDIq|$I8=(LA3>ka z-6~K-p#|@_)o;D|BPXtikiY2P)H`LS7{z(Cg7b-|9{Y8B6YOy3DIIB?Mt-+Aun&a^6H-ohsFK42h&h zh&ufv7ry#*DyzU=#A!%5^n&8!27VIW&vhXy$#i)9IG{Ow5f`Ij;cY^%Qx|jV#a0vT zGl^iVw51yp5M++CKG2TBgqe7WYzDr+m%=t()lDIOPVZ#hpg`5+n)7V{qSME=l5xabaAOsizqUFRnD%JBU_ z)s>N~9ew+Fsp4-Aw69ZJT7aBEC5zL;AI=)vv1G{^J1?@B7{oAAV^QZzw=I4xo98Vh zRqXwrjN-1Zj~*XQ_hY%my@tJFmYizV^kd~c(T`~^F4WqiM>g-Bo_Iaz$?`M(^%Xlr z-br!+(XrN74B)Yp611)xScZcXem~l1wE-l=kt!i1DwTb@CXsa^?XymRW&5x7V$e7l zLj6FL;-sO6jXVe-860vS6w0TYoRWueaq3s+4rfWYL-lZ-?4yi3_}K?e?KFm@n}FoI zO@l%=tIn~kmZLQQR*XyZ+GcL`P(&IMdJ%Y%j%ONTZ@LZ|3ta9I98!_maI^5cx&}Xe?cwgAV*D)4J#G# zW}IK2f7o!FMP;DOEobq=nDzRsvcpJU3x)SeGIe|f;xQ$tuj4jLU@>OO0UIOo_iSK= zjS&>tG{~gnILK#;rbLj=V<)I1;wJXZ_;5=tW;=Jq468wFi|*%exIQe*%YM1r@=M{% zuIXlrP~!7vstf+fl`7Zr6i_n65GSSYaI6U9+7r_{{>>{B1$69kCDxR?vfQzq=Jb9B z^aD9A`U3Si{0muFh&czSkEtqRvpa~Z(e*TiI~j9g2#AZ=NCo;tkZIviyj>W zs;cuKj#%&VF;G-QprFFd%Bj}u)WiXyd3xS2i8|-4paMvBK!lmXRiZTxtl;FfiRwPs zJONl6ELiEfjJBP~6qp#NC2(#QN$j*J_>{mhOfeA9XVwEfFE&&p%@pnk8 z6W|f%3vVUyFECU8CH@r3ao{Y;HS|oL)=crom|BCKM&u5z$|fBY?^N59_;RUuh- z27=aQ+2~5uv|$X7?6>`7&kr#*WSJZ&04iFHw)zfybQExyxF@%XXkydF#Vy;2kYAA#4=3x8+^JRiUJ*7aA49u8F-P4ziMt}~|2v;Jf|IjM zoJ@zLTy=$4-`2@7n}+;bjP8f@j7mvKM_r&R>-( zj7a=t#shCjOumS=l`%DHxtVRMs8CGHXE#m=cE6h*^bhazzBndJoz!x01rzyv&$y>7 z7)z`t{Qb#VX=m_!!JD)38!L~ix#EHLv9>x{*wnyhmA#+GO0`xf{a+bBQp(Y3y;$K! z-elZsK!|~sDle^#pMz0EF6=M6$ZeYqANAWc_@%!C6Yhb5JL7Qr0r=dVYeZyx&J)!uMhaB{0`FbH97U*7&Q{6*C>Dz)`deap8HA9{dOx;1 zRFRHBCEsaT)1gly<@C7A0aRz?tAkyr{N$3<|OPA9{N1<%2h^jKW2 z__Y;=bQ&F8{)=C5Y6NL5^NvT*qW4@MddusM{THN1%<`U6wMj1MMCC?YuTX_wd~_dd z5a1fk3r&}avEe6Rrm99pMs2f4vqwFTudX%u(vt!NXk!`HQMYKVSaQ>+sIGP31plSj zHKk$zW1q!djN^}{_)fx)XQ^-RK0edRB_>sTePBJ$gIuZ7VM>N4%OL-mu-36+Os#86+guB)97=$Ml!s{z~lY|<`po;3REUxTL@sSsW_}^=~!SuFrIm+K+-s)(QZ)1 z{UmnZ(>3w>qQf_+x{?wunpf_mM;X0UBxU_vL|D{Vrd!>BoD=+2xW*X3OhFVopGS+Y`hHugSkDO5sQjpc|fx;x` z&cFwAOqQr3d{X>lR^1LDZik$0e6YH+#;1%t_QSFN;+2(;U!2l`hXQP4Y;eV4HPiCz zEm?_3PxT^;9F~sZ*F?am}AX>-Yt+fQduHiFZQ4BCixk$KB+ z_IA2-f<+GnO?UZ90|3^=JW4jAEUcLZ2dXdY<$3f6< zm$eD%QfqbKAmv^d>7ffZouXDvbTLTMG)6(25lIaOl3p=rAI>u_RpHJlytC6kJ}fd6 z`vO94-Hszr%y;yG*S4GdEK~?yrG-8rijggi%3$6Qv}45I25_KtesZ||$oI)`yg!$& zy7XHjZQ0luwCCRFUHgKVSg~%|xK_<&{G;cuY|xU~6RXl9a#u?zX$0d-;T`!EiYBfe zXNP_+msK|0g;pCD){)0Ndd}p=C=x%Ky~IN#5R~7$hRZ0{9ZPYo5n0{5R73_p`}d0% z;1iCGeW)n`oqeJ%UmjjEU>UYg#+2Mxnz_Is81P?sXk&L*GQ|TC&J<4h!RP-WvCHk! z=WAZ+x+r=lXLlvMo+i?!w`ep5YRETJ(y+nj-R%F0w}@>3P$X!sbLSNw46{VS`}qPU z5lx4*X^}J=ftyHFNgMh21Z~5JOh!=j*-4ImneBl?GxC8{3@+DntcoQvb*4X1Q!~K3 zNfx#H4VCFXo0ZIP$v^^p?Y6y;89*ZE0sAolmd0I<@(Ei%L^WjiYk;%Zr@Qq7HIkIM zPTtf*|N1*ja*y&`T6?se2v@Nwa&cu07ZiVbL)zlT;8f~g<)Rovcjcy#gtW7)@pI_< zbPv3S%uMPx@{ZQ)`5!u2{g6`oJhwY_BGTa0iah?@N(ngk@1fe@BFD848Ynu+15N)5 z(GCWH!l$YBTU){W5~;gX6Ea1Mj!?CuwzLOMhxjtZfIC*rjrp%fNz8=C8@7?l0G=!)p~(3A32bd;fa@}bw&SDw+P;iOd&jewhs34g1cW+YpAuXP-Dg5sRDP+-#8iw*nUUO5w z9L2ft%%r~EyQoQU9gK) z8xt0b&H2}L&=w65=wE*#K{m=lib*NOKteb;NEJQiV`PjMa9k4WTLhS3`o!hD;{6ZD zX2BFP0Fb_1QD(U*OIN1whGi+|pNfyszq}{&Q>QqLcx)}=#ZVi*_O7bN^g$;$BOPy<)yc;qK z0Yp(6cad=M_8t;>BK(_BNC~hqQZT+p#isbG`?|1Bs{2e880q53y6;@XN(BdlukrNW zz|H{=od$-00BJ_gPJAxHw7>i))0~4F>Hvl-WAVyh#D*bm8@F({c;uzxeDmANG><57E$zRv@He>)gmL|Hiy~^lZR7U32wkLp z6bmrz|2*C1|GP3UnE$?#$tVhi4B{P8YA6P69+Al?)|!I_MiYRV#s0(=r01Psbx`eZ z0j7<`142NJEA4?)$pF#rFV=eG*JEYMhfWI1$m)4#XI&Uwh_ir{vEmk74{hpZh zR1+O}bfe*$O99E`0kflDDrP4%)uClb!71N$gB9F!g15}q+)4FnC;AiFWwxHdrDVZC zRsQ>qq7_!5w&3AN`Ur>D2p)7%dY+(H~oi>AFKDQ|ALs zo;^dI{_p<+oYEq$83)n-1e(@$M0k^Q|HPzop|{+UFeD(9fqMXIyE*vgI(74l%uTg8 zBvUc&ECZD@a*_9^%utL<4zce>m~?|IS^bD-F~dU<6@8ydn{i_e^S(Z-`XyMaxaxq2>KuB)leCl@XW0lSy}lPE zg0`?~!XWY}C{jcLGvV&0=wO~mphj3OwCha#Ey+32xg=?J9B-UR9n_-!kCSliRt)r) zl%}b$H-I(2<fG{P;`Cq-v+O0!3#j66`^;N)j1Qu zxpFo3Tc5zW=QGl?Q2*#hE7Z;qP>WJ zvmv6QUc;HNJq!setrQW(`Nqa;5o^4bpwQ_asEuK`Jr9v=<@JmST#> zNxodADfTU}P<1(D@nXZc-Ldc*^C){~I$r;T5Hbg*FcEFwU5x69Zd`zhu0&BDIZj^w zOjaJ_N&+#P){x~nCxj3}LQp^uQ=$y}*Cvyr;VF*lNHRm)MDh`KZqg@h1gi|^oDB@> zLGJ0Cgb)%31q3lAE{)<`M?^q8jABwgI34&g6cG7ShI7t!Q4c5-2_eov0YQwwu&uWd zzqk-?6vm0m9dks?cL(i@nzW#;D|bxiB!svG zBM`(G7_=KP1=Sw9-@NfW@0;$ReJ>Bs^M2rY-q#7@VYBRQAT2Yq)Om*(aJGLb^*Ps$ zpF2*_t~UIB2_a5F0YOrM$U+AxM>g1m!A3sQN6Hu}j(I}4aBv;&aeY*hV@4kcA+A9I zK~e+brIj*QTm;AqiiamqP&q(AD7!2oBuaJcz@ZR(hEtB*5?rqiUWb)l9lK1t0%Q`1QNNMmq@BafyJ-Km5Ji){O0000m^+S|h)a^4cbax93-6@h%LrHgcDj;3b2-4k>g3{gHN`rua^w1^UedqnYd;f|% zKQP2RarW6~pS9Oo50Ppra#-l(=l}p) zY-<3BmIRyxiUf*ZnqQVY4^gEB*x5ECO1u7A|y#QQ}DZ=NRmzX zYG8InmaM4ih>>!Kjpz_aehG)7q~~-USBO+;2Rp(Dgjtbqn0?=Zg|N+bCwKSB(q>wL zS6@T{J@;hL!uLc!w|&fi;+#F`r$wzEJ8|^?hi}qBg&aK*EMi*x6lx;y#IcC)!)ff#iIN0UyRAf-s(l2!t4*1M^4K_ zDM7u(@@0t!20_?B^v}}?2feA7_U_sb-|w5?Q!@J7=Y_3rW%rW`B90Dvv1E;@kgdNo zgSesJZ;73-aYbqbPVPdEpUHF*2tiA4HEK#ng&tADy4N)x2T*zjRQHyNQQ5 zwDr4KUr}mw;YeacbW7c$56$yt{o&P$3&a?g^K{@8_k!?NxQKp;x?>KCC-@s~wYg^u zrV05$Gda#*yt~Ap`QL#3S4pCNX9=AY7Swe2biA@y`f12t_~GkeJFJ(`FK3{5lzAr~ z7p70@@y=#lfh#5r^S?0p=QJ1YZghkEK0~z^mQGOccxX6>D^}dQ zt`r*JGcdLO^bIxoecQ*V=znskw+Idxcv5DloZ%LVHb-A{kt?;jTs>lStvN$s-xJ+i zna#jleC}Pjt%n1;vTaWAOWmp39_ofZOjNrzjZUbIP=b3w^c453oDwL|T)gvK2Z0VW zublgnV9#x;>j&cj^$Vi2NDd<3nuwuK3B^`lRl8iiKfq@z?Zv9eM8U0Sa!1s8?`v#FWU*DyO$d;lv z$R=U?OHZze^|cN>bBH%-;jyW8u+d6Mc;j~bhVXW2YOkFXfv+P|H;+HRFEA?^w0&t# zT&j!uYHwJio3!$ogE)Ho^GL)A{2~|EKZf$;Khdptu|T&fG3$Bw^SV4~wpWT;n^{gv z*3-)03=Gv~hPizt|G$U*8k#`O+EM*6RB0HE4+fH!TAe3J?R=10)xf;jyjN&10ddbdP^IIx{C-b?Ne`J=Pn^VQ==gT`VHeiKWg>j{ewvYLGPA_1q-NWkEB~UiotS(sA%>ECK$o@ z6W^gKrK1qMxNJX-akKSZ5Xx{;tiByVRM_?*t$A%za+|K+_=-cK6;)Z+@u=PrJ~0a) z$aG}(sMG_$Lp)ziyd8;j(c^>ljk~QPS(yo8hvOwJwQuAIExP_!1s_t)wL*7UfD^7! z*~H#9`bSH>EmHdL*U^`)1@P{`kzo1v^)tv`h`}o2fl1Ff~65Sm^y@e|dE!C5o>~ z|B=P#Z2?YL-?u|Ps$veqCI|nU3!XLc2$&4;78zzN@$razXK>%WZLL8)cur39G_0>1 z2_L=X3rqxICW*&JT{!0>_1IO1>F=xinYhnOeYmE|4NSRYjy_-B`TP5SpLThfj1X$& zNd06bcpq{1%mc4q#8Brm{eL{?85@t7tC5z7_8wd zY^73Ro#344-`n~AwH+(jBJqEa9x)#VRA4&k-J@WUM;7hJR}Q{+3@Nd|D)K3B(4mDv zo-FL0+KREEVY_1Kw*DvzNw89gnY0NSg2dlWrRSUs?OQL{VLRyGVv^F>fyo^2Cwlxy z62Q-P0j)fnp-sFv0|Gb38hB< zDYiM>ME$ENezxYF3djmMco?Ap@mwODN4I!pAL~bGq$72?dg>0Q^gk3cNU$gBF&fcM zxVhdD%dXMa(?xILr}%=d3A6&NHH2+apqxJIj@amg9~}a~n6vRNuDQK~W>qd$I$ zHs4zC7IyI(yNPG?t^lqGJ5)xjIfl110ocPcJ<08>o=(~lWb0Z7_kh*=lR2W5?Ky+M zzpn+ghs40VDv}z=-p)@&$`{dun2<#I&f@G77J}y@hMbS~mrn#>QK=vUgi4yKcqV+W zozahn@SBrj1VWj!NiVM4@h7jF)|Rn8R8l1LLP;{UITX{2?wOZ(g07L396l(qz1eL1 zK4ZL`=eL%(6>6T+^TpfOmn|sxUvv2{dHNw{ZS$D-M@K8ArKMzs+ge8e&gg^wj;?`y zEGFY88_kEL?NQxprk<_g%~z{lHed1R{dYNX0yJr+O^yqLbhF{2=Yv0g{=`t}s!t_ofAEKo65y8JZ~v!L zC?(Xe?1=pafqk-Kjk}C?X5>rX(9t;hM~1uFo|{0??3ICJN0R6vUa2;E^^Y;oB5hwH zF7JCV@;VP-hZVK8)6$-KuabA~KW}!GHa>#^e%V55 ztj90mMyDLxpSY&3R_!jYruDS)aC$Hb?w@JOPEdkq$^vn3KfMO{p@oA;T_3|XyY|&P z4ZdYJpWhUZ3ajJJ*8kGcsdN_Wf}y4%t9P0${wdWwuX_?Wy&45bqxWVIOb0P;WLV3e zscx}U2MeY;6^(V_N%-dezA4gjuoG#!V?(`DxT@}h_SlV6X?1nHdwV(;O4rL$#>tyl zYR#OY%`T%O?Z+nhFS7`gSUo2l^No#f6Ew3WwM-ZH4x5+JpQA_a1_x?4SFsD)galp} zAy&r!H}nibCH7@|+-@YG7$1H<6DoMfS}$6=y;|e$@8eOro(nO$WCr~gDq-C*dHQ6~ zt7`wXygx_6xu^|YLimv}k$3k|wW-=KUtCRGdcE_nl6r2$-~7EnWWI?x4Ps+sc|4zM zFcQQa82ahGXZRHNb`^&?5l=JJUZASm>@nlOU*1C!cKDu(F?(hy!W&~h-wZ_9O%@3~ znAvxKNMX_Z6}c&j&wcuy)CY4DN^6IrsZkDN9NEa~_xMCA3*fVyJ5Y zY8*P>UyfS#GlQv8V~@_<<2F6QFM_4*c;U>iFcLj*>uv2>uS63b_G+ba@xx37Q~huf zNa_YEppaVfA^n@_b>sEhv$cUGrx!wiyZ|elIjkJIrK&&lCTSRIn}6GLg9G;NJX}vS z(>SfY6*=?5*d^R%1&+vgM2a*@LqM4X7f%#uxrYzW%EMN?*k-!Mg%r!I4bwwj2Gf!4 z4?c021@|~wqO#Cuv|b!=QI1+HpyHb1<_mjhA4nd48D2rn#@XNoU5CQ_fFUW9f5q{+ zIpm+51=WRkNqPhcMk3v7coOA1@(-`vX^&CBGyzNr%OB8rKKBR(S9>9H>ittGgCH|`b60O7oE0CRLspEIBL35eeFhGSt zkE16PUS_1v`SIQp)9q4ZTtzLX!W8m9iAEd{Y?cmOE!=NQ#20hk+QP9L8b7O^IfFv9j8y0V# z6gcmgdsQQb`U%~NK{|N1s6(1sVLmFM^GO*QIk?lLKI4d!BqO=tZpM&Nv<@m((a&hK z#?A$VclNu4BqxXp5&^aYqSEVv8rWYnY`sIC{MKIlcr)2M+Ba!4G`=kl0;NP74g?!S z+<&4D9sp|iMxy#_W?%BoJ6#)3c-Hc*^vJDilh88hka(Tb(d`ngwhmqPUvGdETU2Q| ztxn6j$_r!Ik}dTDZ|$aA<8nF;OWH?2_%uisINB^Ln`9*AMFO4F>C@b=o)=+B@V6Yyfp`ok(wOUD=$MhJX&-9@Mq zU^{QM5?B^Lhv-jzVXs}n4_w6I? zYA=oeMo;bEmUXt$@y}oYHI-+#&!u~ZJOHVO=yNM05b^$L4IGchGygMrScuu+Q$=a% z-Os-xJQ(sGDq}aMcFK$-1DcVemR%q7hdAMY^}P3b9#LZy`B+Qu?X`dR9OxK)cH&HD zL$5=>81-%qKN`9-?Ltjk6C1&PJe{&}BRzBpKznr1f4xIGjA z=2h~R+fBcJ6+1h-(yUIuvOrua!)-V~NvO(5&HUj6d+mnHntdsMP6wpr7-Jo>ZA0*VyklN93YjFONE1v)UlP;)< zt7|@XlW~~=(jGB1-_|P1p51iRq?_Tgd4ja{ua90Z^<5*-0#9>&nl2k*XXEv*50&lU zrwAzI3dln1u;!(DXy!D&mz~;Q8}xh83z=_+QLCj825;@kZ2d_1+sKUz4tlRy{ML$< zb<;VU8n_ikmed#Dx}#oyKn4l?F0n*D^qr67FeWAP^@E27$l!WtEkcjJI@nK5uiC za$`O|II-ze=-nK*y_S=rPrXs3Lf+ch5YvKVxnTwTFLEB5AwUqk7zy<`>9Z>)iyCZ1>f&2;@v?iVi@M*ASVWMy9-F@Nq3~k5S9NzN6+QLl2W8VGN_ey?2SdAA6 zpk%QBU~k_{M+T}<+zpV86bJ7j20^?y8t5QS%|$bl*9)02$)rs<-rEtpg;rth8-9xv z)jK#{Y_t!@k8j#KH`S>TUeg`+nghydGf;uhMJfRNXl;6f+7m!im?&?xRPg2gUbzA! z=u$(Xb)@xA(Tsv_N8^$gRlo7WEIFtea`$bcbJUd&bzc-#IaP%ZFsqm z(Qq26ht_SX2(x+eiTVVk#vtXwjvarYn532Wq{{H7ebs7+Y<`F;=%1;kCZA4dc!WG8 z_ucZUVNROWxo|`Uy|?_-x-N<(Y(vnM8{kgf_qfheDPALn6$LjfAdS#M>RPx^p0SfV zwV;?mh$1*q?8Aon*Ag@w2o7)b)JK~67u~}VeQcX=`k&2?f1S6~_+0DkPHGUBNmm;w zCvJd3(@*bL9_*FrtI!KRi4t)M5NYoM+tHlRk`=&An(^XOs#fgy$^J6VXQulyCI~84 zbfDc+04nAfD+)HHB^)+r5lF~!?n#`4uKTKq87*@YjtXD%^%Y(EtbzbMGHLu!Bj&!h zEAOFT?ZbInKJ8XxtW-DC{n%J^-aXS+kOg{>dr21xZOSgtS1JLRsVR;;eUtKx*Z7{A zKgeD|AvF|@;E6_BGnJ8qn9bh0iUhbK0PyZ?7V8QNg<0;SZd|+I&Ksj{mL-?D=^u)^ z9y*Y;%ZFUlydN89+GVWh7UbYbM1Nr(Tck${=2)3QWD;&LCe%u%!ztP%BBT4W*xFNo zGup2h`MkONefRsLo_Qy!7E9Z}J+X!#sC@5S#`43+9Ku#l#}0Bz1lgw;Mj}ylC`RV{ zc7y^c9reH9km2N?;COxeE}!=ALhP?Bl$QgM+Zs8@oAoTZXWkYNM6lKf)htpXlN(Be zcn2)hSv$!<5LHXU6PvcvCcLshXG_Q5W@Z=X>()qQ)5%pHJ!G}&sOkr`^c5e zpZWQd+5JE^vCrVkgy0SQ(8EyuU;=b&pxmc`+4$J9`$Rc?F@*j8SpXP1YR4&Bfn%l6 zvKM<4SctI>-Y0()p`H^HFL=6@S*6!CzE+ADGUb&$A{WRz2kC?Wth|WSwFE4e@6RW4 z)Ge%Dm6tE^>^%Gs_+AeffRw0eFrT=)%I^U02g94aopB zBVq;BuE8g!bN(+sLyg+4@zW&MJpk001=skASRDKA2rvq;m-O126G=}MBrC9; z@_T#^^JDbZmc}vkCvNM}XGsg71Fe_ofmI7mI8Xt~!=2*&G7E&XZge}9_;?lgi3GeD zD!FkYs_$Z&MEfTemBq5le1F0eaQQ3}hhD9y?tc=?*?No1j_mpoO_INj5BPnxgV&)l zzi%9Uc-v))VdfQ74Ybz04?a0TGW$K+XmIEV-)!Te>SeZ6D~GLY8_4n8(1xiHyT5(M zDV!6QEwcw+b%7PzCY+hmJ#Xq+ac`f)=)JftI1z%D@zad3&PyZ?`xR&3SIj?1s!f+z zG}sv~UbjUot8RoF946_TA*{U+mv$kVFT`fG72>ZZBd{~gHU~{pFdH1QGH0{PKIeK( zlIozoXRNg!ySX{3RLZ|fwEEaxP1yi1zIZLBK@%X5!n|9yiKU2a;gqZtHp$Qmz>C}Z z`TNJ1z0bboaBN;E|Ix|pn6#{-2oXaDn!>bpSgB-eykez>wb;xT&Q8~^*h|mQJl~kp83g-JvJ3+kOvff+h*8~!f zp6a$J`R((9r2i9ktcS;x?AlAwCd>q+L$~BoI`=7ybH@fKl(&_xtXQ>cEv~R3b^O$*8+$1xc+uvgiXhi>_yV*r6|# zq)2HTNn*EI>`ds!-s{po{*ZGN{9P1ve~)L&>VhddW2M6xs$Ms68O;tUA(<^)=K!T? z3m;$bRI0|y7J9%d0WWdnKX~tlpz)*z{pg_h<5{hw{^Lwhz04^D>;*P>f#~Qq(*;H4 zcLjvQTLN?x91!z+cD}Ff8K;B@6jZ$gSY6`nRaGB(fytYv6?jslY3ah@{Fzokv#qAU zf8dT(NG{PAsp|#9J({envC0)37$h+Rt5{D%0cw7ANer`tMC>ntT5DFHUUpnZ~`CNAh z!w!0*EBvu53QmD~8nSxGndB;fd$Kp3aOC4aJb5(dFKm~c3PHBY%=67f1aI;~f0&DA z3bLG1q=np8VdVbNyEMcfx`6E5db7?x-Px`hH+#NB&Ta-Mz(&xwA7$N%(K*3?nL{o% zhoK}FPegExhQWw5!^7DTwdJ+1?brM}J)(lB7e^}0*C>A;@7^v!rFhBG!z1s*J3JS z=tAXj#mr%gM(~&}4pz<6ZB82_Dmjg49SESHJJSW34dtjkjks9FOB}BCoGPnz$-3Hx z3bvPM;U{E$^EQMX@}ahp^t1zBB(Ot--=wcrn|!L9=`e(rk*HmIZOQ%pi)nL%P+77$ zd%of7Pn-AAaStR|BGnBvQw6JrjUt*-BRYf3SMkm_A%Z$VL_tQtX-IEVr~Cf2cCGvt zH|wrsF@80&x<5wGE{F_qW7H?G_r=$1Wik2Q$#ImqP`Xp;$oi)x6fbcXYYSyPMDrEZ zaTjXGQeY|G7t+fimXqkqZxV-3NVnjys>D-M{lo|KL<{`Lfpa~6VZ?$1cnfR{B-p8n zzV$iZ`h{jW_zK;;u%KcD0f&&w-gymYK@yC)4iDc>9@1NS0w5YFuF}lsQoNad-tOrUhiX(WoJNK+ zq-mENV4%gDv0dGwA(%V4S7jC@D0i?FG-1T2lT*0 zx`s0=Pa9Tfp`S;^p#bO(oC`0ma%gKXpOP^b)ph2+Qwnm@AyB@__*(dfVm4b^0 zC@gd1sZS#U_8Q-KI%L~l4JYcoKYH+t{3E7Xt0eDM*=q`cM<);KD_bgt=y@l-wN@lN z^fVDjw0h&6P=#stTaf^zD~t6VGla_hOE-A=$t%%1_MyRMa>18~7&^ptYkH?+)QVm% zQ0~o9_7vs40Uc-A?bv%BcB{uAc~SG}TsM=U2; zUt=!&e7egC2uJW?3Njxbe1i+M($vv5TJfPt7oF39zWr6A9hz48CC$oW&TiCZWQGF_G|p4z9!Y}k^-(@Sswa--UUfAqHjZ| zp~(oY`$$|;7z}i-1raH6^5QY1y_K0e3-g|@1mVpnT!fo0pDF!M&lS*AvCQQE z?L~jq3xU{%VeDL{b2%KEt!K~w=Dz_0@Hpd;K)hK;9aY%h?)XgH$g71Sl4pR`#maB$ zZ4^XP$&Iw)LDQs>N(9?RhyX&z->*v9LX=OKVZkFi56^N&>$$CgR~@>Nj+Hpg7RZ1E zEtx9)tI@$f9XLJi5<75~XeQin0tW)$tJ|3w@&F+C{d?sf_hX6+6v1;OlBfCrYP}#| zEx$T1%Q>z&?(CZo!6?`h$8ZxPX0II2?@!2JFJLGNE#5)7_=Wd(8@%r|R2AAq2nuOv zrcX}CZh8rZQ%KjLu5ri!IeT2O8(s-H-MyN6OKy*^{zk%T(m@>Kwq~f6e!Vbhuj2xe z8*-}s$A)44$<`IeukDox;r?8jU{xDtl!CjV@rg?1i()BWrY%KGW9#l|NX( z7a2U8SiT957N@Gb#OPpdTx8ZPwnqe_z*M&R3zMnRzgTw*qkdklollsW0yGt)5F z4VP|T$W?^IBLw4&FkHQWpb}5u?H7Dq%^JSU?(md4S;}dHz^`Vs+6&);PXc*zm9PWM zxCG;^I6tJja)P=2^R;tg_$0N@mH?WNbO198LZ1_#(ApJ)542za`ObL5kpQEx>@!NM z(GNqSZN4-R^5r^}nqi2$z~u^L{L((@L8P!A zWGQT4a*9zHTL1XMnhZ2MF0PW5cj^ITTwUzNDhbdZQWQ*?XtKnTQ|(#2p@m4VG_Nhk z!JcfvOj(w^7(x!RsfJPuHlY@`=vqFqKV-MET6S+MSudx}_Vl=m$@q4k`w`)cvU}?y z(NH@uImRh?cYnOw(Z6$yy#7z>QV;YZRMI5F3;xLR)`q5^m*P>CF;PX7^7i>Ba1(yI zcw1*ZJe9Wp^ri4q(R+vxMh_hwm+}dH8iNT&0hVpZxknHVrpKKC#+{R{UgoGEb=OH+ zw@jZVcw(EdVl?Aau8>2OWuyqTKQ=Qx`+&nq1xg%-vAf*)6YI6{o1c<4s_32&K_n;< zbS~1YRHBo-EN(Y^mf8irAb1mA&TS?hgd<*P7vzXs=`fEOSZB&MC*|v?vAR? z&Q88*f85vro&0M?Ysw+r`3loOCl8OtXm-~~Nvt%cG=}?_-=@gf+*@?OE6}^$`WTr) zU&IeitXloB|8Rvb8!Ia-GQ<|n=@7VIqo^_TF)d9y#={W_zd>=#A|7Bg+|a;o{FSwe z#Y%yarg26-e5VpTJlAiaYG% z@hUZcpHYNk@cM7+oB;hIfhxjKO43q&XTFAIS*$iyv=SlzYDX&ccgzD zxw{RH%{gYj;>A&W~geP{U{f4(ZM zettADwKO&+tnw{Mcnz8U_4=cmE?Hl9*tbumx4U@I!aU4aaumS%3^T})kUJUTfow-m z*D8o?Px^%l9Ec4pd_0M%niXly^^+Njgq&A5QV1+3$ESZ?lC~jfk9BD?QI#WhR4WPT z(~`?{5KXX!DQxaxYJo?cv`&q#XK@9Nk1Yh=;EVG*1^pe z*kLH8tZRGlAL7Jr^jhw$%C@R%?=q7h3^YFrH!=De*!QIU&@b=Q3=jLuTOtQm!-zca zgAfq9*U7&At6ec&UR+!}V4ZANP=^z^)JUKhoHg|jljPnHmE!B@AHjE16T5@U^_YJC zCts8XBS+IXe9P5VU0j5Q{b>(oYqhmc@E$QGw7!mA{jZYW5xYg=I==nPAWiI5duO{rBzx!b(V>c0imY4hHBZh=2+3?2S=63Zlf=O_o9OFz2wvg{=5w z3%$(N6@%XS`s#7s=0jW}tYG5#;sd)8V)m=83$TOIhlVKkpP#C&B-EA|V&VY9Z z$?Y5m0rT4f6Im%Dp0S6n>C3M(UXX4blPo3shK=V{$^Bn?;FPNqpjNs}hweKS=hBS` zJAdpHjqEv*+$OxI7BBj=-(q)JURnBwKvu}MxiV_>K$v1GXhGt-~Deu~u?fZOj(+7RZ%f#$S4?gE%Rwkfze5v@uhVUHo}* zaV0wK{ts#MhDlQ1p?+?%e70d(B@O-^DL7g(j%$Sk=ar`VS^97?Qy{#n(zb8Qd9+&> zfRlz7by_X3e)=2cDIKhcI`&!A(?puGc6LLwZA;3YcGRtzz283a!D75|$rUGDXDpG% z!H+Suqi7yMXCf0SjLG6?eow-~IKiTVc^~aK0A{Cp4Ucbeh|aGPs2?4$nO~rO3w2xn zVR#?+S4dNqVV}PvyS}SAL>rT#eb3{=8pIi;M!7rIhnt!(`g`<1N=>s~j4+<1%;z(} zh5HBrR93)?eE@C&Q@Niy%pM@#m_Vs_!?%FQ9=A%B#I z6*kDM5W`{#Uhfg$3FWHKTCQJrQV?D_m;)W$0G`LyCw_O4LpV`TD}B*Sqd#i%r?fw| zRB1k0jt}c2cKq zF=qRJ@Fbu^&cm&x=q7VOI;m-G_pxL%)f#x&NrAy=Yq5wXFMd_Uw=27KhZl+b!u*i~ zs&}5S&)gAec4yDPGw>9o@k&$?bo-!3XA z^@_Seo}P{H?r1}t&<_NtF{HzR3{Nz4%=V3ya1)>TwI;;XwCmaPly#SQ(LO>p{@Y>& z_~($*K&USTL4YLm_(&O(`38rbSu$~{K4E3f%i(Jhd;vhb8FeG5bGbd2Ro}g)fjE63 z`yR9oT2Y7sXSZ=?(GV+5C3ly!gcz715DU2c z?DsQ5=vRd3g6WfArV&5y8xj`=W-1+el9Hk|sk5vbBXGeZ;rHCW6qc`JkU?30IN8X*~W zh?67l&M%Yd>VgAI3%4{1a=z}@nH{=No$adVyvW(vBRwq{b)oqh_^qdr@(h0EZZ8hb zRxg<+flPCLqs)O17{RCQ0^Hgj5sG`U>7etL&VrM(Ej-rX5abj_N+%wi(HWDd7`1fj z-@V&YM3cUIltVox9kXnu)Dj=Tk5QA&C<+ex9Xc;HmOVZnA`t4DG3@Da1~(bg>?E5b z^8uvWBThZbO8U@e4&>qt?sg_jn{8d5Pd&J6!HK3MjXvU1LKXe)9n(v%wSKHD z8-OVVQ=;;S6DPjDd#D*5IB~ zOb_{+VZQU+`{yjKY#)oSJgigmFU1IV5Tk)^Ba!$|T*<`AW)$GE)hDwKWZS0w8 zJ)xp?m10-AaLWDOUH9AR`ZXx%*D^wJO-EEUs6|HZa@P$`aFRl$;kVHKI_EhWwfo%; zp-Fh?cq>9yYCE2rh9T=!I0Ww%+;G=ToNHcd7i5HZ+Gj*DF$_!~19INzM1u%Hr~&ha zRqgWhyk7?1=Xl9)MS2IYm;_~^`C$NiZS_EQayQBYVbcfb)=|P=kwkf71ZC0Phv%6p z*ursrnT1pV3mn74S4LZ#{w1qGw;@c`ASp8X{KcE`^eUKM92*$PKn)65u^1Sdtt^F_ zdu)|T99H8#as$k8#L2KpO3|-fM)UfN)~cWA>_=%KoS1fG%`rg-&fM>*+hnU!r4=E~nC15F(!HH>P+mg5LOavv*8C>VL~kOlUE8Fbh6W~LB=t%W zU8|rp@2+Y+7gHaLt1D`zyD&d-dtQrcR)eHKHT$O$x^sGk5J8~~!pD+ukKS|cWP!QpOOE>6sN4G|GeXjQ1S$a)-8hyNicYg6o>NksuZKE9QaBidPmp9Q1p_w5-BZMsT zP>{py9#Hb(!-rpG9S)GXs@JJ4Wrq7|1COpWH^t)Mb1phpnKNoUvb~-OxD~J?yL@BV z%1ivu?@<4Tz)1OyzqfQ&dXFMn!0#j#E;zY)KG;PX32pMwo)l9To^bIgOzGo2qMq5m zT!Odss%9U$x_`h$FT3?2OlN@(84rAV?Po%BoTD2z;BP^*eKR zUlAp!Z^G^!{&^c@Kc3B~`cQt#Rq!Q2p1uug_>M6-5aqUb^`6ko2a>p#jnwp?O~Sk= z>F|x4u8R*b%UgyI5|Ja)GqW0op*fS|c>Df%)4iJr?~%^S@v3en|Favp{#J1Np?5s8 z;rm70^Nq@=;~ROB%y0xM+xwkoAGfnEeqih5Auo9O101J`FUi;>zCLp=aI-G;@Ugd0 zg!rb4VMi}37{jDUgwad5e%)GEkcC~(CXvRd~gZ@!m#k=5~(P{sj1b$+6-Yb3?BzFSXSG0& z#<|U?=SQ{FHzt2#Rdq_`egcwTvlbpUt5eC6E`G`b01tp|Ab<{X5 zPT_PcmJTvNO2@(QvR5wz-`7kQm+N&K9C3^yRGuI?3l6c!+S>dY&<$HC!F|*C-0mU6 zHD4s*S3GL1rh?(;@3&q6HIpw3Q8kCxhX@dp*9gRpZJ}-mzlOx$(&~L=p%dK;#orXZ zxrJrIt)t*$G_N_A@1yzJk^)!*zi1QX9b#r@{n4tt#D}R|>kV>uqQ=+-8pskbf4Q@I zAt^2Tec@mj#Yn&O97R@|s)&VDr?W%6u?BYCa$MgvFV$i0nSbgcm$*_JU}=YpA&e9C zgnh0e{R$!*Zh=3L5oR_}r$h`NwZSkM{boCKsNTMFWZJTqq-&R1namu$tnmJWI zu~h{;ebu_ra9YLI6{5$a?;0?fq3ROU?N5LQI53yubja(%vEnG<)C6$OFh+4-om$k8 zVwNkqyrzBgYs@3X&D&%#8SSH{d)+*<2HY*r-KJld9QNB&Z2yvl(7mfYpXDi==-}Ne z6yQ2Xeej}#liC6#f?Q7B5@{S`4z01te^=zOKmDd*j@oM=Tlut|hG`4Skr=@asw$(7 zFQ>H&s1G$}VFmx#60_u*3{WGj;HZ#$$AxG@Tja^vs4?g6Tm5d_&$ne8Gv#~|m1M$4 z`Rk6@=;QQXiDBV?feKf@DHsW|K8~^#e%E9dY zi3k$AH;#q;S>q)wv(tr5_4@3U87HXK#5Nd!JeqwLogUH$rX zPuC~fOruW zzk_>c=J0)XG^E4?yy2GfPR(lkm(q^PJ}vc53yUb)wCry?YY+-Ii)r;ccn|eFcBMqLW;k^mU6p*DWD>J(pL2=x{aM?+_hz zL*u_z9R`aw?7cXFMmXnh{F$56@p5-JgF7Nf?z;jT*}NmRIO#obBmL-eRbDJ>o@O%A z6W08`!}9ZsY#!jA(;Sy*dw3yE$})EP60?|1lQp1QY`&-(?Jw6jr%8M3YJ28zt-tBB zV#q?#pOTR-=I3)S1-5Ss$6yOP{MgY@BgbQa`xv8fAaoMpq2jV9@(Ecj87YVK=i0yjmWYH{gFxlYS z<1e7`wuZZ)KrrP@UTY)vvPsa^(#nHDyLmq~Mw(w#HUV51h9nM=(vXO@@RV`Azr4!2 zlUOHOIZT)Rc$^~5Exz->2NLZ4Ze{^{W2AKc_bqEYWyl)Ib6JlmoD#04B^QG`7x#MR zqwo1r$h35)JxtLDsNgusFi(jw9kf?xJLibQ#xJoOg_!CV9=FE@Qfq8%Ttey!Br3t) zE3`*kUp_{8SS)rdak@=`+_17{kJwmuYXlAq6}FB_5)InM^KRuK>E(+2(hGAvo;DZ^ zGD<*6_Y2wzx;}4`%Kk8E$o;F_TM(`{Tk>Wa(I!mTX?)v^IV^W|YJd}J!~rKXO!;*O z!Fv8rgCLrc>NRr*>)92WLPJ(R(Zt(mRFhGUek!<;8NR*GNE|N+BIiuXLXQt$0R_vL zqhqY~ZRY|`SyqWhYZl>3k}$R^{PhOK0lpErsi5o+V6@s za%yK#F4%HFXvemilz^@dJM@h|5mSodYpA$^qZK}ZRlR~W5m!!~B9u5YoDn;$9y551 z(2NiOD*TB`++FV^Y9^sCu-M>gr@i9?^|28+pR5ugkd3`F)}Fed$~GV*etKmHG|2^| zNm&F)H>~G0X)TF8z3cwf3H=pr%0L#Bo!^5LTrE9)*|{mu2iIdM;Ovb&z9|C0I^hZ1 zVs{!9wOkjr{T720INus?KX#R+x`6|9p#r%2net3+ML+*|DQ>PrWR4E{jQ?@+@8nf`3rzCndHdU1t$ z-}j`)`o#DX#3h6BpXhNceo+2dnA|za@RBMR%x_)BoE%Mvp5}$=f0N%=(=^T(ivPS4 z`3i(e`A^VqOvGaK&}60q174-tH(r+7Z%9i=_%LCUzBUt8YCZUs#C0TAuNN;Zz7i|` zY?{{jsZ-NeBhKDFDz!b+xb!b(o3Xm|Htp|#A59KQYzzTJne8yWHX&ii%K#$$p2 z<4yFJ7%|`RO*)frNYg(>>WEbZFcriGppY|*t(qVu5>o-b$)Nb1Ii5uNv#hiZe6FLT zBRP@6)5BJ$^vtKa7f+ZeI+eXs*%6PNt}0B=hI(zRX#1_*u!@{+pphi5#OSv)Y_}CrK|ct >|=prKFkIj z3~B63BbT9(%U}D_v^La#ue{^+dbMyvJM16F{z=i3K6-2}c}$se1S13wbB(PDbKARt zK3N1UfGv>NX7%+UsafeY=~0_(N+_ASFQamz=CCNuD0rTFNl+i$euRQ2TuG z&F5oNOeXX7#Sb)J#rI5OQPgcZr(J>3r^VMOX7--bXGDF^M?Q1J?mw{spUimSm3t{m(M-`ilChGqwuzuotW~X^M&VsCN*oa{k?u!wAis7nW^m5R)lo*~XOrus zq10b?pcp|AIQ0PcN>_H`YZDlug%5&yymG{B&O!Uuh(tt0yAQd|f6UTJ1v49Lcny|h zo{K5Z3;<{6_WH?nqdOdoD-P2wb2)amr@DuoL*AROCmoj;Jx54@_&T*ms^mRSfgEw+ zSZD!7S$TQjzD&0LjB9o#0H6f?_kRJtu<#dI$i<0nzU9CBy4(>zcGLxWP*_%}qeL<> zBv~{j-n=-i!SD$#>Fj*6Qm9d`M*tB4#m#4BeCmabyDz0a`QqKGM& z{kHow>9tzFe^LL|W4A~-%d@SQQ^{%fIZdlz&lodFQ?i}op|i&<9KUpfI%?eRSaejI z6S?E-08w=8YzPgzX>f0@iC(ky4kO@nwYTG9c$+0|@738}=VD>C51gb`emzs%{cq!W ze7{|TJE$6Jb7L6lCZ;$af*IRd+x7d_b(!{J^*G?@Vv?m>3}|R<7So2m2KnJi{o`iHu$Gs*NuQCVzXa zz~=;YnS!5#!b5+bp}3-`?7#)W*Pra&!jL-jbY5CfQE@izyEtZpAhA_2x~Nf#r~Q82 zd%U8|;A5KcpOfR|ETt+^Gm=EwH{a{IK1Z-UW*FyHChEq3o*2J1Ipj+1e}*N(GHwoo z4M$MtWa?Lt6`4{5{NCGWU#WtY5S>|r^nIF(R^iU8+{2S$*|Pfo)6BWQGr0h8{7n?u z@Jg<^y@x`p9k&!Kqmj!gD>ZuxCk?5mX0eD;o3t>+cxd6|-h~~u5@ES)wW1AWieqE7 zRfm}2Va_pi{2Ax_FMNLcKA-1vF{SMQ$-UsPjO3wfW1e8k`1EV@dcjG{aewa|;!jou z8sAz4lbxXxZNCMr>}>g9b}}1Lv*y&!+Hv-+wB8eW@KNq7k@+TvRUtbt6YzBgmu&pgZoiV&b->@ z(sz>4!t)(a(YUh7!3Utkn)U7@amT(-p_&|vEjt$*ZU`x1MH0WHjR#Dk&`384Ep928 z)yUbsVfW(4ZP3?)R(BVBMdl4r$pJzvY494C4wac*XuMu8UNr(OM6|e_hs4La7%$Eh zESj!m7@`5$V(J)qYqBC;#}8x_d7Y<+tY2;|KzMIMv%}U!IOkzpV0}dAOTHM4AoJ7P z#=&Mq*RCk2PPbo>c}d5`N>yuWnD6Oe4WH=Q9QyAuvJuGG?8Q1utG@lV1w`N@M8c~R zhE3C}&*`K}?8;m&dyM}e&L>1_2r@XQM;2yunCU*fJUSJgVQhC$HI5LIQ4q&jf}cpF z;y`e(E5G7$%jA@kZeM3`HMXs?sk)JKM*2*&I5P^Hms?Qp-XKIq)}P3RAj0vpZfswU zf+XXH=G@t)TQ>BJZA>d^?? z7i=q^ip(GCD)q}#U0WozoTDJa9{avDvZti3iLd&iIh7EJA* z)(LRvoVLyhAqs-#dy2Vx;s(X46W-=2X5TzXkGmetg|`Kc5oa7YPaLcfpq9u_AqpIV zi|Um0>^FGaJX*K*M$9PDlbUO z9;ke5KRSGT_bpippc3}02Y7!-#}fBzRSsZEIRY?$L*h#EJ90(^uLy$NmII@E)$MRs zTWeo0m4Pw2J5v)YnfuE#KaJK9I{K;#4LK~!N%ALGo?-kkvCDZ}G!txy%6PmHr9Dzh z;R0or;{YK3v()6EM#pfe_x%z{Wt8A3@r)U|jVx(LLXcdP4bK87J8%^?zOQiiE*_?g zylTt&Mc-=2)qEtg>dDJ}sIv~Zjiwr>=&U)b*XZI+>-J-(Rd6?Nlml4@Fl3@c*y)tOQn8CpA8l;0WH!5zu9R6;tNi6 zxk?R>B(lRphv9_=-A@f7tzTp)D>wuqzP>X%JLsnXXD2+tCMI!(QD;c4%+bC4i$TWr zFrVNtla$lzTR!B|5qlu0Mmhq^+UvXUneOtH`8tt;kEKoZq{nN4ln6g1x%pd-di(w% z!t_xLCh(@Kjqa7U`JO&EU*;h`VlbYE)vLA?gr`r0h%`JO?axM(R=u@LAS=euU%APk nWJYku@pTA!8}vUOf9hwIqRaAh>&J&{F(4o~;4r4q|5WCG%J(Ah literal 0 HcmV?d00001 diff --git a/tools/port-drayage-webservice/src/main/resources/static/images/logos/marad.png b/tools/port-drayage-webservice/src/main/resources/static/images/logos/marad.png new file mode 100644 index 0000000000000000000000000000000000000000..b6b32631376ba01c77c71cfa5c4155ad1663b566 GIT binary patch literal 23183 zcmX`Tby!tjwEevaDUp=!mXPjlltxmzyIUG*5b5sj?r!Ps?(S~*?eD$!eV+&afx~8> zv)7ty%rQRG5P4aNPYAdO004aY{!R1;06>EO0A)DH|Gq<&RtEsYz;{t0CD+swEi+B@ z`6Yp*@09Ms-Soty#E@9>)RL3O?Mh}=C1vXK^z>y`b@ZMZW%W1a7FJ@*>UL$%+FdGQ z9~7b>#ZW(>%40GKlk0u|Ho!e7y@u?^L{0(?r|q8dK905u-77@1+`E?lKVsX8++6>C285cOSxm-j*YjJN&cG0uHIJXNY~cZm0AxA>Fq$rwM9 zvh!6mZ3~XppcKpkE)>#of0os#b9TloS48alRIWjhLHa$pwzM>H7G?hLANc#Bh{``z zxT?0Y@ygjwS?@3>#f1pL5Em0iSQjl0k<1XT=M$qS^D{ak2LRk)mrv>06Pyj_BZVLy z%+FhxN+0+H6BEg$_wXG4&mH#)p!_9wH~*xr^yBvUvIMIpRJl+)0uTFhBBDsV=oq1? zQ=(*06bX1`WN#AJtHuLVk(>uj%Ctbv;-3F`!?G{a8;sQn$x$8Wy|X(pAAFD?aB(`x z1p@&@)N@`K;WOMzvh+Z80!s5q@y8ZfTnsiZ*O`GV1*F58|NF#PIekuw*bdG__CIw0 zgV6JQ@mS&GedxV^avL2j`{#}_;(Y#sYMV*zK zKIU$)mFYS^V%t7(74QFh@^Fr6C*a=<9g;ZwDaK)~tl6PcAfN3MseNQ8NYQ_LO~^!U zXew>$o;}d|yLx?W&yqjsxGz(l+IIfQXESig_;zMfPoPX^qxR0R`@dC^E#esP-x?_x z+r{UMQ~qlCBioHqUra0L$Zkv3uiH&71E0g>=v#@h)(G87?N_dj*1!D+&GF@8ImhSc zQH{>^iW~p?jQy<~lTY%DcPf@#TOSl+ID(8L>_Sz7LUNA|w{w=Jdj@xg$~w}uT6k6y zWKOF)(Py`v&}N&`i25VK57j^Y-&01PfUho?%d}|caizPZ1Tt&p68#CS&;LE1J`&>#l-xI#BOgLGsDAjt}tuPCK^rkPf_?qR04^+DM zxS#S3&>LgQYQ8um98(b&#uL6gwsB4Wb1p!``%+fe6d8pKBnnvkP9hl1iov;+xq9pJ zs@F+XhMc_p?f$`q1_B@v@-lcMz&JQJ@`eQ;mXdk7(v;;>lz74Y#|s3cqgNLN+o7Ey zbdzcg_1FrT(Bqklj8EX}B%LSQLX!^$1Yx;DRNzIM=FjIi230*6`%a$E_Z_I`)V|}U zy^R}g2mAdqX4!9LD*ostS%mX=Ph;N7_sCN4hxK)9;e*qb4MK~)eZ0!d$j_^55d{Yq zQ#920lUIg2W0>ckZHL;pT)O*5hhgn}lLTf3-oSYckt{^wN;-R0N+D*jiq|XN1fF)v zXA|)|XZ*HgjR(`q8#O$`h{QpS-;|j>U@4>ggfPH)a~)l&E5O5(IhP6hSEpT56NP>fsy@DBs zF+ongCt8E_ORd{iH}g8g1L^91Z|U(JCOUJ?4B8ISd{o?&?!P`5u_RCyv3*GqKQuOA z6g8hb;Mc6X?)@95qJ@MxmVQww-g>JRPg`@0Ne_pU++qrwF?<5gMfYzpcV$sWltkmJjv+@TRwVtKD?OwZ9qB*%dzgE$5QD+A;LjxXcQZCRc!n zc!hAdEXml5W@NqTw;Y!}tV7fm?ZCmbxw`+dD3PPED2UCk73MrArsd3Q;EH>BLMBpnVXCmXgbqb~>+^%8$Z-nj8AYVnUf7@}5 zoQ(*?g#uVKDPkO6Lc~xT{1GXmAtn(>1L^W~uePJwbug#Z5xzJJtde7^$uoaEaxS_M zX$2Ci_0Em3xbudQ`2imr;`42PKOxUnk>4IInjt+3YMQ^A8Uy7DJf06(^&doFgW5T* zM8bZMnMXR)tonsc_~>;ToorH&!30|OwFV+M^@fH++pxB!}R;g+98S^ z!cUmNh0A_u^zC<&Mv8RDVDphU-QLxA((3;G>h<(Q0G;*CaOfA2Rl6qXi=)@bZ>|{p zshjoB(%g`?P~oADs}%FVA8Dwxz*22~hr!>ftE-y$b7E9)^_60G+WBH}g-p_j~g$^j_~Tt?t%Xst|CY@V5k) zq9bT{1nTyec+V86au7m^+BToxCd|HBI-1@c+NgNdJzw-KQ%!|Y78oWoV~WOJupBJR#z%E;0e`$TC%6jW1#aIgj`Sa~kZrrgs8uyW6?_gi%rV!1uLq11tA zVe{Aii1fkhU6$Oh$p;}BFb~ZcORwI>aVRFf0Y@|3_(10Lc0Rf+t5AOAs_V(jpO@b} zal-4Sc%D?kBoAMX?`CXR5KFtVVZ+>Q1= z6Fl-2h%a>NPxVIxhZ1otocQcu#GZ0`G}Wu%PxL?6!83_>Xne29&Z&Gu64dkd)tkZqr4vVXD^g0w|X_vBk;%z#T+M zfWyUFoUbxNuB;2=cbGm%`-R8xYA9)>rB44tm`FGg?$g^zResB=EB%A!-r;rAq4!!@ z8OHOITRVMB1KIsfE6FqNA_y z6x$}@Tl69{>_j>u2_KE8f2{XxeY3!AiTH4TaUsAMn${QSBU(SN&LiX*`< z#zoKLzGk+biMma4`yQkvq35?{xRz9>A7F&3yKG5bz6|E!btGD}_JP}5W?8YGaQKI5 z1|rM-8}c&?zo+|2|9PA6MBM0dOho!{1~cUkIt5A{8ko;;g1N&K-MKX%Quw`oUGgwY zn+?>pMvG;fTp#u9GDXH5Hr$;w*B`bVo_R>yR6z!ky} z`zdEisspm=t>|&ey^aPipYvGla5v>iBZKUX(&xa&pxB86)vOOz@ql&b!UjjGA@$L0(U5R` zx90rs{C6dQ6e2h_Rk?Y0W7o)`AEj@^dB8U|bt}{jhzV}DYuqmgCyK4S`ns)MT#kyI z^yFlyGrj?wL+#sC7w+ta6|}$itu0}e2_#U)mF$&s59pKLa%3N{ic+dtuf(@*%2RgQ z0>H#}f(<oISmi}B+<9_saV)YIrTt)OXkqQ~j=GKt?_zp9E%=rL*~?mT#Z zp-UjQw!gO0Hfd;t_6xFSjC_K>a+m!B8Tbjw=yVuG>a#jC+_`i zqL>;I8fPHyF>R@Y&vx}Sd zrr)}AIeBxgVAb|v0HS~E%PA@p>F*hHtEal`m2OyCj@L0`7Ob)K35HIKrxYd(WHG1k zuS~D4o)X9h>qw*Mp?T+DpSey|>NryBAHqo#P=$K`q>X)9s(c>`*T8`F`gyiJ_-y}J z+upX?KroJQ)W=i%_)1^QqTK8jLi%W*C6K{n{|zoneQbo<&FNC5NnC((%EnOBRmYnl zKr%%`KFYCv13YodrA6f{1X2DIeY5jYpEV+k#O`iW35mA%j;;iWxt&M^_N_;QN}LI0 z)Vo~tz}_HX|9xchM?wdij>k1S}0#yfYfA++YO&q`E==4YmFDE^BqS{sr7Q$Wb z+RWkQs|NqkkU96IPJmOjs=C7U>R*R;4{^CV1Q9l;Xd2%_KHByW0|OOn-cd%9lt9s-u{2J`!+Q@Ud4bKo#G-R#%I&Y>$q9)J;6FQ#VJIT zG%Im)gX6sYLHNsh0Gq?m0LkR*KK-hjoP5XCt18@MqCDLP!1Q+E26adJ7H+g`2^ic(1zio49V}kOHtnV6-=#=?u=C zT|beNY>LvIW_DhmtgRIm^1*Yr=+-pI>HSlt=KWwFV!OOnvtFKzhk0^e5xHg`_g7r3 z*;*Vf1^}Ww`8pmQaY+JVSZU|pT_wvW$5U>)m*mzM&n~!Z{@{Lgeml-p(wE72;qu=M zBq3Q_W~XDOX@wPs_DZ#7JawDZ;TYcP|F=S44*mICc@MlSsh8!*!lnY?69*K1_EH*-OU>ASV~d(qV_hs z7ADa_${$UF26V>B2s}-1O>C@bBC#;(d4XDCnCJx!>#W(cM|f*I<}PjcD>@`!yZ1Dy zBA4MyW7mJhprbTiEHIZjAcD%~Jw8IkhBMLq3yYUwXMK1W1OS>G+zDXo1@2%71YUy| zK#}R+2}eKWDNlp*e&0;1{k9r_NUiX?HLu_Px@EQX$Pc;&gb8(Etuod&GZT}+`oJ#x za<3~ES~!=vPW4Ix+8YK+`gn|@#TKy~tdh&LD3~Yv$Aji_d(%aM0C4QZJ3H!z56S&$ zvHr5h>AYj6e^{)%=bg@@a_f0rJNW%Y-ag*|Z_5rFp-j6-oMJRI#@i4q5K*@dqx37_ zO7ePp8}^aZPD`|WSty*TrEp3PjQQ6F&>E|9fbztM#Ms>6}O{>XCW$38>MDrj?J9 z1Wgg!?FSe0|kC;z9 z44|p;!T+RYxuB?CtmP?ZUL474mqj*hxXD9`k%U|KTGb}S-pLWS+OW$aEdN!b*xX@$ zo_g|^&0j{gt5705mc2fCL5lbEcw``R5+$?er{NbiG95})um#EyF~|`KpZ<&I1KBt7 zV%3Ph2RbV8<2Xo#JFy=*$VU;t8`?fl#>82Aye$Pk+vKyzO5F~f20Fc{EO6hLi}PQi z_8~Hga)WDb;Xt0nvqOBD+n>hw3q={wIT1y)#x@2(fGtmjM!anjYmJtPGOFN4Lk$-K zA0ZKX?cp(dmB%A}DX2oFi7>jdqZR2_h$$g-8#`d{dmdwCp6@Q*D_mKkC@Iv{G-tJG zWqBJah40D@u?RR5&TZq;aSSEH^S^#H4rH?1q)}Rb4Fo04Qbr#Z%f}X-IFU-@#XmV3 z31^youYI-xTbW+fZ{Lh%qo7jc3&HJ18$l6AeKmXx$=l@7E)^%}*ik+AP$5Yiig@~o zQL}tf8D5kz2@;SWs8ghhs4Ttc!xDyt`Sm?F88qJ5>aw3BaJQeH{}7^D{haELxxYI2 zl4;dqi_JfYWP-+LojHx7s*TrWW21u%DsLo~=d;bO0{Hxz zmhZ+b=$ODx97!O%54C`8AV55otDvAFwp+7~O`%%Lr=#v^n;G$w>0R5yXM4){13*l} z%V;fV19ZNO-%ERYD{kGzw*F?G?nWr%_cAs0$tW;#I3G>k=*x^1_{_n|KD-mU61_Cg zo^J4FwQF{~J($8{N8EX_ObJbv+mMn`@%5LqNY0IQovU=?IGn|}5r4wtlUkUT34Aa# z5Xnj#DhUnvAn*ODDNb_tzEcA_%c_&b%|6Eb1^Cul5@-{qjiXWh(Qr;yg&bsgD;Tlt zi`fnuI$q9Bg&WkD6o}L9aMQ~AS27vbcZQL2lm*V73`8v#9J0NU;IBZDsKx2towYME zyPhF`SV<7XvQ!g)Lbqct=BIgjEWB^4rmjRazxkud{4!a`4w2<6Ocx{IGoJaaHW70c z0s!EFL__7RAs4;JC%4}(L6U5eIV7XztMWGdVb*O8+Sd5ja*U#4&0S(by4!1ZoA^n7xF>D_n8~rq9!5*Aj!=a@U zF`q}2MiFua1qV~Nt~7xMSvL?VBQYOi%50!3gJ1i8yXfYm#Vp`=Y75)M-|OX$k?({~*})G!Ywfg<~f-0O&+y^|x$V z{wdAvs{i}Acm3m@;rY$uO3SRiEV97uiIA>Ogm6R)cQy^p2iX>FCyJKB0x0DgZZkJ- zlcRwrx9{C|*Bqfl*@a^yhUXK5w15w|8W~))MGRPiAQissY%-A;_kBi)gPDZ_Zn(8* zWthRX46Gm}6|e!qVucCn-b!Z6=t9RgD*jSs9Kk)8JL*BY*gd!Gf!{?2%6c3lch-8+ zV1Yu5$U4_1bOS^l=Kk>y70mnzBta#UYo>Lfex7YiF)j+y* zxpb4QpOCM+Y>5OA_zlrtI%mPWFRoudiUg5^GnYl1_vua~p;_)u{TVUJ&^}Rzy~zubJwpS5W}Bcpw|QP=8nLg8tfH}Te(m2qM&9@ zQysWJHK~GDimqKD==7-J+JT12DoqIl0R7VD}Ic2}7#eoY;8V)6vSAZE)m zU63I1=N})Rt`}-Ge&^qtM1+JR)iFtz&BbfBDF%aOjddXnR=*_vCz$HgUNKE<_UQa^ zR0=Z&{hGnA6~j&1`m?0mk0WfDLB;aRVlUD{1tera;^FwXY@pQm$iEt;K{?W{Eg8v& z8JFtOWLu`D&$R}2X-ZPDelJ=@aDC(R)5~eU3bMcc0tT?qJMr+-HKC>I*t;uVN~|XT^+R7a(rsySUJ3-V zSHx6@N(?4Z{6!ehhr+hru*3FWbaUUZRkJjocc@75mGnK2pLf;?z{DYhGgRmIvwxUT zo<0Zt^Vx3705k&J>sYixw!++>lf~GunUcin*Q;H=wGdiBn zpcPV+x*ws;pytCPA-^Bwe^~$|(Agiuq30@^hNgADZ6jP2D=YE`%yoifwc51hDWmwT zh67|DcLkf12x}#YCBN}5601hw?3`~8BEw%1FcZsX^{bZhST2s|dhSmld`R=Wbw=k; zZ(SGwUD|uq(7efgBrV8k9r3E>+|ohB?A(sh(nJA-?`H|0S%gbKv1HA!{xx3g z#>v}GzS3ZsZL19@2MEk)|6yr{7N;s-f8QXWb&wXb2riDYb^BIHVp1=}k9T-XIhJuy2DN@V^6{f}DoaM6n-569=TFYNqk$>SHzG4(M3*LQK!UMEl zG#wyWv`AB6ghjTwS|Gwz)=i$<=t8MhT z;*=}t_WEpn78i^>!JA!7NX?npR-_a~m;4QW!vETCZ;x#5md{|qBmDV}x4g&5^kM@tOKAYgF)=&V~ z_oEI5BQ#Io{LOQ7-(5}Vir8B<$6LxhlVn^rchleC(s38G1jByz{V}PImsAq?Lb`#& zqKJ>X>*(goq$`nd*+<2aY?usMU1ySm%N}1o0)pRENj+R!+EZ-Qf29>3sw91BlshiF ze9CRyb)n%P8rE*!9dT))hXjsdzl0(7^+UH^&$(ug7*y@3Bn>S0%!La=|N6DWEegp9 zFNgx@J_TPeB*?MUF(BXE|EF8Q%tMB@P}be1h9g5L=SOj$J!V?A{4x7i?>M-V!|r@Y zf-$|x0$J?ZN5iv!o;VgU^uP*GXo&Oy5_q{dOc6)5`!;ik1R??d%K}86H(3#tFS+t^ z?Q37fwX|DHBLrw_Eh7Sn{B}T!*m_K~iQyoddM#VN_%exUZJ}rx%WMUxPuSc)0EX&< zEbH<9kTATHWKXVFKb+~T2#ntt*61B^<9@78bZ1BZl-}8H2t)^MYxA$2h>|m!>7{c= zKH|u_(VFD|kXeY-_g!$l`~$Bqm^tSNd`-W4lPj7ZRy6V0A2!i#%#zI}rL;O;`Y9)3 zUQ{O-(eQ<>o))^-@sN?Wqq1^7b2^eCp@Tv-+uf_9-Pz@7Y4s4o!?;cqzV->QIje3m zU_ToMxbZ1Y;?jFp~lV;2M+ z=5}Y(%P<9%kBW^n&gNKF#$h%Wvn&i_&kKi+r9z>crYlX}gt>wb4%}_A zS-?N5$Lr=te9G!awYwpr@zNEya;GBzz~=XK6xHu;iN7|03HVVqade70!g<-cd1!St zKgx_z?9FZ{M?XF0WiZ2HI`ElMwD~qOt8`1j{SxXFJe})2d%Cp=Qyo-8bL}wzA7PS+ zUraNsJ7~V`o~_$3H)qSsX%A7dB6HsSSb!~e&bRy-0BB7bxWM|2j=sib547<<+CjMm zLA%z@bN`lqx^pI)T39Kzfdv4;e0kF6XIVlb5!dJB*YB2&2T89b95!Q)PZAikoB|z%8{|6;P*|3} zJez+i?wT^7x8hRRx?#MDII_vZLs9Hi6(>w*Hu$x9RZJ|01`-A$NIL~dHEyr8Lx=W3$CRyX|DoGR=v zq42Pa>+5=oSy-SGg}N~UD?GGv5%VSk20b;L8tgvv>#hU)15Y^}4;9ix%Y@pJf*U%H zIWk6Zd5I4k-5|;seiMIA6b%i#fCALid)ykYx4QpxpaB5vF>RI;td@T5t;}Y_6m_SF zd_3NMJC3K2b72c~ze)llk(1pnuJq)J=|iR!!JHreTCtn$Ck<;V&q0xswsw73Au&C! zMQv`WQp{G^fp;C?efxND3U7?d#-FC&oTO3kTRH@9VtG6zB5?r#kp=jp?KZvT^WJhO zZo1AC9x{I8U06k=_xMRV#m1)ka#aR7FU`h^%L53Yk^ZC+qKz;8TVikzHUUoUsqXR2 zV|5Xs$K1#u0~*s&u)Z`m^Ou?7^)QP^$GdC02*s?Izs|wv<0R?%Nm?Dd4`9(*MgB8I zqR!fESM|yxjT)&c&wiFB+J7feEGz(KDalkqkInF;-3`+yd_@zT|i)NBPC8<<8RJ!Be^$HSbwS#9zNix|~>86;I%;_4z(8#VdoG_he#DE*P6B z8-}{l;M%1zp}F#m;H+6TOOn{!G?ssOb*tAKt4umR_osr|Q*gjdBhyDP4-143l3zBB zrorFs)P?qgT>py2UChq?>2L|7$3^c|)n039UGG_{{@-=&&p53#2k0)Ax$Bc{F(*#s zRnefB?M~X|{+M~f3K6fZ>`oWG#qX;;nt$m_TMSHiCf<|mGh|=pCu!KtOfAR0dR!n{ za()OO8pmok9M5Bjsy#-XHHy?L+{!BCgSz+TwuO>+URqlX@kX)r)3%X0Kk!HQrmc-` zwtL_i+70eHb_*li_oiDhsfbM+3%_nQ<?HxPb|IS zLF}t*uj^+4=;I9kAq=VH7xvvD*4c40x6t8CkUgJ%yY;<1VEswrIS~?bN;4}ZlYr=F zTqdbZv;B|Wc_4zp0YGA-?;e_Ov)SiAUI}Ysa22$<(mo;1p@*yrJ;Rs&-%F`{5P`^n zSTGF;770j&?ur?%Ex`;=x!*Ho$w)^ciJ_%HsHGavmJ7mj`X4Z8>lb)!;uu=>S~slV zEtF`G9x|>g2Q#p-i(q;bUIPk(e**{Vb)OLyo$2KN!_DBS-hzZ+fdAT7vUH*UWwCCY zwVp2@^hCOww|T@0NIFStgG4&B$uvunmjCBBQXgP_5V6DswI&J;_+%?r-k}jz>osg?rp*-l0nYJ=AV{uDJRwM(@QeXRbVZ+ z#7p|&?TWa?``1VKnwuPKL{IksheELQBL=3i(=31?`lvf4;riCi0U8z%F|FfSd$@gl%ZQeuf#9aF7O7i3S;;+(5mu$9zM_S8~8kw zOi_^%a4Egya@HNUoIi=x#;euw=%M1$82SF4+*+>4W9HkhY>WBBOQxPTG5@JE_!EA| zHx;w5eWG>eVvl?_k1= zWJytxNk?*-dx+I0EAY$1F=&x6osUkgusk<1NQ?i8-#!J7a6cc*5|y z+ZeS@Ln%id4QnBm&9=#OIBGaSFvoTf{P|INE*i2b_Y*|Cbtc8$$T|8z@_A~ZcNpf5-|i#({oh> zfa5ywx6Y@$w zjL3R=Ku;g=o3cjX9AX(AGshaRf*CH@GCs7@5b~7?6JnIE5r5{QRD=~Fe{$elduOk% zNMIkBHAY=Xi8VDB_cGD)Ie|zEoH$V8$6&uoC?qUkIzX~1tO3KbBw@Y86I#*rZT1DF ztLeR3H?;7%zL6+)!K_HV12Z2EOdK~Pid5(kS=w;(ybMET%Vu%9o|@pJ6;HuTsq6(x z3T~IJPAvhtvnE?A-#6`whzM&Ho+VL|?TCmRj_+MTN0*?HI8B8N1%R1{^f=9v^Q@-CP1UCbC41*L z&pMboZWiIH8x=dY>+_gcoatl17;zwF!YmG{2E~2}z6>+&8yng`bQP?gHVlFStyhUn zXS>~94bY``$isyq$r$^h&e`(zIQe|XDz8KpM=i$ui7`~X)@}Hu6UkpGt0>08$F9NR z79pT`KlypxM>r4T`)ubxq1mnX$GQ(VfUfk688YJv%1qe(YckjPhSk_EV}yW&1Hh{m%nltVkeRz5BhnX7Qz9iA=K`x;t9QmmM-^pD#u<$4|?<$CGMcXx}t#n(O%6Cm!kzgGS z3hdO(kzo)T|BGnff6pvDv~yAAVg^ zMTFI}lJF--Cpom`Uc4EEV}1ZG)M_K!wPXH$s`s8o=$qQ6Rt*~_nx6~Jlk2TK<5h7L z$e8TO7Do;{%7P72Hozp)4bGi7VsQxNPRVSn&88%)A--3M6V8hpiUk0|gv0Z`IzB3A zbq6JQ(GEhH4u^{Ra&1YE%exI3LM%SdE5;h5QQ9xhr!P>);a8+|98Eyb8R~~$C{I@|SF+8Som+_nrCCP{&frhmx!TQ1Vl7iXj zB@qjb+uSJ}%)^&B$%Ly|A4lpm^6HHDX(z_NI@>b7Q0LdFgDki>Xkgd>I zLnHU=0syrOvmcWGPLbL^Kr@d9Dq*H8bow=do7`3Nmc#2aioD z@njcP3I~O5JwR}C@m9-V^gq1V<6XjgO%XN_Gu(Qz)_c8C+3sC|Oeju+wV4O2gTp`@ zl+QLZ`tJbYWL4yvHH2p?gE2-5n!T@*vb}Sf@=@MgX2F=DXZ5DPXx=u<7bRxP7ZJX| z630Z%{MDPqV_N>i?!T6|tfXEH^9NWRm^D`0LA?@5nvds2I+!2x{Ea?Y0|;erM{7nA zeN#WrE%)zt5A1q+8z;7xRRQ1!%au-g6dbQ~E1Obt+OY}x{^_Yv2R^4K0ppi^XCLuz z%7vOiP$6#n`3)ggL|*k@4@K9eH+ZlKCzo$;(&fTGDo~)b@xKR|SN%EQvIZ<^9>*2o ziw=KDbx3ViqEHI66V!dn5BYe{=EjXCt6(-?@_=7_ISLZ=WrQ&Ub?AZ6)^E*F)B*Bz zG7FBD<4JgQG)V!ShUj_57JLXZ3F8mWeM%*kGA_hsD$*L2RX2Km;S-HtaaWfskgC>W zN^7%?hs$f+kzNO{bgNMkMM+U>3i@q7_fR0P(yzFH)w3XV_)*V0@KQ~$F{^>&eP=8# zAJ4U`;5$gXZA_?}DATK~4Zmew>8%b+)z=I}9%>#kY35G-Vu^|+kb+n6l`hwO9evA% zTEv&je?%yDT$47u54@*?uaqvw=i}Q{F?v;8O_$^V(UN5jI@Yn5$=H#fC3iK2AbTbX zX-~kf=kq?9i?ROV>T#V##~)%gHAr&pZPt>dUlH(;r%QXeYp_b5KH3ht6##*i zpMzjGCfCldrnEX>LXv+A1t=A2XAAZt9<;q(C*|u$gXSpvc?S&kXQU6+t?jkk(z#Pf zf6pcc|1{~~>rYan6y5sMdwn$qZN-@Nx4St%7zTFbne5l&0~6!u!~#`+%xy(IT2+6Q z4(my&^O00WtI7P8D{f32^EOhYW~VT!@}KM?Q>CuEr=OZA>U<#Ge`2SiD^Ov$;lssw zYkdz6M^d(!m|tIwbZ#3`YT$6X>2Q9nTsYeP@g?4R+1+UrPaj3 zPQD@zs~A3|2yklQFI?UHsz#Ymm}D^_TrYxhNoQ_Dg^8^o7KIkr3_!lLwZFWnfp!`` zW_Q+NC~@e~C3jQccqaM#RaBI3^kCfjIcHdBF26QC603|jlL(Q3Tp4DY7BwlQe70cN zFtoAZxwWk^_5yz|0zLkR*tRlM^7qnkfuDpZlN9PTB8p%;{@t873E0Gt9) zwdON1+l3IR1YL*pOs~FXKZ$yJtJr$F7mtWa1#1bJaWSxy=}NBHpE~C~nf!G#HXay)>{pDXQXuBGDP5 zEnP(y%aKV0hElkw4@adVeqx#CQGgpeCf z7(7jWu?>VL*nGq=Cf$=r7a_x|fDA-(*sQ)IkXrX(o_`A5WMW*oxNIf^0I8vVgUME{ zgMWV0*^^C|T*gL!^9{=%?y!N*_0gf2D4Co}vsjS4$04%f^R|tP>d*dxI-O<%L-PT= zpWcH%JfUI**z2!!&??!1HXKA{9(1?+EQ~9FtzS~8R+*40h=6YdEYmxNhSTbwGVF8F z;imXv+W;&R)RBkewPpT0L!z1xD5e>>bxpQEwRxNE!fUzz^i|Wxkd3K&{Yu-N@~Pjq zn0zu2>x%<1T?;wJ;cP|C13AnzNLqy+kfEL~Pk45(DVr;rJj!Qy-HphN2zM`yJNbl% z_K#Gge%Ae~`fDuwB!Q$Z{NTc*fW2Zx97G~?p&_YnnQ#OYBCI-H=e&`)hcs5U(tnO8 zNMQTdl2=qdjX^O1J{!2fkm`Ja`Y`Nq_&6tRc1Lj2_toltV^0qS$uL|1F?%&~#__j2 z+BDhlzlck5(Go9UIq82NV0TB~*JNOlgrqQEO^FGbg~O9CH5g{CgYh&PYX%8hq*FIe z*8c=s(*$*WjM+qCuw7ip`%9%jkE_dAKLe<<$9bS|JtVso|g=At2?U^^XY#s&5%i=Kc-dF zQk?&gUCbDKw~M{=dL1ulQM07Fe=*PXU=*dnl=K$JSk@ya7B23}kG2XE zUtk@|;cnTwOtzP06#Y#y1#ZfQF1H`lm6Zx_%3JX4Vd=?=#s(^S!8^nG?azzppxa$9 z5oL)$AM`yiy&b#oGv_fFjkdb8vm+u#ffp-vsmC+Ay(42I^PbyEYk#A!F9?&#F?Cw_ z(?tl-lKng1Or!b{RzSsKD9edR3r&w z*~!8W0>7BP5DXpZ2Jeg;;J3Rzk82<=8T=Tf+_$$50n5vR0UQpb&kLA~&=WlV*2U2n zBuwZDJvsiK3W0a9K1q{rykjHaNX^zU6(+=#(hBp*UI7`Y{HgQ zHJJr|DMKpAlyN?bFRt3_$)rJpVT~XtAN~)BAD^tm@6{q>;vM5UdK%J!Dm0op zbv&G<;!*JL2pzhXO_X$@ zivDKZk>Sa~tem%{cKwTNv?&vxwJxdQuww449t{DE5_etmG0Z49`sYaiX@SKW;hWl` zE*eOpnDj>(=C4c+IE@A>KbwDt>lLN1oSVd#3v6Y+D4$RTlK(~}nt)jvXgm;X{Zphs z!B{O}I_*H1l?Zs2@CQR{*6H9+?UqONWU5v%Z8W~7yMf#6)`B&B({=nQXE-HNJ^2dd zy9rQ$^nLEE6Um8^H&4p+&uUnJ(SclSNnF)5B4YnWkLcl4vOqHtoO&4UjWK3L24~D9 zKbzhH046$#xa5fVWllarhk&#B{W}CutFBZ&1p#1xUYN=*W0OchlDKr9?{?I5Lqz^~ zWc0Lb~G1R4z}2&Gr7Uvbk2IRK-5kD>tm!_eEHWp^F*RbE~g z(!vA^OYS=`gCIy}_#IcJfCm61BC}|DQAU<+!H=58CqBS(k``*>&DO`$Gbu3mB-J|) zq3zSQEIxICx3l=RTTFCka>A8VXSK?sRT)Jx0(m-P17@K=QyhIOgYEVw$VA*->baID z3TMGJv1V<#6$oyO9PUA#2AV&}?aAtwx6e-gd>@PZss5bF6_D5m7lz$h8 zbFx<+>B=xqv2?Xa=c!$8DJgI_28~$EB96%8qxH6xg;$6HfLTc74R*DKPe=M?e$0Fob0X(NGpVd{Qfm#e5{gf+Yag@iVfN2^?pNFTw9bKBVE z#rDhHbn>84Iyr)>K&%M-=CTG>HhCxxN}|6$%y8S0aDnBTciG1({K2_9UOVpKDDcpW z?+pxzv{@-e3C+8^UIDum!q8-yQ%lg^nd|qw&mII>Y5)K`ic(2lib;Kic3vHu`A7gc z$3fQ7aKauaRNAp?<7KIsDJ|Lb)%GKWtW{?vFWfF5Def0zmXS8}xg72r=^mwW@Lb$e z$D5`VE|=$^ok0GQx`EFI=L04Bi zqm-G*6NChqMwa~imSVKU6bXtXvZveXYY!Z(G%*S2TV|tkqQR?Q>FuH)e>QI1lLYx z+xNnGom?&!@=7M;?giufdzkZyM|f~6&(%u*C)^2W|nkPCI+^pAb z>{d~oB$F`?7xVtqi*j_P5rA9>5FCai+pcM; zMQ&kOV2970js(d{ly|w6^k|#vWu_IBo#Se^$B{9FeQ@9f?y%%hjlB4wF%o3;9CoXM zjh4I)ewb@FQGd8JQtViEvb#$$;JIlRylqVR=&)^4ffx)24SdE_r8txIw9Lk)oFG<3 zmz|YMN|+?e<_Z}+oh|9V*Z^!wI!F;O{KK#486y})^@(?o+xa!A;zu&rx~jbXic6tv zhp%MM%0--0pNE0utke@<2ImMJwCp%Nn|82!jKd!lDDV_mh??wuw-Rvm*FOyT7+_qj zUxtK-wJgB2sWttIg-7rN+BUQuOKJ9xvRE&WV1NBs(eJz{o@2qJbt+n;-oUb1bf}ft zF`rfDE290=C_XmSH6!hLS0rZ#q-<(+eCC&FU6Pdx<+HQhsH^DBKe^pRXfkN0pu~cH z(MKKuCdE-OeOK{d3>Y=0f4cLh_JsvfIb*D5V^?HXsEe3+PHB|h?|M!3zi#z^(!QBR zRkRLdw4^R8tSaW<=Bs@!13y28iJ!CuSLdQy##jq2fdB*!?dJc9w!_EgzIt9Cddw!izQ=j4rp;N&g}gI zmnmD|?4@)Dw_cYQ*nz>N)mFKK3)pJ%j3<7LL_?PmTN=X`{Mlrb&@`5fS#;4x{gsD) z1mCJNNI4b0d8rc^D^P(%0`{4?jN^AWWx8FwJ3rUEvK2S$L)B++Jhog}A09jc_gefw zvOJ0JeY?M(yBMAfu0L(yq7!gozf{Tmu`%;91frwBhL@3*lNAfop*jKP?E3gH$O%Rc zeTK6;0Os`8CU3Xv}M#M38g`CeHL}JIZvN4vG z@*VPk)o>{nTR73opRh*<2Zzl~EydmBo1^K=#YKEQ1q3+zpdS2=8K)GdGMmIrQ)}uN zrW0m1E@rZM0)I`3$egAJO}UGy-9e6OHa$6HY#X#Q;3XXs4Xn|ip zG@NUwfPPMb{m{q=b4u(%F&9|^o$IK*XV33fwD~d2B5r~^%$`q5%)GPRedcQ^Iiu=S z(g9c<*VTs-V3rN?ykFI6i+H)0(OC-RUlXxJMoq!#S&yqb&gp}8e>3+2b7Q7LV`-W| zyfv*RPq4Ow<>E|Ky=s4DkgXZ#k||zp^W-=W%__wgRJa|Gyk**`AbRyQzJGVUnPgo+ z2pW56BF_^W z@$8{qIaQV-oK!2~at2bFs zB2KAvSnPnld>58I=cKIs5v#2dxK4>~dTUI3at1mL`EvQR@JVZ|T35FRLPJic_DC*! z8?Z;Wr^oOyaUqu92SxPPoM~gtYI`h}6hCM%6WB)f^?YyU`1U#w8y&iC!T62)GCC_BcXMF|TWD=r zY-UJrH&dOE9>Yh(^s_w9kzoM}wXVxDc_YkBS|nO*cx;$uvFOM^g&sFr)xi)6fjei) z7(X^9aK~A(L}7dxBV?#r*!1ZSzqzvM-fo-$A-&$5JS;Li&>?vW%~Tt5jecm174h$t zoV#9(Hk$_ku==CdY+MoB*1tRMokSO?yQTp4Kqgn*c_233-dY_tb$HktlZUtWCo`su zy7XtUQ4&Cgq1w8p`<1me%x)EWeAr+slM@o;hhpYxJBdsQ%*bA3c;JLV0aoKiqL{(e zVmYe>qK*49x=-^6uxS*jT(#)i6Y1BA-kCnCYq4Oe1fryU=k}b=V#yuR^cE&!t_xS+QW%uQNVKOwGu*UwR;ER;=H0eCmQ9cBSO;80N;Z zS{*hdGN5b1cl$9QBGBK1OYmF-pHf;;QzL9J=B@+)*csynMRhF-wHZ$u;Lh&wRS_1{ zOOHJxA;vR+TxstHu$mfzPPd?iCOcN8K`l2h;o{ofKg-L)(ACVqLb3Gx)gne)7E^&@ zS5EwZ$>bImNeSO`eD%5N_2pf8TK0~L||7XYfakIWj&B*U^ zL-q@MTa+3z4L6&C*cNE7+sQAzn7HSHsV1V%1^e}K=QKzaFa#5P%KxoDRQ{-uput)l zHhpZQomC;ovz9vkQ_#^FAw2f%udfTbF#;8pkJ1VSmckMmot~Lfq|vo@ltv+u$>!1* z213rfe&34lr)|$6Qmf+GHk_#s?L=&J=-K_NPMym+`A7EU!bcnig-~3X+D-5nh(@cM z|M{L{KbeP~c^-gvRWi{9n9*;0jknwKuMT{b8uz(5(c*HLE9Os}n{d?ZG$Jr06w6G% z$mELr^1AN3{POawqi`{}ntBX=c6LIF@z_A-&z~PcN?5>7oFD zNnJUan|7soG0d48S0=J<>+eRoi()vD^4m=B07Im5q4dVBd!}U1mB#{Yi5!Ch7neV7 zF99ThYJo`DC~q(GgA-=pyRa6{o-lp#u(FCrzn#swoLeTAC{!qJD*Z;tkXDC%@x#fS z9wvJpE{w)zr76*EkSZRFB{oE?3N>2&uepvCWae$ z9EQWw^IF;KZ%iKk$E90lu2Ezds%aa;rQr5`xeo8yTr2<}WXP3_;23uQQDaGU{b?PB z8-PNO0{~cL2!Tn&rC@{lVz_}#qkJ;I-9Yb-#gvzauHA9bNPtb9xFdXcreb%k7PabZ zYee5Z-YC|_9D_xtB%irv!+$e1BfnOn>Xb>#e+$oEn`nu^03V3dMv2m_)=hhLSa%!} z?1WG(O-(Ddj8sX$cq`esp4e3Kj-yvi4O{vJ`hm6~2B{P{?a$)t1!Xp#9fy*$5R;g2 zPS^u3he?Esk~Ay+x>vf>bMCTQ*kr0{E310UvCpm5A%Gzg5lz*ViTHDA{#=?X6JgUj4lXCx=;DWm z_mGP^0hP(L_;~W;LVYYvg!LFcWI&*)C%C4gs9pVo{S+? z8+)|%(ZizTnl@Jiher8f_l5R6!GvPz`(Ny}4C&HCaO1HD{VTxKivWg5O)ctgHy^cH zUadiwtlp*8{C|6A8WqKr#qmckMK|3vo5&6}i)>*Lf)dctMAW!W#6%b)MhxnR6E)%z z7mg;HMPpWDCL~T0^^Bt?cqW;UM1#g9M1_bfDk7T=O{5XJS$eIl=R;{zR981G0+RTC zhYwn(y6U}p%dL9v-v32SeO`;=v7z1r;v7qd-DW&JDRyycQajC?fFO+;6mMwi$(L5& zc*kMbj~0S7N(B7PYZnaJ9i1ei)M@eNF-dBaNQeo#FE@8a6dC}4%dt}^)zcQfai*x8 z{tBYgqZcn%&CPoIN^Q#!i_HF^i3ssahzVj0%LYZ~%8mP2!gclN^_r#u$%RchvzSC& z`;Du_{?M`0rvC~BNZQN|I~mN%;LaX zxn%Ztr_0+qG}JW8<=Bx%P*z!Ia;-L{6B^FQyA64p(*`>)HiNJbKl2$)jg#ZYu|yPE zK`21h{%t%%Rl%OmB}ik&+D|4YMJC0E006qXH6;}d#g(^odbHo70YlGl*xLgDyqNyv z{;w`Ldi6XvHxY9DR7HE&-oGzQF|7?!d2W9ysu~v?^q0g4OW8_oq^7p9=xP%~u?Yac zjI8eswVqEu;(+ijR@|beA{rYP>Ml8jVK_sQtyQI2wEoj4qNSnIkuFZ++b!*7)xR@h zs^}0y=IQrGK&MB~Uc7#-s-AKtxPI$ST!eq#?iHqqrL#+O=-6pj#!juC@b__Jx!k}J z6yP}}Ioy1TXzS1{UY9p1F@l;RTJNZ88{1C)auxIzN*w~`&Pdw&Zob}t(Yvmj2>I#a zjpE8%e@O@p_8+0uqm-_%(P*U4V1wtAVbSdQc({D}R@QUbADXrbICkJ_b>o1SVDRYH zV=qjL%Xs$5A-->HRIt>?t?{;!OWT;0x{CUdg(N$3)|pGybPaxRZ&&QZ`AU;oBc$FXxjcn=;e{)nLL)NFYDP-U}iW_oehniYx z9pNgW`xy>52-2uj>2udSJM@}cJ{~S1Qm=Y>n`w)?OOItukMGB&f&x6(WKLVO;Q&LK z69B+!=N=>=_mO4YiqzuL8irf4J)cW?2C2HV005Kp2^GCZkjA4wlqEzy?DjUhQn5@#an?lx4Ot7boeP*Pqn8O{WFR#OgjQJ^>GA7aGA^`x7 z0=}CFF`u|)O6{hslp$MZTDA0f%XD5gP;IBBF`3SjJ!#amxae>3M z&aA!|PHIuyfDzQ6#oGY@NFzb}Q(F$oR^uf7Ou%-glSFjjqqWOY6RkgFf;6^kP?oQBHgY|qD{-E)HmL_`;)jJbGI51VwW)5i^uP20;v|Y6!^Ss z;k5DNBKGb7_Izo5WwT1c=TL66C_$oxQH*foBLlXsnwuCOzT^F`62f~{2F!~m^>ufr zkcJIrGb#TiWW_JY|pDp%dgdqbawD| z@6j;BF`Us414ntKO^l=;aTE(#<;w*K&(B@Ly%%oif|HhZD+9b7-JE;eg7|zM-OwNi z-_ye_0mDrl2FGwGXXZMd)WgY^#uW&Vq|siCVM{+jXwUcc^#B0SZ^zJsrP9$oJ|^tT zqo*#G)yX>b5qNS!32=s=G? z#~q_=IV)19rzBXJB4$sD*^vELCy7{q@aR(nYZ-(BWOAerW3-yz*G(dzPhwUk69B-> zl!U8eBMuz>>0I&6(yFEgrN$(+Pd&ZSqdYRxo_uP2jP;!W;aNqKbd4py1 zbb6H1@TMcQ=d(tZ(BI?C8NxhO==%S-J%^MO?0^ZST}mQ$*Bg@8}5WxcG4D3bxeLmeI<3nx%)v_|?t2rgoLO zuAvzKAP@?DJYA&$p4JB@1#6?T{?N)}wAJiUEM5QckrSokLcI=rwARPNrJ%56K~A1| z`u2wcl~sA?TJ}s%5C{YUfdE_f_UL@LBWwGL8K=I!dgS=e0Dze(3Blej!$I#~rA4_M zyTc!3Lz@SIKp+q++@IN_R*?Ulzk2&Wzo+zX_U&8(9(L$)y9S+}6n^H|wn0@OgFqk< z$e)1wTjVrxy{2jR$KSlWZLzDf_|UP!McWViIzEI{r3Q>pqr}F{l$Tzd{UE9t5C{YU zc|_=^*#iJj`hL{z<<9qxym#;vBk}a0Ld8yv3HIFi$^!V22Z2B!5F6>g*<*0{_?eBn zj%rbSu#F!<8oTtEo1<{e3zJ_+n*u-bAP@)yVmkw7_5c9Ywel^y4*&dH4Z>w+#T*a_ z(%7NH+$F-fDKTqT%o}2XX$S-Yf&2*=NV5k3(CN|Bzm)I&{QDDSGA|KgC0p2iVZewM zwINRGzF^K1(^C?LK;RVufj}UCN(R{MQFL}`3JOc!`K;hpO9xIGMF{VH?H}bDszq^} zG&=CPF{8axXC%&?G8TT}K_Cza9bAP@+|Mux)d(V;XFTU(VHU60Bim&bQ@w09rj u^04v*K_Cza8-7u75tGmW0000Port Drayage Inspection Area +
-

Requested Inspection

-

- Inspection for vehicle : - - with container : - -

-
-

-

- +

+

+ Vehicle : + + with cargo : + +

+

+
+ - -
Vehicle is proceeding to Holding Area.
-

+ +

+ Vehicle is proceeding to Holding Area. +

+
+
+ Staging Area + Port Area +
-

Pending Inspections

+

Pending Inspections

@@ -43,7 +59,7 @@

Pending Inspections

-

Completed Inspections

+

Completed Inspections

@@ -57,7 +73,7 @@

Completed Inspections

- + @@ -69,6 +85,12 @@

Completed Inspections

No Completed Actions No Completed Inspection
+
+ + +
+ - - - - - - - - - + + + - - + + + + + - + \ No newline at end of file diff --git a/tools/port-drayage-webservice/src/main/resources/templates/landing.html b/tools/port-drayage-webservice/src/main/resources/templates/landing.html new file mode 100644 index 000000000..c51e651de --- /dev/null +++ b/tools/port-drayage-webservice/src/main/resources/templates/landing.html @@ -0,0 +1,80 @@ + + + + + + + CARMA Freight Web Service + + + + + + + + + +
+
+
+
+ +
+
+
+
+ CARMA Streets is a component of CARMA ecosystem, which enables coordination among different transportation users. + This component provides an interface for Cooperative Driving Automation (CDA) participants to interact with the road and + port infrastructure. CARMA Streets is also an edge-computing unit that improves the efficiency and performance of the + Transportation Systems Management and Operations (TSMO) strategies and Port Drayage Operations. +
+
+
+
+ + +
+
+
+
+
+ + +
+
V2X-Hub 6.2
+ +
+
+ + + + + +
+ + \ No newline at end of file From 72e50d9d55a5a9c7c278b4e8a715002711c4298c Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Mon, 20 Dec 2021 09:41:07 -0500 Subject: [PATCH 17/17] Update release notes --- docs/Release_notes.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/Release_notes.md b/docs/Release_notes.md index b152d4861..f96643126 100644 --- a/docs/Release_notes.md +++ b/docs/Release_notes.md @@ -1,6 +1,41 @@ V2X-Hub Release Notes ---------------------------- +Version 6.3, released Dec 17th, 2021 +-------------------------------------------------------- + +**Summary:** +V2X Hub release version 6.3 is a hotfix release for 6.0. + +Enhancements in this release: +- Issue 290: Implemented several UI changes to the Port Drayage Web Service for CARMA-Freight as below. +1. Added landing page with CARMA-Streets Logo and Description +2. Added Tab Icons and tab notifications +3. Added Footer with FHWA and MARAD logos +4. Added indication of operation area (PORT or STAGING) + +Fixes in this release: +- Issue 287: Updated image tags for arm64 and amd64 Docker-compose deployments to use 6.2 release images instead of release candidate images. + +Version 6.2, released Dec 10th, 2021 +-------------------------------------------------------- + +**Summary:** +V2X Hub release version 6.2 is a hotfix release for 6.0. + +Enhancements in this release: +- Issue 268: Added Spring Boot Port Drayage Web Service which includes Open API, REST API and Implemented Spring boot REST server. Added Maven pom.xml for Open API Spring boot server code generation. Updated Maven pom.xml for unit test and Jacoco unit test coverage report. +- Issue 255: Created Lightweight V2X-Hub Deployment Image by removing unnecessary apt-get tools and libraries installed and unnecessary files included in build context and any steps not necessary for V2X-Hub deployment. +- Issue 272: Added REST Client to Port Drayage Plugin. Changes consist of Qt REST ext/pdclient library generated using Open API code gen and added logic to request and poll loading/unloading and inspection actions from web service, and added Port Drayage Plugin in sonar scanner properties. +- Issue 279&281: Implementing Port Drayage Plugin CI/CD integration by Adding Docker file, Circle CI build and Push workflow and Docker-compose setup for Port Drayage Web service and updated DSRC Immediate Forward Plugin Configurations to include Mobility Operation message by default. +- Issue 282: Added Clear button for web service to clear existing actions to allow for repeated executions of the same sequence of actions without requiring restart of web service. + +Fixes in this release: +- Issue 213: Fixed PLOG and FILE_LOG logic where PLOG never prints statements and FILE_LOG only prints error level statements. Discovered and fixed some segmentation faults in Qt HTTP client code and Tmxctl CLI calls to obtain correct MySQL credentials. +- Issue 257: Fixed DB Connection Pool Logging to debug the Docker secrets deployment implementation was unintentionally kept in V2X-Hub which cause V2X-Hub to print the MySQL password it uses every time it attempts to authenticate to MySQL. +- Issue 260: Fixed Sonar scan issues found in Preemption Plugin during V2xhub sonar scanning. +- Issue 280: Fixed the mobility operation messages used for Vehicle and Infrastructure communication does not indicate the origin of the message where infrastructure may attempt to respond to other infrastructure communication. + Version 6.1, released Oct 15th, 2021 --------------------------------------------------------