44
44
import no .nav .vedtak .sikkerhet .abac .BeskyttetRessurs ;
45
45
import no .nav .vedtak .sikkerhet .abac .TilpassetAbacAttributt ;
46
46
import no .nav .vedtak .sikkerhet .abac .beskyttet .ActionType ;
47
+ import no .nav .vedtak .sikkerhet .abac .beskyttet .ResourceType ;
47
48
48
49
@ OpenAPIDefinition (tags = @ Tag (name = "prosesstask" , description = "Håndtering av asynkrone oppgaver i form av prosesstask" ))
49
50
@ Path ("/prosesstask" )
53
54
public class ProsessTaskRestTjeneste {
54
55
55
56
private static final Logger LOG = LoggerFactory .getLogger (ProsessTaskRestTjeneste .class );
56
- private static final String ABAC_DRIFT_ATTRIBUTT = "abac.attributt.drift" ;
57
57
58
58
private ProsessTaskApplikasjonTjeneste prosessTaskApplikasjonTjeneste ;
59
59
@@ -73,7 +73,7 @@ public ProsessTaskRestTjeneste(ProsessTaskApplikasjonTjeneste prosessTaskApplika
73
73
@ ApiResponse (responseCode = "202" , description = "Prosesstaskens oppdatert informasjon" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ProsessTaskDataDto .class ))),
74
74
@ ApiResponse (responseCode = "500" , description = "Feilet pga ukjent feil eller tekniske/funksjonelle feil" )
75
75
})
76
- @ BeskyttetRessurs (actionType = ActionType .CREATE , property = ABAC_DRIFT_ATTRIBUTT )
76
+ @ BeskyttetRessurs (actionType = ActionType .CREATE , resourceType = ResourceType . DRIFT )
77
77
public ProsessTaskDataDto createProsessTask (@ Parameter (description = "Informasjon for restart en eksisterende prosesstask" ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid ProsessTaskOpprettInputDto inputDto ) {
78
78
// kjøres manuelt for å avhjelpe feilsituasjon, da er det veldig greit at det blir logget!
79
79
LOG .info ("Oppretter prossess task {}" , LoggerUtils .toStringWithoutLineBreaks (inputDto .getTaskType ()));
@@ -88,7 +88,7 @@ public ProsessTaskDataDto createProsessTask(@Parameter(description = "Informasjo
88
88
@ ApiResponse (responseCode = "200" , description = "Prosesstaskens oppdatert informasjon" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ProsessTaskRestartResultatDto .class ))),
89
89
@ ApiResponse (responseCode = "500" , description = "Feilet pga ukjent feil eller tekniske/funksjonelle feil" )
90
90
})
91
- @ BeskyttetRessurs (actionType = ActionType .CREATE , property = ABAC_DRIFT_ATTRIBUTT , sporingslogg = false )
91
+ @ BeskyttetRessurs (actionType = ActionType .CREATE , resourceType = ResourceType . DRIFT , sporingslogg = false )
92
92
public ProsessTaskRestartResultatDto restartProsessTask (@ Parameter (description = "Informasjon for restart en eksisterende prosesstask" ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid @ BeanParam ProsessTaskRestartInputDto restartInputDto ) {
93
93
// kjøres manuelt for å avhjelpe feilsituasjon, da er det veldig greit at det blir logget!
94
94
LOG .info ("Restarter prossess task {}" , restartInputDto .getProsessTaskId ());
@@ -102,7 +102,7 @@ public ProsessTaskRestartResultatDto restartProsessTask(@Parameter(description =
102
102
@ ApiResponse (responseCode = "200" , description = "Response med liste av prosesstasks som restartes" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ProsessTaskRetryAllResultatDto .class ))),
103
103
@ ApiResponse (responseCode = "500" , description = "Feilet pga ukjent feil eller tekniske/funksjonelle feil" )
104
104
})
105
- @ BeskyttetRessurs (actionType = ActionType .CREATE , property = ABAC_DRIFT_ATTRIBUTT , sporingslogg = false )
105
+ @ BeskyttetRessurs (actionType = ActionType .CREATE , resourceType = ResourceType . DRIFT , sporingslogg = false )
106
106
public ProsessTaskRetryAllResultatDto retryAllProsessTask () {
107
107
// kjøres manuelt for å avhjelpe feilsituasjon, da er det veldig greit at det blir logget!
108
108
LOG .info ("Restarter alle prossess task i status FEILET" );
@@ -115,7 +115,7 @@ public ProsessTaskRetryAllResultatDto retryAllProsessTask() {
115
115
@ Operation (description = "Lister prosesstasker med angitt status." , tags = "prosesstask" , responses = {
116
116
@ ApiResponse (responseCode = "200" , description = "Liste over prosesstasker, eller tom liste når angitt/default søkefilter ikke finner noen prosesstasker" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ProsessTaskDataDto .class )))
117
117
})
118
- @ BeskyttetRessurs (actionType = ActionType .READ , property = ABAC_DRIFT_ATTRIBUTT )
118
+ @ BeskyttetRessurs (actionType = ActionType .READ , resourceType = ResourceType . DRIFT )
119
119
public List <ProsessTaskDataDto > finnProsessTasks (@ Parameter (description = "Liste av statuser som skal hentes." ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid @ PathParam ("prosessTaskStatus" )
120
120
IkkeFerdigProsessTaskStatusEnum finnTaskStatus ) {
121
121
var status = Optional .ofNullable (mapToProsessTaskStatus (finnTaskStatus )).map (List ::of ).orElseGet (List ::of );
@@ -128,7 +128,7 @@ public List<ProsessTaskDataDto> finnProsessTasks(@Parameter(description = "Liste
128
128
@ Operation (description = "Søker etter prosesstask med angitt tekst i properties." , tags = "prosesstask" , responses = {
129
129
@ ApiResponse (responseCode = "200" , description = "Liste over prosesstasker, eller tom liste når angitt/default søkefilter ikke finner noen prosesstasker" , content = @ Content (mediaType = "application/json" , schema = @ Schema (implementation = ProsessTaskDataDto .class )))
130
130
})
131
- @ BeskyttetRessurs (actionType = ActionType .READ , property = ABAC_DRIFT_ATTRIBUTT )
131
+ @ BeskyttetRessurs (actionType = ActionType .READ , resourceType = ResourceType . DRIFT )
132
132
public List <ProsessTaskDataDto > searchProsessTasks (@ Parameter (description = "Søkefilter for å begrense resultatet av returnerte prosesstask." ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid SokeFilterDto sokeFilterDto ) {
133
133
return prosessTaskApplikasjonTjeneste .søk (sokeFilterDto );
134
134
}
@@ -141,7 +141,7 @@ public List<ProsessTaskDataDto> searchProsessTasks(@Parameter(description = "Sø
141
141
@ ApiResponse (responseCode = "404" , description = "Tom respons når angitt prosesstask-id ikke finnes" ),
142
142
@ ApiResponse (responseCode = "400" , description = "Feil input" )
143
143
})
144
- @ BeskyttetRessurs (actionType = ActionType .READ , property = ABAC_DRIFT_ATTRIBUTT )
144
+ @ BeskyttetRessurs (actionType = ActionType .READ , resourceType = ResourceType . DRIFT )
145
145
public Response finnFeiletProsessTask (@ NotNull @ Parameter (description = "Prosesstask-id for feilet prosesstask" ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid @ BeanParam ProsessTaskIdDto prosessTaskIdDto ) {
146
146
var resultat = prosessTaskApplikasjonTjeneste .finnFeiletProsessTask (prosessTaskIdDto .getProsessTaskId ());
147
147
if (resultat .isPresent ()) {
@@ -157,7 +157,7 @@ public Response finnFeiletProsessTask(@NotNull @Parameter(description = "Prosess
157
157
@ ApiResponse (responseCode = "200" , description = "Angitt prosesstask-id satt til status FERDIG" ),
158
158
@ ApiResponse (responseCode = "500" , description = "Feilet pga ukjent feil eller tekniske/funksjonelle feil" )
159
159
})
160
- @ BeskyttetRessurs (actionType = ActionType .CREATE , property = ABAC_DRIFT_ATTRIBUTT )
160
+ @ BeskyttetRessurs (actionType = ActionType .CREATE , resourceType = ResourceType . DRIFT )
161
161
public Response setFeiletProsessTaskFerdig (@ NotNull @ Parameter (description = "Prosesstask-id for feilet prosesstask" ) @ TilpassetAbacAttributt (supplierClass = AbacEmptySupplier .class ) @ Valid @ BeanParam ProsessTaskSetFerdigInputDto prosessTaskIdDto ) {
162
162
prosessTaskApplikasjonTjeneste .setProsessTaskFerdig (prosessTaskIdDto .getProsessTaskId (), mapToProsessTaskStatus (prosessTaskIdDto .getNaaVaaerendeStatus ()));
163
163
return Response .ok ().build ();
0 commit comments