-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix/missing_azure_app_client
# Conflicts: # apps/sykemelding-api/src/main/resources/application-local.yml
- Loading branch information
Showing
43 changed files
with
1,526 additions
and
151 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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM ghcr.io/navikt/baseimages/temurin:21 | ||
LABEL maintainer="Team Dolly" | ||
|
||
ENV JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED" | ||
ADD /build/libs/app.jar /app/app.jar | ||
|
||
EXPOSE 8080 |
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
21 changes: 21 additions & 0 deletions
21
...sykemelding-api/src/main/java/no/nav/registre/testnorge/sykemelding/config/Consumers.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,21 @@ | ||
package no.nav.registre.testnorge.sykemelding.config; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import no.nav.testnav.libs.securitycore.domain.ServerProperties; | ||
|
||
import static lombok.AccessLevel.PACKAGE; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "consumers") | ||
@NoArgsConstructor(access = PACKAGE) | ||
@Getter | ||
@Setter(PACKAGE) | ||
public class Consumers { | ||
|
||
private ServerProperties sykemeldingProxy; | ||
} |
37 changes: 37 additions & 0 deletions
37
...ng-api/src/main/java/no/nav/registre/testnorge/sykemelding/config/MapperFacadeConfig.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,37 @@ | ||
package no.nav.registre.testnorge.sykemelding.config; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import ma.glasnost.orika.CustomConverter; | ||
import ma.glasnost.orika.MapperFacade; | ||
import ma.glasnost.orika.impl.DefaultMapperFactory; | ||
import no.nav.registre.testnorge.sykemelding.mapper.MappingStrategy; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.util.List; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class MapperFacadeConfig { | ||
|
||
@Bean | ||
MapperFacade mapperFacade(List<MappingStrategy> mappingStrategies, List<CustomConverter> customConverters) { | ||
DefaultMapperFactory mapperFactory = new DefaultMapperFactory.Builder().build(); | ||
|
||
if (nonNull(mappingStrategies)) { | ||
for (MappingStrategy mapper : mappingStrategies) { | ||
mapper.register(mapperFactory); | ||
} | ||
} | ||
|
||
if (nonNull(customConverters)) { | ||
for (CustomConverter converter : customConverters) { | ||
mapperFactory.getConverterFactory().registerConverter(converter); | ||
} | ||
} | ||
|
||
return mapperFactory.getMapperFacade(); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
...pi/src/main/java/no/nav/registre/testnorge/sykemelding/consumer/SyfosmreglerConsumer.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,34 @@ | ||
package no.nav.registre.testnorge.sykemelding.consumer; | ||
|
||
import no.nav.registre.testnorge.sykemelding.config.Consumers; | ||
import no.nav.registre.testnorge.sykemelding.consumer.command.SyfosmreglerPostValidateCommand; | ||
import no.nav.registre.testnorge.sykemelding.dto.ReceivedSykemeldingDTO; | ||
import no.nav.testnav.libs.dto.sykemelding.v1.ValidationResultDTO; | ||
import no.nav.testnav.libs.securitycore.domain.ServerProperties; | ||
import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Service | ||
public class SyfosmreglerConsumer { | ||
|
||
private final ServerProperties properties; | ||
private final TokenExchange tokenExchange; | ||
private final WebClient webClient; | ||
|
||
public SyfosmreglerConsumer(Consumers consumers, WebClient.Builder webClientBuilder, TokenExchange tokenExchange) { | ||
|
||
this.properties = consumers.getSykemeldingProxy(); | ||
this.tokenExchange = tokenExchange; | ||
this.webClient = webClientBuilder | ||
.baseUrl(properties.getUrl()) | ||
.build(); | ||
} | ||
|
||
public Mono<ValidationResultDTO> validate(ReceivedSykemeldingDTO sykemelding) { | ||
|
||
return tokenExchange.exchange(properties) | ||
.flatMap(token -> new SyfosmreglerPostValidateCommand(webClient, sykemelding, token.getTokenValue()).call()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
.../nav/registre/testnorge/sykemelding/consumer/command/SyfosmreglerPostValidateCommand.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,42 @@ | ||
package no.nav.registre.testnorge.sykemelding.consumer.command; | ||
|
||
import io.swagger.v3.core.util.Json; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import no.nav.registre.testnorge.sykemelding.dto.ReceivedSykemeldingDTO; | ||
import no.nav.testnav.libs.dto.sykemelding.v1.ValidationResultDTO; | ||
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class SyfosmreglerPostValidateCommand implements Callable<Mono<ValidationResultDTO>> { | ||
|
||
private static final String SYFOSMREGLER_VALIDATE_URL = "/v1/rules/validate"; | ||
|
||
private final WebClient webClient; | ||
private final ReceivedSykemeldingDTO receivedSykemelding; | ||
private final String accessToken; | ||
|
||
@Override | ||
public Mono<ValidationResultDTO> call() { | ||
|
||
log.info("Sender til syfosmregler {}", Json.pretty(receivedSykemelding)); | ||
|
||
return webClient.post() | ||
.uri(uriBuilder -> uriBuilder.path(SYFOSMREGLER_VALIDATE_URL).build()) | ||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken) | ||
.bodyValue(receivedSykemelding) | ||
.retrieve() | ||
.bodyToMono(ValidationResultDTO.class) | ||
.doOnError(WebClientFilter::logErrorMessage) | ||
.onErrorResume(error -> Mono.just(ValidationResultDTO.builder() | ||
.httpStatus(WebClientFilter.getStatus(error)) | ||
.message(WebClientFilter.getMessage(error)) | ||
.build())); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...ing-api/src/main/java/no/nav/registre/testnorge/sykemelding/domain/KontaktMedPasient.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,22 @@ | ||
package no.nav.registre.testnorge.sykemelding.domain; | ||
|
||
import no.nav.registre.testnorge.sykemelding.external.xmlstds.helseopplysningerarbeidsuforhet._2013_10_01.XMLHelseOpplysningerArbeidsuforhet; | ||
import no.nav.testnav.libs.dto.sykemelding.v1.KontaktMedPasientDTO; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
class KontaktMedPasient { | ||
|
||
private final XMLHelseOpplysningerArbeidsuforhet.KontaktMedPasient xmlKontaktMedPasient; | ||
|
||
KontaktMedPasient(KontaktMedPasientDTO dto) { | ||
|
||
xmlKontaktMedPasient = nonNull(dto) ? new XMLHelseOpplysningerArbeidsuforhet.KontaktMedPasient() | ||
.withKontaktDato(dto.getKontaktDato()) | ||
.withBegrunnIkkeKontakt(dto.getBegrunnelseIkkeKontakt()) : null; | ||
} | ||
|
||
XMLHelseOpplysningerArbeidsuforhet.KontaktMedPasient getXmlObject() { | ||
return xmlKontaktMedPasient; | ||
} | ||
} |
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
Oops, something went wrong.