diff --git a/src/main/kotlin/no/nav/klage/dokument/service/SmartDocumentService.kt b/src/main/kotlin/no/nav/klage/dokument/service/SmartDocumentService.kt index da7a1ef99..ae3a43e1d 100644 --- a/src/main/kotlin/no/nav/klage/dokument/service/SmartDocumentService.kt +++ b/src/main/kotlin/no/nav/klage/dokument/service/SmartDocumentService.kt @@ -2,7 +2,6 @@ package no.nav.klage.dokument.service import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper -import jakarta.transaction.Transactional import no.nav.klage.dokument.api.mapper.DokumentMapper import no.nav.klage.dokument.api.view.* import no.nav.klage.dokument.clients.kabalsmarteditorapi.model.request.CommentInput @@ -31,6 +30,7 @@ import no.nav.klage.oppgave.util.getSecureLogger import no.nav.klage.oppgave.util.ourJacksonObjectMapper import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional import java.time.LocalDateTime import java.util.* diff --git a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/CleanupAfterBehandlingEventListener.kt b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/CleanupAfterBehandlingEventListener.kt index bc3d05faa..921b34b82 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/CleanupAfterBehandlingEventListener.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/CleanupAfterBehandlingEventListener.kt @@ -17,7 +17,10 @@ import no.nav.klage.oppgave.util.getSecureLogger import org.springframework.beans.factory.annotation.Value import org.springframework.context.event.EventListener import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Propagation import org.springframework.transaction.annotation.Transactional +import org.springframework.transaction.event.TransactionPhase +import org.springframework.transaction.event.TransactionalEventListener import java.time.LocalDateTime import java.util.* @@ -50,6 +53,8 @@ class CleanupAfterBehandlingEventListener( } @EventListener + @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) + @Transactional(propagation = Propagation.REQUIRES_NEW) fun cleanupAfterBehandling(behandlingEndretEvent: BehandlingEndretEvent) { val behandling = behandlingEndretEvent.behandling diff --git a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/SendBehandlingEndretToKafkaEventListener.kt b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/SendBehandlingEndretToKafkaEventListener.kt index c77ce47f8..9298089dd 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/SendBehandlingEndretToKafkaEventListener.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/SendBehandlingEndretToKafkaEventListener.kt @@ -26,7 +26,6 @@ class SendBehandlingEndretToKafkaEventListener( val objectMapper: ObjectMapper = ourJacksonObjectMapper() } - /* This code needs a transaction b/c of lazy loading */ @EventListener @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) @Transactional(propagation = Propagation.REQUIRES_NEW) diff --git a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHEventListener.kt b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHEventListener.kt index 8ed4d9c2e..1421e7c26 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHEventListener.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHEventListener.kt @@ -1,6 +1,7 @@ package no.nav.klage.oppgave.eventlisteners import no.nav.klage.oppgave.domain.events.BehandlingEndretEvent +import no.nav.klage.oppgave.service.StatistikkTilDVHService import no.nav.klage.oppgave.util.getLogger import org.springframework.context.event.EventListener import org.springframework.stereotype.Service diff --git a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/UpdateGosysOppgaveEventListener.kt b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/UpdateGosysOppgaveEventListener.kt index 9878efacd..4c87fb315 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/UpdateGosysOppgaveEventListener.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/UpdateGosysOppgaveEventListener.kt @@ -3,7 +3,6 @@ package no.nav.klage.oppgave.eventlisteners import com.fasterxml.jackson.databind.ObjectMapper import no.nav.klage.oppgave.domain.events.BehandlingEndretEvent import no.nav.klage.oppgave.domain.klage.Felt -import no.nav.klage.oppgave.repositories.BehandlingRepository import no.nav.klage.oppgave.service.GosysOppgaveService import no.nav.klage.oppgave.util.getLogger import no.nav.klage.oppgave.util.ourJacksonObjectMapper @@ -17,7 +16,6 @@ import org.springframework.transaction.event.TransactionalEventListener @Service class UpdateGosysOppgaveEventListener( - private val behandlingRepository: BehandlingRepository, private val gosysOppgaveService: GosysOppgaveService, @Value("\${SYSTEMBRUKER_IDENT}") private val systembrukerIdent: String, ) { @@ -28,7 +26,6 @@ class UpdateGosysOppgaveEventListener( val objectMapper: ObjectMapper = ourJacksonObjectMapper() } - /* This code needs a transaction b/c of lazy loading */ @EventListener @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) @Transactional(propagation = Propagation.REQUIRES_NEW) diff --git a/src/main/kotlin/no/nav/klage/oppgave/service/AdminService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/AdminService.kt index 83a7c9450..6f7de7eb9 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/service/AdminService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/AdminService.kt @@ -26,8 +26,8 @@ import no.nav.klage.oppgave.domain.kafka.EventType import no.nav.klage.oppgave.domain.kafka.StatistikkTilDVH import no.nav.klage.oppgave.domain.kafka.UtsendingStatus import no.nav.klage.oppgave.domain.klage.* -import no.nav.klage.oppgave.eventlisteners.StatistikkTilDVHService.Companion.TR_ENHET import no.nav.klage.oppgave.repositories.* +import no.nav.klage.oppgave.service.StatistikkTilDVHService.Companion.TR_ENHET import no.nav.klage.oppgave.util.* import org.slf4j.Logger import org.springframework.beans.factory.annotation.Value diff --git a/src/main/kotlin/no/nav/klage/oppgave/service/AnkeITrygderettenbehandlingService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/AnkeITrygderettenbehandlingService.kt index d568a8bc1..dc69bf10c 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/service/AnkeITrygderettenbehandlingService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/AnkeITrygderettenbehandlingService.kt @@ -3,7 +3,6 @@ package no.nav.klage.oppgave.service import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import jakarta.transaction.Transactional import no.nav.klage.dokument.api.view.JournalfoertDokumentReference import no.nav.klage.kodeverk.hjemmel.Hjemmel import no.nav.klage.kodeverk.hjemmel.ytelseTilRegistreringshjemlerV2 @@ -21,6 +20,7 @@ import no.nav.klage.oppgave.util.getLogger import org.springframework.beans.factory.annotation.Value import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional import java.util.* @Service diff --git a/src/main/kotlin/no/nav/klage/oppgave/service/AnkebehandlingService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/AnkebehandlingService.kt index f9b1ddf78..246fc158b 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/service/AnkebehandlingService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/AnkebehandlingService.kt @@ -1,18 +1,17 @@ package no.nav.klage.oppgave.service -import jakarta.transaction.Transactional import no.nav.klage.dokument.api.view.JournalfoertDokumentReference import no.nav.klage.kodeverk.Type import no.nav.klage.oppgave.clients.kaka.KakaApiGateway import no.nav.klage.oppgave.domain.events.BehandlingEndretEvent import no.nav.klage.oppgave.domain.klage.* import no.nav.klage.oppgave.repositories.AnkebehandlingRepository -import no.nav.klage.oppgave.repositories.BehandlingEtterTrygderettenOpphevetRepository import no.nav.klage.oppgave.repositories.BehandlingRepository import no.nav.klage.oppgave.util.getLogger import org.springframework.beans.factory.annotation.Value import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional import java.time.LocalDate import java.time.Period import java.util.* @@ -21,14 +20,11 @@ import java.util.* @Transactional class AnkebehandlingService( private val ankebehandlingRepository: AnkebehandlingRepository, - private val behandlingEtterTrygderettenOpphevetRepository: BehandlingEtterTrygderettenOpphevetRepository, private val behandlingRepository: BehandlingRepository, private val kakaApiGateway: KakaApiGateway, private val dokumentService: DokumentService, private val behandlingService: BehandlingService, private val applicationEventPublisher: ApplicationEventPublisher, - @Value("#{T(java.time.LocalDate).parse('\${KAKA_VERSION_2_DATE}')}") - private val kakaVersion2Date: LocalDate, @Value("\${SYSTEMBRUKER_IDENT}") private val systembrukerIdent: String, ) { diff --git a/src/main/kotlin/no/nav/klage/oppgave/service/BehandlingEtterTrygderettenOpphevetService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/BehandlingEtterTrygderettenOpphevetService.kt index cb1e32550..9daacd481 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/service/BehandlingEtterTrygderettenOpphevetService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/BehandlingEtterTrygderettenOpphevetService.kt @@ -3,7 +3,6 @@ package no.nav.klage.oppgave.service import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import jakarta.transaction.Transactional import no.nav.klage.dokument.api.view.JournalfoertDokumentReference import no.nav.klage.kodeverk.Type import no.nav.klage.oppgave.clients.kaka.KakaApiGateway @@ -17,6 +16,7 @@ import no.nav.klage.oppgave.util.getLogger import org.springframework.beans.factory.annotation.Value import org.springframework.context.ApplicationEventPublisher import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional import java.time.LocalDate import java.time.LocalDateTime diff --git a/src/main/kotlin/no/nav/klage/oppgave/service/GosysOppgaveService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/GosysOppgaveService.kt index 0c146a2bc..140794a7b 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/service/GosysOppgaveService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/GosysOppgaveService.kt @@ -15,6 +15,7 @@ import no.nav.klage.oppgave.domain.kafka.GosysoppgaveEvent import no.nav.klage.oppgave.domain.kafka.InternalBehandlingEvent import no.nav.klage.oppgave.domain.kafka.InternalEventType import no.nav.klage.oppgave.domain.klage.Behandling +import no.nav.klage.oppgave.exceptions.GosysOppgaveClientException import no.nav.klage.oppgave.exceptions.GosysOppgaveNotEditableException import no.nav.klage.oppgave.exceptions.IllegalOperation import no.nav.klage.oppgave.util.getLogger @@ -282,7 +283,7 @@ class GosysOppgaveService( val mappeResponse = gosysOppgaveClient.getMappe(id = id, systemContext = systemContext) if (mappeResponse.id == null) { - throw OppgaveClientException("Mappe did not contain id") + throw GosysOppgaveClientException("Mappe did not contain id") } return GosysOppgaveMappeView( diff --git a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHService.kt b/src/main/kotlin/no/nav/klage/oppgave/service/StatistikkTilDVHService.kt similarity index 99% rename from src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHService.kt rename to src/main/kotlin/no/nav/klage/oppgave/service/StatistikkTilDVHService.kt index 7de6ca9f3..1d34f60a6 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHService.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/service/StatistikkTilDVHService.kt @@ -1,4 +1,4 @@ -package no.nav.klage.oppgave.eventlisteners +package no.nav.klage.oppgave.service import no.nav.klage.kodeverk.Fagsystem import no.nav.klage.kodeverk.PartIdType diff --git a/src/test/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHServiceTest.kt b/src/test/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHServiceTest.kt index a274e543b..307d5d659 100644 --- a/src/test/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHServiceTest.kt +++ b/src/test/kotlin/no/nav/klage/oppgave/eventlisteners/StatistikkTilDVHServiceTest.kt @@ -8,6 +8,7 @@ import no.nav.klage.kodeverk.Ytelse import no.nav.klage.oppgave.domain.events.BehandlingEndretEvent import no.nav.klage.oppgave.domain.klage.* import no.nav.klage.oppgave.repositories.KafkaEventRepository +import no.nav.klage.oppgave.service.StatistikkTilDVHService import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test