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

Refactor/depricated methods and code clean up #710

Merged
merged 17 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
allowGetAndOptions(http,
"/settings/**",
"/codelist/**",

"/krav/**",
"/kravprioritering/**",
"/etterlevelse/**",
Expand All @@ -82,13 +81,11 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
"/settings/**",
"/codelist/**",
"/export/codelist/**",
"/etterlevelse/update/behandlingid/**",
"/etterlevelsearkiv/status/arkivert",
"/etterlevelsearkiv/admin/update"
);

http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/krav/**")).hasAnyRole(AppRole.KRAVEIER.name(), AppRole.ADMIN.name()));

http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/tilbakemelding/**")).hasAnyRole(AppRole.WRITE.name(), AppRole.ADMIN.name(), AppRole.KRAVEIER.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/tilbakemelding/status/**")).hasAnyRole(AppRole.ADMIN.name(), AppRole.KRAVEIER.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/export/**")).hasAnyRole(AppRole.WRITE.name(), AppRole.ADMIN.name(), AppRole.KRAVEIER.name()));
Expand All @@ -99,7 +96,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/etterlevelsemetadata/**")).hasAnyRole(AppRole.ADMIN.name(), AppRole.WRITE.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/melding/**")).hasAnyRole(AppRole.ADMIN.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/etterlevelsearkiv/**")).hasAnyRole(AppRole.WRITE.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/etterlevelse/update/behandlingid/**")).hasAnyRole(AppRole.ADMIN.name()));
http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/virkemiddel/**")).hasAnyRole(AppRole.KRAVEIER.name(), AppRole.ADMIN.name()));

http.authorizeHttpRequests(auth -> auth.requestMatchers(antMatcher("/logout")).authenticated());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import no.nav.data.common.utils.JsonUtils;
import no.nav.data.common.utils.StreamUtils;
import no.nav.data.etterlevelse.arkivering.domain.EtterlevelseArkiv;
import no.nav.data.etterlevelse.behandling.domain.BehandlingData;
import no.nav.data.etterlevelse.etterlevelse.domain.Etterlevelse;
import no.nav.data.etterlevelse.etterlevelseDokumentasjon.domain.EtterlevelseDokumentasjon;
import no.nav.data.etterlevelse.etterlevelsemetadata.domain.EtterlevelseMetadata;
Expand Down Expand Up @@ -116,10 +115,6 @@ public Etterlevelse toEtterlevelse() {
return getDomainObjectData(Etterlevelse.class);
}

public BehandlingData toBehandlingData() {
return getDomainObjectData(BehandlingData.class);
}

public EtterlevelseMetadata toEtterlevelseMetadata() {
return getDomainObjectData(EtterlevelseMetadata.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import no.nav.data.common.security.azure.support.MailLog;
import no.nav.data.common.validator.RequestElement;
import no.nav.data.etterlevelse.arkivering.domain.EtterlevelseArkiv;
import no.nav.data.etterlevelse.behandling.domain.BehandlingData;
import no.nav.data.etterlevelse.etterlevelse.domain.Etterlevelse;
import no.nav.data.etterlevelse.etterlevelseDokumentasjon.domain.EtterlevelseDokumentasjon;
import no.nav.data.etterlevelse.etterlevelsemetadata.domain.EtterlevelseMetadata;
Expand All @@ -31,7 +30,6 @@ public final class TypeRegistration {
addDomainClass(Krav.class, true);
addDomainClass(KravPrioritering.class, true);
addDomainClass(Etterlevelse.class, true);
addDomainClass(BehandlingData.class, true);
addDomainClass(EtterlevelseMetadata.class, true);
addDomainClass(Melding.class, true);
addDomainClass(EtterlevelseArkiv.class, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import no.nav.data.etterlevelse.arkivering.dto.ArkiverRequest;
import no.nav.data.etterlevelse.arkivering.dto.EtterlevelseArkivRequest;
import no.nav.data.etterlevelse.arkivering.dto.EtterlevelseArkivResponse;
import no.nav.data.etterlevelse.behandling.BehandlingService;
import no.nav.data.etterlevelse.etterlevelse.EtterlevelseService;
import no.nav.data.etterlevelse.etterlevelse.domain.Etterlevelse;
import no.nav.data.etterlevelse.etterlevelseDokumentasjon.EtterlevelseDokumentasjonService;
Expand Down Expand Up @@ -55,8 +54,6 @@ public class EtterlevelseArkivController {

private final EtterlevelseDokumentasjonService etterlevelseDokumentasjonService;

private final BehandlingService behandlingService;

@Operation(summary = "Get all etterlevelsearkiv")
@ApiResponse(description = "Ok")
@GetMapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,6 @@ public List<EtterlevelseArkiv> setStatusToArkivert() {
return arkivert;
}

/*
TODO review before deleting
public List<EtterlevelseArkiv> updateArkiveringDato(String status, String arkiveringDato) {
return GenericStorage.to(repo.updateArkiveringDato(status, arkiveringDato), EtterlevelseArkiv.class);
}
*/

public List<EtterlevelseArkiv> setStatusToBehandler_arkivering() {
List<EtterlevelseArkiv> tilArkivering = getByStatus(EtterlevelseArkivStatus.TIL_ARKIVERING.name());
List<EtterlevelseArkiv> behandlerArkivering = new ArrayList<>();
Expand All @@ -203,11 +196,10 @@ public List<EtterlevelseArkiv> setStatusToBehandler_arkivering() {
return behandlerArkivering;
}

public List<EtterlevelseArkiv> setStatusWithEtterlevelseDokumentasjonId(EtterlevelseArkivStatus newStatus, String etterlevelseDokumentasjonId) {
public void setStatusWithEtterlevelseDokumentasjonId(EtterlevelseArkivStatus newStatus, String etterlevelseDokumentasjonId) {
List<EtterlevelseArkiv> arkiveringTilNyStatus = getByEtterlevelseDokumentasjon(etterlevelseDokumentasjonId);
List<EtterlevelseArkiv> oppdatertArkivering = new ArrayList<>();
arkiveringTilNyStatus.forEach(e -> {
EtterlevelseArkiv etterlevelseArkiv = save(EtterlevelseArkivRequest.builder()
arkiveringTilNyStatus.forEach(e ->
save(EtterlevelseArkivRequest.builder()
.id(e.getId().toString())
.behandlingId(e.getBehandlingId())
.etterlevelseDokumentasjonId(e.getEtterlevelseDokumentasjonId())
Expand All @@ -217,11 +209,8 @@ public List<EtterlevelseArkiv> setStatusWithEtterlevelseDokumentasjonId(Etterlev
.arkiveringAvbruttDato(e.getArkiveringAvbruttDato())
.webSakNummer(e.getWebSakNummer())
.update(true)
.build());
oppdatertArkivering.add(etterlevelseArkiv);
});

return oppdatertArkivering;
.build())
);
}

public EtterlevelseArkiv save(EtterlevelseArkivRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@ public interface EtterlevelseArkivRepo extends JpaRepository<GenericStorage, UUI
@Query(value = "select * from generic_storage where data ->> 'etterlevelseDokumentasjonId' = ?1 and type = 'EtterlevelseArkiv'", nativeQuery = true)
List<GenericStorage> findByEtterlevelseDokumentsjonId(String behandlingId);

/*
TODO review this code if newer one is better
@Modifying(clearAutomatically = true)
@Transactional
@Query(value = "update generic_storage set DATA = jsonb_set(DATA, '{status}', to_jsonb(?2) , false ) where data -> 'status' = to_jsonb(?1) and type = 'EtterlevelseArkiv' returning *", nativeQuery = true)
List<GenericStorage> updateStatus(String oldStatus, String newStatus);

@Modifying(clearAutomatically = true)
@Transactional
@Query(value = "update generic_storage set DATA = jsonb_set(DATA, '{status}', to_jsonb(?1) , false ) where data ->> 'etterlevelseDokumentasjonId' = ?2 and type = 'EtterlevelseArkiv' returning *", nativeQuery = true)
List<GenericStorage> updateStatusWithEtterlevelseDokumentasjonId(String newStatus, String behandlingsId);

*/

@Modifying(clearAutomatically = true)
@Transactional
@Query(value = "update generic_storage set DATA = jsonb_set(DATA, '{arkiveringDato}', to_jsonb(?2) , false ) where data -> 'status' = to_jsonb(?1) and type = 'EtterlevelseArkiv' returning *", nativeQuery = true)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading