Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fjerne GET intrygd-grunnlag #1348

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions felles/util/src/main/java/no/nav/vedtak/konfig/Tid.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ private Tid() {
// hidden
}

public static LocalDate fomEllerBegynnelse(LocalDate fom) {
public static LocalDate fomEllerMin(LocalDate fom) {
return fom != null ? fom : TIDENES_BEGYNNELSE;
}

public static LocalDate tomEllerEndetid(LocalDate tom) {
public static LocalDate tomEllerMax(LocalDate tom) {
return tom != null ? tom : TIDENES_ENDE;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.ws.rs.core.UriBuilder;
import no.nav.vedtak.exception.TekniskException;
import no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag.v1.respons.Grunnlag;
import no.nav.vedtak.felles.integrasjon.rest.RestClient;
Expand All @@ -33,32 +29,6 @@ protected AbstractInfotrygdGrunnlag(RestClient client) {
this.restConfig = RestConfig.forClient(this.getClass());
}

@Override
public List<Grunnlag> hentGrunnlag(String fnr, LocalDate fom, LocalDate tom) {
try {
var path = UriBuilder.fromUri(restConfig.endpoint())
.queryParam("fnr", fnr)
.queryParam("fom", konverter(fom))
.queryParam("tom", konverter(tom))
.build();
return restClient.sendReturnList(RestRequest.newGET(path, restConfig), Grunnlag.class);
} catch (Exception e) {
throw new TekniskException("FP-180125",
String.format("Tjeneste %s gir feil, meld til #infotrygd_replikering hvis dette skjer gjennom lengre tidsperiode.",
restConfig.endpoint()), e);
}
}

@Override
public List<Grunnlag> hentGrunnlagFailSoft(String fnr, LocalDate fom, LocalDate tom) {
try {
return hentGrunnlag(fnr, fom, tom);
} catch (Exception e) {
LOG.warn("Feil ved oppslag mot {}, returnerer ingen grunnlag", restConfig.endpoint(), e);
return Collections.emptyList();
}
}

@Override
public List<Grunnlag> hentGrunnlag(GrunnlagRequest request) {
try {
Expand All @@ -82,17 +52,4 @@ public List<Grunnlag> hentGrunnlagFailSoft(GrunnlagRequest request) {
}
}

private static String konverter(LocalDate dato) {
var brukDato = Optional.ofNullable(dato).orElseGet(LocalDate::now);
return brukDato.format(DateTimeFormatter.ISO_LOCAL_DATE);
}

protected RestClient getRestClient() {
return restClient;
}

protected RestConfig getRestConfig() {
return restConfig;
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag;

import java.time.LocalDate;
import java.util.List;

import no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag.v1.respons.Grunnlag;

public interface InfotrygdGrunnlag {

/*
* Klassisk GET
*/
List<Grunnlag> hentGrunnlag(String fnr, LocalDate fom, LocalDate tom);

List<Grunnlag> hentGrunnlagFailSoft(String fnr, LocalDate fom, LocalDate tom);

/*
* POST
Expand Down