Skip to content

Commit

Permalink
Fiks kjøring igjen for behandling ved å fjerne proxis som ikke brukes… (
Browse files Browse the repository at this point in the history
#7129)

* Fiks kjøring igjen for behandling ved å fjerne proxis som ikke brukes og som var avhengig av fjernet config

* Slette begge proxix
  • Loading branch information
sebassonav authored Feb 25, 2025
1 parent 8a5cb9a commit e47e2f8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 443 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ import no.nav.etterlatte.funksjonsbrytere.FeatureToggleService
import no.nav.etterlatte.grunnlag.GrunnlagHenter
import no.nav.etterlatte.grunnlag.GrunnlagService
import no.nav.etterlatte.grunnlag.GrunnlagServiceImpl
import no.nav.etterlatte.grunnlag.IOpplysningDao
import no.nav.etterlatte.grunnlag.OpplysningDao
import no.nav.etterlatte.grunnlag.OpplysningDaoProxy
import no.nav.etterlatte.grunnlag.aldersovergang.AldersovergangDao
import no.nav.etterlatte.grunnlag.aldersovergang.AldersovergangDaoProxy
import no.nav.etterlatte.grunnlag.aldersovergang.IAldersovergangDao
import no.nav.etterlatte.grunnlagsendring.GrunnlagsendringsHendelseFilter
import no.nav.etterlatte.grunnlagsendring.GrunnlagsendringshendelseDao
import no.nav.etterlatte.grunnlagsendring.GrunnlagsendringshendelseService
Expand Down Expand Up @@ -311,9 +307,6 @@ internal class ApplicationContext(
config.getString("inntektskomponenten.url"),
), // TODO interface og stub osv...
val brukerService: BrukerService = BrukerServiceImpl(pdlTjenesterKlient, norg2Klient),
// TODO: slette disse
val aldersovergangDaoProxy: IAldersovergangDao? = AldersovergangDaoProxy(config, httpClient()),
val opplysningDaoProxy: IOpplysningDao? = OpplysningDaoProxy(config, httpClient()),
) {
val httpPort = env.getOrDefault(HTTP_PORT, "8080").toInt()
val saksbehandlerGroupIdsByKey = AzureGroup.entries.associateWith { env.requireEnvValue(it.envKey) }
Expand Down Expand Up @@ -374,20 +367,9 @@ internal class ApplicationContext(
val tilbakekrevingHendelserService = TilbakekrevingHendelserServiceImpl(rapid)
val oppgaveService = OppgaveService(oppgaveDaoEndringer, sakLesDao, hendelseDao, behandlingsHendelser)

val skalBrukeDaoProxy = false
val aldersovergangDao =
if (skalBrukeDaoProxy && aldersovergangDaoProxy != null) {
aldersovergangDaoProxy
} else {
AldersovergangDao(dataSource)
}
val aldersovergangDao = AldersovergangDao(dataSource)

val opplysningDao =
if (skalBrukeDaoProxy && opplysningDaoProxy != null) {
opplysningDaoProxy
} else {
OpplysningDao(dataSource)
}
val opplysningDao = OpplysningDao(dataSource)

val nyAldersovergangService =
no.nav.etterlatte.grunnlag.aldersovergang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ interface GrunnlagService {

class GrunnlagServiceImpl(
private val pdltjenesterKlient: PdlTjenesterKlient,
private val opplysningDao: IOpplysningDao,
private val opplysningDao: OpplysningDao,
private val grunnlagHenter: GrunnlagHenter,
) : GrunnlagService {
private val logger = LoggerFactory.getLogger(this::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,9 @@ import java.time.YearMonth
import java.util.UUID
import javax.sql.DataSource

// TODO: Dette kan fjernes så fort grunnlag er migrert over til behandling
interface IOpplysningDao {
fun finnesGrunnlagForSak(sakId: SakId): Boolean

fun hentAlleGrunnlagForSak(sakId: SakId): List<GrunnlagHendelse>

fun hentAlleGrunnlagForBehandling(behandlingId: UUID): List<GrunnlagHendelse>

fun hentGrunnlagAvTypeForBehandling(
behandlingId: UUID,
vararg typer: Opplysningstype,
): List<GrunnlagHendelse>

fun finnHendelserIGrunnlag(sakId: SakId): List<GrunnlagHendelse>

fun finnNyesteGrunnlagForSak(
sakId: SakId,
opplysningType: Opplysningstype,
): GrunnlagHendelse?

fun finnNyesteGrunnlagForBehandling(
behandlingId: UUID,
opplysningType: Opplysningstype,
): GrunnlagHendelse?

fun leggOpplysningTilGrunnlag(
sakId: SakId,
behandlingsopplysning: Grunnlagsopplysning<JsonNode>,
fnr: Folkeregisteridentifikator? = null,
): Long

fun oppdaterVersjonForBehandling(
behandlingId: UUID,
sakId: SakId,
hendelsenummer: Long,
): Int

fun laasGrunnlagVersjonForBehandling(behandlingId: UUID): Int

fun finnAllePersongalleriHvorPersonFinnes(fnr: Folkeregisteridentifikator): List<GrunnlagHendelse>

fun finnAlleSakerForPerson(fnr: Folkeregisteridentifikator): Set<SakId>

fun hentBehandlingVersjon(behandlingId: UUID): BehandlingGrunnlagVersjon?
}

class OpplysningDao(
private val datasource: DataSource,
) : IOpplysningDao {
) {
private val connection get() = datasource.connection

data class GrunnlagHendelse(
Expand Down Expand Up @@ -102,7 +56,7 @@ class OpplysningDao(
hendelseNummer = getLong("hendelsenummer"),
)

override fun finnesGrunnlagForSak(sakId: SakId): Boolean =
fun finnesGrunnlagForSak(sakId: SakId): Boolean =
connection.use {
it
.prepareStatement("SELECT EXISTS(SELECT 1 FROM grunnlagshendelse WHERE sak_id = ?)")
Expand All @@ -111,7 +65,7 @@ class OpplysningDao(
.single { getBoolean(1) }
}

override fun hentAlleGrunnlagForSak(sakId: SakId): List<GrunnlagHendelse> =
fun hentAlleGrunnlagForSak(sakId: SakId): List<GrunnlagHendelse> =
connection.use {
it
.prepareStatement(
Expand All @@ -126,7 +80,7 @@ class OpplysningDao(
.toList { asGrunnlagshendelse() }
}

override fun hentAlleGrunnlagForBehandling(behandlingId: UUID): List<GrunnlagHendelse> =
fun hentAlleGrunnlagForBehandling(behandlingId: UUID): List<GrunnlagHendelse> =
connection.use {
it
.prepareStatement(
Expand All @@ -143,7 +97,7 @@ class OpplysningDao(
.toList { asGrunnlagshendelse() }
}

override fun hentGrunnlagAvTypeForBehandling(
fun hentGrunnlagAvTypeForBehandling(
behandlingId: UUID,
vararg typer: Opplysningstype,
): List<GrunnlagHendelse> =
Expand All @@ -166,7 +120,7 @@ class OpplysningDao(
.toList { asGrunnlagshendelse() }
}

override fun finnHendelserIGrunnlag(sakId: SakId): List<GrunnlagHendelse> =
fun finnHendelserIGrunnlag(sakId: SakId): List<GrunnlagHendelse> =
connection.use {
it
.prepareStatement(
Expand All @@ -187,7 +141,7 @@ class OpplysningDao(
.toList { asGrunnlagshendelse() }
}

override fun finnNyesteGrunnlagForSak(
fun finnNyesteGrunnlagForSak(
sakId: SakId,
opplysningType: Opplysningstype,
): GrunnlagHendelse? =
Expand All @@ -213,7 +167,7 @@ class OpplysningDao(
.singleOrNull { asGrunnlagshendelse() }
}

override fun finnNyesteGrunnlagForBehandling(
fun finnNyesteGrunnlagForBehandling(
behandlingId: UUID,
opplysningType: Opplysningstype,
): GrunnlagHendelse? =
Expand All @@ -237,10 +191,10 @@ class OpplysningDao(
.firstOrNull { asGrunnlagshendelse() }
}

override fun leggOpplysningTilGrunnlag(
fun leggOpplysningTilGrunnlag(
sakId: SakId,
behandlingsopplysning: Grunnlagsopplysning<JsonNode>,
fnr: Folkeregisteridentifikator?,
fnr: Folkeregisteridentifikator? = null,
): Long =
connection.use {
it
Expand All @@ -263,7 +217,7 @@ class OpplysningDao(
.getLong("hendelsenummer")
}

override fun oppdaterVersjonForBehandling(
fun oppdaterVersjonForBehandling(
behandlingId: UUID,
sakId: SakId,
hendelsenummer: Long,
Expand All @@ -286,15 +240,15 @@ class OpplysningDao(
}
}

override fun laasGrunnlagVersjonForBehandling(behandlingId: UUID) =
fun laasGrunnlagVersjonForBehandling(behandlingId: UUID) =
connection.use {
it
.prepareStatement("UPDATE behandling_versjon SET laast = true WHERE behandling_id = ?::UUID")
.apply { setObject(1, behandlingId) }
.executeUpdate()
}

override fun finnAllePersongalleriHvorPersonFinnes(fnr: Folkeregisteridentifikator): List<GrunnlagHendelse> =
fun finnAllePersongalleriHvorPersonFinnes(fnr: Folkeregisteridentifikator): List<GrunnlagHendelse> =
connection.use {
it
.prepareStatement(
Expand All @@ -310,7 +264,7 @@ class OpplysningDao(
.toList { asGrunnlagshendelse() }
}

override fun finnAlleSakerForPerson(fnr: Folkeregisteridentifikator): Set<SakId> =
fun finnAlleSakerForPerson(fnr: Folkeregisteridentifikator): Set<SakId> =
connection.use {
it
.prepareStatement(
Expand All @@ -328,7 +282,7 @@ class OpplysningDao(
.toSet()
}

override fun hentBehandlingVersjon(behandlingId: UUID): BehandlingGrunnlagVersjon? =
fun hentBehandlingVersjon(behandlingId: UUID): BehandlingGrunnlagVersjon? =
connection.use {
it
.prepareStatement("SELECT * FROM behandling_versjon WHERE behandling_id = ?::UUID")
Expand Down
Loading

0 comments on commit e47e2f8

Please sign in to comment.