From 4b7cd5405dea9003f31af1aa9cd584d8ccf2141f Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Wed, 23 Aug 2023 09:54:43 +0200 Subject: Consistently use the preferences and history names in the bff code base - rename openapi clients (client-portal-prefs -> client-preferences, client-portal-history -> client-history, client-portal-keycloak -> client-keycloak) - rename related spring configurations (portal-prefs -> preferences, portal-history -> history) - rename related environment variables (PORTAL_PREFS_URL -> PREFERENCES_URL, PORTAL_HISTORY_URL -> HISTORY_URL) Note that the changes to the configurations and variables affect external services using it and the bff chart Issue-ID: PORTALNG-49 Change-Id: I434abdf130a5a81534c2387143b296122408d452 Signed-off-by: Fiete Ostkamp --- lib/build.gradle | 24 ++---- .../org/onap/portalng/bff/config/BffConfig.java | 5 +- .../portalng/bff/config/clients/HistoryConfig.java | 95 +++++++++++++++++++++ .../bff/config/clients/KeycloakConfig.java | 6 +- .../bff/config/clients/PortalHistoryConfig.java | 97 ---------------------- .../bff/config/clients/PortalPrefsConfig.java | 96 --------------------- .../bff/config/clients/PreferencesConfig.java | 96 +++++++++++++++++++++ .../onap/portalng/bff/mappers/ActionsMapper.java | 6 +- .../portalng/bff/mappers/CredentialMapper.java | 2 +- .../portalng/bff/mappers/PreferencesMapper.java | 6 +- .../org/onap/portalng/bff/mappers/RolesMapper.java | 2 +- .../org/onap/portalng/bff/mappers/UsersMapper.java | 4 +- .../onap/portalng/bff/services/ActionService.java | 16 ++-- .../portalng/bff/services/KeycloakService.java | 4 +- .../portalng/bff/services/PreferencesService.java | 18 ++-- .../java/org/onap/portalng/bff/utils/Logger.java | 4 +- 16 files changed, 235 insertions(+), 246 deletions(-) create mode 100644 lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java delete mode 100644 lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java delete mode 100644 lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java create mode 100644 lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java (limited to 'lib') diff --git a/lib/build.gradle b/lib/build.gradle index 76b1d42..e72062d 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' id 'io.spring.dependency-management' - id 'com.github.johnrengelman.shadow' // + id 'com.github.johnrengelman.shadow' id 'maven-publish' // publish lib jar to artifact repository id 'com.diffplug.spotless' // code formatting id 'com.github.spotbugs' // bug linting that can be picked up by IDE @@ -13,9 +13,9 @@ version rootProject.file('version').text.trim() dependencies { implementation project(':openapi:server') - implementation project(':openapi:client-portal-prefs') - implementation project(':openapi:client-portal-history') - implementation project(':openapi:client-portal-keycloak') + implementation project(':openapi:client-preferences') + implementation project(':openapi:client-history') + implementation project(':openapi:client-keycloak') implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-actuator' @@ -50,9 +50,9 @@ shadowJar { archiveBaseName.set('bff') dependencies { include(project(':openapi:server')) - include(project(':openapi:client-portal-history')) - include(project(':openapi:client-portal-prefs')) - include(project(':openapi:client-portal-keycloak')) + include(project(':openapi:client-history')) + include(project(':openapi:client-preferences')) + include(project(':openapi:client-keycloak')) } } @@ -69,17 +69,9 @@ publishing { } } } - // https://gitlab.devops.telekom.de/tnap/development/tesla-team/portal-community/bff/-/blob/pipeline/lib/build.gradle#L60 + repositories{ mavenCentral() - // maven { - // url "${maven_central_url}" - // credentials { - // username = "${artifactory_user}" - // password = "${artifactory_password}" - // } - // } - } } diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java index 7e773ed..5bc618c 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java @@ -42,9 +42,8 @@ import reactor.core.publisher.Mono; public class BffConfig { @NotBlank private final String realm; - @NotBlank private final String portalServiceUrl; - @NotBlank private final String portalPrefsUrl; - @NotBlank private final String portalHistoryUrl; + @NotBlank private final String preferencesUrl; + @NotBlank private final String historyUrl; @NotBlank private final String keycloakUrl; @NotNull private final Map> accessControl; diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java new file mode 100644 index 0000000..c7f8709 --- /dev/null +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java @@ -0,0 +1,95 @@ +/* + * + * Copyright (c) 2022. Deutsche Telekom AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * + * + */ + +package org.onap.portalng.bff.config.clients; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.function.Function; +import lombok.extern.slf4j.Slf4j; +import org.onap.portalng.bff.config.BeansConfig; +import org.onap.portalng.bff.config.BffConfig; +import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; +import org.onap.portalng.bff.openapi.client_history.ApiClient; +import org.onap.portalng.bff.openapi.client_history.api.ActionsApi; +import org.onap.portalng.bff.openapi.client_history.model.ProblemHistoryDto; +import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatusCode; +import org.springframework.web.reactive.function.client.ExchangeFilterFunction; +import org.springframework.web.reactive.function.client.WebClient; + +@Slf4j +@Configuration +public class HistoryConfig extends AbstractClientConfig { + private final ObjectMapper objectMapper; + private final BffConfig bffConfig; + private final ExchangeFilterFunction oauth2ExchangeFilterFunction; + + public HistoryConfig( + @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) + ExchangeFilterFunction oauth2ExchangeFilterFunction, + ObjectMapper objectMapper, + BffConfig bffConfig) { + super(ProblemHistoryDto.class); + this.objectMapper = objectMapper; + this.bffConfig = bffConfig; + this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; + } + + @Bean + public ActionsApi portalHistoryActionApi(WebClient.Builder webClientBuilder) { + return constructApiClient(webClientBuilder, ActionsApi::new); + } + + private T constructApiClient( + WebClient.Builder webClientBuilder, Function apiConstructor) { + final ApiClient apiClient = + new ApiClient( + getWebClient(webClientBuilder, List.of(oauth2ExchangeFilterFunction)), + objectMapper, + objectMapper.getDateFormat()); + final String generatedBasePath = apiClient.getBasePath(); + String basePath = ""; + try { + basePath = bffConfig.getHistoryUrl() + new URL(generatedBasePath).getPath(); + } catch (MalformedURLException e) { + log.error(e.getLocalizedMessage()); + } + return apiConstructor.apply(apiClient.setBasePath(basePath)); + } + + @Override + protected DownstreamApiProblemException mapException( + ProblemHistoryDto errorResponse, HttpStatusCode httpStatusCode) { + return DownstreamApiProblemException.builder() + .title(httpStatusCode.toString()) + .detail(errorResponse.getDetail()) + .downstreamMessageId(errorResponse.getType()) + .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY.toString()) + .downstreamStatus(httpStatusCode.value()) + .build(); + } +} diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java index 9880ef7..2ff3974 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java @@ -27,9 +27,9 @@ import java.util.function.Function; import org.onap.portalng.bff.config.BeansConfig; import org.onap.portalng.bff.config.BffConfig; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_keycloak.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_keycloak.api.KeycloakApi; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.ApiClient; +import org.onap.portalng.bff.openapi.client_keycloak.api.KeycloakApi; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java deleted file mode 100644 index e6904b1..0000000 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Copyright (c) 2022. Deutsche Telekom AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * - * - */ - -package org.onap.portalng.bff.config.clients; - -import com.fasterxml.jackson.databind.ObjectMapper; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import java.util.function.Function; -import lombok.extern.slf4j.Slf4j; -import org.onap.portalng.bff.config.BeansConfig; -import org.onap.portalng.bff.config.BffConfig; -import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_history.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_history.api.ActionsApi; -import org.onap.portalng.bff.openapi.client_portal_history.model.ProblemPortalHistoryDto; -import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatusCode; -import org.springframework.web.reactive.function.client.ExchangeFilterFunction; -import org.springframework.web.reactive.function.client.WebClient; - -@Slf4j -@Configuration -public class PortalHistoryConfig extends AbstractClientConfig { - private final ObjectMapper objectMapper; - private final BffConfig bffConfig; - private final ExchangeFilterFunction oauth2ExchangeFilterFunction; - - @Autowired - public PortalHistoryConfig( - @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) - ExchangeFilterFunction oauth2ExchangeFilterFunction, - ObjectMapper objectMapper, - BffConfig bffConfig) { - super(ProblemPortalHistoryDto.class); - this.objectMapper = objectMapper; - this.bffConfig = bffConfig; - this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; - } - - @Bean - public ActionsApi portalHistoryActionApi(WebClient.Builder webClientBuilder) { - return constructApiClient(webClientBuilder, ActionsApi::new); - } - - private T constructApiClient( - WebClient.Builder webClientBuilder, Function apiConstructor) { - final ApiClient apiClient = - new ApiClient( - getWebClient(webClientBuilder, List.of(oauth2ExchangeFilterFunction)), - objectMapper, - objectMapper.getDateFormat()); - final String generatedBasePath = apiClient.getBasePath(); - String basePath = ""; - try { - basePath = bffConfig.getPortalHistoryUrl() + new URL(generatedBasePath).getPath(); - } catch (MalformedURLException e) { - log.error(e.getLocalizedMessage()); - } - return apiConstructor.apply(apiClient.setBasePath(basePath)); - } - - @Override - protected DownstreamApiProblemException mapException( - ProblemPortalHistoryDto errorResponse, HttpStatusCode httpStatusCode) { - return DownstreamApiProblemException.builder() - .title(httpStatusCode.toString()) - .detail(errorResponse.getDetail()) - .downstreamMessageId(errorResponse.getType()) - .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY.toString()) - .downstreamStatus(httpStatusCode.value()) - .build(); - } -} diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java deleted file mode 100644 index 8c2eba4..0000000 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * - * Copyright (c) 2022. Deutsche Telekom AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * - * - */ - -package org.onap.portalng.bff.config.clients; - -import com.fasterxml.jackson.databind.ObjectMapper; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import java.util.function.Function; -import lombok.extern.slf4j.Slf4j; -import org.onap.portalng.bff.config.BeansConfig; -import org.onap.portalng.bff.config.BffConfig; -import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_prefs.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_prefs.api.PreferencesApi; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; -import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatusCode; -import org.springframework.web.reactive.function.client.ExchangeFilterFunction; -import org.springframework.web.reactive.function.client.WebClient; - -@Slf4j -@Configuration -public class PortalPrefsConfig extends AbstractClientConfig { - private final ObjectMapper objectMapper; - private final BffConfig bffConfig; - private final ExchangeFilterFunction oauth2ExchangeFilterFunction; - - public PortalPrefsConfig( - @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) - ExchangeFilterFunction oauth2ExchangeFilterFunction, - ObjectMapper objectMapper, - BffConfig bffConfig) { - super(ProblemPortalPrefsDto.class); - this.objectMapper = objectMapper; - this.bffConfig = bffConfig; - this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; - } - - @Bean - public PreferencesApi portalPrefsApi(WebClient.Builder webClientBuilder) { - return constructApiClient(webClientBuilder, PreferencesApi::new); - } - - private T constructApiClient( - WebClient.Builder webClientBuilder, Function apiConstructor) { - final ApiClient apiClient = - new ApiClient( - getWebClient(webClientBuilder, List.of(oauth2ExchangeFilterFunction)), - objectMapper, - objectMapper.getDateFormat()); - - final String generatedBasePath = apiClient.getBasePath(); - String basePath = ""; - try { - basePath = bffConfig.getPortalPrefsUrl() + new URL(generatedBasePath).getPath(); - } catch (MalformedURLException e) { - log.error(e.getLocalizedMessage()); - } - return apiConstructor.apply(apiClient.setBasePath(basePath)); - } - - @Override - protected DownstreamApiProblemException mapException( - ProblemPortalPrefsDto errorResponse, HttpStatusCode httpStatusCode) { - return DownstreamApiProblemException.builder() - .title(httpStatusCode.toString()) - .detail(errorResponse.getDetail()) - .downstreamMessageId(errorResponse.getType()) - .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS.toString()) - .downstreamStatus(httpStatusCode.value()) - .build(); - } -} diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java new file mode 100644 index 0000000..d94eae2 --- /dev/null +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java @@ -0,0 +1,96 @@ +/* + * + * Copyright (c) 2022. Deutsche Telekom AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * + * + */ + +package org.onap.portalng.bff.config.clients; + +import com.fasterxml.jackson.databind.ObjectMapper; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.function.Function; +import lombok.extern.slf4j.Slf4j; +import org.onap.portalng.bff.config.BeansConfig; +import org.onap.portalng.bff.config.BffConfig; +import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; +import org.onap.portalng.bff.openapi.client_preferences.ApiClient; +import org.onap.portalng.bff.openapi.client_preferences.api.PreferencesApi; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; +import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatusCode; +import org.springframework.web.reactive.function.client.ExchangeFilterFunction; +import org.springframework.web.reactive.function.client.WebClient; + +@Slf4j +@Configuration +public class PreferencesConfig extends AbstractClientConfig { + private final ObjectMapper objectMapper; + private final BffConfig bffConfig; + private final ExchangeFilterFunction oauth2ExchangeFilterFunction; + + public PreferencesConfig( + @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) + ExchangeFilterFunction oauth2ExchangeFilterFunction, + ObjectMapper objectMapper, + BffConfig bffConfig) { + super(ProblemPreferencesDto.class); + this.objectMapper = objectMapper; + this.bffConfig = bffConfig; + this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; + } + + @Bean + public PreferencesApi portalPrefsApi(WebClient.Builder webClientBuilder) { + return constructApiClient(webClientBuilder, PreferencesApi::new); + } + + private T constructApiClient( + WebClient.Builder webClientBuilder, Function apiConstructor) { + final ApiClient apiClient = + new ApiClient( + getWebClient(webClientBuilder, List.of(oauth2ExchangeFilterFunction)), + objectMapper, + objectMapper.getDateFormat()); + + final String generatedBasePath = apiClient.getBasePath(); + String basePath = ""; + try { + basePath = bffConfig.getPreferencesUrl() + new URL(generatedBasePath).getPath(); + } catch (MalformedURLException e) { + log.error(e.getLocalizedMessage()); + } + return apiConstructor.apply(apiClient.setBasePath(basePath)); + } + + @Override + protected DownstreamApiProblemException mapException( + ProblemPreferencesDto errorResponse, HttpStatusCode httpStatusCode) { + return DownstreamApiProblemException.builder() + .title(httpStatusCode.toString()) + .detail(errorResponse.getDetail()) + .downstreamMessageId(errorResponse.getType()) + .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PREFERENCES.toString()) + .downstreamStatus(httpStatusCode.value()) + .build(); + } +} diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java index 3f0ebdf..bc4f550 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java @@ -24,14 +24,14 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.springframework.core.convert.converter.Converter; @Mapper(config = MapperSpringConfig.class) public interface ActionsMapper - extends Converter { + extends Converter { @Mapping(source = "actionsList", target = "items") - ActionsListResponseApiDto convert(ActionsListResponsePortalHistoryDto source); + ActionsListResponseApiDto convert(ActionsListResponseHistoryDto source); } diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java index b3c7f05..6b05ae3 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.CredentialKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.CredentialKeycloakDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserPasswordRequestApiDto; @Mapper(config = MapperSpringConfig.class, unmappedTargetPolicy = ReportingPolicy.IGNORE) diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java index 6e615c3..13f9e3f 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java @@ -24,14 +24,14 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.springframework.core.convert.converter.Converter; @Mapper(config = MapperSpringConfig.class) public interface PreferencesMapper - extends Converter { + extends Converter { @Mapping(source = "properties", target = "properties") - PreferencesResponseApiDto convert(PreferencesPortalPrefsDto source); + PreferencesResponseApiDto convert(PreferencesPreferencesDto source); } diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java index 6e14d7e..ca3ee4c 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.springframework.core.convert.converter.Converter; diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java index f494c5d..78ba804 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java @@ -26,8 +26,8 @@ import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RequiredActionsKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RequiredActionsKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.CreateUserRequestApiDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserRequestApiDto; import org.onap.portalng.bff.openapi.server.model.UserResponseApiDto; diff --git a/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java b/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java index 17afa39..cb7b6b4 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java @@ -23,8 +23,8 @@ package org.onap.portalng.bff.services; import lombok.RequiredArgsConstructor; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_history.api.ActionsApi; -import org.onap.portalng.bff.openapi.client_portal_history.model.CreateActionRequestPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.api.ActionsApi; +import org.onap.portalng.bff.openapi.client_history.model.CreateActionRequestHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ActionsResponseApiDto; import org.onap.portalng.bff.openapi.server.model.CreateActionRequestApiDto; @@ -43,15 +43,15 @@ public class ActionService { public Mono createAction( String userId, String xRequestId, CreateActionRequestApiDto createActionRequestApiDto) { // First map from server API model to client API model - CreateActionRequestPortalHistoryDto createActionRequestPortalHistoryDto = - new CreateActionRequestPortalHistoryDto(); - createActionRequestPortalHistoryDto.setUserId(createActionRequestApiDto.getUserId()); - createActionRequestPortalHistoryDto.setAction(createActionRequestApiDto.getAction()); - createActionRequestPortalHistoryDto.setActionCreatedAt( + CreateActionRequestHistoryDto createActionRequestHistoryDto = + new CreateActionRequestHistoryDto(); + createActionRequestHistoryDto.setUserId(createActionRequestApiDto.getUserId()); + createActionRequestHistoryDto.setAction(createActionRequestApiDto.getAction()); + createActionRequestHistoryDto.setActionCreatedAt( createActionRequestApiDto.getActionCreatedAt()); return actionsApi - .createAction(userId, xRequestId, createActionRequestPortalHistoryDto) + .createAction(userId, xRequestId, createActionRequestHistoryDto) .map( action -> new ActionsResponseApiDto() diff --git a/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java b/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java index b902128..5780ad0 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java @@ -33,8 +33,8 @@ import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; import org.onap.portalng.bff.mappers.CredentialMapper; import org.onap.portalng.bff.mappers.RolesMapper; import org.onap.portalng.bff.mappers.UsersMapper; -import org.onap.portalng.bff.openapi.client_portal_keycloak.api.KeycloakApi; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RequiredActionsKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.api.KeycloakApi; +import org.onap.portalng.bff.openapi.client_keycloak.model.RequiredActionsKeycloakDto; import org.onap.portalng.bff.openapi.server.model.*; import org.onap.portalng.bff.utils.Logger; import org.springframework.core.convert.support.ConfigurableConversionService; diff --git a/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java b/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java index af62d28..53bceee 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java @@ -23,8 +23,8 @@ package org.onap.portalng.bff.services; import lombok.RequiredArgsConstructor; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_prefs.api.PreferencesApi; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.api.PreferencesApi; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.onap.portalng.bff.utils.Logger; @@ -36,17 +36,17 @@ import reactor.core.publisher.Mono; @Service public class PreferencesService { - private static final String PREFERENCES_APPLICATION_NAME = "PORTAL_PREFS"; + private static final String PREFERENCES_APPLICATION_NAME = "PREFERENCES"; private final PreferencesApi preferencesApi; private final ConfigurableConversionService conversionService; public Mono createPreferences( String xRequestId, CreatePreferencesRequestApiDto request) { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties(request.getProperties()); + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties(request.getProperties()); return preferencesApi - .savePreferences(xRequestId, preferencesPortalPrefsDto) + .savePreferences(xRequestId, preferencesPreferencesDto) .map(resp -> conversionService.convert(resp, PreferencesResponseApiDto.class)) .onErrorResume( DownstreamApiProblemException.class, @@ -59,10 +59,10 @@ public class PreferencesService { public Mono updatePreferences( String xRequestId, CreatePreferencesRequestApiDto request) { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties(request.getProperties()); + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties(request.getProperties()); return preferencesApi - .updatePreferences(xRequestId, preferencesPortalPrefsDto) + .updatePreferences(xRequestId, preferencesPreferencesDto) .map(resp -> conversionService.convert(resp, PreferencesResponseApiDto.class)) .onErrorResume( DownstreamApiProblemException.class, diff --git a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java index c20cd49..10d4833 100644 --- a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java +++ b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java @@ -35,8 +35,8 @@ public class Logger { */ private Logger() {} - public static void requestLog(String xRequestId, HttpMethod methode, URI path) { - log.info("bff - request - X-Request-Id {} {} {}", xRequestId, methode, path); + public static void requestLog(String xRequestId, HttpMethod method, URI path) { + log.info("bff - request - X-Request-Id {} {} {}", xRequestId, method, path); } public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) { -- cgit 1.2.3-korg