-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/OBI-1160_reas…
…signment_feedback_chat
- Loading branch information
Showing
37 changed files
with
770 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
openapi: 3.0.1 | ||
|
||
info: | ||
title: Definition for Application Settings API | ||
description: This information will be replaced by the SpringFox config information | ||
version: 0.0.1 | ||
|
||
paths: | ||
/settings: | ||
get: | ||
tags: | ||
- applicationsettings-controller | ||
summary: 'Get all application settings' | ||
operationId: getApplicationSettings | ||
responses: | ||
200: | ||
description: OK - successful operation | ||
|
||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ApplicationSettingsDTO' | ||
204: | ||
description: NO CONTENT - no content found | ||
400: | ||
description: BAD REQUEST - invalid/incomplete request or body object | ||
401: | ||
description: UNAUTHORIZED - no/invalid Keycloak token | ||
500: | ||
description: INTERNAL SERVER ERROR - server encountered unexpected condition | ||
|
||
components: | ||
schemas: | ||
ApplicationSettingsDTO: | ||
type: object | ||
required: | ||
- multitenancyWithSingleDomainEnabled | ||
- multitenancyEnabled | ||
properties: | ||
multitenancyWithSingleDomainEnabled: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
multitenancyEnabled: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
useTenantService: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
enableWalkthrough: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
disableVideoAppointments: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
mainTenantSubdomainForSingleDomainMultitenancy: | ||
allOf: | ||
- $ref: '#/components/schemas/SettingDTO' | ||
budibaseSSO: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
useOverviewPage: | ||
allOf: | ||
- $ref: '#/components/schemas/FeatureToggleDTO' | ||
|
||
|
||
FeatureToggleDTO: | ||
type: object | ||
required: | ||
- value | ||
- readOnly | ||
properties: | ||
value: | ||
type: boolean | ||
example: true | ||
readOnly: | ||
type: boolean | ||
example: false | ||
SettingDTO: | ||
type: object | ||
required: | ||
- value | ||
- readOnly | ||
properties: | ||
value: | ||
type: string | ||
example: true | ||
readOnly: | ||
type: boolean | ||
example: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...in/java/de/caritas/cob/userservice/api/config/apiclient/ApplicationSettingsApiClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package de.caritas.cob.userservice.api.config.apiclient; | ||
|
||
import static java.util.Objects.isNull; | ||
import static java.util.Objects.nonNull; | ||
import static org.apache.commons.lang3.StringUtils.isEmpty; | ||
|
||
import de.caritas.cob.userservice.api.exception.httpresponses.InternalServerErrorException; | ||
import java.beans.IntrospectionException; | ||
import java.beans.Introspector; | ||
import java.beans.PropertyDescriptor; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import org.springframework.util.LinkedMultiValueMap; | ||
import org.springframework.util.MultiValueMap; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
/** Extension of the generated UserService API client to adapt the handling of parameter values. */ | ||
public class ApplicationSettingsApiClient | ||
extends de.caritas.cob.userservice.applicationsettingsservice.generated.ApiClient { | ||
|
||
private static final String FILTER_NAME = "filter"; | ||
|
||
public ApplicationSettingsApiClient(RestTemplate restTemplate) { | ||
super(restTemplate); | ||
} | ||
|
||
/** | ||
* Changes the behavior of mapping multiple parameter values to exclude null values for objects | ||
* which are not {@link Collection} for filter query params. | ||
* | ||
* @param collectionFormat The format to convert to | ||
* @param name The name of the parameter | ||
* @param value The parameter's value | ||
* @return a Map containing non-null String value(s) of the input parameter | ||
*/ | ||
@Override | ||
public MultiValueMap<String, String> parameterToMultiValueMap( | ||
CollectionFormat collectionFormat, String name, Object value) { | ||
|
||
if (noValidFilterParams(name, value)) { | ||
return super.parameterToMultiValueMap(collectionFormat, name, value); | ||
} | ||
|
||
return obtainQueryParameters(value); | ||
} | ||
|
||
private boolean noValidFilterParams(String queryName, Object queryValue) { | ||
return isEmpty(queryName) || !queryName.equals(FILTER_NAME) || isNull(queryValue); | ||
} | ||
|
||
private MultiValueMap<String, String> obtainQueryParameters(Object queryValue) { | ||
MultiValueMap<String, String> paramMap = new LinkedMultiValueMap<>(); | ||
|
||
try { | ||
Arrays.asList( | ||
Introspector.getBeanInfo(queryValue.getClass(), Object.class) | ||
.getPropertyDescriptors()) | ||
.stream() | ||
.filter(descriptor -> nonNull(descriptor.getReadMethod())) | ||
.forEach(descriptor -> setMethodKeyValuePairs(queryValue, paramMap, descriptor)); | ||
return paramMap; | ||
|
||
} catch (IntrospectionException exception) { | ||
throw new InternalServerErrorException( | ||
String.format("Could not obtain method properties of %s", queryValue.toString()), | ||
exception); | ||
} | ||
} | ||
|
||
private void setMethodKeyValuePairs( | ||
Object queryValue, MultiValueMap<String, String> map, PropertyDescriptor descriptor) { | ||
try { | ||
Object value = descriptor.getReadMethod().invoke(queryValue); | ||
if (nonNull(value)) { | ||
map.add(descriptor.getName(), value.toString()); | ||
} | ||
} catch (Exception exception) { | ||
throw new InternalServerErrorException( | ||
String.format("Could not obtain method key value pairs of %s", queryValue.toString()), | ||
exception); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...caritas/cob/userservice/api/config/apiclient/ApplicationSettingsApiControllerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package de.caritas.cob.userservice.api.config.apiclient; | ||
|
||
import de.caritas.cob.userservice.applicationsettingsservice.generated.web.ApplicationsettingsControllerApi; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@Component | ||
public class ApplicationSettingsApiControllerFactory { | ||
|
||
@Value("${consulting.type.service.api.url}") | ||
private String applicationsettingsServiceApiUrl; | ||
|
||
@Autowired private RestTemplate restTemplate; | ||
|
||
public ApplicationsettingsControllerApi createControllerApi() { | ||
var apiClient = | ||
new ApplicationSettingsApiClient(restTemplate) | ||
.setBasePath(this.applicationsettingsServiceApiUrl); | ||
return new ApplicationsettingsControllerApi(apiClient); | ||
} | ||
} |
Oops, something went wrong.