1
1
package life .qbic .projectmanagement .application .api ;
2
2
3
- import static life .qbic .logging .service .LoggerFactory .logger ;
4
- import static life .qbic .projectmanagement .application .authorization .ReactiveSecurityContextUtils .applySecurityContext ;
5
- import static life .qbic .projectmanagement .application .authorization .ReactiveSecurityContextUtils .writeSecurityContext ;
6
-
7
3
import java .util .Objects ;
8
4
import life .qbic .logging .api .Logger ;
9
5
import life .qbic .logging .service .LoggerFactory ;
10
6
import life .qbic .projectmanagement .application .ProjectInformationService ;
7
+ import static life .qbic .projectmanagement .application .authorization .ReactiveSecurityContextUtils .applySecurityContext ;
8
+ import static life .qbic .projectmanagement .application .authorization .ReactiveSecurityContextUtils .writeSecurityContext ;
11
9
import life .qbic .projectmanagement .application .sample .SampleIdCodeEntry ;
12
10
import life .qbic .projectmanagement .application .sample .SamplePreview ;
13
11
import life .qbic .projectmanagement .domain .model .project .ProjectId ;
33
31
@ Service
34
32
public class AsyncProjectServiceImpl implements AsyncProjectService {
35
33
34
+ private static final Logger log = LoggerFactory .logger (AsyncProjectServiceImpl .class );
36
35
private final ProjectInformationService projectService ;
37
36
private final Scheduler scheduler ;
38
- private static final Logger log = LoggerFactory .logger (AsyncProjectServiceImpl .class );
39
37
40
38
public AsyncProjectServiceImpl (@ Autowired ProjectInformationService projectService ,
41
39
@ Autowired Scheduler scheduler ) {
42
40
this .projectService = Objects .requireNonNull (projectService );
43
41
this .scheduler = Objects .requireNonNull (scheduler );
44
42
}
45
43
44
+ private static Retry defaultRetryStrategy () {
45
+ return Retry .maxInARow (5 )
46
+ .doBeforeRetry (retrySignal -> log .warn ("Operation failed (" + retrySignal + ")" ));
47
+ }
48
+
46
49
@ Override
47
50
public Mono <ProjectUpdateResponse > update (@ NonNull ProjectUpdateRequest request )
48
51
throws UnknownRequestException , RequestFailedException , AccessDeniedException {
@@ -67,31 +70,35 @@ public Mono<ProjectCreationResponse> create(ProjectCreationRequest request)
67
70
}
68
71
69
72
@ Override
70
- public Flux <SamplePreview > getSamplePreviews (String experimentId ) throws RequestFailedException {
73
+ public Flux <SamplePreview > getSamplePreviews (String projectId , String experimentId )
74
+ throws RequestFailedException {
71
75
throw new RuntimeException ("not implemented" );
72
76
}
73
77
74
78
@ Override
75
- public Flux <SamplePreview > getSamplePreviews (String experimentId , int offset , int limit ) {
79
+ public Flux <SamplePreview > getSamplePreviews (String projectId , String experimentId , int offset ,
80
+ int limit ) {
76
81
throw new RuntimeException ("not implemented" );
77
82
}
78
83
79
84
@ Override
80
- public Flux <Sample > getSamples (String experimentId ) throws RequestFailedException {
85
+ public Flux <Sample > getSamples (String projectId , String experimentId )
86
+ throws RequestFailedException {
81
87
throw new RuntimeException ("not implemented" );
82
88
}
83
89
84
90
@ Override
85
- public Flux <Sample > getSamplesForBatch (String batchId ) throws RequestFailedException {
91
+ public Flux <Sample > getSamplesForBatch (String projectId , String batchId )
92
+ throws RequestFailedException {
86
93
throw new RuntimeException ("not implemented" );
87
94
}
88
95
89
96
@ Override
90
- public Mono <SampleIdCodeEntry > findSampleId (String sampleCode ) throws RequestFailedException {
97
+ public Mono <SampleIdCodeEntry > findSampleId (String projectId , String sampleCode )
98
+ throws RequestFailedException {
91
99
throw new RuntimeException ("not implemented" );
92
100
}
93
101
94
-
95
102
@ Override
96
103
public Mono <ExperimentUpdateResponse > update (
97
104
ExperimentUpdateRequest request ) {
@@ -115,11 +122,6 @@ public Mono<ExperimentUpdateResponse> update(
115
122
.retryWhen (defaultRetryStrategy ());
116
123
}
117
124
118
- private static Retry defaultRetryStrategy () {
119
- return Retry .maxInARow (5 )
120
- .doBeforeRetry (retrySignal -> log .warn ("Operation failed (" + retrySignal + ")" ));
121
- }
122
-
123
125
private <T > Mono <T > unknownRequest () {
124
126
return Mono .error (() -> new UnknownRequestException ("Invalid request body" ));
125
127
}
@@ -145,7 +147,8 @@ private Mono<ExperimentUpdateResponse> updateExperimentalVariables(String projec
145
147
}
146
148
147
149
148
- private Mono <ProjectUpdateResponse > updateProjectDesign (String projectId , ProjectDesign design , String requestId ) {
150
+ private Mono <ProjectUpdateResponse > updateProjectDesign (String projectId , ProjectDesign design ,
151
+ String requestId ) {
149
152
return applySecurityContext (
150
153
Mono .<ProjectUpdateResponse >create (sink -> {
151
154
try {
0 commit comments