From 4269c6f4cbf878072d26e92f0944a42237f80f1c Mon Sep 17 00:00:00 2001 From: tigershi Date: Thu, 20 Jul 2023 11:15:11 +0800 Subject: [PATCH] upgrade singleton service to springboot3.1.1 (#2482) * update the gradlew * upgrade the common * l10n upgrade springboot 3 * upgrade lit i18n * upgrade lite * upgrade lite i18n * fixed part i18n * commit the swagger * upgrade spring boot 3 * fix swagger ui * fixed agent issue * fixed the other issue * format code * format code2 * format code3 * format code4 * format code5 * format code * upgrade jackson * format code --- g11n-ws/build.gradle | 19 +- g11n-ws/gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 60756 bytes .../gradle/wrapper/gradle-wrapper.properties | 2 +- g11n-ws/gradlew | 6 + g11n-ws/gradlew.bat | 184 +++++----- .../md-data-api-bundleimpl/build.gradle | 12 +- g11n-ws/modules/md-data-api-mt/build.gradle | 6 + .../vip/messages/mt/MTConfigContent.java | 4 +- .../mt/intento/IntentoConfigContent.java | 4 +- .../balance/PgDataNodeBalancerAdapter.java | 4 +- .../modules/md-data-api-s3impl/build.gradle | 1 + .../vip/messages/data/conf/S3Client.java | 5 +- g11n-ws/modules/md-data-initdb/build.gradle | 19 +- .../modules/md-restful-api-db/build.gradle | 7 +- .../com/vmware/vip/DBBootApplication.java | 6 +- .../java/com/vmware/vip/Swagger2Conf.java | 39 -- .../main/java/com/vmware/vip/SwaggerConf.java | 49 +++ .../com/vmware/vip/api/rest/DBServerTest.java | 30 -- .../vip/api/rest/ProductRegisterControl.java | 25 +- .../modules/md-restful-api-i18n/build.gradle | 13 +- .../vip/core/except/ExceptionHandle.java | 4 +- .../i18n/api/base/StreamProductAction.java | 2 +- .../api/base/TranslationProductAction.java | 18 +- .../TranslationProductComponentAction.java | 14 +- .../TranslationProductComponentKeyAction.java | 16 +- .../api/base/TranslationSourceAction.java | 9 +- .../i18n/api/base/TranslationSyncAction.java | 4 +- .../base/TranslationWithPatternAction.java | 4 +- .../vip/i18n/api/swagger/SwaggerUIAPI.java | 24 -- .../SecurityAuthenticationAPI.java | 20 +- .../api/v1/authentication/SecurityKeyAPI.java | 29 +- .../v1/formatting/date/FormattingDateAPI.java | 16 +- .../number/FormattingNumberAPI.java | 19 +- .../pattern/FormattingPatternAPI.java | 13 +- .../vip/i18n/api/v1/locale/LocaleAPI.java | 11 +- .../translation/TranslationComponentAPI.java | 38 +- .../api/v1/translation/TranslationKeyAPI.java | 32 +- .../v1/translation/TranslationProductAPI.java | 32 +- .../TranslationProductComponentAPI.java | 33 +- .../TranslationProductComponentKeyAPI.java | 68 ++-- .../v1/translation/TranslationSourceAPI.java | 22 +- .../v1/translation/TranslationSyncAPI.java | 9 +- .../i18n/api/v2/about/AboutVersionAPI.java | 12 +- .../v2/combine/TranslationWithPatternAPI.java | 35 +- .../v2/formatting/date/FormattingDateAPI.java | 20 +- .../number/FormattingNumberAPI.java | 18 +- .../pattern/FormattingPatternAPI.java | 22 +- .../vip/i18n/api/v2/locale/LocaleAPI.java | 28 +- .../v2/translation/TranslationProductAPI.java | 40 +- .../TranslationProductComponentAPI.java | 25 +- .../TranslationProductComponentKeyAPI.java | 82 ++--- .../v2/translation/TranslationSourceAPI.java | 26 +- .../v2/translation/TranslationSyncAPI.java | 6 +- g11n-ws/modules/md-restful-api/build.gradle | 4 +- .../md-restful-l10n-synch/build.gradle | 9 +- .../com/vmware/l10n/synch/utils/GitUtils.java | 6 +- g11n-ws/modules/md-restful-synch/build.gradle | 14 +- .../v2/synch/TranslationSynchController.java | 8 +- .../modules/md-service-authen/build.gradle | 11 +- .../Interceptor/APISourceInterceptor.java | 8 +- .../vip/core/auth/IPAuthentication.java | 5 +- .../vip/core/auth/VIPAuthentication.java | 5 +- .../auth/interceptor/AuthInterceptor.java | 10 +- .../interceptor/VipAPIAuthInterceptor.java | 10 +- .../AuthenticationLoginController.java | 17 +- .../com/vmware/vip/core/security/BaseAPI.java | 9 +- .../core/validation/ParameterValidation.java | 4 +- .../vip/core/validation/URLValidation.java | 4 +- .../vip/core/validation/VIPValidation.java | 4 +- .../modules/md-service-i18n-l2/build.gradle | 2 + .../l2/service/date/DateFormatService.java | 7 +- .../service/pattern/PatternServiceImpl.java | 4 +- .../modules/md-service-i18n-l3/build.gradle | 6 + .../core/messages/service/mt/MTService.java | 9 +- .../service/mt/SourceToLatestCron.java | 8 +- .../multcomponent/MultComponentService.java | 4 +- .../service/product/ProductService.java | 8 +- .../singlecomponent/OneComponentService.java | 5 +- .../service/string/StringService.java | 7 +- g11n-ws/tools/tool-trans-fetcher/build.gradle | 18 +- g11n-ws/vip-common/build.gradle | 13 +- g11n-ws/vip-manager-i18n/build.gradle | 62 ++-- .../java/com/vmware/vip/BootApplication.java | 11 +- .../APICacheControlInterceptor.java | 11 +- .../APICrossDomainInterceptor.java | 13 +- .../Interceptor/APISecurityInterceptor.java | 14 +- .../Interceptor/APIValidationInterceptor.java | 12 +- .../vip/core/conf/Swagger3HostResolver.java | 57 --- .../vmware/vip/core/conf/SwaggerConfig.java | 346 ++++++++---------- .../vmware/vip/core/conf/TomcatConfig.java | 20 +- .../conf/VIPTomcatConnectionCustomizer.java | 33 +- .../resources/application-bundle.properties | 16 +- .../main/resources/application-s3.properties | 18 +- .../vip/i18n/api/v1/common/RequestUtil.java | 4 +- .../vip/i18n/config/SwaggerConfigTest.java | 8 +- g11n-ws/vip-manager-l10n-agent/build.gradle | 19 +- .../l10agent/schedule/SourceRequestCron.java | 3 +- .../l10agent/service/RecordServiceImpl.java | 3 +- g11n-ws/vip-manager-l10n/build.gradle | 52 +-- .../java/com/vmware/l10n/BootApplication.java | 10 +- .../conf/CollectSourceReqBodyInterceptor.java | 8 +- .../CollectSourceValidationInterceptor.java | 10 +- .../vmware/l10n/conf/CspAuthInterceptor.java | 12 +- .../java/com/vmware/l10n/conf/S3Client.java | 4 +- .../com/vmware/l10n/conf/SwaggerConfig.java | 100 +---- .../com/vmware/l10n/expt/ExceptionHandle.java | 4 +- .../record/controller/RecordController.java | 2 +- .../source/controller/SourceController.java | 6 +- .../controller/TranslationCollectKeyAPI.java | 98 ++--- .../controller/TranslationSourceAPI.java | 20 +- .../l10n/source/dao/impl/S3SourceDaoImpl.java | 2 +- .../TranslationSyncServerController.java | 10 +- .../dao/impl/S3SingleComponentDaoImpl.java | 4 +- .../translation/dto/ComponentMessagesDTO.java | 5 +- .../TranslationSyncServerServiceImpl.java | 6 +- .../com/vmware/l10n/utils/DiskQueueUtils.java | 4 +- .../resources/application-bundle.properties | 13 +- g11n-ws/vip-manager-lite-i18n/build.gradle | 60 ++- .../com/vmware/vip/LiteBootApplication.java | 11 +- .../LiteAPICacheControlInterceptor.java | 11 +- .../LiteAPICrossDomainInterceptor.java | 10 +- .../LiteAPIValidationInterceptor.java | 13 +- .../vip/core/conf/LiteTomcatConfig.java | 24 +- .../conf/LiteTomcatConnectionCustomizer.java | 32 +- .../vip/i18n/api/v1/common/RequestUtil.java | 4 +- 125 files changed, 1187 insertions(+), 1403 deletions(-) delete mode 100644 g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/Swagger2Conf.java create mode 100644 g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/SwaggerConf.java delete mode 100644 g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/DBServerTest.java delete mode 100644 g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/swagger/SwaggerUIAPI.java delete mode 100644 g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/Swagger3HostResolver.java diff --git a/g11n-ws/build.gradle b/g11n-ws/build.gradle index fd50d9a37..fb551aad6 100644 --- a/g11n-ws/build.gradle +++ b/g11n-ws/build.gradle @@ -3,7 +3,7 @@ buildscript { ext { - springBootVersion = '2.7.12' + springBootVersion = '3.1.1' } repositories { mavenLocal() @@ -31,7 +31,9 @@ allprojects{ group = 'com.vmware' - + sourceCompatibility = '17' + + repositories { mavenLocal() maven { url "https://repo1.maven.org/maven2/" } @@ -48,18 +50,15 @@ allprojects{ subprojects{ - sourceCompatibility = '1.8' - + ext { projectVersion = '0.0.1-SNAPSHOT' - springWebVersion='5.3.27' - tomcatVersion= '9.0.75' httpclient='4.5.13' jacksonVersion = '2.15.2' - sqliteVersion= '3.41.2.1' + springdocVersion='2.1.0' - ehCacheVersion = '3.9.2' + ehCacheVersion = '3.10.8' cacheApiVersion='1.1.1' hsqlVersion = '2.3.3' junitVersion = '4.13.2' @@ -72,14 +71,14 @@ subprojects{ guavaVersion="30.1.1-jre" snakeyam="2.0" jjwtVersion="0.9.1" - hibernateJpa21Api = "1.0.2" + hibernateJpa21Api = "1.0.2.Final" log4j2Version="2.18.0" slf4jVersion="1.7.32" esapiVersion="2.5.1.0" postgresqlVersion = "42.1.4" druidVersion = "1.1.8" - awsS3Version = "1.12.261" + awsS3Version = "1.12.497" swaggerVersion = "3.0.0" icu4jVersion = "60.3" diff --git a/g11n-ws/gradle/wrapper/gradle-wrapper.jar b/g11n-ws/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..249e5832f090a2944b7473328c07c9755baa3196 100644 GIT binary patch delta 10158 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 delta 9041 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 diff --git a/g11n-ws/gradle/wrapper/gradle-wrapper.properties b/g11n-ws/gradle/wrapper/gradle-wrapper.properties index ffed3a254..774fae876 100644 --- a/g11n-ws/gradle/wrapper/gradle-wrapper.properties +++ b/g11n-ws/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/g11n-ws/gradlew b/g11n-ws/gradlew index 1b6c78733..a69d9cb6c 100755 --- a/g11n-ws/gradlew +++ b/g11n-ws/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/g11n-ws/gradlew.bat b/g11n-ws/gradlew.bat index 898f18fb3..82f11ad3b 100644 --- a/g11n-ws/gradlew.bat +++ b/g11n-ws/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2019-2022 VMware, Inc. -@rem SPDX-License-Identifier: EPL-2.0 -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem Copyright 2019-2023 VMware, Inc. +@rem SPDX-License-Identifier: EPL-2.0 +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/g11n-ws/modules/md-data-api-bundleimpl/build.gradle b/g11n-ws/modules/md-data-api-bundleimpl/build.gradle index b3345357d..2eceba156 100644 --- a/g11n-ws/modules/md-data-api-bundleimpl/build.gradle +++ b/g11n-ws/modules/md-data-api-bundleimpl/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' apply plugin: 'org.springframework.boot' @@ -16,8 +16,14 @@ jar { dependencies { api project(":md-data-api") api project(":vip-common") - implementation("org.springframework.boot:spring-boot") - implementation("org.slf4j:slf4j-api:$slf4jVersion") + compileOnly("org.springframework.boot:spring-boot") + compileOnly("org.slf4j:slf4j-api:$slf4jVersion") + compileOnly("commons-io:commons-io:$commonsIoVersion") + compileOnly("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + + + } bootJar { diff --git a/g11n-ws/modules/md-data-api-mt/build.gradle b/g11n-ws/modules/md-data-api-mt/build.gradle index c921c1f2c..1c811f8bf 100644 --- a/g11n-ws/modules/md-data-api-mt/build.gradle +++ b/g11n-ws/modules/md-data-api-mt/build.gradle @@ -23,6 +23,12 @@ dependencies { compileOnly("org.springframework.boot:spring-boot-starter-data-jpa") compileOnly("org.slf4j:slf4j-api:$slf4jVersion") compileOnly("commons-collections:commons-collections:$commonsCollectionsVersion") + compileOnly("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + compileOnly("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ + exclude group: 'junit' + } + } bootJar { diff --git a/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/MTConfigContent.java b/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/MTConfigContent.java index 06b90ffd1..a6be272c3 100644 --- a/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/MTConfigContent.java +++ b/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/MTConfigContent.java @@ -1,11 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.messages.mt; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; diff --git a/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/intento/IntentoConfigContent.java b/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/intento/IntentoConfigContent.java index 2d86c92f8..4ef0b9d17 100644 --- a/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/intento/IntentoConfigContent.java +++ b/g11n-ws/modules/md-data-api-mt/src/main/java/com/vmware/vip/messages/mt/intento/IntentoConfigContent.java @@ -1,14 +1,14 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.messages.mt.intento; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; -import javax.annotation.PostConstruct; /** * A config class to accept the configuration settings from application properties diff --git a/g11n-ws/modules/md-data-api-pgimpl/src/main/java/com/vmware/vip/messages/data/dao/pgimpl/balance/PgDataNodeBalancerAdapter.java b/g11n-ws/modules/md-data-api-pgimpl/src/main/java/com/vmware/vip/messages/data/dao/pgimpl/balance/PgDataNodeBalancerAdapter.java index dee63a95b..9fab612e3 100644 --- a/g11n-ws/modules/md-data-api-pgimpl/src/main/java/com/vmware/vip/messages/data/dao/pgimpl/balance/PgDataNodeBalancerAdapter.java +++ b/g11n-ws/modules/md-data-api-pgimpl/src/main/java/com/vmware/vip/messages/data/dao/pgimpl/balance/PgDataNodeBalancerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.messages.data.dao.pgimpl.balance; @@ -8,8 +8,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/g11n-ws/modules/md-data-api-s3impl/build.gradle b/g11n-ws/modules/md-data-api-s3impl/build.gradle index 18034c8f4..face08e7e 100644 --- a/g11n-ws/modules/md-data-api-s3impl/build.gradle +++ b/g11n-ws/modules/md-data-api-s3impl/build.gradle @@ -22,6 +22,7 @@ dependencies { compileOnly("org.springframework.boot:spring-boot") compileOnly("org.springframework.boot:spring-boot-starter-data-jpa") compileOnly("org.slf4j:slf4j-api:$slf4jVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") implementation ("com.amazonaws:aws-java-sdk-s3:$awsS3Version") implementation ("com.amazonaws:aws-java-sdk-sts:$awsS3Version") implementation ("com.amazonaws:aws-java-sdk-iam:$awsS3Version") diff --git a/g11n-ws/modules/md-data-api-s3impl/src/main/java/com/vmware/vip/messages/data/conf/S3Client.java b/g11n-ws/modules/md-data-api-s3impl/src/main/java/com/vmware/vip/messages/data/conf/S3Client.java index 56ecc5aca..3d488516f 100644 --- a/g11n-ws/modules/md-data-api-s3impl/src/main/java/com/vmware/vip/messages/data/conf/S3Client.java +++ b/g11n-ws/modules/md-data-api-s3impl/src/main/java/com/vmware/vip/messages/data/conf/S3Client.java @@ -1,11 +1,10 @@ /** - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.messages.data.conf; -import javax.annotation.PostConstruct; - +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-data-initdb/build.gradle b/g11n-ws/modules/md-data-initdb/build.gradle index 7efcdab96..3fea7e800 100644 --- a/g11n-ws/modules/md-data-initdb/build.gradle +++ b/g11n-ws/modules/md-data-initdb/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 buildscript { repositories { @@ -98,15 +98,16 @@ configurations { } dependencies { - api project(":md-data-api") - api project(":vip-common") - api project(":md-data-api-pgimpl") - api "org.springframework.boot:spring-boot-starter" - api ('org.springframework.boot:spring-boot-starter-log4j2') - api group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '4.11.0.201803080745-r' - api("org.apache.httpcomponents:httpclient:$httpclient") + implementation project(":md-data-api") + implementation project(":vip-common") + implementation project(":md-data-api-pgimpl") + implementation "org.springframework.boot:spring-boot-starter" + implementation ('org.springframework.boot:spring-boot-starter-log4j2') + implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '4.11.0.201803080745-r' + implementation("org.apache.httpcomponents:httpclient:$httpclient") implementation("commons-collections:commons-collections:$commonsCollectionsVersion") - api group: 'org.python', name: 'jython-standalone', version: '2.7.1' + implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + implementation group: 'org.python', name: 'jython-standalone', version: '2.7.1' testImplementation group: 'junit', name: 'junit', version: '4.+' } diff --git a/g11n-ws/modules/md-restful-api-db/build.gradle b/g11n-ws/modules/md-restful-api-db/build.gradle index b12f1dd43..f53f6fa4a 100644 --- a/g11n-ws/modules/md-restful-api-db/build.gradle +++ b/g11n-ws/modules/md-restful-api-db/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' apply plugin: 'org.springframework.boot' @@ -27,8 +27,9 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-web") implementation('org.springframework.boot:spring-boot-starter-log4j2') implementation ("commons-collections:commons-collections:$commonsCollectionsVersion") - //swagger UI -START - implementation("io.springfox:springfox-boot-starter:$swaggerVersion") + //swagger UI -START + implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:$springdocVersion") + implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") //swagger UI -END testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation ("junit:junit:$junitVersion") diff --git a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/DBBootApplication.java b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/DBBootApplication.java index 78788a923..ed0445104 100644 --- a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/DBBootApplication.java +++ b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/DBBootApplication.java @@ -1,13 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; - -import springfox.documentation.swagger2.annotations.EnableSwagger2; +; /** * @@ -16,7 +15,6 @@ * */ @SpringBootApplication -@EnableSwagger2 public class DBBootApplication { public static void main(String[] args) { diff --git a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/Swagger2Conf.java b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/Swagger2Conf.java deleted file mode 100644 index ba79aa666..000000000 --- a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/Swagger2Conf.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2019-2022 VMware, Inc. - * SPDX-License-Identifier: EPL-2.0 - */ -package com.vmware.vip; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.vmware.vip.api.domain.DbApiUrl; - -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; - -/** - * - * - * @author shihu - * - */ -@Configuration -public class Swagger2Conf { - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2).groupName(DbApiUrl.API_ROOT).apiInfo(apiInfo(DbApiUrl.API_ROOT)) - .select().apis(RequestHandlerSelectors.basePackage("com.vmware.vip.api.rest")) - .paths(PathSelectors.any()).build(); - } - - private ApiInfo apiInfo(String baseDir) { - return new ApiInfoBuilder().title("VIP DB Restful API").description("VIP DB Restful API document") - .contact(new Contact("VMWare G11n Team", null, null)).version(baseDir + "1.0").build(); - } -} diff --git a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/SwaggerConf.java b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/SwaggerConf.java new file mode 100644 index 000000000..5427240be --- /dev/null +++ b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/SwaggerConf.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2023 VMware, Inc. + * SPDX-License-Identifier: EPL-2.0 + */ +package com.vmware.vip; + +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import org.springdoc.core.models.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.vmware.vip.api.domain.DbApiUrl; + + +/** + * + * + * @author shihu + * + */ +@Configuration +public class SwaggerConf { + + @Bean + public GroupedOpenApi singletV2Api() { + GroupedOpenApi.Builder builder = GroupedOpenApi.builder().group(DbApiUrl.API_ROOT) + .packagesToScan("com.vmware.vip.api.rest"); + builder.addOpenApiCustomizer(openApi -> { + openApi.info(generateInfo(DbApiUrl.API_ROOT + "1.0")); + + }); + + return builder.build(); + } + + + private Info generateInfo(String version){ + Contact contact = new Contact(); + contact.setName("VMWare G11n Team"); + Info info = new Info().title("VIP DB REST APIs") + .description("VIP DB Restful API document") + .version(version) + .contact(contact) + .license(new License().name("Apache 2.0").url("http://springdoc.org")); + return info; + } +} diff --git a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/DBServerTest.java b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/DBServerTest.java deleted file mode 100644 index 1c2ab26cb..000000000 --- a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/DBServerTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019-2022 VMware, Inc. - * SPDX-License-Identifier: EPL-2.0 - */ -package com.vmware.vip.api.rest; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.vmware.vip.api.domain.DbApiUrl; - -import io.swagger.annotations.ApiOperation; - -/** - * - * - * @author shihu - * - */ -@RestController -@RequestMapping(DbApiUrl.API_ROOT) -public class DBServerTest { - @ApiOperation(value = "获取用户详细信息", notes = "根据url的id来获取用户详细信息") - @GetMapping("/test") - public String test() { - return "this is a test!!!"; - } - -} diff --git a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/ProductRegisterControl.java b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/ProductRegisterControl.java index 75930a99e..0b2c89ef8 100644 --- a/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/ProductRegisterControl.java +++ b/g11n-ws/modules/md-restful-api-db/src/main/java/com/vmware/vip/api/rest/ProductRegisterControl.java @@ -1,9 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.api.rest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -17,9 +19,6 @@ import com.vmware.vip.messages.data.dao.api.IPgVipDbTabApi; import com.vmware.vip.messages.data.dao.exception.DataException; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; /** * @@ -34,12 +33,10 @@ public class ProductRegisterControl { @Autowired private IPgVipDbTabApi dbtab; - @ApiOperation(value = "get product", notes = "get product from vip DB") - @ApiImplicitParams({ - @ApiImplicitParam(name = "productName", value = "product Name", required = true, dataType = "String", paramType = "path") }) + @Operation(summary = "get product", description = "get product from vip DB") @GetMapping(value = "/product/{productName}") - public DbResponseStatus getProduct(@PathVariable String productName) { + public DbResponseStatus getProduct(@Parameter(name = "productName", description = "product Name", required = true) @PathVariable String productName) { boolean result = dbtab.productIsRegistered(productName); if (result) { @@ -50,11 +47,9 @@ public DbResponseStatus getProduct(@PathVariable String productName) { } - @ApiOperation(value = "register product", notes = "customer need register product to vip DB") - @ApiImplicitParams({ - @ApiImplicitParam(name = "productName", value = "product Name", required = true, dataType = "String", paramType = "path") }) + @Operation(summary = "register product", description = "customer need register product to vip DB") @PutMapping(value = "/product/{productName}") - public DbResponseStatus addProduct(@PathVariable String productName) { + public DbResponseStatus addProduct(@Parameter(name = "productName", description = "product Name", required = true) @PathVariable String productName) { boolean result = dbtab.registerProduct(productName); if (result) { @@ -65,11 +60,9 @@ public DbResponseStatus addProduct(@PathVariable String productName) { } - @ApiOperation(value = "delete product", notes = "delete product to vip DB") - @ApiImplicitParams({ - @ApiImplicitParam(name = "productName", value = "product Name", required = true, dataType = "String", paramType = "path") }) + @Operation(summary = "delete product", description = "delete product to vip DB") @DeleteMapping(value = "/product/{productName}") - public DbResponseStatus deleteProduct(@PathVariable String productName) throws DataException { + public DbResponseStatus deleteProduct(@Parameter(name = "productName", description = "product Name", required = true) @PathVariable String productName) throws DataException { boolean result = dbtab.delProduct(productName); if (result) { diff --git a/g11n-ws/modules/md-restful-api-i18n/build.gradle b/g11n-ws/modules/md-restful-api-i18n/build.gradle index 52987448a..e40be3de3 100644 --- a/g11n-ws/modules/md-restful-api-i18n/build.gradle +++ b/g11n-ws/modules/md-restful-api-i18n/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' apply plugin: 'org.springframework.boot' @@ -18,11 +18,12 @@ dependencies { api project(":md-service-about") api project(":md-service-i18n-l2") api project(":md-service-i18n-l3") - compileOnly("org.springframework:spring-webmvc:$springWebVersion") - compileOnly("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - compileOnly("commons-codec:commons-codec:$commonsCodecVersion") - compileOnly("io.springfox:springfox-swagger2:$swaggerVersion") - // Actuator - START + compileOnly("org.springframework.boot:spring-boot-starter-web") + compileOnly("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") + //compileOnly("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") + compileOnly("commons-codec:commons-codec:$commonsCodecVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + // Actuator - START compileOnly("org.springframework.boot:spring-boot-starter-actuator") // Actuator - END } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/core/except/ExceptionHandle.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/core/except/ExceptionHandle.java index 174433e21..83b0d71ab 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/core/except/ExceptionHandle.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/core/except/ExceptionHandle.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.except; @@ -13,6 +13,7 @@ import com.vmware.vip.core.about.exception.AboutAPIException; import com.vmware.vip.core.messages.exception.L2APIException; import com.vmware.vip.core.messages.exception.L3APIException; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.ControllerAdvice; @@ -21,7 +22,6 @@ import java.text.MessageFormat; -import javax.servlet.http.HttpServletResponse; @ControllerAdvice public class ExceptionHandle { diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/StreamProductAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/StreamProductAction.java index 1cb31f390..0530f4870 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/StreamProductAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/StreamProductAction.java @@ -18,7 +18,7 @@ import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.Buffer; import java.nio.ByteBuffer; diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductAction.java index e006a0e91..c1beeaec6 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.base; @@ -9,13 +9,12 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -37,7 +36,6 @@ import com.vmware.vip.core.messages.service.multcomponent.IMultComponentService; import com.vmware.vip.core.messages.service.multcomponent.TranslationDTO; import com.vmware.vip.core.messages.service.product.IProductService; -import com.vmware.vip.core.messages.utils.LocaleUtility; import com.vmware.vip.i18n.api.base.utils.VersionMatcher; @@ -51,8 +49,8 @@ public class TranslationProductAction extends BaseAction { @Autowired IMultComponentService multipleComponentsService; - public String getProductTrans(String productName, String version,String locale,String pseudo, - HttpServletRequest request, HttpServletResponse response) throws Exception { + public String getProductTrans(String productName, String version, String locale, String pseudo, + HttpServletRequest request, HttpServletResponse response) throws Exception { locale = locale == null ? ConstantsUnicode.EN : getMappingLocale(productName, version, locale.trim()); List componentList = productService .getComponentNameList(productName, version); @@ -130,7 +128,7 @@ private TranslationDTO getResultTranslationDTO(String productName, translationDTO.setComponents(componentList); List localeList = new ArrayList(); - if (new Boolean(pseudo)) { + if (Boolean.parseBoolean(pseudo)) { localeList.add(ConstantsKeys.LATEST); } else if (!StringUtils.isEmpty(locales)) { List supportedLocaleList = productService @@ -142,7 +140,7 @@ private TranslationDTO getResultTranslationDTO(String productName, localeList = productService.getSupportedLocaleList(productName,version); } translationDTO.setLocales(localeList); - translationDTO.setPseudo(new Boolean(pseudo)); + translationDTO.setPseudo(Boolean.parseBoolean(pseudo)); return translationDTO; } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentAction.java index 4c03d3908..bac819c8f 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.base; @@ -10,7 +10,7 @@ import java.util.Map; import java.util.Map.Entry; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; @@ -51,14 +51,14 @@ public APIResponseDTO getSingleComponentTrans(String productName, c.setProductName(productName); c.setComponent(component == null ? ConstantsKeys.DEFAULT : component); c.setVersion(version); - if (new Boolean(pseudo)) { + if (Boolean.parseBoolean(pseudo)) { c.setLocale(ConstantsKeys.LATEST); } else { c.setLocale(locale == null ? ConstantsUnicode.EN : locale); } - c.setPseudo(new Boolean(pseudo)); + c.setPseudo(Boolean.parseBoolean(pseudo)); // get MT translation - if (new Boolean(mt)) { + if (Boolean.parseBoolean(mt)) { c.setLocale(locale); c = mtService.getComponentMTTranslation(c); c.setMachineTranslation(true); @@ -104,7 +104,7 @@ public APIResponseDTO getMultipleComponentsTrans(String productName, translationDTO.setComponents(componentList); List localeList = new ArrayList(); - if (new Boolean(pseudo)) { + if (Boolean.parseBoolean(pseudo)) { localeList.add(ConstantsKeys.LATEST); } else if (!StringUtils.isEmpty(locales)) { List supportedLocaleList = productService @@ -117,7 +117,7 @@ public APIResponseDTO getMultipleComponentsTrans(String productName, version); } translationDTO.setLocales(localeList); - translationDTO.setPseudo(new Boolean(pseudo)); + translationDTO.setPseudo(Boolean.parseBoolean(pseudo)); translationDTO = multipleComponentsService .getMultiComponentsTranslation(translationDTO); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentKeyAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentKeyAction.java index d10b40c9f..f176a9679 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentKeyAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationProductComponentKeyAction.java @@ -8,8 +8,8 @@ import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import com.vmware.vip.common.utils.SourceFormatUtils; import org.apache.commons.io.IOUtils; @@ -65,19 +65,19 @@ public APIResponseDTO getStringBasedTranslation(String productName, c.setProductName(productName); c.setComponent(component); c.setVersion(version); - c.setPseudo(new Boolean(pseudo)); + c.setPseudo(Boolean.parseBoolean(pseudo)); c.setLocale(locale == null ? ConstantsUnicode.EN : locale); StringBasedDTO stringBasedDTO = null; - if (new Boolean(machineTranslation)) { + if (Boolean.parseBoolean(machineTranslation)) { stringBasedDTO = mtService.getStringMTTranslation(c, key, source); stringBasedDTO - .setMachineTranslation(new Boolean(machineTranslation)); + .setMachineTranslation(Boolean.parseBoolean(machineTranslation)); } else { stringBasedDTO = stringBasedService.getStringTranslation(c, key, source); } - if(new Boolean(checkTranslationStatus)) { + if(Boolean.parseBoolean(checkTranslationStatus)) { if(stringBasedDTO.getStatus().indexOf(ConstantsMsg.TRANS_IS_NOT_FOUND) != -1 || stringBasedDTO.getStatus().equals(String.format(ConstantsMsg.EN_NOT_SOURCE, ConstantsMsg.TRANS_FOUND_RETURN))) { return super.handleResponse(APIResponseStatus.TRANSLATION_NOT_READY, stringBasedDTO); } else { @@ -123,7 +123,7 @@ private StringBasedDTO getTransByKey(String productName, String version, c.setVersion(version); c.setLocale(locale == null ? ConstantsUnicode.EN : locale); if (ConstantsKeys.TRUE.equalsIgnoreCase(pseudo)) { - c.setPseudo(new Boolean(pseudo)); + c.setPseudo(Boolean.parseBoolean(pseudo)); } return stringBasedService.getStringTranslation(c, key, source); @@ -183,7 +183,7 @@ private SingleComponentDTO getTransByKeys(String productName, String version, c.setVersion(version); c.setLocale(locale == null ? ConstantsUnicode.EN : locale); if (ConstantsKeys.TRUE.equalsIgnoreCase(pseudo)) { - c.setPseudo(new Boolean(pseudo)); + c.setPseudo(Boolean.parseBoolean(pseudo)); } return stringBasedService.getMultKeyTranslation(c, keyArr); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSourceAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSourceAction.java index 22ea0289d..97dc5e87f 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSourceAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSourceAction.java @@ -1,14 +1,14 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.base; import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -23,7 +23,6 @@ import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.common.utils.KeyUtils; import com.vmware.vip.core.messages.exception.L3APIException; -import com.vmware.vip.i18n.api.base.BaseAction; import com.vmware.vip.i18n.api.v1.translation.TranslationProductComponentKeyAPI; /** diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSyncAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSyncAction.java index dbd0af36e..6ef0bd265 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSyncAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationSyncAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.base; @@ -9,7 +9,7 @@ import java.util.Map; import java.util.Map.Entry; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationWithPatternAction.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationWithPatternAction.java index dd8297f51..4808c9a78 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationWithPatternAction.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/base/TranslationWithPatternAction.java @@ -301,12 +301,12 @@ public ComponentMessagesDTO getSingleComponentTrans(String productName, String c c.setProductName(productName); c.setComponent(component == null ? ConstantsKeys.DEFAULT : component.trim()); c.setVersion(version); - if (new Boolean(pseudo)) { + if (Boolean.parseBoolean(pseudo)) { c.setLocale(ConstantsKeys.LATEST); } else { c.setLocale(locale == null ? ConstantsUnicode.EN : locale); } - c.setPseudo(new Boolean(pseudo)); + c.setPseudo(Boolean.parseBoolean(pseudo)); c = singleComponentService.getComponentTranslation(c); return c; } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/swagger/SwaggerUIAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/swagger/SwaggerUIAPI.java deleted file mode 100644 index dae487015..000000000 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/swagger/SwaggerUIAPI.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2019-2022 VMware, Inc. - * SPDX-License-Identifier: EPL-2.0 - */ -package com.vmware.vip.i18n.api.swagger; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.vmware.vip.api.rest.API; - -@RestController -public class SwaggerUIAPI { - - @RequestMapping(value = "/i18n/api/doc/swagger-ui", method = RequestMethod.GET, produces = { API.API_CHARSET }) - public void swaggerUI(HttpServletRequest request, HttpServletResponse response) throws Exception{ - request.getRequestDispatcher("/swagger-ui.html").forward(request, response); - } - -} diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityAuthenticationAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityAuthenticationAPI.java index b11cebd64..1559f4c4f 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityAuthenticationAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityAuthenticationAPI.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.authentication; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,8 +29,6 @@ import com.vmware.vip.i18n.api.v1.utils.SignatureUtil; import com.vmware.vip.i18n.api.v1.utils.TokenUtil; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API to authenticate the product’s identification before business API request. @@ -58,15 +58,15 @@ public class SecurityAuthenticationAPI { * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.Authenticate_VALUE, notes = APIOperation.Authenticate_NOTES) + @Operation(summary = APIOperation.Authenticate_VALUE, description = APIOperation.Authenticate_NOTES) @RequestMapping(value = APIV1.AUTHENTICATION, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public AuthResponseDTO authentication(HttpServletRequest request, - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.USER_ID, required = true, value = APIParamValue.USERID) @RequestParam(value = APIParamName.USER_ID, required = true) String userID, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @RequestParam(value = APIParamName.KEY, required = true) String key) { + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.USER_ID, required = true, description = APIParamValue.USERID) @RequestParam(value = APIParamName.USER_ID, required = true) String userID, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @RequestParam(value = APIParamName.KEY, required = true) String key) { AuthenKeyDTO keyDTO = new AuthenKeyDTO(productName, version, key, userID); AuthResponseDTO respDTO = new AuthResponseDTO(); if (!KeyService.validateKey(keyDTO)) { diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityKeyAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityKeyAPI.java index cdd5109ad..c44324722 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityKeyAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/authentication/SecurityKeyAPI.java @@ -1,31 +1,20 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.authentication; -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -import com.vmware.vip.api.rest.API; -import com.vmware.vip.api.rest.APIOperation; import com.vmware.vip.api.rest.APIParamName; import com.vmware.vip.api.rest.APIParamValue; -import com.vmware.vip.api.rest.APIV1; import com.vmware.vip.common.i18n.dto.AuthenKeyDTO; import com.vmware.vip.common.i18n.dto.response.AthenticationResponseDTO; import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.i18n.api.v1.utils.KeyService; - -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; /** * Provide RESTful API to manipulate the key for product. @@ -60,9 +49,9 @@ public class SecurityKeyAPI { * Temporarily disabling this unused API by commenting out the following annotations. - 09May19 */ public AthenticationResponseDTO getKey( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamName.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.USER_ID, required = true, value = APIParamValue.USERID) @RequestParam(value = APIParamName.USER_ID, required = true) String userID, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamName.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.USER_ID, required = true, description = APIParamValue.USERID) @RequestParam(value = APIParamName.USER_ID, required = true) String userID, HttpServletRequest request) { AthenticationResponseDTO athenticationResponseDTO = new AthenticationResponseDTO(); if (StringUtils.isNotEmpty(productName) && StringUtils.isNotEmpty(version) diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/date/FormattingDateAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/date/FormattingDateAPI.java index ce7706acf..44f759b09 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/date/FormattingDateAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/date/FormattingDateAPI.java @@ -1,10 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.formatting.date; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -25,8 +27,6 @@ import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API to manipulate the date by specific locale and pattern. @@ -53,7 +53,7 @@ public class FormattingDateAPI extends BaseAction{ * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.FORMAT_DATE_GET_VALUE, notes = APIOperation.FORMAT_DATE_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_DATE_GET_VALUE, description = APIOperation.FORMAT_DATE_GET_NOTES) /* @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string", paramType = "header"), @ApiImplicitParam(name = "sessionid", value = "sessionid", required = true, dataType = "string", paramType = "header") @@ -61,9 +61,9 @@ public class FormattingDateAPI extends BaseAction{ @RequestMapping(value = APIV1.LOCALIZED_DATE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO formatDate( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, - @ApiParam(name = APIParamName.LONGDATE, required = true, value = APIParamValue.LONGDATE) @RequestParam(value = APIParamName.LONGDATE, required = true) String longDate, - @ApiParam(name = APIParamName.PATTERN, required = true, value = APIParamValue.PATTERN) @RequestParam(value = APIParamName.PATTERN, required = true) String pattern, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, + @Parameter(name = APIParamName.LONGDATE, required = true, description = APIParamValue.LONGDATE) @RequestParam(value = APIParamName.LONGDATE, required = true) String longDate, + @Parameter(name = APIParamName.PATTERN, required = true, description = APIParamValue.PATTERN) @RequestParam(value = APIParamName.PATTERN, required = true) String pattern, HttpServletRequest request) throws Exception{ DateDTO dateDTO = new DateDTO(); String formattedDate = dateFormatService.formatDate(locale, Long.parseLong(longDate), diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/number/FormattingNumberAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/number/FormattingNumberAPI.java index c4f5859d1..2b4e8d3cd 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/number/FormattingNumberAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/number/FormattingNumberAPI.java @@ -1,10 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.formatting.number; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -25,9 +27,6 @@ import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; - /** * Provide RESTful API to manipulate the number by specific locale and scale. * @@ -51,13 +50,13 @@ public class FormattingNumberAPI extends BaseAction { * Digital precision, decimal digits * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.FORMAT_NUMBER_GET_VALUE, notes = APIOperation.FORMAT_NUMBER_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_NUMBER_GET_VALUE, description = APIOperation.FORMAT_NUMBER_GET_NOTES) @RequestMapping(value = APIV1.LOCALIZED_NUMBER, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO formatDate( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, - @ApiParam(name = APIParamName.NUMBER, required = true, value = APIParamValue.NUMBER) @RequestParam(value = APIParamName.NUMBER, required = true) String number, - @ApiParam(name = APIParamName.SCALE, required = false, value = APIParamValue.SCALE) @RequestParam(value = APIParamName.SCALE, required = false) Integer scale, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, + @Parameter(name = APIParamName.NUMBER, required = true, description = APIParamValue.NUMBER) @RequestParam(value = APIParamName.NUMBER, required = true) String number, + @Parameter(name = APIParamName.SCALE, required = false, description = APIParamValue.SCALE) @RequestParam(value = APIParamName.SCALE, required = false) Integer scale, HttpServletRequest request) { int s = scale == null ? 0 : scale.intValue(); String localeNumber = numberFormatService.formatNumber(locale, number, @@ -65,7 +64,7 @@ public APIResponseDTO formatDate( NumberDTO numberDTO = new NumberDTO(); numberDTO.setFormattedNumber(localeNumber); numberDTO.setLocale(locale); - numberDTO.setScale(new Integer(s).toString()); + numberDTO.setScale(Integer.valueOf(s).toString()); numberDTO.setNumber(number); return super.handleResponse(APIResponseStatus.OK, numberDTO); } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/pattern/FormattingPatternAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/pattern/FormattingPatternAPI.java index 126a4b267..8b52908b2 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/pattern/FormattingPatternAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/formatting/pattern/FormattingPatternAPI.java @@ -12,6 +12,8 @@ import com.vmware.vip.common.constants.ConstantsMsg; import com.vmware.vip.common.utils.RegExpValidatorUtils; import com.vmware.vip.i18n.api.base.utils.CommonUtility; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; @@ -30,9 +32,6 @@ import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; - @RestController public class FormattingPatternAPI extends BaseAction { @@ -46,13 +45,13 @@ public class FormattingPatternAPI extends BaseAction { * @param scope pattern category string. e.g. dates,numbers,plurals,measurements, split by ',' * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.FORMAT_PATTERN_GET_VALUE, notes = APIOperation.FORMAT_PATTERN_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_PATTERN_GET_VALUE, description = APIOperation.FORMAT_PATTERN_GET_NOTES) @RequestMapping(value = APIV1.PATTERN, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getI18nPattern( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, - @ApiParam(name = APIParamName.SCOPE, required = true, value = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, - @ApiParam(name = APIParamName.SCOPE_FILTER, required = false, value = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, + @Parameter(name = APIParamName.SCOPE, required = true, description = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, + @Parameter(name = APIParamName.SCOPE_FILTER, required = false, description = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter ) throws Exception { List categories = CommonUtility.getCategoriesByEnum(scope, true); if (CommonUtil.isEmpty(categories)) { diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/locale/LocaleAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/locale/LocaleAPI.java index 09b8301ee..38f10a0f0 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/locale/LocaleAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/locale/LocaleAPI.java @@ -1,11 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.locale; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -21,7 +22,7 @@ import com.vmware.vip.i18n.api.base.BaseAction; import com.vmware.vip.i18n.api.base.utils.LocaleUtility; -import io.swagger.annotations.ApiOperation; + /** * Provide RESTful API to manipulate the locale. @@ -38,7 +39,7 @@ public class LocaleAPI extends BaseAction{ * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.LOCALE_PICKUP_VALUE, notes = APIOperation.LOCALE_PICKUP_NOTES) + @Operation(summary = APIOperation.LOCALE_PICKUP_VALUE, description = APIOperation.LOCALE_PICKUP_NOTES) @RequestMapping(value = APIV1.BROWSER_LOCALE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getBrowserLocale(HttpServletRequest request) { @@ -53,7 +54,7 @@ public APIResponseDTO getBrowserLocale(HttpServletRequest request) { * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.LOCALE_NORMALIZATION_VALUE, notes = APIOperation.LOCALE_NORMALIZATION_NOTES) + @Operation(summary = APIOperation.LOCALE_NORMALIZATION_VALUE, description = APIOperation.LOCALE_NORMALIZATION_NOTES) @RequestMapping(value = APIV1.NORM_BROWSER_LOCALE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getNormalizedBrowserLocale(HttpServletRequest request) { diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationComponentAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationComponentAPI.java index 31217d926..dc2635936 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationComponentAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationComponentAPI.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; @@ -7,7 +7,9 @@ import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -36,8 +38,6 @@ import com.vmware.vip.core.messages.service.singlecomponent.IOneComponentService; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide API for product to get translation by component base. @@ -59,16 +59,16 @@ public class TranslationComponentAPI extends BaseAction { * */ //@ApiIgnore - @ApiOperation(value = APIOperation.COMPONENT_TRANSLATION_VALUE, notes = APIOperation.COMPONENT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.COMPONENT_TRANSLATION_VALUE, description = APIOperation.COMPONENT_TRANSLATION_NOTES) @RequestMapping(value = APIV1.TRANS_COMPONENT, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getSingleComponentTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws Exception { ComponentMessagesDTO componentMessagesDTO = new ComponentMessagesDTO(); @@ -76,7 +76,7 @@ public APIResponseDTO getSingleComponentTranslation( componentMessagesDTO.setComponent(component == null ? ConstantsKeys.DEFAULT : component); componentMessagesDTO.setVersion(version); componentMessagesDTO.setLocale(locale == null ? ConstantsUnicode.EN : locale); - componentMessagesDTO.setPseudo(new Boolean(pseudo)); + componentMessagesDTO.setPseudo(Boolean.parseBoolean(pseudo)); ComponentMessagesDTO dto = singleComponentService .getComponentTranslation(componentMessagesDTO); return super.handleResponse(APIResponseStatus.OK, dto); @@ -87,16 +87,16 @@ public APIResponseDTO getSingleComponentTranslation( * */ //@ApiIgnore - @ApiOperation(value = APIOperation.MULT_COMPONENT_TRANSLATION_VALUE, notes = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.MULT_COMPONENT_TRANSLATION_VALUE, description = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES) @RequestMapping(value = APIV1.TRANS_COMPONENTS, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getMultipleComponentsTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.COMPONENTS, required = true, value = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS, required = true) String components, - @ApiParam(name = APIParamName.LOCALES, required = true, value = APIParamValue.LOCALES) @RequestParam(value = APIParamName.LOCALES, required = true) String locales, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.COMPONENTS, required = true, description = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS, required = true) String components, + @Parameter(name = APIParamName.LOCALES, required = true, description = APIParamValue.LOCALES) @RequestParam(value = APIParamName.LOCALES, required = true) String locales, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws Exception { TranslationDTO translationDTO = new TranslationDTO(); @@ -110,7 +110,7 @@ public APIResponseDTO getMultipleComponentsTranslation( translationDTO.setComponents(componentList); translationDTO.setVersion(version); List localeList = new ArrayList(); - if(new Boolean(pseudo)) { + if(Boolean.parseBoolean(pseudo)) { localeList.add(ConstantsKeys.LATEST); } else if(locales != null) { List supportedLocaleList = productService.getSupportedLocaleList(productName, version); @@ -119,7 +119,7 @@ public APIResponseDTO getMultipleComponentsTranslation( } } translationDTO.setLocales(localeList); - translationDTO.setPseudo(new Boolean(pseudo)); + translationDTO.setPseudo(Boolean.parseBoolean(pseudo)); translationDTO =multipleComponentsService.getMultiComponentsTranslation(translationDTO); if(translationDTO.getBundles() == null || translationDTO.getBundles().size() == 0) { throw new L3APIException(String.format(ConstantsMsg.TRANS_GET_FAILD, productName + ConstantsChar.BACKSLASH + version)); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationKeyAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationKeyAPI.java index 087fa53c6..72196a912 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationKeyAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationKeyAPI.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -31,8 +33,6 @@ import com.vmware.vip.core.messages.service.string.IStringService; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide API for product to get translation by String base. @@ -47,36 +47,36 @@ public class TranslationKeyAPI extends BaseAction { * Provide translation based on String. * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_GET_VALUE, description = APIOperation.KEY_TRANSLATION_GET_NOTES) @RequestMapping(value = APIV1.TRANS_STRING, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getStringTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @RequestParam(value = APIParamName.KEY, required = true) String key, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE, required = false, value = APIParamValue.SOURCE) + @Parameter(name = APIParamName.SOURCE, required = false, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required=false, defaultValue="false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws Exception { ComponentMessagesDTO componentMessagesDTO = new ComponentMessagesDTO(); componentMessagesDTO.setProductName(productName); componentMessagesDTO.setComponent(StringUtils.isEmpty(component) ? ConstantsFile.DEFAULT_COMPONENT : component); componentMessagesDTO.setVersion(version); - componentMessagesDTO.setPseudo(new Boolean(pseudo)); + componentMessagesDTO.setPseudo(Boolean.parseBoolean(pseudo)); componentMessagesDTO.setLocale(locale == null ? ConstantsUnicode.EN : locale); StringBasedDTO stringBasedDTO = stringBasedService.getStringTranslation( componentMessagesDTO, StringUtils.isEmpty(sourceFormat) ? key : (key + ConstantsChar.DOT + ConstantsChar.POUND + sourceFormat.toUpperCase()), source); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductAPI.java index 06d1c7b82..3827d25cc 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductAPI.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -23,8 +25,6 @@ import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.i18n.api.base.TranslationProductAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide API for product to get translation by component base. @@ -37,13 +37,13 @@ public class TranslationProductAPI extends TranslationProductAction{ * get translation by product. * */ - @ApiOperation(value = APIOperation.PRODUCT_TRANSLATION_VALUE, notes = APIOperation.PRODUCT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.PRODUCT_TRANSLATION_VALUE, description = APIOperation.PRODUCT_TRANSLATION_NOTES) @RequestMapping(value = APIV1.TRANSLATION, method = RequestMethod.GET, produces = { API.API_CHARSET }) public String getProductTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request, HttpServletResponse response) throws Exception { return super.getProductTrans(productName, version, locale, pseudo, request, response); } @@ -52,12 +52,12 @@ public String getProductTranslation( * get supported locale-list by product name and version. * */ - @ApiOperation(value = APIOperation.PRODUCT_LOCALE_LIST_VALUE, notes = APIOperation.PRODUCT_LOCALE_LIST_NOTES) + @Operation(summary = APIOperation.PRODUCT_LOCALE_LIST_VALUE, description = APIOperation.PRODUCT_LOCALE_LIST_NOTES) @RequestMapping(value = APIV1.SUPPORTED_LOCALES, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getSupportedLocales( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(APIParamName.VERSION) String version, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request) throws Exception { return super.getSLocales(productName, version, request); } @@ -66,12 +66,12 @@ public APIResponseDTO getSupportedLocales( * get component-list by product name and version. * */ - @ApiOperation(value = APIOperation.PRODUCT_COMPONENT_LIST_VALUE, notes = APIOperation.PRODUCT_COMPONENT_LIST_NOTES) + @Operation(summary = APIOperation.PRODUCT_COMPONENT_LIST_VALUE, description = APIOperation.PRODUCT_COMPONENT_LIST_NOTES) @RequestMapping(value = APIV1.COMPONENTS, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getComponentNameList( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, HttpServletRequest request) throws Exception { return super.getCNameList(productName, version, request); } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentAPI.java index d6066173e..012c983e3 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentAPI.java @@ -1,9 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -25,9 +27,6 @@ import com.vmware.vip.core.messages.service.multcomponent.TranslationDTO; import com.vmware.vip.i18n.api.base.TranslationProductComponentAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; - /** * Provide RESTful API for product to get translation by component base. * @@ -39,15 +38,15 @@ public class TranslationProductComponentAPI extends TranslationProductComponentA * Provide translation based on single component. * */ - @ApiOperation(value = APIOperation.COMPONENT_TRANSLATION_VALUE, notes = APIOperation.COMPONENT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.COMPONENT_TRANSLATION_VALUE, description = APIOperation.COMPONENT_TRANSLATION_NOTES) @RequestMapping(value = APIV1.COMPONENT, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getSingleComponentTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws Exception { return super.getSingleComponentTrans(productName, component, version, locale, pseudo, "false", request); @@ -57,15 +56,15 @@ public APIResponseDTO getSingleComponentTranslation( * Get translation based on multiple component. * */ - @ApiOperation(value = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES, notes = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES, description = APIOperation.MULT_COMPONENT_TRANSLATION_NOTES) @RequestMapping(value = APIV1.COMPONENTS2, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getMultipleComponentsTrans( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.COMPONENTS, required = true, value = APIParamValue.COMPONENTS) @PathVariable(APIParamName.COMPONENTS) String components, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.LOCALES, required = true, value = APIParamValue.LOCALES, defaultValue = "") @RequestParam(value = APIParamName.LOCALES, required = true) String locales, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.COMPONENTS, required = true, description = APIParamValue.COMPONENTS) @PathVariable(APIParamName.COMPONENTS) String components, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.LOCALES, required = true, description = APIParamValue.LOCALES) @RequestParam(value = APIParamName.LOCALES, required = true) String locales, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest req) throws Exception { APIResponseDTO resp = super.getMultipleComponentsTrans(productName, components, version, locales, pseudo, req); TranslationDTO translationDTO = (TranslationDTO) resp.getData(); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentKeyAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentKeyAPI.java index f80e1eb55..982df3c62 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentKeyAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationProductComponentKeyAPI.java @@ -1,13 +1,15 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -28,8 +30,6 @@ import com.vmware.vip.core.messages.exception.L3APIException; import com.vmware.vip.i18n.api.base.TranslationProductComponentKeyAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API for product to get translation by String base. @@ -43,20 +43,20 @@ public class TranslationProductComponentKeyAPI extends * get translation by string * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_GET_VALUE, description = APIOperation.KEY_TRANSLATION_GET_NOTES) @RequestMapping(value = APIV1.KEY2_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getTranslationByGet( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(name = APIParamName.SOURCE, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(name = APIParamName.SOURCE, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L3APIException { return super.getTransByGet(productName, version, locale, component, key, source, sourceFormat, pseudo); } @@ -65,19 +65,19 @@ public APIResponseDTO getTranslationByGet( * Provide translation based on String use default component. * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_GET_VALUE, description = APIOperation.KEY_TRANSLATION_GET_NOTES) @RequestMapping(value = APIV1.PRODUCT_KEY2, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getStringTranslationExclusiveComponent( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(name = APIParamName.SOURCE, required = false, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = ConstantsKeys.FALSE) String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = ConstantsKeys.FALSE) String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(name = APIParamName.SOURCE, required = false, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = ConstantsKeys.FALSE) String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = ConstantsKeys.FALSE) String pseudo, HttpServletRequest request) throws L3APIException { return super.getStringBasedTranslation(productName, version, ConstantsFile.DEFAULT_COMPONENT, locale, key, source, pseudo, ConstantsKeys.FALSE, sourceFormat, ConstantsKeys.FALSE); } @@ -88,20 +88,20 @@ public APIResponseDTO getStringTranslationExclusiveComponent( * source * */ - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = APIV1.KEY2_POST, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getTranslationByPost( @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, @PathVariable(APIParamName.COMPONENT) String component, @PathVariable(APIParamName.KEY) String key, - @ApiParam(value = APIParamValue.SOURCE, required = false) String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.SOURCE, description = APIParamValue.SOURCE, required = false) String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request, HttpServletResponse response) throws L3APIException, IOException { return super.getTransByPost(productName, version, locale, component, key, source, commentForSource, sourceFormat, collectSource, pseudo, "false", "false", request, response); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSourceAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSourceAPI.java index 49137394a..1348d03ba 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSourceAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSourceAPI.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -26,8 +28,6 @@ import com.vmware.vip.core.messages.exception.L3APIException; import com.vmware.vip.i18n.api.base.TranslationSourceAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API for product to get translation by String base. @@ -40,7 +40,7 @@ public class TranslationSourceAPI extends TranslationSourceAction { * Provide translation based on String * */ - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_GET_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.SOURCE_TRANSLATION_GET_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = APIV1.SOURCES_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) @Override public String getTranslationBySource( @@ -50,8 +50,8 @@ public String getTranslationBySource( @RequestParam(value = APIParamName.SOURCE, required = true) String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request, HttpServletResponse response) { return super.getTranslationBySource(productName, component, version, locale, source, sourceFormat, collectSource, pseudo, request, @@ -63,7 +63,7 @@ public String getTranslationBySource( * source * */ - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Operation(summary =APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = APIV1.SOURCES_POST, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseBody @ResponseStatus(HttpStatus.OK) @@ -74,8 +74,8 @@ public APIResponseDTO postTranslationBySource( @RequestBody String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L3APIException { return super.createSource(productName, component, version, locale, source, sourceFormat, collectSource, pseudo, request); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSyncAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSyncAPI.java index 2ccddd5b8..db283f6e8 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSyncAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v1/translation/TranslationSyncAPI.java @@ -1,10 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.translation; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -22,8 +23,6 @@ import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.i18n.api.base.TranslationSyncAction; -import io.swagger.annotations.ApiOperation; - /** * * Provide RESTful API to synchronize the latest translation. @@ -38,7 +37,7 @@ public class TranslationSyncAPI extends TranslationSyncAction { * Apply to On-Premise and SaaS. * */ - @ApiOperation(value = APIOperation.TRANSLATION_UPDATE_VALUE, notes = APIOperation.TRANSLATION_UPDATE_NOTES) + @Operation(summary = APIOperation.TRANSLATION_UPDATE_VALUE, description = APIOperation.TRANSLATION_UPDATE_NOTES) @RequestMapping(value = APIV1.PRODUCT_VERSION, method = RequestMethod.PUT, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO updateTranslation( diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/about/AboutVersionAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/about/AboutVersionAPI.java index ec512a424..099f371f3 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/about/AboutVersionAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/about/AboutVersionAPI.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.about; @@ -18,8 +18,8 @@ import com.vmware.vip.core.about.service.version.IVersionService; import com.vmware.vip.core.about.service.version.ServiceVersionDTO; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; @@ -43,11 +43,11 @@ public class AboutVersionAPI extends BaseAction { * @return * @throws AboutAPIException */ - @ApiOperation(value = APIOperation.ABOUT_VERSION_VALUE, notes = APIOperation.ABOUT_VERSION_NOTES) + @Operation(summary = APIOperation.ABOUT_VERSION_VALUE, description = APIOperation.ABOUT_VERSION_NOTES) @RequestMapping(value = APIV2.VERSION, method = RequestMethod.GET, produces = { API.API_CHARSET }) public APIResponseDTO getVersionInfo( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = false, value = APIParamValue.PRODUCT_NAME) @RequestParam(required = false) String productName, - @ApiParam(name = APIParamName.VERSION, required = false, value = APIParamValue.VERSION) @RequestParam(required = false) String version) throws AboutAPIException { + @Parameter(name = APIParamName.PRODUCT_NAME, required = false, description = APIParamValue.PRODUCT_NAME) @RequestParam(required = false) String productName, + @Parameter(name = APIParamName.VERSION, required = false, description = APIParamValue.VERSION) @RequestParam(required = false) String version) throws AboutAPIException { BuildVersionDTO buildVersionDTO = new BuildVersionDTO(); ServiceVersionDTO serviceVersionDTO = versionService.getServiceVersion(); buildVersionDTO.setService(serviceVersionDTO); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/combine/TranslationWithPatternAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/combine/TranslationWithPatternAPI.java index 94920e358..9f183084d 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/combine/TranslationWithPatternAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/combine/TranslationWithPatternAPI.java @@ -1,10 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.combine; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestBody; @@ -22,9 +25,7 @@ import com.vmware.vip.common.i18n.dto.TranslationWithPatternDTO; import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.i18n.api.base.TranslationWithPatternAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import springfox.documentation.annotations.ApiIgnore; + @RestController("v2-TranslationWithPattern") public class TranslationWithPatternAPI extends TranslationWithPatternAction { @@ -33,8 +34,8 @@ public class TranslationWithPatternAPI extends TranslationWithPatternAction { * This is use to get the combine pattern and translation * */ - @ApiIgnore - @ApiOperation(value = APIOperation.TRANSLATION_WITH_PATTERN_VALUE, notes = APIOperation.TRANSLATION_WITH_PATTERN_NOTES) + @Hidden + @Operation(summary = APIOperation.TRANSLATION_WITH_PATTERN_VALUE, description = APIOperation.TRANSLATION_WITH_PATTERN_NOTES) @Deprecated @RequestMapping(value = APIV2.TRANSLATION_WITH_PATTERN, method = RequestMethod.POST, produces = { API.API_CHARSET }) @@ -45,20 +46,20 @@ public APIResponseDTO getRranslationWithPattern( } - @ApiOperation(value = APIOperation.TRANSLATION_WITH_PATTERN_VALUE, notes = APIOperation.TRANSLATION_WITH_PATTERN_NOTES) + @Operation(summary = APIOperation.TRANSLATION_WITH_PATTERN_VALUE, description = APIOperation.TRANSLATION_WITH_PATTERN_NOTES) @RequestMapping(value = APIV2.TRANSLATION_WITH_PATTERN, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getRranslationWithPattern( - @ApiParam(name = APIParamName.COMBINE, required = true, value = APIParamValue.COMBINE) @RequestParam(value = APIParamName.COMBINE) int combine, - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.COMPONENTS, required = true, value = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS) String components, - @ApiParam(name = APIParamName.LANGUAGE, required = true, value = APIParamValue.LANGUAGE) @RequestParam(value = APIParamName.LANGUAGE) String language, - @ApiParam(name = APIParamName.SCOPE, required = true, value = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE) String scope, - @ApiParam(name = APIParamName.REGION, required=false, value = APIParamValue.REGION) @RequestParam(value = APIParamName.REGION, required=false, defaultValue="") String region, - @ApiParam(name = APIParamName.PSEUDO, required=false, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, - @ApiParam(name = APIParamName.SCOPE_FILTER, required = false, value = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter, + @Parameter(name = APIParamName.COMBINE, required = true, description = APIParamValue.COMBINE) @RequestParam(value = APIParamName.COMBINE) int combine, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.COMPONENTS, required = true, description = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS) String components, + @Parameter(name = APIParamName.LANGUAGE, required = true, description = APIParamValue.LANGUAGE) @RequestParam(value = APIParamName.LANGUAGE) String language, + @Parameter(name = APIParamName.SCOPE, required = true, description = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE) String scope, + @Parameter(name = APIParamName.REGION, required=false, description = APIParamValue.REGION) @RequestParam(value = APIParamName.REGION, required=false, defaultValue="") String region, + @Parameter(name = APIParamName.PSEUDO, required=false, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, + @Parameter(name = APIParamName.SCOPE_FILTER, required = false, description = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter, HttpServletRequest req) throws Exception { return super.getTransPattern(combine, productName, version, components, language, scope, region, pseudo, scopeFilter); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/date/FormattingDateAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/date/FormattingDateAPI.java index 7a73de612..5a0011227 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/date/FormattingDateAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/date/FormattingDateAPI.java @@ -1,10 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.formatting.date; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -27,8 +29,6 @@ import com.vmware.vip.core.messages.exception.L2APIException; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API to manipulate the date by specific locale and pattern. @@ -55,7 +55,7 @@ public class FormattingDateAPI extends BaseAction{ * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.FORMAT_DATE_GET_VALUE, notes = APIOperation.FORMAT_DATE_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_DATE_GET_VALUE, description = APIOperation.FORMAT_DATE_GET_NOTES) /* @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "string", paramType = "header"), @ApiImplicitParam(name = "sessionid", value = "sessionid", required = true, dataType = "string", paramType = "header") @@ -63,9 +63,9 @@ public class FormattingDateAPI extends BaseAction{ @RequestMapping(value = APIV2.LOCALIZED_DATE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO formatDate( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, - @ApiParam(name = APIParamName.LONGDATE, required = true, value = APIParamValue.LONGDATE) @RequestParam(value = APIParamName.LONGDATE, required = true) String longDate, - @ApiParam(name = APIParamName.PATTERN, required = true, value = APIParamValue.PATTERN) @RequestParam(value = APIParamName.PATTERN, required = true) String pattern, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, + @Parameter(name = APIParamName.LONGDATE, required = true, description = APIParamValue.LONGDATE) @RequestParam(value = APIParamName.LONGDATE, required = true) String longDate, + @Parameter(name = APIParamName.PATTERN, required = true, description = APIParamValue.PATTERN) @RequestParam(value = APIParamName.PATTERN, required = true) String pattern, HttpServletRequest request) throws Exception{ DateDTO dateDTO = new DateDTO(); String formattedDate = dateFormatService.formatDate(locale, Long.parseLong(longDate), @@ -80,8 +80,8 @@ public APIResponseDTO formatDate( @RequestMapping(value = APIV2.LOCALIZED_TIMEZONE_NAME, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getDisplayTimezoneNameList( - @ApiParam(name = APIParamName.DISPLAY_LANGUAGE, required = true, value = APIParamValue.DISPLAY_LANGUAGE) @RequestParam(value = APIParamName.DISPLAY_LANGUAGE, required = true) String displayLanguage, - @ApiParam(name = APIParamName.DEFAULT_TERRITORY, required = false, value = APIParamValue.DEFAULT_TERRITORY) @RequestParam(value = APIParamName.DEFAULT_TERRITORY, required = false, defaultValue = "true") String defaultTerritory + @Parameter(name = APIParamName.DISPLAY_LANGUAGE, required = true, description = APIParamValue.DISPLAY_LANGUAGE) @RequestParam(value = APIParamName.DISPLAY_LANGUAGE, required = true) String displayLanguage, + @Parameter(name = APIParamName.DEFAULT_TERRITORY, required = false, description = APIParamValue.DEFAULT_TERRITORY) @RequestParam(value = APIParamName.DEFAULT_TERRITORY, required = false, defaultValue = "true") String defaultTerritory ) throws L2APIException{ TimeZoneName jsonObj = dateFormatService.getTimeZoneName(displayLanguage, Boolean.parseBoolean(defaultTerritory)); return super.handleResponse(APIResponseStatus.OK, jsonObj); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/number/FormattingNumberAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/number/FormattingNumberAPI.java index f0061b956..5320ddb29 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/number/FormattingNumberAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/number/FormattingNumberAPI.java @@ -1,10 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.formatting.number; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -25,8 +27,6 @@ import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.i18n.api.base.BaseAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API to manipulate the number by specific locale and scale. @@ -51,13 +51,13 @@ public class FormattingNumberAPI extends BaseAction { * Digital precision, decimal digits * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.FORMAT_NUMBER_GET_VALUE, notes = APIOperation.FORMAT_NUMBER_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_NUMBER_GET_VALUE, description = APIOperation.FORMAT_NUMBER_GET_NOTES) @RequestMapping(value = APIV2.LOCALIZED_NUMBER, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO formatDate( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, - @ApiParam(name = APIParamName.NUMBER, required = true, value = APIParamValue.NUMBER) @RequestParam(value = APIParamName.NUMBER, required = true) String number, - @ApiParam(name = APIParamName.SCALE, required = false, value = APIParamValue.SCALE) @RequestParam(value = APIParamName.SCALE, required = false) Integer scale, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = true) String locale, + @Parameter(name = APIParamName.NUMBER, required = true, description = APIParamValue.NUMBER) @RequestParam(value = APIParamName.NUMBER, required = true) String number, + @Parameter(name = APIParamName.SCALE, required = false, description = APIParamValue.SCALE) @RequestParam(value = APIParamName.SCALE, required = false) Integer scale, HttpServletRequest request) { int s = scale == null ? 0 : scale.intValue(); String localeNumber = numberFormatService.formatNumber(locale, number, @@ -65,7 +65,7 @@ public APIResponseDTO formatDate( NumberDTO numberDTO = new NumberDTO(); numberDTO.setFormattedNumber(localeNumber); numberDTO.setLocale(locale); - numberDTO.setScale(new Integer(s).toString()); + numberDTO.setScale(Integer.valueOf(s).toString()); numberDTO.setNumber(number); return super.handleResponse(APIResponseStatus.OK, numberDTO); } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/pattern/FormattingPatternAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/pattern/FormattingPatternAPI.java index 5f2ebc1f9..b79dc9aba 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/pattern/FormattingPatternAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/formatting/pattern/FormattingPatternAPI.java @@ -19,8 +19,8 @@ import com.vmware.vip.common.utils.RegExpValidatorUtils; import com.vmware.vip.i18n.api.base.BaseAction; import com.vmware.vip.i18n.api.base.utils.CommonUtility; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; @@ -43,13 +43,13 @@ public class FormattingPatternAPI extends BaseAction { /** * Get i18n pattern by specific locale and scope */ - @ApiOperation(value = APIOperation.FORMAT_PATTERN_GET_VALUE, notes = APIOperation.FORMAT_PATTERN_GET_NOTES) + @Operation(summary = APIOperation.FORMAT_PATTERN_GET_VALUE, description = APIOperation.FORMAT_PATTERN_GET_NOTES) @RequestMapping(value = APIV2.FORMAT_PATTERN_GET, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getI18nPattern( - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.SCOPE, required = true, value = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, - @ApiParam(name = APIParamName.SCOPE_FILTER, required = false, value = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.SCOPE, required = true, description = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, + @Parameter(name = APIParamName.SCOPE_FILTER, required = false, description = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter ) throws Exception { List categories = CommonUtility.getCategoriesByEnum(scope, true); if (CommonUtil.isEmpty(categories)) { @@ -71,14 +71,14 @@ public APIResponseDTO getI18nPattern( /** * Get i18n pattern with language, region and scope parameter. */ - @ApiOperation(value = APIOperation.FORMAT_PATTERN_VALUE, notes = APIOperation.FORMAT_PATTERN_NOTES) + @Operation(summary = APIOperation.FORMAT_PATTERN_VALUE, description = APIOperation.FORMAT_PATTERN_NOTES) @GetMapping(value = APIV2.FORMAT_PATTERN_WITH_LANGUAGE, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getI18nPatternWithLanguageAndRegion( - @ApiParam(name = APIParamName.LANGUAGE, required = true, value = APIParamValue.LANGUAGE) @RequestParam(value = APIParamName.LANGUAGE, required = true) String language, - @ApiParam(name = APIParamName.REGION, required = true, value = APIParamValue.REGION) @RequestParam(value = APIParamName.REGION, required = true) String region, - @ApiParam(name = APIParamName.SCOPE, required = true, value = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, - @ApiParam(name = APIParamName.SCOPE_FILTER, required = false, value = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter + @Parameter(name = APIParamName.LANGUAGE, required = true, description = APIParamValue.LANGUAGE) @RequestParam(value = APIParamName.LANGUAGE, required = true) String language, + @Parameter(name = APIParamName.REGION, required = true, description = APIParamValue.REGION) @RequestParam(value = APIParamName.REGION, required = true) String region, + @Parameter(name = APIParamName.SCOPE, required = true, description = APIParamValue.SCOPE) @RequestParam(value = APIParamName.SCOPE, required = true) String scope, + @Parameter(name = APIParamName.SCOPE_FILTER, required = false, description = APIParamValue.SCOPE_FILTER) @RequestParam(value = APIParamName.SCOPE_FILTER, required = false) String scopeFilter ) throws VIPCacheException { if (!CommonUtil.isEmpty(scopeFilter) && !RegExpValidatorUtils.startLetterAndCommValidchar(scopeFilter)) { return super.handleResponse(APIResponseStatus.BAD_REQUEST.getCode(), ConstantsMsg.SCOPE_FILTER_NOT_VALIDATE, null); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/locale/LocaleAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/locale/LocaleAPI.java index 21ac61915..d34b5e8e9 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/locale/LocaleAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/locale/LocaleAPI.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.locale; @@ -7,7 +7,9 @@ import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -31,8 +33,6 @@ import com.vmware.vip.i18n.api.base.BaseAction; import com.vmware.vip.i18n.api.base.utils.LocaleUtility; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API to manipulate the locale. @@ -52,7 +52,7 @@ public class LocaleAPI extends BaseAction { * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.LOCALE_PICKUP_VALUE, notes = APIOperation.LOCALE_PICKUP_NOTES) + @Operation(summary = APIOperation.LOCALE_PICKUP_VALUE, description = APIOperation.LOCALE_PICKUP_NOTES) @RequestMapping(value = APIV2.BROWSER_LOCALE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getBrowserLocale(HttpServletRequest request) { @@ -67,7 +67,7 @@ public APIResponseDTO getBrowserLocale(HttpServletRequest request) { * @return APIResponseDTO * The object which represents response status. */ - @ApiOperation(value = APIOperation.LOCALE_NORMALIZATION_VALUE, notes = APIOperation.LOCALE_NORMALIZATION_NOTES) + @Operation(summary = APIOperation.LOCALE_NORMALIZATION_VALUE, description = APIOperation.LOCALE_NORMALIZATION_NOTES) @RequestMapping(value = APIV2.NORM_BROWSER_LOCALE, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getNormalizedBrowserLocale(HttpServletRequest request) { @@ -93,13 +93,13 @@ private LocaleDTO getLocaleDTO(String locale, String displayName) { * @return APIResponseDTO * @throws Exception */ - @ApiOperation(value = APIOperation.LOCALE_REGION_LIST_VALUE, notes = APIOperation.LOCALE_REGION_LIST_NOTES) + @Operation(summary = APIOperation.LOCALE_REGION_LIST_VALUE, description = APIOperation.LOCALE_REGION_LIST_NOTES) @RequestMapping(value = APIV2.REGION_LIST, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getRegionList( - @ApiParam(name = APIParamName.SUPPORTED_LANGUAGE_LIST, required = true, value = APIParamValue.SUPPORTED_LANGUAGES) @RequestParam(value = APIParamName.SUPPORTED_LANGUAGE_LIST, required = true) String supportedLanguageList, - @ApiParam(name = APIParamName.DISPLAY_CITY, required = false, value = APIParamValue.DISPLAY_CITY) @RequestParam(value = APIParamName.DISPLAY_CITY, required = false) String displayCity, - @ApiParam(name = APIParamName.REGIONS, required = false, value = APIParamValue.REGIONS) @RequestParam(value = APIParamName.REGIONS, required = false) String regions) + @Parameter(name = APIParamName.SUPPORTED_LANGUAGE_LIST, required = true, description = APIParamValue.SUPPORTED_LANGUAGES) @RequestParam(value = APIParamName.SUPPORTED_LANGUAGE_LIST, required = true) String supportedLanguageList, + @Parameter(name = APIParamName.DISPLAY_CITY, required = false, description = APIParamValue.DISPLAY_CITY) @RequestParam(value = APIParamName.DISPLAY_CITY, required = false) String displayCity, + @Parameter(name = APIParamName.REGIONS, required = false, description = APIParamValue.REGIONS) @RequestParam(value = APIParamName.REGIONS, required = false) String regions) throws Exception { return super.handleResponse(APIResponseStatus.OK, this.localeService.getTerritoriesFromCLDR(supportedLanguageList.toLowerCase(), displayCity, regions)); @@ -117,13 +117,13 @@ public APIResponseDTO getRegionList( * @return APIResponseDTO * @throws Exception */ - @ApiOperation(value = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_VALUE, notes = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_NOTES) + @Operation(summary = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_VALUE, description = APIOperation.LOCALE_SUPPORTED_LANGUAGE_LIST_NOTES) @RequestMapping(value = APIV2.SUPPORTED_LANGUAGE_LIST, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getDisplayLanguagesList( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.DISPLAY_LANGUAGE, required = false, value = APIParamValue.DISPLAY_LANGUAGE) @RequestParam(value = APIParamName.DISPLAY_LANGUAGE, required = false) String displayLanguage) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.DISPLAY_LANGUAGE, required = false, description = APIParamValue.DISPLAY_LANGUAGE) @RequestParam(value = APIParamName.DISPLAY_LANGUAGE, required = false) String displayLanguage) throws Exception { Map data = new HashMap(); String newVersion = super.getAvailableVersion(productName, version); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductAPI.java index 87a3beebc..496acbe5b 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductAPI.java @@ -1,13 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.translation; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -36,15 +36,15 @@ public class TranslationProductAPI extends StreamProductAction { * Provide translation based on multiple component. * */ - @ApiOperation(value = APIOperation.PRODUCT_TRANSLATION_VALUE, notes = APIOperation.PRODUCT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.PRODUCT_TRANSLATION_VALUE, description = APIOperation.PRODUCT_TRANSLATION_NOTES) @RequestMapping(value = APIV2.PRODUCT_TRANSLATION_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public void getMultipleComponentsTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.COMPONENTS, required = false, value = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS, required = false, defaultValue = "") String components, - @ApiParam(name = APIParamName.LOCALES, required = false, value = APIParamValue.LOCALES) @RequestParam(value = APIParamName.LOCALES, required = false, defaultValue = "") String locales, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.COMPONENTS, required = false, description = APIParamValue.COMPONENTS) @RequestParam(value = APIParamName.COMPONENTS, required = false, defaultValue = "") String components, + @Parameter(name = APIParamName.LOCALES, required = false, description = APIParamValue.LOCALES) @RequestParam(value = APIParamName.LOCALES, required = false, defaultValue = "") String locales, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletResponse resp) throws Exception { super.writeMultTranslationResponse(productName, version, components, locales, pseudo, resp); } @@ -53,12 +53,12 @@ public void getMultipleComponentsTranslation( * Provide supported locales by product name and version. * */ - @ApiOperation(value = APIOperation.PRODUCT_LOCALE_LIST_VALUE, notes = APIOperation.PRODUCT_LOCALE_LIST_NOTES) + @Operation(summary = APIOperation.PRODUCT_LOCALE_LIST_VALUE, description = APIOperation.PRODUCT_LOCALE_LIST_NOTES) @RequestMapping(value = APIV2.PRODUCT_LOCALE_LIST_GET, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getSupportedLocales( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(APIParamName.VERSION) String version, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(APIParamName.VERSION) String version, HttpServletRequest request) throws Exception{ return super.getSLocales(productName, version, request); } @@ -67,12 +67,12 @@ public APIResponseDTO getSupportedLocales( * Provide component's names by product name and version. * */ - @ApiOperation(value = APIOperation.PRODUCT_COMPONENT_LIST_VALUE, notes = APIOperation.PRODUCT_COMPONENT_LIST_NOTES) + @Operation(summary = APIOperation.PRODUCT_COMPONENT_LIST_VALUE, description = APIOperation.PRODUCT_COMPONENT_LIST_NOTES) @RequestMapping(value = APIV2.PRODUCT_COMPONENT_LIST_GET, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getComponentNameList( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, HttpServletRequest request) throws Exception { return super.getCNameList(productName, version, request); } @@ -82,12 +82,12 @@ public APIResponseDTO getComponentNameList( * @throws L3APIException * */ - @ApiOperation(value = APIOperation.PRODUCT_VERSIONINFO_VALUE, notes = APIOperation.PRODUCT_VERSIONINFO_NOTES) + @Operation(summary = APIOperation.PRODUCT_VERSIONINFO_VALUE, description = APIOperation.PRODUCT_VERSIONINFO_NOTES) @RequestMapping(value = APIV2.PRODUCT_VERSIONINFO_GET, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getDropInfo( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, HttpServletRequest request) throws L3APIException { return super.getVersionInfo(productName, version); } diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentAPI.java index 5a726f794..7a0ceca8c 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentAPI.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.translation; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -19,13 +21,10 @@ import com.vmware.vip.api.rest.APIOperation; import com.vmware.vip.api.rest.APIParamName; import com.vmware.vip.api.rest.APIParamValue; -import com.vmware.vip.api.rest.APIV1; import com.vmware.vip.api.rest.APIV2; import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.i18n.api.base.TranslationProductComponentAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** @@ -40,16 +39,16 @@ public class TranslationProductComponentAPI extends TranslationProductComponentA * Provide translation based on single component. * */ - @ApiOperation(value = APIOperation.COMPONENT_TRANSLATION_VALUE, notes = APIOperation.COMPONENT_TRANSLATION_NOTES) + @Operation(summary = APIOperation.COMPONENT_TRANSLATION_VALUE, description = APIOperation.COMPONENT_TRANSLATION_NOTES) @RequestMapping(value = APIV2.COMPONENT_TRANSLATION_GET, method = RequestMethod.GET, produces = {API.API_CHARSET}) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getSingleComponentTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, - @ApiParam(name = APIParamName.MT, value = APIParamValue.MT) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, + @Parameter(name = APIParamName.MT, description = APIParamValue.MT) @RequestParam(value = APIParamName.MT, required=false, defaultValue="false") String machineTranslation, // @RequestHeader(required = true) String authorization, diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentKeyAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentKeyAPI.java index c235b0357..f5e469630 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentKeyAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationProductComponentKeyAPI.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.translation; @@ -7,8 +7,10 @@ import java.io.IOException; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -37,8 +39,6 @@ import com.vmware.vip.i18n.api.base.TranslationProductComponentKeyAction; import io.micrometer.core.instrument.MeterRegistry; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; /** * Provide RESTful API for product to get translation by String base. @@ -57,20 +57,20 @@ public class TranslationProductComponentKeyAPI extends TranslationProductCompone * Provide translation based on String * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_GET_VALUE, description = APIOperation.KEY_TRANSLATION_GET_NOTES) @RequestMapping(value = APIV2.KEY_TRANSLATION_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getTranslationByGet( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(name = APIParamName.SOURCE, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(name = APIParamName.SOURCE, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false, defaultValue = "") String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L3APIException { return super.getTransByGet(productName, version, locale, component, key, source, sourceFormat, pseudo); @@ -81,21 +81,21 @@ public APIResponseDTO getTranslationByGet( * source * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_POST_VALUE, notes = APIOperation.KEY_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_POST_VALUE, description = APIOperation.KEY_TRANSLATION_POST_NOTES) @RequestMapping(value = APIV2.KEY_TRANSLATION_POST, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getTranslationByPost( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(value = APIParamValue.SOURCE, required = false) String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, - @ApiParam(name = APIParamName.MT, value = APIParamValue.MT) + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(description = APIParamValue.SOURCE, required = false) String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.MT, description = APIParamValue.MT) @RequestParam(value = APIParamName.MT, required=false, defaultValue="false") String machineTranslation, @RequestParam(value = APIParamName.CHECK_TRANS_STATUS, required=false, defaultValue="false") String checkTranslationStatus, // @RequestHeader(required = true) String authorization, @@ -113,16 +113,16 @@ public APIResponseDTO getTranslationByPost( * @throws VIPAPIException * */ - @ApiOperation(value = APIOperation.KEY_SET_POST_VALUE, notes = APIOperation.KEY_SET_POST_NOTES) + @Operation(summary = APIOperation.KEY_SET_POST_VALUE, description = APIOperation.KEY_SET_POST_NOTES) @RequestMapping(value = APIV2.KEY_SET_POST, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO postSources( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, @RequestBody List sourceSet, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = false, defaultValue = "false") String collectSource, HttpServletRequest request) throws JsonProcessingException, VIPAPIException { request.setAttribute(ConstantsKeys.KEY, ConstantsKeys.JSON_KEYSET); ObjectMapper mapper = new ObjectMapper(); @@ -138,16 +138,16 @@ public APIResponseDTO postSources( * API to get a bunch of strings * */ - @ApiOperation(value = APIOperation.KEY_SET_GET_VALUE, notes = APIOperation.KEY_SET_GET_NOTES) + @Operation(summary = APIOperation.KEY_SET_GET_VALUE, description = APIOperation.KEY_SET_GET_NOTES) @RequestMapping(value = APIV2.KEY_SET_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO getKeysTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.KEYS, required = true, value = APIParamValue.KEYS) @RequestParam(value = APIParamName.KEYS) String keys, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.KEYS, required = true, description = APIParamValue.KEYS) @RequestParam(value = APIParamName.KEYS) String keys, + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L3APIException { return super.getMultTransByGet(productName, version, locale, component, keys, pseudo); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSourceAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSourceAPI.java index 334e8aadf..f7a44e043 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSourceAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSourceAPI.java @@ -1,11 +1,14 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.translation; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -26,9 +29,6 @@ import com.vmware.vip.core.messages.exception.L3APIException; import com.vmware.vip.i18n.api.base.TranslationSourceAction; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import springfox.documentation.annotations.ApiIgnore; /** * Provide RESTful API for product to get translation by String base. @@ -55,8 +55,8 @@ public class TranslationSourceAPI extends TranslationSourceAction { * @return APIResponseDTO * The object which represents response status. */ - @ApiIgnore - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_GET_VALUE, notes = APIOperation.KEY_TRANSLATION_GET_NOTES) + @Hidden + @Operation(summary = APIOperation.SOURCE_TRANSLATION_GET_VALUE, description = APIOperation.KEY_TRANSLATION_GET_NOTES) @RequestMapping(value = APIV2.SOURCE_TRANSLATION_GET, method = RequestMethod.GET, produces = { API.API_CHARSET }) public String getTranslationBySource( @PathVariable(APIParamName.PRODUCT_NAME) String productName, @@ -65,9 +65,9 @@ public String getTranslationBySource( @RequestParam(value = APIParamName.LOCALE, required = false) String locale, @RequestParam(value = APIParamName.SOURCE, required = true) String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required=false, defaultValue="false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request, HttpServletResponse response) { @@ -92,7 +92,7 @@ public String getTranslationBySource( * Extends the ServletRequest interface to provide request information for HTTP servlets. * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = APIV2.SOURCE_TRANSLATION_POST, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseBody @ResponseStatus(HttpStatus.OK) @@ -103,9 +103,9 @@ public APIResponseDTO createSource ( @PathVariable(value = APIParamName.LOCALE) String locale, @RequestBody String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required=false, defaultValue="false") String collectSource, - @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) + @Parameter(name = APIParamName.PSEUDO, description = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws L3APIException { return super.createSource(productName, component, version, locale, source, sourceFormat, collectSource, pseudo, request); diff --git a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSyncAPI.java b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSyncAPI.java index b991ea92b..ae69d6525 100644 --- a/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSyncAPI.java +++ b/g11n-ws/modules/md-restful-api-i18n/src/main/java/com/vmware/vip/i18n/api/v2/translation/TranslationSyncAPI.java @@ -4,7 +4,8 @@ */ package com.vmware.vip.i18n.api.v2.translation; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; @@ -22,7 +23,6 @@ import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; import com.vmware.vip.i18n.api.base.TranslationSyncAction; -import io.swagger.annotations.ApiOperation; /** * @@ -49,7 +49,7 @@ public class TranslationSyncAPI extends TranslationSyncAction { * information for HTTP servlets. * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.TRANSLATION_UPDATE_VALUE, notes = APIOperation.TRANSLATION_UPDATE_NOTES) + @Operation(summary = APIOperation.TRANSLATION_UPDATE_VALUE, description = APIOperation.TRANSLATION_UPDATE_NOTES) @RequestMapping(value = APIV2.PRODUCT_TRANSLATION_PUT, method = RequestMethod.PUT, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO updateTranslation( diff --git a/g11n-ws/modules/md-restful-api/build.gradle b/g11n-ws/modules/md-restful-api/build.gradle index b2986235c..4c0fda76c 100644 --- a/g11n-ws/modules/md-restful-api/build.gradle +++ b/g11n-ws/modules/md-restful-api/build.gradle @@ -1,6 +1,6 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 - +apply plugin: 'java' archivesBaseName = 'md-restful-api' jar { diff --git a/g11n-ws/modules/md-restful-l10n-synch/build.gradle b/g11n-ws/modules/md-restful-l10n-synch/build.gradle index af2fc5ba6..a9a13afe8 100644 --- a/g11n-ws/modules/md-restful-l10n-synch/build.gradle +++ b/g11n-ws/modules/md-restful-l10n-synch/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' apply plugin: 'org.springframework.boot' @@ -17,11 +17,8 @@ configurations { dependencies { implementation project(":vip-common") implementation project(":md-restful-api") - compileOnly("org.springframework.boot:spring-boot") - compileOnly("org.springframework:spring-webmvc:$springWebVersion") - compileOnly ('org.springframework.boot:spring-boot-starter-log4j2'){ - exclude group: "org.apache.logging.log4j" - } + compileOnly("org.springframework.boot:spring-boot-starter-web") + compileOnly ('org.springframework.boot:spring-boot-starter-log4j2') api group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '4.11.8.201904181247-r' } diff --git a/g11n-ws/modules/md-restful-l10n-synch/src/main/java/com/vmware/l10n/synch/utils/GitUtils.java b/g11n-ws/modules/md-restful-l10n-synch/src/main/java/com/vmware/l10n/synch/utils/GitUtils.java index d1c30e5b5..9c963e702 100644 --- a/g11n-ws/modules/md-restful-l10n-synch/src/main/java/com/vmware/l10n/synch/utils/GitUtils.java +++ b/g11n-ws/modules/md-restful-l10n-synch/src/main/java/com/vmware/l10n/synch/utils/GitUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.synch.utils; @@ -139,12 +139,8 @@ public static File cloneRepBySSh(String remoteUri, String tempFolder, String bra * * @param remoteUrl * to connect. - * @param localPath - * where to clone the repo. * @param passphrase * to access private key. - * @param privateKey - * file location. If null default (~.ssh/id_rsa) location is used. * * @return Git instance. Caller is responsible to close the connection. */ diff --git a/g11n-ws/modules/md-restful-synch/build.gradle b/g11n-ws/modules/md-restful-synch/build.gradle index a02bbc85a..8cd44b0bb 100644 --- a/g11n-ws/modules/md-restful-synch/build.gradle +++ b/g11n-ws/modules/md-restful-synch/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' apply plugin: 'org.springframework.boot' @@ -18,12 +18,14 @@ dependencies { api project(":md-service-i18n-l3") compileOnly("org.apache.httpcomponents:httpclient:$httpclient") api("com.alibaba:fastjson:1.2.51") - compileOnly("io.springfox:springfox-swagger2:$swaggerVersion") - compileOnly("org.springframework:spring-webmvc:$springWebVersion") - compileOnly("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - compileOnly('org.springframework.boot:spring-boot-starter-log4j2'){ - exclude group: "org.apache.logging.log4j" + implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ + exclude group: 'junit' } + compileOnly("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") + implementation("commons-io:commons-io:$commonsIoVersion") + compileOnly("org.springframework.boot:spring-boot-starter-web") + compileOnly('org.springframework.boot:spring-boot-starter-log4j2') + compileOnly("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") compileOnly('org.springframework.boot:spring-boot-autoconfigure') } diff --git a/g11n-ws/modules/md-restful-synch/src/main/java/com/vmware/vip/i18n/api/v2/synch/TranslationSynchController.java b/g11n-ws/modules/md-restful-synch/src/main/java/com/vmware/vip/i18n/api/v2/synch/TranslationSynchController.java index 10d26a6a4..9b9f6078f 100644 --- a/g11n-ws/modules/md-restful-synch/src/main/java/com/vmware/vip/i18n/api/v2/synch/TranslationSynchController.java +++ b/g11n-ws/modules/md-restful-synch/src/main/java/com/vmware/vip/i18n/api/v2/synch/TranslationSynchController.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v2.synch; @@ -21,7 +21,7 @@ import com.vmware.vip.messages.synch.model.SynchFile2GitReq; import com.vmware.vip.messages.synch.service.SynchService; import com.vmware.vip.messages.synch.utils.HttpsUtils; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -59,7 +59,7 @@ public class TranslationSynchController { @Value("${translation.synch.git.flag}") private String translationSynchGitFlag; - @ApiOperation(value = APIOperation.TRANSLATION_SYNC_VALUE, notes = APIOperation.TRANSLATION_SYNC_NOTES) + @Operation(summary = APIOperation.TRANSLATION_SYNC_VALUE, description = APIOperation.TRANSLATION_SYNC_NOTES) @RequestMapping(value = APIV2.PRODUCT_TRANSLATION_SYNC_PUT, method = RequestMethod.PUT, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public APIResponseDTO synchTranslation(@RequestBody UpdateTranslationDTO updateTranslationDTO, diff --git a/g11n-ws/modules/md-service-authen/build.gradle b/g11n-ws/modules/md-service-authen/build.gradle index f16dc4102..d6166d4e9 100644 --- a/g11n-ws/modules/md-service-authen/build.gradle +++ b/g11n-ws/modules/md-service-authen/build.gradle @@ -22,13 +22,8 @@ configurations { dependencies { api project(":vip-common") api project(":md-restful-api") - compileOnly("org.springframework:spring-webmvc:$springWebVersion") - compileOnly ('org.springframework.boot:spring-boot-starter-log4j2'){ - exclude group: "org.apache.logging.log4j" - } - compileOnly("org.apache.logging.log4j:log4j-api:$log4j2Version") - compileOnly("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - compileOnly("io.springfox:springfox-swagger2:$swaggerVersion") + compileOnly("org.springframework.boot:spring-boot-starter-web") + compileOnly ('org.springframework.boot:spring-boot-starter-log4j2') compileOnly("commons-codec:commons-codec:$commonsCodecVersion") api("com.auth0:java-jwt:3.18.2") implementation("org.owasp.esapi:esapi:$esapiVersion"){ @@ -38,6 +33,8 @@ dependencies { } implementation("commons-fileupload:commons-fileupload:1.5") compileOnly("io.jsonwebtoken:jjwt:$jjwtVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + compileOnly("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") implementation("com.nimbusds:nimbus-jose-jwt:9.27") } diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/Interceptor/APISourceInterceptor.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/Interceptor/APISourceInterceptor.java index a58ae45c7..3f9f02623 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/Interceptor/APISourceInterceptor.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/Interceptor/APISourceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; @@ -9,9 +9,9 @@ import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -154,7 +154,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons @Override public void afterCompletion(HttpServletRequest request, - HttpServletResponse response, Object handler, Exception ex) + HttpServletResponse response, Object handler, Exception ex) throws Exception { if (StringUtils.equalsIgnoreCase( request.getParameter(ConstantsKeys.COLLECT_SOURCE), diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/IPAuthentication.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/IPAuthentication.java index 95b12e426..c67b5d045 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/IPAuthentication.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/IPAuthentication.java @@ -1,11 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.auth; -import javax.servlet.http.HttpServletRequest; + +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/VIPAuthentication.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/VIPAuthentication.java index 145e38f54..52f480f22 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/VIPAuthentication.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/VIPAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.auth; @@ -7,8 +7,7 @@ import java.lang.reflect.AnnotatedType; import java.lang.reflect.InvocationTargetException; -import javax.servlet.http.HttpServletRequest; - +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/AuthInterceptor.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/AuthInterceptor.java index 9a3e6acd2..b920d4a94 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/AuthInterceptor.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/AuthInterceptor.java @@ -6,20 +6,22 @@ import java.io.IOException; import java.time.LocalDateTime; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + + import com.vmware.vip.core.csp.service.CSPTokenService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; import com.vmware.vip.common.constants.ConstantsKeys; import com.vmware.vip.common.i18n.status.Response; -public class AuthInterceptor extends HandlerInterceptorAdapter { +public class AuthInterceptor implements HandlerInterceptor { private static Logger logger = LoggerFactory.getLogger(AuthInterceptor.class); diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/VipAPIAuthInterceptor.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/VipAPIAuthInterceptor.java index 209b30f02..3112afdbb 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/VipAPIAuthInterceptor.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/auth/interceptor/VipAPIAuthInterceptor.java @@ -1,20 +1,20 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.auth.interceptor; import java.time.LocalDateTime; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; import com.fasterxml.jackson.databind.ObjectMapper; import com.vmware.vip.common.i18n.dto.response.APIResponseDTO; @@ -22,7 +22,7 @@ import com.vmware.vip.core.csp.service.JwtTokenService; @Component -public class VipAPIAuthInterceptor extends HandlerInterceptorAdapter{ +public class VipAPIAuthInterceptor implements HandlerInterceptor { private static Logger logger = LoggerFactory.getLogger(VipAPIAuthInterceptor.class); private static final String AUTH_TOKEN = "token"; private static final String AUTH_APPID = "appId"; diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/login/controller/AuthenticationLoginController.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/login/controller/AuthenticationLoginController.java index 9c9fd19d2..a692b7efb 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/login/controller/AuthenticationLoginController.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/login/controller/AuthenticationLoginController.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.login.controller; @@ -8,6 +8,8 @@ import java.util.HashMap; import java.util.Map; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,13 +27,8 @@ import com.vmware.vip.core.csp.service.JwtTokenService; import com.vmware.vip.core.login.LdapAuthenticator; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiParam; - - - @RestController("authentication-authenticationLoginAPI") -@Api(value = "Login Controller login operations") +@Tag(name = "authentication-authenticationLoginAPI", description = "Login Controller login operations") public class AuthenticationLoginController { private static Logger logger = LoggerFactory.getLogger(AuthenticationLoginController.class); @@ -45,11 +42,11 @@ public class AuthenticationLoginController { @PostMapping("/auth/login") public APIResponseDTO vipLogin( - @ApiParam(name = APIParamName.USERNAME, value = APIParamValue.USERNAME) + @Parameter(name = APIParamName.USERNAME, description = APIParamValue.USERNAME) @RequestParam(value = APIParamName.USERNAME) String username, - @ApiParam(name = APIParamName.PASSWORD, value = APIParamValue.PASSWORD) + @Parameter(name = APIParamName.PASSWORD, description = APIParamValue.PASSWORD) @RequestParam(value = APIParamName.PASSWORD) String password, - @ApiParam(name = APIParamName.EXPIREDAYS, value = APIParamValue.EXPIREDAYS) + @Parameter(name = APIParamName.EXPIREDAYS, description = APIParamValue.EXPIREDAYS) @RequestParam(value = APIParamName.EXPIREDAYS) Integer expireDays ) throws ValidationException { logger.info("{} begin to login", username ); diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/security/BaseAPI.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/security/BaseAPI.java index 3f7e3a349..28564fe17 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/security/BaseAPI.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/security/BaseAPI.java @@ -1,11 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.security; -import javax.servlet.http.HttpServletRequest; + +import jakarta.servlet.http.HttpServletRequest; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestParam; @@ -22,8 +23,8 @@ public class BaseAPI { @ModelAttribute public void validateToken(HttpServletRequest request, - @RequestParam(value = APIParamName.PRODUCT_NAME) String productName, - @RequestParam(value = APIParamName.VERSION) String version) { + @RequestParam(value = APIParamName.PRODUCT_NAME) String productName, + @RequestParam(value = APIParamName.VERSION) String version) { APIResponseDTO respDTO = new APIResponseDTO(); respDTO.setSignature((String) request.getSession().getAttribute(ConstantsKeys.SIGNATURE)); respDTO.setResponse(APIResponseStatus.OK); diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/ParameterValidation.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/ParameterValidation.java index 633d20781..21e7b53d4 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/ParameterValidation.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/ParameterValidation.java @@ -12,10 +12,10 @@ import com.vmware.vip.common.exceptions.ValidationException; import com.vmware.vip.common.utils.RegExpValidatorUtils; import com.vmware.vip.common.utils.SourceFormatUtils; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.web.servlet.HandlerMapping; -import javax.servlet.http.HttpServletRequest; import java.util.Map; public class ParameterValidation implements IVlidation { @@ -302,7 +302,7 @@ private void validateScale(HttpServletRequest request) : request.getParameter(APIParamName.SCALE); try { if (!StringUtils.isEmpty(scale) - && new Integer(scale).intValue() < 0) { + && Integer.parseInt(scale) < 0) { throw new ValidationException(ValidationMsg.SCALE_NOT_VALIDE); } } catch (NumberFormatException e) { diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/URLValidation.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/URLValidation.java index 0c5e878f9..52f55e90b 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/URLValidation.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/URLValidation.java @@ -1,11 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.validation; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/VIPValidation.java b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/VIPValidation.java index 68d7055f1..72f33084e 100644 --- a/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/VIPValidation.java +++ b/g11n-ws/modules/md-service-authen/src/main/java/com/vmware/vip/core/validation/VIPValidation.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.validation; @@ -7,8 +7,8 @@ import java.lang.reflect.AnnotatedType; import java.lang.reflect.InvocationTargetException; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/modules/md-service-i18n-l2/build.gradle b/g11n-ws/modules/md-service-i18n-l2/build.gradle index 3b3908e57..83831ffb8 100644 --- a/g11n-ws/modules/md-service-i18n-l2/build.gradle +++ b/g11n-ws/modules/md-service-i18n-l2/build.gradle @@ -18,6 +18,8 @@ dependencies { compileOnly("org.springframework:spring-context") compileOnly("org.springframework.boot:spring-boot-starter-data-jpa") compileOnly("org.slf4j:slf4j-api:$slf4jVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + } bootJar { diff --git a/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/date/DateFormatService.java b/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/date/DateFormatService.java index 2aff80cf2..1d26e0f31 100644 --- a/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/date/DateFormatService.java +++ b/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/date/DateFormatService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.i18n.l2.service.date; @@ -9,10 +9,9 @@ import java.util.Date; -import javax.annotation.Resource; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -37,7 +36,7 @@ public class DateFormatService implements IDateFormatService{ private static final Logger logger = LoggerFactory.getLogger(DateFormatService.class.getName()); - @Resource + @Autowired private IPatternDao patternDao; /** diff --git a/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/pattern/PatternServiceImpl.java b/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/pattern/PatternServiceImpl.java index c12ad7ef4..66bb18123 100644 --- a/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/pattern/PatternServiceImpl.java +++ b/g11n-ws/modules/md-service-i18n-l2/src/main/java/com/vmware/i18n/l2/service/pattern/PatternServiceImpl.java @@ -18,11 +18,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import javax.annotation.Resource; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -41,7 +41,7 @@ public class PatternServiceImpl implements IPatternService { private static List specialCategories = Arrays.asList(ConstantsKeys.PLURALS, ConstantsKeys.DATE_FIELDS, ConstantsKeys.MEASUREMENTS, ConstantsKeys.CURRENCIES); private static List otherCategories = Arrays.asList(ConstantsKeys.DATES, ConstantsKeys.NUMBERS); - @Resource + @Autowired private IPatternDao patternDao; /** diff --git a/g11n-ws/modules/md-service-i18n-l3/build.gradle b/g11n-ws/modules/md-service-i18n-l3/build.gradle index 78a70c2ff..aaee76bef 100644 --- a/g11n-ws/modules/md-service-i18n-l3/build.gradle +++ b/g11n-ws/modules/md-service-i18n-l3/build.gradle @@ -28,6 +28,12 @@ dependencies { compileOnly("org.springframework.boot:spring-boot-starter-data-jpa") compileOnly("org.slf4j:slf4j-api:$slf4jVersion") implementation('org.springframework.boot:spring-boot-autoconfigure') + compileOnly("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + compileOnly("org.apache.commons:commons-lang3:$commonsLangVersion") + implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ + exclude group: 'junit' + } + } bootJar { diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/MTService.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/MTService.java index b25b49adf..3b40833e3 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/MTService.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/MTService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.messages.service.mt; @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; -import javax.annotation.Resource; import com.vmware.vip.messages.mt.MTFactory; import org.springframework.beans.BeanUtils; @@ -46,7 +45,7 @@ public class MTService implements IMTService { private static Logger LOGGER = LoggerFactory.getLogger(MTService.class); - @Resource + @Autowired private IOneComponentDao oneComponentDao; @Autowired @@ -99,7 +98,9 @@ public ComponentMessagesDTO getComponentMTTranslation( List mtResult = new ArrayList(); IMTProcessor mtProcessor = MTFactory.getMTProcessor(); // Since Azure has limitation(max 25) to the array size of source, so we need to handle it. - int translatedCount = new Integer(MTConfig.TRANSLATECOUNT).intValue(), fromIndex = 0, toIndex = translatedCount; + int translatedCount = Integer.parseInt(MTConfig.TRANSLATECOUNT); + int fromIndex = 0; + int toIndex = translatedCount; if (sourceList.size() < translatedCount) { mtResult = mtProcessor.translateArray(ConstantsUnicode.EN, toLang, sourceList); diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/SourceToLatestCron.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/SourceToLatestCron.java index 0127c50b0..ce5c6d356 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/SourceToLatestCron.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/mt/SourceToLatestCron.java @@ -1,15 +1,15 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.messages.service.mt; import java.util.List; -import javax.annotation.Resource; import org.json.simple.parser.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @@ -33,10 +33,10 @@ public class SourceToLatestCron { private static Logger LOGGER = LoggerFactory.getLogger(SourceToLatestCron.class); - @Resource + @Autowired private IProductService productService; - @Resource + @Autowired private IOneComponentService oneComponentService; diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/multcomponent/MultComponentService.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/multcomponent/MultComponentService.java index 26f805d25..a84ee534d 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/multcomponent/MultComponentService.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/multcomponent/MultComponentService.java @@ -6,8 +6,6 @@ import java.util.List; -import javax.annotation.Resource; - import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -36,7 +34,7 @@ public class MultComponentService implements IMultComponentService { private static Logger LOGGER = LoggerFactory.getLogger(MultComponentService.class); - @Resource + @Autowired private IMultComponentDao multipleComponentsDao; @Autowired diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/product/ProductService.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/product/ProductService.java index 043a9fe87..d5695db68 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/product/ProductService.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/product/ProductService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.messages.service.product; @@ -29,10 +29,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import javax.annotation.Resource; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -46,10 +46,10 @@ public class ProductService implements IProductService { private static Logger logger = LoggerFactory .getLogger(ProductService.class); - @Resource + @Autowired private IProductDao productdao; - @Resource + @Autowired private IOneComponentDao oneComponentDao; @Override diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/singlecomponent/OneComponentService.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/singlecomponent/OneComponentService.java index 67882feb5..2ab4e5e8e 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/singlecomponent/OneComponentService.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/singlecomponent/OneComponentService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.messages.service.singlecomponent; @@ -8,7 +8,6 @@ import java.util.List; import java.util.Locale; -import javax.annotation.Resource; import org.json.simple.parser.ParseException; import org.slf4j.Logger; @@ -46,7 +45,7 @@ public class OneComponentService implements IOneComponentService { @Autowired IProductService productService; - @Resource + @Autowired private IOneComponentDao oneComponentDao; @Autowired diff --git a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/string/StringService.java b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/string/StringService.java index f2a341249..84b67b514 100644 --- a/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/string/StringService.java +++ b/g11n-ws/modules/md-service-i18n-l3/src/main/java/com/vmware/vip/core/messages/service/string/StringService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.messages.service.string; @@ -23,7 +23,6 @@ import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; @@ -37,7 +36,7 @@ public class StringService implements IStringService { private static Logger logger = LoggerFactory.getLogger(StringService.class); @Autowired private PseudoConfig pseudoConfig; - @Resource + @Autowired private IOneComponentService singleComponentService; /** @@ -158,7 +157,7 @@ private ComponentMessagesDTO createComponentDTO( ComponentMessagesDTO newComponentMessagesDTO = new ComponentMessagesDTO(); BeanUtils.copyProperties(componentMessagesDTO, newComponentMessagesDTO); newComponentMessagesDTO.setLocale(locale); - newComponentMessagesDTO.setPseudo(new Boolean(pseudo)); + newComponentMessagesDTO.setPseudo(Boolean.parseBoolean(pseudo)); return newComponentMessagesDTO; } diff --git a/g11n-ws/tools/tool-trans-fetcher/build.gradle b/g11n-ws/tools/tool-trans-fetcher/build.gradle index aa5c33976..678d3d3a5 100644 --- a/g11n-ws/tools/tool-trans-fetcher/build.gradle +++ b/g11n-ws/tools/tool-trans-fetcher/build.gradle @@ -1,4 +1,4 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 apply plugin: 'java-library' description = 'translation fetcher module' @@ -8,12 +8,16 @@ configurations { } dependencies { - api("org.quartz-scheduler:quartz:2.2.2") - api("org.quartz-scheduler:quartz-jobs:2.2.2") - api("commons-io:commons-io:$commonsIoVersion") - api("org.apache.commons:commons-lang3:$commonsLangVersion") - api project(":vip-common") - testImplementation("junit:junit:$junitVersion") + implementation("org.quartz-scheduler:quartz:2.2.2") + implementation("org.quartz-scheduler:quartz-jobs:2.2.2") + implementation("commons-io:commons-io:$commonsIoVersion") + implementation("org.apache.commons:commons-lang3:$commonsLangVersion") + implementation project(":vip-common") + implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ + exclude group: 'junit' + } + + testImplementation("junit:junit:$junitVersion") } jar { diff --git a/g11n-ws/vip-common/build.gradle b/g11n-ws/vip-common/build.gradle index 6c3eef26d..a0617694e 100644 --- a/g11n-ws/vip-common/build.gradle +++ b/g11n-ws/vip-common/build.gradle @@ -1,6 +1,6 @@ //Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 -apply plugin: 'java-library' +apply plugin: 'java' description = 'common tools module' configurations { @@ -8,13 +8,14 @@ configurations { } dependencies { - api("org.apache.commons:commons-lang3:$commonsLangVersion") - api("commons-io:commons-io:$commonsIoVersion") - api("commons-codec:commons-codec:$commonsCodecVersion") - api("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - api("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ + implementation("org.apache.commons:commons-lang3:$commonsLangVersion") + implementation("commons-io:commons-io:$commonsIoVersion") + implementation("commons-codec:commons-codec:$commonsCodecVersion") + implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ exclude group: 'junit' } + compileOnly("org.slf4j:slf4j-api:$slf4jVersion") compileOnly("org.ehcache:ehcache:$ehCacheVersion") compileOnly("javax.cache:cache-api:$cacheApiVersion") diff --git a/g11n-ws/vip-manager-i18n/build.gradle b/g11n-ws/vip-manager-i18n/build.gradle index a6a8e1d25..6ec1569ea 100644 --- a/g11n-ws/vip-manager-i18n/build.gradle +++ b/g11n-ws/vip-manager-i18n/build.gradle @@ -12,7 +12,8 @@ configurations { war providedRuntime // remove default logger - all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + all*.exclude group: 'commons-logging', module: 'commons-logging' } sourceSets { @@ -42,53 +43,39 @@ dependencies { if (project.hasProperty('datatype') && project.getProperty('datatype') == 'bundle' && project.getProperty('syncdata') == 'true') { api project(":md-restful-synch") } - implementation("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - implementation("org.apache.tomcat:tomcat-annotations-api:$tomcatVersion") - implementation("org.springframework:spring-webmvc:$springWebVersion") - implementation('org.springframework.boot:spring-boot-starter-log4j2'){ - exclude group: "org.apache.logging.log4j" - } - implementation("org.apache.logging.log4j:log4j-api:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-core:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version") - implementation("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") + implementation('org.springframework.boot:spring-boot-starter-log4j2') + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.apache.commons:commons-lang3:$commonsLangVersion") implementation("commons-io:commons-io:$commonsIoVersion") implementation("commons-codec:commons-codec:$commonsCodecVersion") + + implementation("org.ehcache:ehcache:$ehCacheVersion") { + capabilities { + requireCapability('org.ehcache:ehcache-jakarta') + } + } + implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.3' + + implementation("com.google.guava:guava:$guavaVersion") + implementation("com.ibm.icu:icu4j:$icu4jVersion") implementation("org.yaml:snakeyaml:$snakeyam") - implementation("io.jsonwebtoken:jjwt:$jjwtVersion") implementation("org.hibernate.javax.persistence:hibernate-jpa-2.1-api:$hibernateJpa21Api") - implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:$jacksonVersion") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion") - implementation("org.ehcache:ehcache:$ehCacheVersion") - implementation("javax.cache:cache-api:$cacheApiVersion") - implementation("org.apache.httpcomponents:httpclient:$httpclient") - // Actuator - START - implementation ('org.springframework.boot:spring-boot-starter-actuator') - // Actuator - END //swagger UI -START - implementation("io.springfox:springfox-boot-starter:$swaggerVersion") + implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.1.0' + implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-api', version: '2.1.0' //swagger UI -END - - - //jdk 11 - runtimeOnly 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' - runtimeOnly 'javax.activation:activation:1.1.1' - runtimeOnly 'com.sun.xml.bind:jaxb-impl:3.0.2' - runtimeOnly 'com.sun.xml.bind:jaxb-core:3.0.2' - //end jdk 11 + + + // Actuator - START + implementation ('org.springframework.boot:spring-boot-starter-actuator') + // Actuator - END + testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("org.asciidoctor:asciidoctorj:2.5.10") - testImplementation("io.github.swagger2markup:swagger2markup:1.3.3") - testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc") testImplementation("junit:junit:$junitVersion") } @@ -238,10 +225,11 @@ tasks.withType(JavaCompile) { //test.dependsOn.add fetchTranslationForTest test.dependsOn.add testFetchedTranslation +/** if (project.hasProperty('datatype') && (project.getProperty('datatype') == 'pgdb') || (project.getProperty('datatype') == 's3') ) { check.dependsOn.remove(test) } - +**/ task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allJava diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/BootApplication.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/BootApplication.java index 294fa0377..44e878b2c 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/BootApplication.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/BootApplication.java @@ -1,13 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; @@ -15,12 +13,7 @@ @SpringBootApplication @EnableScheduling @ComponentScan(basePackages = { "com.vmware" }) -public class BootApplication extends SpringBootServletInitializer { - @Override - protected SpringApplicationBuilder configure( - SpringApplicationBuilder application) { - return application.sources(BootApplication.class); - } +public class BootApplication{ public static void main(String[] args) throws Exception { System.setProperty( diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICacheControlInterceptor.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICacheControlInterceptor.java index 3e0c00368..850cd1487 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICacheControlInterceptor.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICacheControlInterceptor.java @@ -1,16 +1,17 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; -public class APICacheControlInterceptor extends HandlerInterceptorAdapter { +public class APICacheControlInterceptor implements HandlerInterceptor { private String cacheControlValue; diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICrossDomainInterceptor.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICrossDomainInterceptor.java index b7b194f48..e3feff719 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICrossDomainInterceptor.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICrossDomainInterceptor.java @@ -1,17 +1,16 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import java.util.Set; -public class APICrossDomainInterceptor extends HandlerInterceptorAdapter { +public class APICrossDomainInterceptor implements HandlerInterceptor { private Set allowOrigin; private String allowHeaders; diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APISecurityInterceptor.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APISecurityInterceptor.java index 5d37ce17a..541a744b6 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APISecurityInterceptor.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APISecurityInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; @@ -7,16 +7,16 @@ import java.io.PrintWriter; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; +import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.vmware.vip.common.constants.ConstantsChar; import com.vmware.vip.common.constants.ConstantsKeys; @@ -26,7 +26,7 @@ /** * Security interceptor, this is for sessionID and toksn validation and Authentication requests legitimacy */ -public class APISecurityInterceptor extends HandlerInterceptorAdapter { +public class APISecurityInterceptor implements HandlerInterceptor { private Logger LOGGER = LoggerFactory.getLogger(APISecurityInterceptor.class); @@ -36,7 +36,7 @@ public class APISecurityInterceptor extends HandlerInterceptorAdapter { */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, - Object handler) throws Exception { + Object handler) throws Exception { HttpSession session = request.getSession(false); if (session == null || !validateToken(request) || !verifyRightForResouceAccess(request)) { diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APIValidationInterceptor.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APIValidationInterceptor.java index 78f1e85c8..70c744e1b 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APIValidationInterceptor.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APIValidationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; @@ -8,14 +8,14 @@ import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; +import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.vmware.vip.common.constants.ConstantsChar; import com.vmware.vip.core.auth.AuthenException; @@ -29,7 +29,7 @@ /** * Interceptor for collection new resource */ -public class APIValidationInterceptor extends HandlerInterceptorAdapter { +public class APIValidationInterceptor implements HandlerInterceptor { private static Logger LOGGER = LoggerFactory.getLogger(APIValidationInterceptor.class); private Map allowedListMap; @@ -97,7 +97,7 @@ public void postHandle(HttpServletRequest request, @Override public void afterCompletion(HttpServletRequest request, - HttpServletResponse response, Object handler, Exception ex) + HttpServletResponse response, Object handler, Exception ex) throws Exception { // Do nothing because of not need to afterCompletion business } diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/Swagger3HostResolver.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/Swagger3HostResolver.java deleted file mode 100644 index eba65a47e..000000000 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/Swagger3HostResolver.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2019-2023 VMware, Inc. - * SPDX-License-Identifier: EPL-2.0 - */ - -package com.vmware.vip.core.conf; - -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.servers.Server; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import springfox.documentation.oas.web.OpenApiTransformationContext; -import springfox.documentation.oas.web.WebMvcOpenApiTransformationFilter; -import springfox.documentation.spi.DocumentationType; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - - -@Component -public class Swagger3HostResolver implements WebMvcOpenApiTransformationFilter { - private static Logger logger = LoggerFactory.getLogger(Swagger3HostResolver.class); - - @Value("${springfox.documentation.swagger-ui.server.url:}") - private String hostUrl; - - @Value("${springfox.documentation.swagger-ui.server.description:Inferred Url}") - private String hostDesp; - - @Override - public OpenAPI transform(OpenApiTransformationContext context) { - OpenAPI swagger = context.getSpecification(); - if (StringUtils.isNotEmpty(hostUrl)){ - List servers = swagger.getServers(); - for (Server server : servers){ - logger.info("------old server:{} new server {} -------", server.getUrl(), hostUrl); - server.setUrl(hostUrl); - server.setDescription(hostDesp); - } - } - return swagger; - } - - - @Override - public boolean supports(DocumentationType documentationType) { - return documentationType.equals(DocumentationType.OAS_30); - } - - public void setHostUrl(String hostUrl) { - this.hostUrl = hostUrl; - } - -} diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/SwaggerConfig.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/SwaggerConfig.java index b77c538f2..00c6e914c 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/SwaggerConfig.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/SwaggerConfig.java @@ -1,57 +1,33 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.conf; -import static springfox.documentation.builders.BuilderDefaults.nullToEmpty; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import com.vmware.vip.core.login.VipAuthConfig; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.servers.Server; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springdoc.core.customizers.OperationCustomizer; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties; -import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType; -import org.springframework.boot.actuate.endpoint.ExposableEndpoint; -import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver; -import org.springframework.boot.actuate.endpoint.web.EndpointMapping; -import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; -import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; -import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Controller; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.method.HandlerMethod; -import com.vmware.vip.api.rest.APIV1; -import com.vmware.vip.api.rest.APIV2; -import com.vmware.vip.core.login.VipAuthConfig; +import java.util.ArrayList; +import java.util.List; -import springfox.documentation.annotations.ApiIgnore; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.builders.RequestParameterBuilder; -import springfox.documentation.oas.annotations.EnableOpenApi; -import springfox.documentation.schema.ScalarType; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.service.ParameterType; -import springfox.documentation.service.RequestParameter; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; /** * This java class mainly is to integrate the swagger-UI into spring boot, @@ -59,151 +35,147 @@ */ @Configuration -@EnableOpenApi public class SwaggerConfig { - /** - * The date of build, it's recorded in 'application.properties' and displayed on - * swagger-UI. - */ - @Value("${build.number.builddate}") - private String buildDate; - - /** - * The current version of vip-server - */ - @Value("${build.number.branch}") - private String branch; - - /** - * The build number, it's loaded from jenkins. - */ - @Value("${build.number.buildnumber}") - private String buildNumber; - - @Autowired - private VipAuthConfig authConfig; - - @Bean - @ConditionalOnProperty(value = "vipservice.authority.enable") - public Docket serviceloginApi() { - - return new Docket(DocumentationType.OAS_30).groupName("authentication").select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.vip.core.login.controller")) - .paths(PathSelectors.any()).build().apiInfo(apiInfo("interface test doc")); - - } - - @Bean - public Docket createRestApi2() { - if (authConfig.getAuthSwitch().equalsIgnoreCase("true")) { - return new Docket(DocumentationType.OAS_30).groupName(APIV2.V).apiInfo(apiInfo(APIV2.V)).select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.vip.i18n.api.v2")).paths(PathSelectors.any()) - .build().globalRequestParameters(createGlobalParameter()); - } else { - - return new Docket(DocumentationType.OAS_30).groupName(APIV2.V).apiInfo(apiInfo(APIV2.V)).select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.vip.i18n.api.v2")).paths(PathSelectors.any()) - .build(); - } - } - - @Bean - public Docket createRestApi1() { - if (authConfig.getAuthSwitch().equalsIgnoreCase("true")) { - return new Docket(DocumentationType.OAS_30).groupName(APIV1.V).apiInfo(apiInfo(APIV1.V)).select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.vip.i18n.api.v1")).paths(PathSelectors.any()) - .build().globalRequestParameters(createGlobalParameter()); - } else { - return new Docket(DocumentationType.OAS_30).groupName(APIV1.V).apiInfo(apiInfo(APIV1.V)).select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.vip.i18n.api.v1")).paths(PathSelectors.any()) - .build(); - } - } - - - - private List createGlobalParameter(){ - List pars = new ArrayList(); - RequestParameterBuilder rpbToken = new RequestParameterBuilder(); - rpbToken.name("token").description("token code").in(ParameterType.HEADER) - .query(param -> param.model(model -> model.scalarModel(ScalarType.STRING))).required(false); - - RequestParameterBuilder rpbAppId = new RequestParameterBuilder(); - rpbAppId.name("appId").description("the app Id").in(ParameterType.HEADER) - .query(param -> param.model(model -> model.scalarModel(ScalarType.STRING))).required(false); - - pars.add(rpbToken.build()); - pars.add(rpbAppId.build()); - - return pars; - } - - - - /** - * Build API information, include build number, service url, build date, - * changeset and so on. - */ - private ApiInfo apiInfo(String version) { - return new ApiInfoBuilder().title("VIP REST APIs").contact(new Contact("VMWare G11n Team", null, null)) - .version(version + ", build number:" + buildNumber + ", build date:" + buildDate + ", branch:" + branch) - .build(); - } - - public VipAuthConfig getAuthConfig() { - return authConfig; - } - - @Bean - public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, - ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, - EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, - WebEndpointProperties webEndpointProperties, Environment environment) { - List> allEndpoints = new ArrayList<>(); - Collection webEndpoints = webEndpointsSupplier.getEndpoints(); - allEndpoints.addAll(webEndpoints); - allEndpoints.addAll(servletEndpointsSupplier.getEndpoints()); - allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints()); - String basePath = webEndpointProperties.getBasePath(); - EndpointMapping endpointMapping = new EndpointMapping(basePath); - boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, - basePath); - return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, - corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), - shouldRegisterLinksMapping); - } - - private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, - String basePath) { - return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) - || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT)); - } - - - - - private static final String DEFAULT_PATH = "/i18n/api/doc"; - - @Controller - @ApiIgnore - @RequestMapping(DEFAULT_PATH) - @ConditionalOnProperty(value = "springfox.documentation.swagger-ui.enabled") - public static class SwaggerResourceController { - @Value("${springfox.documentation.swagger-ui.base-url:}") - private String swaggerBaseUrl; - - @RequestMapping("/swagger-ui.html") - public void forwardNewURL(HttpServletRequest req, HttpServletResponse resp) throws Exception { - String redirectPath = fixup(swaggerBaseUrl) + "/swagger-ui/index.html"; - resp.sendRedirect(redirectPath); - } - - private String fixup(String swaggerBaseUrl) { - return StringUtils.trimTrailingCharacter(nullToEmpty(swaggerBaseUrl), '/'); - } - - } - - + private static Logger logger = LoggerFactory.getLogger(SwaggerConfig.class); + + /** + * The date of build, it's recorded in 'application.properties' and displayed on + * swagger-UI. + */ + @Value("${build.number.builddate}") + private String buildDate; + + /** + * The current version of vip-server + */ + @Value("${build.number.branch}") + private String branch; + + /** + * The build number, it's loaded from jenkins. + */ + @Value("${build.number.buildnumber}") + private String buildNumber; + + + @Value("${springdoc.swagger-ui.server.url:}") + private String hostUrl; + + @Value("${springdoc.swagger-ui.server.description:Inferred Url}") + private String hostDesp; + + + @Autowired + private VipAuthConfig authConfig; + + + @Bean + public GroupedOpenApi singletV1Api() { + + GroupedOpenApi.Builder builder = GroupedOpenApi.builder().group("v1") + .packagesToScan("com.vmware.vip.i18n.api.v1"); + builder.addOpenApiCustomizer(openApi -> { + openApi.info(generateInfo("v1")); + if (StringUtils.isNotEmpty(hostUrl)) { + logger.info("new host url: {}", hostUrl); + Server server = new Server(); + server.setUrl(hostUrl); + server.setDescription(hostDesp); + List list = new ArrayList<>(); + list.add(server); + openApi.servers(list); + } + }); + if (authConfig.getAuthSwitch().equalsIgnoreCase("true")) { + builder.addOperationCustomizer(customGlobalHeaders()); + } + return builder.build(); + } + + @Bean + public GroupedOpenApi singletV2Api() { + GroupedOpenApi.Builder builder = GroupedOpenApi.builder().group("v2") + .packagesToScan("com.vmware.vip.i18n.api.v2"); + builder.addOpenApiCustomizer(openApi -> { + openApi.info(generateInfo("v2")); + if (StringUtils.isNotEmpty(hostUrl)) { + logger.info("new host url: {}", hostUrl); + Server server = new Server(); + server.setUrl(hostUrl); + server.setDescription(hostDesp); + List list = new ArrayList<>(); + list.add(server); + openApi.servers(list); + } + }); + if (authConfig.getAuthSwitch().equalsIgnoreCase("true")) { + builder.addOperationCustomizer(customGlobalHeaders()); + } + return builder.build(); + } + + @Bean + @ConditionalOnProperty(value = "vipservice.authority.enable") + public GroupedOpenApi singletAuthApi() { + GroupedOpenApi.Builder builder = GroupedOpenApi.builder().group("authentication") + .packagesToScan("com.vmware.vip.core.login.controller"); + logger.info("init authority swagger ui"); + builder.addOpenApiCustomizer(openApi -> { + openApi.info(generateInfo("authentication")); + if (StringUtils.isNotEmpty(hostUrl)) { + logger.info("new host url: {}", hostUrl); + Server server = new Server(); + server.setUrl(hostUrl); + server.setDescription(hostDesp); + List list = new ArrayList<>(); + list.add(server); + openApi.servers(list); + } + + }); + return builder.build(); + } + + + private Info generateInfo(String versionStr){ + String version = versionStr + ",build number:" + buildNumber + ", build date:" + buildDate + ", branch:" + branch; + Contact contact = new Contact(); + contact.setName("VMWare G11n Team"); + Info info = new Info().title("Singleton REST APIs") + .description("Singleton manager APIs") + .version(version) + .contact(contact) + .license(new License().name("Apache 2.0").url("http://springdoc.org")); + + return info; + } + + + + private OperationCustomizer customGlobalHeaders() { + + return (Operation operation, HandlerMethod handlerMethod) -> { + + Parameter tokenParam = new Parameter() + .in(ParameterIn.HEADER.toString()) + .schema(new StringSchema()) + .name("token") + .description("token code") + .required(true); + + Parameter appIdParam = new Parameter() + .in(ParameterIn.HEADER.toString()) + .schema(new StringSchema()) + .name("appId") + .description("the app Id") + .required(true); + + operation.addParametersItem(tokenParam); + operation.addParametersItem(appIdParam); + + return operation; + }; + } + } diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/TomcatConfig.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/TomcatConfig.java index bbe4795b2..f1d0f8b09 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/TomcatConfig.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/TomcatConfig.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.conf; import org.apache.catalina.connector.Connector; import org.apache.coyote.http11.Http11NioProtocol; +import org.apache.tomcat.util.net.SSLHostConfig; +import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; @@ -48,11 +50,17 @@ private Connector initiateHttpsConnector(ServerProperties serverProperties) { connector.setSecure(true); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setSSLEnabled(true); - protocol.setKeystoreFile(serverProperties.getHttpsKeyStore()); - protocol.setKeystorePass(serverProperties.getHttpsKeyStorePassword()); - protocol.setKeystoreType(serverProperties.getHttpsKeyStoreType()); - protocol.setKeyPass(serverProperties.getHttpsKeyPassword()); - protocol.setKeyAlias(serverProperties.getHttpsKeyAlias()); + + SSLHostConfig sslHostConfig = new SSLHostConfig(); + SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, SSLHostConfigCertificate.Type.RSA); + certificate.setCertificateKeystoreFile(serverProperties.getHttpsKeyStore()); + certificate.setCertificateKeystorePassword(serverProperties.getHttpsKeyStorePassword()); + certificate.setCertificateKeystoreType(serverProperties.getHttpsKeyStoreType()); + certificate.setCertificateKeyPassword(serverProperties.getHttpsKeyPassword()); + certificate.setCertificateKeyAlias(serverProperties.getHttpsKeyAlias()); + sslHostConfig.addCertificate(certificate); + protocol.addSslHostConfig(sslHostConfig); + protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); connector.setRedirectPort(ConstantsTomcat.REDIRECT_PORT); connector.setAllowTrace(serverProperties.isAllowTrace()); diff --git a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/VIPTomcatConnectionCustomizer.java b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/VIPTomcatConnectionCustomizer.java index 1e1c85cf5..3d9cfd407 100644 --- a/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/VIPTomcatConnectionCustomizer.java +++ b/g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/conf/VIPTomcatConnectionCustomizer.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.conf; import org.apache.catalina.connector.Connector; import org.apache.coyote.http11.Http11NioProtocol; +import org.apache.tomcat.util.net.SSLHostConfig; +import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; @@ -38,8 +40,10 @@ public void customize(Connector connector) { this.serverProperties.getServerScheme().equalsIgnoreCase(ConstantsTomcat.HTTPS_HTTP)) { logger.info("the tomcat support http and https protocol"); connector.setPort(serverProperties.getHttpPort()); - connector.setAttribute("protocol", ConstantsTomcat.HTTP); - connector.setAttribute("redirectPort", ConstantsTomcat.REDIRECT_PORT); + + connector.setProperty("protocol", ConstantsTomcat.HTTP); + connector.setRedirectPort( ConstantsTomcat.REDIRECT_PORT); + connector.setAllowTrace(serverProperties.isAllowTrace()); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); @@ -49,8 +53,10 @@ public void customize(Connector connector) { } else if(serverProperties.getServerScheme().equalsIgnoreCase(ConstantsTomcat.HTTP)){ logger.info("the tomcat only support http protocol"); connector.setPort(serverProperties.getHttpPort()); - connector.setAttribute("protocol", ConstantsTomcat.HTTP); - connector.setAttribute("redirectPort", ConstantsTomcat.REDIRECT_PORT); + + connector.setProperty("protocol", ConstantsTomcat.HTTP); + connector.setRedirectPort( ConstantsTomcat.REDIRECT_PORT); + connector.setAllowTrace(serverProperties.isAllowTrace()); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); @@ -63,11 +69,18 @@ public void customize(Connector connector) { connector.setSecure(true); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setSSLEnabled(true); - protocol.setKeystoreFile(serverProperties.getHttpsKeyStore()); - protocol.setKeystorePass(serverProperties.getHttpsKeyStorePassword()); - protocol.setKeystoreType(serverProperties.getHttpsKeyStoreType()); - protocol.setKeyPass(serverProperties.getHttpsKeyPassword()); - protocol.setKeyAlias(serverProperties.getHttpsKeyAlias()); + + + SSLHostConfig sslHostConfig = new SSLHostConfig(); + SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(); + certificate.setCertificateKeystoreFile(serverProperties.getHttpsKeyStore()); + certificate.setCertificateKeystorePassword(serverProperties.getHttpsKeyStorePassword()); + certificate.setCertificateKeystoreType(serverProperties.getHttpsKeyStoreType()); + certificate.setCertificateKeyPassword(serverProperties.getHttpsKeyPassword()); + certificate.setCertificateKeyAlias(serverProperties.getHttpsKeyAlias()); + sslHostConfig.addCertificate(certificate); + + protocol.addSslHostConfig(sslHostConfig); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); connector.setRedirectPort(ConstantsTomcat.REDIRECT_PORT); connector.setAllowTrace(serverProperties.isAllowTrace()); diff --git a/g11n-ws/vip-manager-i18n/src/main/resources/application-bundle.properties b/g11n-ws/vip-manager-i18n/src/main/resources/application-bundle.properties index c3f010a2a..afbe577c4 100644 --- a/g11n-ws/vip-manager-i18n/src/main/resources/application-bundle.properties +++ b/g11n-ws/vip-manager-i18n/src/main/resources/application-bundle.properties @@ -77,12 +77,22 @@ vipservice.cross.domain.maxage=3600 cache-control.value=max-age=604800, public #swagger3-ui switch -springfox.documentation.swagger-ui.enabled=true -springfox.documentation.swagger-ui.base-url=/i18n/api/doc -springfox.documentation.openApi.v3.path=/i18n/api/doc/v3/api-docs +#springfox.documentation.swagger-ui.enabled=true +#springfox.documentation.swagger-ui.base-url=/i18n/api/doc +#springfox.documentation.openApi.v3.path=/i18n/api/doc/v3/api-docs #springfox.documentation.swagger-ui.server.url=https://vmtest.prd.com #springfox.documentation.swagger-ui.server.description=test server spring.mvc.pathmatch.matching-strategy=ant_path_matcher +#spring doc +springdoc.swagger-ui.enabled=true +springdoc.swagger-ui.disable-swagger-default-url=true +springdoc.swagger-ui.use-root-path=true +springdoc.swagger-ui.path=/i18n/api/doc/swagger-ui/index.html +#springdoc.swagger-ui.server.url=https://vmtest.prd.com +#springdoc.swagger-ui.server.description=test server +springdoc.api-docs.enabled=true +springdoc.api-docs.path=/i18n/api/doc/v3/api-docs + # MT config diff --git a/g11n-ws/vip-manager-i18n/src/main/resources/application-s3.properties b/g11n-ws/vip-manager-i18n/src/main/resources/application-s3.properties index 443c4fb6b..fc441add4 100644 --- a/g11n-ws/vip-manager-i18n/src/main/resources/application-s3.properties +++ b/g11n-ws/vip-manager-i18n/src/main/resources/application-s3.properties @@ -83,12 +83,22 @@ vipservice.cross.domain.maxage=3600 cache-control.value=max-age=604800, public #swagger3-ui switch -springfox.documentation.swagger-ui.enabled=true -springfox.documentation.swagger-ui.base-url=/i18n/api/doc -springfox.documentation.openApi.v3.path=/i18n/api/doc/v3/api-docs +#springfox.documentation.swagger-ui.enabled=true +#springfox.documentation.swagger-ui.base-url=/i18n/api/doc +#springfox.documentation.openApi.v3.path=/i18n/api/doc/v3/api-docs #springfox.documentation.swagger-ui.server.url=https://vmtest.prd.com #springfox.documentation.swagger-ui.server.description=test server -spring.mvc.pathmatch.matching-strategy=ant_path_matcher +#spring.mvc.pathmatch.matching-strategy= + +#spring doc +springdoc.swagger-ui.enabled=true +springdoc.swagger-ui.disable-swagger-default-url=true +springdoc.swagger-ui.use-root-path=true +springdoc.swagger-ui.path=/i18n/api/doc/swagger-ui/index.html +#springdoc.swagger-ui.server.url=https://vmtest.prd.com +#springdoc.swagger-ui.server.description=test server +springdoc.api-docs.enabled=true +springdoc.api-docs.path=/i18n/api/doc/v3/api-docs #microsoftstore mt config diff --git a/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java b/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java index f11b50fd1..6b4b03aa6 100644 --- a/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java +++ b/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.common; @@ -8,8 +8,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; diff --git a/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/config/SwaggerConfigTest.java b/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/config/SwaggerConfigTest.java index 5a2edbbbd..6ea8c7b2b 100644 --- a/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/config/SwaggerConfigTest.java +++ b/g11n-ws/vip-manager-i18n/src/test/java/com/vmware/vip/i18n/config/SwaggerConfigTest.java @@ -1,10 +1,9 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.config; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; @@ -42,9 +41,8 @@ public void test001servicelogin() { @Test public void test001serviceswich() { SwaggerConfig conf = webApplicationContext.getBean(SwaggerConfig.class); - conf.getAuthConfig().setAuthSwitch("true"); - conf.createRestApi1(); - conf.createRestApi2(); + conf.singletV1Api(); + conf.singletV2Api(); logger.info("createRestApi1"); logger.info("createRestApi2"); } diff --git a/g11n-ws/vip-manager-l10n-agent/build.gradle b/g11n-ws/vip-manager-l10n-agent/build.gradle index dd5584ac1..242f15a44 100644 --- a/g11n-ws/vip-manager-l10n-agent/build.gradle +++ b/g11n-ws/vip-manager-l10n-agent/build.gradle @@ -14,17 +14,14 @@ configurations { } dependencies { - api project(":vip-common") - api project(":md-restful-api") - api ("org.springframework.boot:spring-boot-starter") - api ("org.springframework.boot:spring-boot-starter-log4j2") - - api ("com.alibaba:fastjson:1.2.75") - implementation("org.apache.logging.log4j:log4j-api:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-core:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version") - implementation("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") + implementation project(":vip-common") + implementation project(":md-restful-api") + implementation("org.springframework.boot:spring-boot-starter") + implementation("org.springframework.boot:spring-boot-starter-log4j2") + + implementation('com.alibaba:fastjson:2.0.32') + implementation("org.apache.commons:commons-lang3:$commonsLangVersion") + testImplementation("org.springframework.boot:spring-boot-starter-test") } diff --git a/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/schedule/SourceRequestCron.java b/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/schedule/SourceRequestCron.java index 4c7cf2678..0092d6a83 100644 --- a/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/schedule/SourceRequestCron.java +++ b/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/schedule/SourceRequestCron.java @@ -13,10 +13,9 @@ import java.util.Map.Entry; import java.util.Set; -import javax.annotation.PostConstruct; - import com.vmware.l10agent.utils.ValidationUtils; import com.vmware.vip.common.constants.ValidationMsg; +import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/service/RecordServiceImpl.java b/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/service/RecordServiceImpl.java index 1a59cd0ac..839564edc 100644 --- a/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/service/RecordServiceImpl.java +++ b/g11n-ws/vip-manager-l10n-agent/src/main/java/com/vmware/l10agent/service/RecordServiceImpl.java @@ -9,8 +9,7 @@ import java.util.Map; import java.util.Map.Entry; -import javax.annotation.PostConstruct; - +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/vip-manager-l10n/build.gradle b/g11n-ws/vip-manager-l10n/build.gradle index e714d6430..999da8bde 100644 --- a/g11n-ws/vip-manager-l10n/build.gradle +++ b/g11n-ws/vip-manager-l10n/build.gradle @@ -8,59 +8,41 @@ description = 'l10n manager' configurations { + bootJar + providedRuntime // remove default logger all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + all*.exclude group: 'commons-logging', module: 'commons-logging' } dependencies { - api project(":vip-common") - api project(":md-restful-api") + implementation project(":vip-common") + implementation project(":md-restful-api") if (project.hasProperty('datatype') && project.getProperty('datatype') == 'bundle' && project.getProperty('syncdata') == 'true') { - api project(":md-restful-l10n-synch") + implementation project(":md-restful-l10n-synch") } - implementation("org.apache.commons:commons-lang3:$commonsLangVersion") + // implementation("org.apache.commons:commons-lang3:$commonsLangVersion") implementation("commons-io:commons-io:$commonsIoVersion") - implementation("commons-codec:commons-codec:$commonsCodecVersion") + // implementation("commons-codec:commons-codec:$commonsCodecVersion") implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ exclude group: 'junit' } - implementation('org.springframework.boot:spring-boot-starter-log4j2') { - exclude group: "org.apache.logging.log4j" - } - implementation("org.apache.logging.log4j:log4j-api:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-core:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version") - implementation("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") - - implementation("org.springframework.boot:spring-boot-starter-web") { - exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' - } - implementation("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - implementation("org.apache.tomcat:tomcat-annotations-api:$tomcatVersion") - - //implementation("org.xerial:sqlite-jdbc:$sqliteVersion") - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") + implementation('org.springframework.boot:spring-boot-starter-log4j2') + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.yaml:snakeyaml:$snakeyam") implementation("io.jsonwebtoken:jjwt:$jjwtVersion") implementation("org.hibernate.javax.persistence:hibernate-jpa-2.1-api:$hibernateJpa21Api") - implementation("org.ehcache:ehcache:$ehCacheVersion") - implementation("javax.cache:cache-api:$cacheApiVersion") - implementation("com.nimbusds:nimbus-jose-jwt:9.27") - - implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:$jacksonVersion") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonVersion") - implementation("com.fasterxml.jackson.module:jackson-module-parameter-names:$jacksonVersion") + implementation('com.nimbusds:nimbus-jose-jwt:9.30.2') + //swagger UI -START - implementation("io.springfox:springfox-boot-starter:$swaggerVersion") + implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:$springdocVersion") + implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:$springdocVersion") + //swagger UI -END - implementation("org.apache.httpcomponents:httpclient:$httpclient") + implementation ("com.amazonaws:aws-java-sdk-s3:$awsS3Version") implementation ("com.amazonaws:aws-java-sdk-sts:$awsS3Version") implementation ("com.amazonaws:aws-java-sdk-iam:$awsS3Version") diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/BootApplication.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/BootApplication.java index 59f80a94b..c79e780dd 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/BootApplication.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/BootApplication.java @@ -1,14 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.scheduling.annotation.EnableScheduling; /** @@ -17,12 +15,8 @@ @SpringBootApplication(scanBasePackages = { "com.vmware.vip", "com.vmware.l10n" }) @EnableScheduling @ServletComponentScan("com.vmware.l10n") -public class BootApplication extends SpringBootServletInitializer { +public class BootApplication { - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(BootApplication.class); - } /** * The entrance to start the springboot application. diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceReqBodyInterceptor.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceReqBodyInterceptor.java index a5d40b78d..0d576761b 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceReqBodyInterceptor.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceReqBodyInterceptor.java @@ -1,12 +1,12 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.conf; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import com.vmware.vip.common.constants.ConstantsKeys; @@ -24,7 +24,7 @@ public CollectSourceReqBodyInterceptor(int sourceReqSize) { @Override public boolean preHandle(HttpServletRequest request, - HttpServletResponse response, Object handler) throws Exception { + HttpServletResponse response, Object handler) throws Exception { if (request.getMethod().equalsIgnoreCase(ConstantsKeys.POST) && Integer.valueOf(request.getHeader("content-length")) > this.sourceReqBodySize) { throw new ValidationException(String.format(ValidationMsg.COLLECTSOURCE_REQUEST_BODY_NOT_VALIDE, this.sourceReqBodySize, request.getHeader("content-length"))); } diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceValidationInterceptor.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceValidationInterceptor.java index 9d6339c30..1eaf514e5 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceValidationInterceptor.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CollectSourceValidationInterceptor.java @@ -8,15 +8,15 @@ import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import com.vmware.vip.common.utils.SourceFormatUtils; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerMapping; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.vmware.vip.api.rest.APIParamName; import com.vmware.vip.common.constants.ConstantsChar; @@ -26,7 +26,7 @@ import com.vmware.vip.common.utils.RegExpValidatorUtils; -public class CollectSourceValidationInterceptor extends HandlerInterceptorAdapter { +public class CollectSourceValidationInterceptor implements HandlerInterceptor { private static Logger LOGGER = LoggerFactory.getLogger(CollectSourceValidationInterceptor.class); @@ -56,7 +56,7 @@ public CollectSourceValidationInterceptor(Map> allowListMap */ @Override public boolean preHandle(HttpServletRequest request, - HttpServletResponse response, Object handler) throws Exception { + HttpServletResponse response, Object handler) throws Exception { String singletonRequestID = getRequestId(request, this.clientRequestIds); String logOfUrl = singletonRequestID + "The request url is: " + request.getRequestURL(); String logOfQueryStr = singletonRequestID + "The request query string is: " + request.getQueryString(); diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CspAuthInterceptor.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CspAuthInterceptor.java index 929bec16a..3a344951d 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CspAuthInterceptor.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/CspAuthInterceptor.java @@ -6,18 +6,20 @@ import java.time.LocalDateTime; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; import com.vmware.vip.common.constants.ConstantsKeys; import com.vmware.vip.common.i18n.status.Response; -public class CspAuthInterceptor extends HandlerInterceptorAdapter { + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + + +public class CspAuthInterceptor implements HandlerInterceptor { private static Logger logger = LoggerFactory.getLogger(CspAuthInterceptor.class); diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/S3Client.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/S3Client.java index 0b4146d07..e04e5dfd8 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/S3Client.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/S3Client.java @@ -1,10 +1,10 @@ /** - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.conf; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/SwaggerConfig.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/SwaggerConfig.java index 1e4e207f9..c5e468171 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/SwaggerConfig.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/conf/SwaggerConfig.java @@ -1,111 +1,37 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.conf; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import com.vmware.vip.api.rest.APIV2; -import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties; -import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType; -import org.springframework.boot.actuate.endpoint.ExposableEndpoint; -import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver; -import org.springframework.boot.actuate.endpoint.web.EndpointMapping; -import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; -import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint; -import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier; -import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import io.swagger.v3.oas.models.ExternalDocumentation; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Controller; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import com.vmware.vip.api.rest.APIV2; -import io.swagger.annotations.ApiOperation; -import springfox.documentation.annotations.ApiIgnore; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.oas.annotations.EnableOpenApi; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; /** * This java class mainly is to integrate the swagger-UI into spring boot, * provide a way to access vIP-server API from web UI for test or else. */ @Configuration -@EnableOpenApi public class SwaggerConfig { @Bean - public Docket createRestApi2() { - - return new Docket(DocumentationType.OAS_30).apiInfo(apiInfo(APIV2.V)).select() - .apis(RequestHandlerSelectors.basePackage("com.vmware.l10n.source.controller")) - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).paths(PathSelectors.any()) - .build(); - - } - - /** - * Build API information, include build number, service url, build date, - * changeset and so on. - */ - private ApiInfo apiInfo(String version) { - return new ApiInfoBuilder().title("L10n REST APIs").contact(new Contact("VMWare G11n Team", null, null)) - .version(version).build(); - } - - @Bean - public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, - ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, - EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, - WebEndpointProperties webEndpointProperties, Environment environment) { - List> allEndpoints = new ArrayList<>(); - Collection webEndpoints = webEndpointsSupplier.getEndpoints(); - allEndpoints.addAll(webEndpoints); - allEndpoints.addAll(servletEndpointsSupplier.getEndpoints()); - allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints()); - String basePath = webEndpointProperties.getBasePath(); - EndpointMapping endpointMapping = new EndpointMapping(basePath); - boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, - basePath); - return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, - corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), - shouldRegisterLinksMapping); + public OpenAPI springL10nOpenAPI() { + return new OpenAPI() + .info(new Info().title("L10n REST APIs") + .description("Singleton L10n manager APIs") + .version(APIV2.V) + .license(new License().name("Apache 2.0").url("http://springdoc.org"))) + .externalDocs(new ExternalDocumentation()); } - private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, - String basePath) { - return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) - || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT)); - } - @Controller - @ApiIgnore - @ConditionalOnProperty(value = "springfox.documentation.swagger-ui.enabled") - public static class SwaggerResourceController { - - @RequestMapping("/swagger-ui.html") - public void forwardNewURL(HttpServletRequest req, HttpServletResponse resp) throws Exception { - resp.sendRedirect("/swagger-ui/index.html"); - } - - } } diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/expt/ExceptionHandle.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/expt/ExceptionHandle.java index 85b167bde..c34dd64f4 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/expt/ExceptionHandle.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/expt/ExceptionHandle.java @@ -1,10 +1,10 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.expt; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/record/controller/RecordController.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/record/controller/RecordController.java index d6b10e0fe..2c8eff3bc 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/record/controller/RecordController.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/record/controller/RecordController.java @@ -6,8 +6,8 @@ import java.util.List; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/SourceController.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/SourceController.java index e0e840f84..105970b21 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/SourceController.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/SourceController.java @@ -6,7 +6,8 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Hidden; +import jakarta.servlet.http.HttpServletRequest; import com.vmware.vip.common.utils.SourceFormatUtils; import org.apache.commons.io.IOUtils; @@ -38,13 +39,12 @@ import com.vmware.vip.common.i18n.status.APIResponseStatus; import com.vmware.vip.common.l10n.source.dto.StringSourceDTO; -import springfox.documentation.annotations.ApiIgnore; /** * This class is the controller for collecting dynamic english strings in * product code. */ -@ApiIgnore +@Hidden @RestController public class SourceController { private static Logger LOGGER = LoggerFactory.getLogger(SourceController.class); diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationCollectKeyAPI.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationCollectKeyAPI.java index 8c2c8e125..b68c0b5f5 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationCollectKeyAPI.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationCollectKeyAPI.java @@ -6,7 +6,10 @@ import java.util.List; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import com.vmware.vip.common.utils.SourceFormatUtils; import org.slf4j.Logger; @@ -40,9 +43,6 @@ import com.vmware.vip.common.l10n.source.dto.StringSourceDTO; import com.vmware.vip.common.utils.RegExpValidatorUtils; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import springfox.documentation.annotations.ApiIgnore; @RestController("i10n-TranslationCollectKeyAPI") public class TranslationCollectKeyAPI { @@ -53,20 +53,20 @@ public class TranslationCollectKeyAPI { /** * Post a string key's source to l10n server */ - @ApiIgnore - @ApiOperation(value = APIOperation.KEY_SOURCE_POST_VALUE, notes = APIOperation.KEY_SOURCE_POST_NOTES) + @Hidden + @Operation(summary = APIOperation.KEY_SOURCE_POST_VALUE, description = APIOperation.KEY_SOURCE_POST_NOTES) @RequestMapping(value = L10nI18nAPI.TRANSLATION_KEY_APIV1, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public SourceAPIResponseDTO collectV1StringTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @RequestParam(value = APIParamName.KEY, required = true) String key, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE, required = false, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @RequestParam(value = APIParamName.PRODUCT_NAME, required = true) String productName, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @RequestParam(value = APIParamName.KEY, required = true) String key, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @RequestParam(value = APIParamName.COMPONENT, required = true) String component, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE, required = false, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, //@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L10nAPIException { String newLocale = StringUtils.isEmpty(locale) ? ConstantsUnicode.EN : locale; @@ -94,20 +94,20 @@ public SourceAPIResponseDTO collectV1StringTranslation( * @return * @throws L10nAPIException */ - @ApiIgnore - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Hidden + @Operation(summary = APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = L10nI18nAPI.TRANSLATION_PRODUCT_COMOPONENT_KEY_APIV1, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public SourceAPIResponseDTO collectV1KeyTranslation( @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, @PathVariable(APIParamName.COMPONENT) String component, @PathVariable(APIParamName.KEY) String key, - @ApiParam(value = APIParamValue.SOURCE, required = false) @RequestBody String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, + @Parameter(description = APIParamValue.SOURCE, required = false) @RequestBody String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, //@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L10nAPIException { @@ -129,19 +129,19 @@ public SourceAPIResponseDTO collectV1KeyTranslation( *Post a string key's source to l10n server. * */ - @ApiIgnore - @ApiOperation(value = APIOperation.KEY_SOURCE_POST_VALUE, notes = APIOperation.KEY_SOURCE_POST_NOTES) + @Hidden + @Operation(summary = APIOperation.KEY_SOURCE_POST_VALUE, description = APIOperation.KEY_SOURCE_POST_NOTES) @RequestMapping(value = L10nI18nAPI.TRANSLATION_PRODUCT_NOCOMOPONENT_KEY_APIV1, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public SourceAPIResponseDTO collectV1KeyTranslationNoComponent( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(name = APIParamName.SOURCE, required = false, value = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.LOCALE, value = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @RequestParam(value = APIParamName.VERSION, required = true) String version, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(name = APIParamName.SOURCE, required = false, description = APIParamValue.SOURCE) @RequestParam(value = APIParamName.SOURCE, required = false) String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.LOCALE, description = APIParamValue.LOCALE) @RequestParam(value = APIParamName.LOCALE, required = false) String locale, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, // @ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = ConstantsKeys.FALSE) String pseudo, HttpServletRequest request) throws L10nAPIException { String newLocale = locale == null ? ConstantsUnicode.EN : locale; @@ -160,19 +160,19 @@ public SourceAPIResponseDTO collectV1KeyTranslationNoComponent( * source * */ - @ApiOperation(value = APIOperation.KEY_TRANSLATION_POST_VALUE, notes = APIOperation.KEY_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.KEY_TRANSLATION_POST_VALUE, description = APIOperation.KEY_TRANSLATION_POST_NOTES) @RequestMapping(value = L10nI18nAPI.KEY_TRANSLATION_APIV2, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public SourceAPIResponseDTO collectV2KeyTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, - @ApiParam(name = APIParamName.KEY, required = true, value = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, - @ApiParam(value = APIParamValue.SOURCE, required = false) @RequestBody String source, - @ApiParam(name = APIParamName.COMMENT_SOURCE, value = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, - @ApiParam(name = APIParamName.SOURCE_FORMAT, value = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.KEY, required = true, description = APIParamValue.KEY) @PathVariable(APIParamName.KEY) String key, + @Parameter(description = APIParamValue.SOURCE, required = false) @RequestBody String source, + @Parameter(name = APIParamName.COMMENT_SOURCE, description = APIParamValue.COMMENT_SOURCE) @RequestParam(value = APIParamName.COMMENT_SOURCE, required = false) String commentForSource, + @Parameter(name = APIParamName.SOURCE_FORMAT, description = APIParamValue.SOURCE_FORMAT) @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource ) throws L10nAPIException { @@ -198,16 +198,16 @@ public SourceAPIResponseDTO collectV2KeyTranslation( * @throws ValidationException * */ - @ApiOperation(value = APIOperation.KEY_SET_POST_VALUE, notes = APIOperation.KEY_SET_POST_NOTES) + @Operation(summary = APIOperation.KEY_SET_POST_VALUE, description = APIOperation.KEY_SET_POST_NOTES) @RequestMapping(value = L10nI18nAPI.KEYS_TRANSLATION_APIV2, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseStatus(HttpStatus.OK) public SourceAPIResponseDTO collectV2KeysTranslation( - @ApiParam(name = APIParamName.PRODUCT_NAME, required = true, value = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, - @ApiParam(name = APIParamName.VERSION, required = true, value = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, - @ApiParam(name = APIParamName.LOCALE, required = true, value = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, - @ApiParam(name = APIParamName.COMPONENT, required = true, value = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, + @Parameter(name = APIParamName.PRODUCT_NAME, required = true, description = APIParamValue.PRODUCT_NAME) @PathVariable(APIParamName.PRODUCT_NAME) String productName, + @Parameter(name = APIParamName.VERSION, required = true, description = APIParamValue.VERSION) @PathVariable(value = APIParamName.VERSION) String version, + @Parameter(name = APIParamName.LOCALE, required = true, description = APIParamValue.LOCALE) @PathVariable(value = APIParamName.LOCALE) String locale, + @Parameter(name = APIParamName.COMPONENT, required = true, description = APIParamValue.COMPONENT) @PathVariable(APIParamName.COMPONENT) String component, @RequestBody List sourceSet, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, HttpServletRequest request) throws ValidationException { logger.info("The parameters are: productName={}, version={}, component={}, locale={}", productName, version, component, locale); for (KeySourceCommentDTO sto : sourceSet) { diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationSourceAPI.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationSourceAPI.java index 067a08a5b..a15962273 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationSourceAPI.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/controller/TranslationSourceAPI.java @@ -1,10 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.source.controller; -import javax.servlet.http.HttpServletRequest; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,9 +36,6 @@ import com.vmware.vip.common.l10n.source.dto.StringSourceDTO; import com.vmware.vip.common.utils.KeyUtils; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import springfox.documentation.annotations.ApiIgnore; /** * Provide RESTful API for product to get translation by String base. @@ -52,8 +52,8 @@ public class TranslationSourceAPI { * source * */ - @ApiIgnore - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Hidden + @Operation(summary = APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = L10nI18nAPI.TRANSLATION_SOURCE_APIV1, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseBody @ResponseStatus(HttpStatus.OK) @@ -64,7 +64,7 @@ public SourceAPIResponseDTO postTranslationBySource( @RequestBody String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, @RequestParam(value = APIParamName.LOCALE, required = false) String locale, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, //@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required = false, defaultValue = "false") String pseudo, HttpServletRequest request) throws L10nAPIException { String key = KeyUtils.generateKey(component, null, source.toString()); @@ -95,7 +95,7 @@ public SourceAPIResponseDTO postTranslationBySource( * @return APIResponseDTO The object which represents response status. */ - @ApiOperation(value = APIOperation.SOURCE_TRANSLATION_POST_VALUE, notes = APIOperation.SOURCE_TRANSLATION_POST_NOTES) + @Operation(summary = APIOperation.SOURCE_TRANSLATION_POST_VALUE, description = APIOperation.SOURCE_TRANSLATION_POST_NOTES) @RequestMapping(value = L10nI18nAPI.TRANSLATION_SOURCE_APIV2, method = RequestMethod.POST, produces = { API.API_CHARSET }) @ResponseBody @ResponseStatus(HttpStatus.OK) @@ -106,7 +106,7 @@ public SourceAPIResponseDTO createSource ( @PathVariable(value = APIParamName.LOCALE) String locale, @RequestBody String source, @RequestParam(value = APIParamName.SOURCE_FORMAT, required = false) String sourceFormat, - @ApiParam(name = APIParamName.COLLECT_SOURCE, value = APIParamValue.COLLECT_SOURCE) + @Parameter(name = APIParamName.COLLECT_SOURCE, description = APIParamValue.COLLECT_SOURCE) @RequestParam(value = APIParamName.COLLECT_SOURCE, required = true, defaultValue = "true") String collectSource, //@ApiParam(name = APIParamName.PSEUDO, value = APIParamValue.PSEUDO) @RequestParam(value = APIParamName.PSEUDO, required=false, defaultValue="false") String pseudo, HttpServletRequest request) throws L10nAPIException { diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/dao/impl/S3SourceDaoImpl.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/dao/impl/S3SourceDaoImpl.java index 38c0d93c9..fee23c9ee 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/dao/impl/S3SourceDaoImpl.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/source/dao/impl/S3SourceDaoImpl.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/controller/TranslationSyncServerController.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/controller/TranslationSyncServerController.java index a8840314b..c9ca5c326 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/controller/TranslationSyncServerController.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/controller/TranslationSyncServerController.java @@ -1,26 +1,23 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.translation.controller; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; + import org.springframework.http.HttpStatus; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -35,7 +32,6 @@ import com.vmware.vip.api.rest.API; import com.vmware.vip.api.rest.APIParamName; import com.vmware.vip.api.rest.l10n.L10NAPIV1; -import com.vmware.vip.common.constants.ConstantsUnicode; import com.vmware.vip.common.constants.ValidationMsg; import com.vmware.vip.common.exceptions.ValidationException; import com.vmware.vip.common.i18n.dto.UpdateTranslationDTO; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dao/impl/S3SingleComponentDaoImpl.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dao/impl/S3SingleComponentDaoImpl.java index 1f7e130e1..4a1b985c0 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dao/impl/S3SingleComponentDaoImpl.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dao/impl/S3SingleComponentDaoImpl.java @@ -1,11 +1,11 @@ -//Copyright 2019-2022 VMware, Inc. +//Copyright 2019-2023 VMware, Inc. //SPDX-License-Identifier: EPL-2.0 package com.vmware.l10n.translation.dao.impl; import java.util.HashMap; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.json.simple.parser.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dto/ComponentMessagesDTO.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dto/ComponentMessagesDTO.java index 551a31963..7b0eff7e2 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dto/ComponentMessagesDTO.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/dto/ComponentMessagesDTO.java @@ -1,15 +1,16 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.translation.dto; import java.io.Serializable; -import javax.persistence.Entity; import com.vmware.vip.common.i18n.dto.SingleComponentDTO; +import javax.persistence.Entity; + /** * Data Object for Component */ diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/service/impl/TranslationSyncServerServiceImpl.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/service/impl/TranslationSyncServerServiceImpl.java index 8502e73ef..ce5bbe6a1 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/service/impl/TranslationSyncServerServiceImpl.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/translation/service/impl/TranslationSyncServerServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.translation.service.impl; @@ -9,11 +9,11 @@ import java.util.List; import java.util.Map; -import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -35,7 +35,7 @@ public class TranslationSyncServerServiceImpl implements TranslationSyncServerService { private static Logger LOGGER = LoggerFactory.getLogger(TranslationSyncServerServiceImpl.class); - @Resource + @Autowired private SingleComponentDao singleComponentDao; /** diff --git a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/utils/DiskQueueUtils.java b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/utils/DiskQueueUtils.java index 39c54e674..ce2892a38 100644 --- a/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/utils/DiskQueueUtils.java +++ b/g11n-ws/vip-manager-l10n/src/main/java/com/vmware/l10n/utils/DiskQueueUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.l10n.utils; @@ -135,7 +135,7 @@ public boolean accept(File dir, String name) { * @return * @throws IOException */ - public static Map getQueueFile2Obj(File file) throws IOException { + public static Map getQueueFile2Obj(File file) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); @SuppressWarnings("unchecked") diff --git a/g11n-ws/vip-manager-l10n/src/main/resources/application-bundle.properties b/g11n-ws/vip-manager-l10n/src/main/resources/application-bundle.properties index e895a281e..9fd916b45 100644 --- a/g11n-ws/vip-manager-l10n/src/main/resources/application-bundle.properties +++ b/g11n-ws/vip-manager-l10n/src/main/resources/application-bundle.properties @@ -62,8 +62,17 @@ csp.auth.refresh-interval-sec=30 allow.list.location=bundle.json #swagger3-ui switch -springfox.documentation.swagger-ui.enabled=true -spring.mvc.pathmatch.matching-strategy=ant_path_matcher +springdoc.packagesToScan=com.vmware.l10n.source.controller +#springdoc.api-docs.enabled=false +#springdoc.swagger-ui.enabled=false +springdoc.swagger-ui.path=/index.html + + + + + + + #request IDs print in log that defined by customer config.client.requestIds=csp-request-id \ No newline at end of file diff --git a/g11n-ws/vip-manager-lite-i18n/build.gradle b/g11n-ws/vip-manager-lite-i18n/build.gradle index 9f6893558..92f4ed5c4 100644 --- a/g11n-ws/vip-manager-lite-i18n/build.gradle +++ b/g11n-ws/vip-manager-lite-i18n/build.gradle @@ -3,14 +3,12 @@ apply plugin: 'java-library' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' -sourceCompatibility = 1.8 description = 'singleton lite manager' archivesBaseName = 'singleton-lite' configurations { bootJar - war providedRuntime // remove default logger all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' @@ -32,60 +30,44 @@ test { dependencies { if (project.hasProperty('datatype') && project.getProperty('datatype') == 'pgdb') { - api project(":md-data-api-pgimpl") + implementation project(":md-data-api-pgimpl") }else if (project.hasProperty('datatype') && project.getProperty('datatype') == 's3') { - api project(":md-data-api-s3impl") + implementation project(":md-data-api-s3impl") }else { - api project(":md-data-api-bundleimpl") + implementation project(":md-data-api-bundleimpl") } - api project(":vip-common") - api project(":md-restful-api-i18n") + implementation project(":vip-common") + implementation project(":md-restful-api-i18n") + implementation("org.apache.commons:commons-lang3:$commonsLangVersion") implementation("commons-io:commons-io:$commonsIoVersion") + implementation("commons-codec:commons-codec:$commonsCodecVersion") implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion"){ exclude group: 'junit' } - implementation("org.ehcache:ehcache:$ehCacheVersion") - implementation("javax.cache:cache-api:$cacheApiVersion") - - implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion") - compileOnly("com.google.guava:guava:$guavaVersion") - implementation("commons-codec:commons-codec:$commonsCodecVersion") - implementation("com.ibm.icu:icu4j:$icu4jVersion") - api group: 'org.webjars.bower', name: 'cldr-data', version: '28.0.1' + implementation('org.springframework.boot:spring-boot-starter-log4j2') + implementation("org.springframework.boot:spring-boot-starter-web") - api ("org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion") - api ("org.apache.tomcat:tomcat-annotations-api:$tomcatVersion") - api('org.springframework.boot:spring-boot-autoconfigure') - api ('org.springframework.boot:spring-boot-starter-log4j2'){ - exclude group: "org.apache.logging.log4j" + implementation("org.ehcache:ehcache:$ehCacheVersion") { + capabilities { + requireCapability('org.ehcache:ehcache-jakarta') + } } - implementation("org.springframework:spring-webmvc:$springWebVersion") + implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.3' - implementation("org.apache.logging.log4j:log4j-api:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-core:$log4j2Version") - implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version") - implementation("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") + implementation("com.google.guava:guava:$guavaVersion") + implementation("com.ibm.icu:icu4j:$icu4jVersion") implementation("org.yaml:snakeyaml:$snakeyam") implementation("org.hibernate.javax.persistence:hibernate-jpa-2.1-api:$hibernateJpa21Api") - implementation("org.apache.httpcomponents:httpclient:$httpclient") - + + implementation ('org.springframework.boot:spring-boot-starter-actuator') - //jdk 11 - runtimeOnly 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' - runtimeOnly 'javax.activation:activation:1.1.1' - runtimeOnly 'com.sun.xml.bind:jaxb-impl:3.0.2' - runtimeOnly 'com.sun.xml.bind:jaxb-core:3.0.2' - //end jdk 11 + testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("org.asciidoctor:asciidoctorj:2.5.10") - testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc") testImplementation("junit:junit:$junitVersion") + + } processResources { diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/LiteBootApplication.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/LiteBootApplication.java index 5e85f4c0e..796f7288a 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/LiteBootApplication.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/LiteBootApplication.java @@ -1,13 +1,11 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; @@ -15,12 +13,7 @@ @SpringBootApplication @EnableScheduling @ComponentScan(basePackages = { "com.vmware" }) -public class LiteBootApplication extends SpringBootServletInitializer { - @Override - protected SpringApplicationBuilder configure( - SpringApplicationBuilder application) { - return application.sources(LiteBootApplication.class); - } +public class LiteBootApplication { public static void main(String[] args) throws Exception { diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICacheControlInterceptor.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICacheControlInterceptor.java index 91caa438f..5a2c9e01d 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICacheControlInterceptor.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICacheControlInterceptor.java @@ -1,16 +1,15 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; -public class LiteAPICacheControlInterceptor extends HandlerInterceptorAdapter { +public class LiteAPICacheControlInterceptor implements HandlerInterceptor { private String cacheControlValue; diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICrossDomainInterceptor.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICrossDomainInterceptor.java index c6b5e1268..d119e93a7 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICrossDomainInterceptor.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPICrossDomainInterceptor.java @@ -1,17 +1,17 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.HandlerInterceptor; -public class LiteAPICrossDomainInterceptor extends HandlerInterceptorAdapter { +public class LiteAPICrossDomainInterceptor implements HandlerInterceptor { private Set allowOrigin; private String allowHeaders; diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPIValidationInterceptor.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPIValidationInterceptor.java index 336313932..054a4bbb2 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPIValidationInterceptor.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/Interceptor/LiteAPIValidationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.Interceptor; @@ -8,16 +8,15 @@ import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; +import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - import com.vmware.vip.api.rest.APIParamName; import com.vmware.vip.common.constants.ConstantsChar; import com.vmware.vip.common.constants.ConstantsKeys; @@ -28,7 +27,7 @@ /** * Interceptor for collection new resource */ -public class LiteAPIValidationInterceptor extends HandlerInterceptorAdapter { +public class LiteAPIValidationInterceptor implements HandlerInterceptor { private static Logger LOGGER = LoggerFactory.getLogger(LiteAPIValidationInterceptor.class); private String clientRequestIdsStr; @@ -340,7 +339,7 @@ private void validateScale(HttpServletRequest request) : request.getParameter(APIParamName.SCALE); try { if (!StringUtils.isEmpty(scale) - && new Integer(scale).intValue() < 0) { + && Integer.valueOf(scale).intValue() < 0) { throw new ValidationException(ValidationMsg.SCALE_NOT_VALIDE); } } catch (NumberFormatException e) { diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConfig.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConfig.java index 12a6ddbc9..b5fd2f465 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConfig.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConfig.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.conf; import org.apache.catalina.connector.Connector; import org.apache.coyote.http11.Http11NioProtocol; +import org.apache.tomcat.util.net.SSLHostConfig; +import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; @@ -21,10 +23,10 @@ @Configuration public class LiteTomcatConfig { - @Value("${config.gzip.enable}") + @Value("${config.gzip.enable:off}") private String compression; - @Value("${config.gzip.minsize}") + @Value("${config.gzip.minsize:2048}") private int compressionMinSize; @Bean @@ -48,11 +50,17 @@ private Connector initiateHttpsConnector(LiteServerProperties serverProperties) connector.setSecure(true); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setSSLEnabled(true); - protocol.setKeystoreFile(serverProperties.getHttpsKeyStore()); - protocol.setKeystorePass(serverProperties.getHttpsKeyStorePassword()); - protocol.setKeystoreType(serverProperties.getHttpsKeyStoreType()); - protocol.setKeyPass(serverProperties.getHttpsKeyPassword()); - protocol.setKeyAlias(serverProperties.getHttpsKeyAlias()); + + SSLHostConfig sslHostConfig = new SSLHostConfig(); + SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, SSLHostConfigCertificate.Type.RSA); + certificate.setCertificateKeystoreFile(serverProperties.getHttpsKeyStore()); + certificate.setCertificateKeystorePassword(serverProperties.getHttpsKeyStorePassword()); + certificate.setCertificateKeystoreType(serverProperties.getHttpsKeyStoreType()); + certificate.setCertificateKeyPassword(serverProperties.getHttpsKeyPassword()); + certificate.setCertificateKeyAlias(serverProperties.getHttpsKeyAlias()); + sslHostConfig.addCertificate(certificate); + protocol.addSslHostConfig(sslHostConfig); + protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); connector.setRedirectPort(ConstantsTomcat.REDIRECT_PORT); connector.setAllowTrace(serverProperties.isAllowTrace()); diff --git a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConnectionCustomizer.java b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConnectionCustomizer.java index 56a6365ee..dd163b7c0 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConnectionCustomizer.java +++ b/g11n-ws/vip-manager-lite-i18n/src/main/java/com/vmware/vip/core/conf/LiteTomcatConnectionCustomizer.java @@ -1,11 +1,13 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.core.conf; import org.apache.catalina.connector.Connector; import org.apache.coyote.http11.Http11NioProtocol; +import org.apache.tomcat.util.net.SSLHostConfig; +import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; @@ -38,8 +40,10 @@ public void customize(Connector connector) { this.serverProperties.getServerScheme().equalsIgnoreCase(ConstantsTomcat.HTTPS_HTTP)) { logger.info("the tomcat support http and https protocol"); connector.setPort(serverProperties.getHttpPort()); - connector.setAttribute("protocol", ConstantsTomcat.HTTP); - connector.setAttribute("redirectPort", ConstantsTomcat.REDIRECT_PORT); + + connector.setProperty("protocol", ConstantsTomcat.HTTP); + connector.setRedirectPort( ConstantsTomcat.REDIRECT_PORT); + connector.setAllowTrace(serverProperties.isAllowTrace()); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); @@ -48,8 +52,10 @@ public void customize(Connector connector) { } else if(serverProperties.getServerScheme().equalsIgnoreCase(ConstantsTomcat.HTTP)){ logger.info("the tomcat only support http protocol"); connector.setPort(serverProperties.getHttpPort()); - connector.setAttribute("protocol", ConstantsTomcat.HTTP); - connector.setAttribute("redirectPort", ConstantsTomcat.REDIRECT_PORT); + + connector.setProperty("protocol", ConstantsTomcat.HTTP); + connector.setRedirectPort( ConstantsTomcat.REDIRECT_PORT); + connector.setAllowTrace(serverProperties.isAllowTrace()); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); @@ -62,11 +68,17 @@ public void customize(Connector connector) { connector.setSecure(true); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setSSLEnabled(true); - protocol.setKeystoreFile(serverProperties.getHttpsKeyStore()); - protocol.setKeystorePass(serverProperties.getHttpsKeyStorePassword()); - protocol.setKeystoreType(serverProperties.getHttpsKeyStoreType()); - protocol.setKeyPass(serverProperties.getHttpsKeyPassword()); - protocol.setKeyAlias(serverProperties.getHttpsKeyAlias()); + + SSLHostConfig sslHostConfig = new SSLHostConfig(); + SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(); + certificate.setCertificateKeystoreFile(serverProperties.getHttpsKeyStore()); + certificate.setCertificateKeystorePassword(serverProperties.getHttpsKeyStorePassword()); + certificate.setCertificateKeystoreType(serverProperties.getHttpsKeyStoreType()); + certificate.setCertificateKeyPassword(serverProperties.getHttpsKeyPassword()); + certificate.setCertificateKeyAlias(serverProperties.getHttpsKeyAlias()); + sslHostConfig.addCertificate(certificate); + + protocol.addSslHostConfig(sslHostConfig); protocol.setMaxHttpHeaderSize(serverProperties.getMaxHttpHeaderSize()); connector.setRedirectPort(ConstantsTomcat.REDIRECT_PORT); connector.setAllowTrace(serverProperties.isAllowTrace()); diff --git a/g11n-ws/vip-manager-lite-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java b/g11n-ws/vip-manager-lite-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java index f11b50fd1..6b4b03aa6 100644 --- a/g11n-ws/vip-manager-lite-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java +++ b/g11n-ws/vip-manager-lite-i18n/src/test/java/com/vmware/vip/i18n/api/v1/common/RequestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 VMware, Inc. + * Copyright 2019-2023 VMware, Inc. * SPDX-License-Identifier: EPL-2.0 */ package com.vmware.vip.i18n.api.v1.common; @@ -8,8 +8,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders;