2
2
3
3
import static java .util .Objects .nonNull ;
4
4
5
+ import java .util .List ;
5
6
import java .util .Optional ;
7
+ import java .util .Set ;
6
8
import java .util .UUID ;
9
+ import life .qbic .projectmanagement .application .confounding .ConfoundingVariableService .ConfoundingVariableInformation ;
7
10
import reactor .core .publisher .Mono ;
8
11
9
12
/**
@@ -29,10 +32,10 @@ public interface AsyncProjectService {
29
32
* The method is non-blocking.
30
33
* <p>
31
34
* The implementing class must ensure to be able to process all implementing classes of the
32
- * {@link UpdateRequestBody } interface contained in the request.
35
+ * {@link ProjectUpdateRequestBody } interface contained in the request.
33
36
* <p>
34
37
* The implementing class must also ensure to only return responses with classes implementing the
35
- * {@link UpdateResponseBody } interface.
38
+ * {@link ProjectUpdateResponseBody } interface.
36
39
*
37
40
* @param request the request to update a project
38
41
* @return a {@link Mono<ProjectUpdateResponse>} object publishing an
@@ -47,6 +50,31 @@ Mono<ProjectUpdateResponse> update(
47
50
throws UnknownRequestException , RequestFailedException , AccessDeniedException ;
48
51
49
52
53
+ /**
54
+ * Submits an experiment update request and returns a reactive
55
+ * {@link Mono< ExperimentUpdateResponse >} object immediately.
56
+ * <p>
57
+ * The method is non-blocking.
58
+ * <p>
59
+ * The implementing class must ensure to be able to process all implementing classes of the
60
+ * {@link ProjectUpdateRequestBody} interface contained in the request.
61
+ * <p>
62
+ * The implementing class must also ensure to only return responses with classes implementing the
63
+ * {@link ProjectUpdateResponseBody} interface.
64
+ *
65
+ * @param request the request to update a project
66
+ * @return a {@link Mono<ProjectUpdateResponse>} object publishing an
67
+ * {@link ProjectUpdateResponse} on success.
68
+ * @throws UnknownRequestException if an unknown request has been used in the service call
69
+ * @throws RequestFailedException if the request was not successfully executed
70
+ * @throws AccessDeniedException if the user has insufficient rights
71
+ * @since 1.9.0
72
+ */
73
+ Mono <ExperimentUpdateResponse > update (ExperimentUpdateRequest request )
74
+ throws RequestFailedException , AccessDeniedException ;
75
+
76
+
77
+
50
78
Mono <ProjectCreationResponse > create (ProjectCreationRequest request )
51
79
throws UnknownRequestException , RequestFailedException , AccessDeniedException ;
52
80
@@ -57,7 +85,8 @@ Mono<ProjectCreationResponse> create(ProjectCreationRequest request)
57
85
*
58
86
* @since 1.9.0
59
87
*/
60
- sealed interface UpdateRequestBody permits FundingInformation , ProjectContacts , ProjectDesign {
88
+ sealed interface ProjectUpdateRequestBody permits FundingInformation , ProjectContacts ,
89
+ ProjectDesign {
61
90
62
91
}
63
92
@@ -67,17 +96,29 @@ sealed interface UpdateRequestBody permits FundingInformation, ProjectContacts,
67
96
*
68
97
* @since 1.9.0
69
98
*/
70
- sealed interface UpdateResponseBody permits FundingInformation , ProjectContacts , ProjectDesign {
99
+ sealed interface ProjectUpdateResponseBody permits FundingInformation , ProjectContacts ,
100
+ ProjectDesign {
101
+
102
+ }
103
+
104
+ sealed interface ExperimentUpdateRequestBody permits ConfoundingVariables , ExperimentDescription ,
105
+ ExperimentalVariables {
71
106
72
107
}
73
108
109
+ sealed interface ExperimentUpdateResponseBody permits ConfoundingVariables , ExperimentDescription ,
110
+ ExperimentalVariables {
111
+
112
+ }
113
+
114
+
74
115
/**
75
116
* Cacheable requests provide a unique identifier so cache implementations can unambiguously
76
117
* manage the requests.
77
118
*
78
119
* @since 1.9.0
79
120
*/
80
- sealed interface CacheableRequest permits ProjectUpdateRequest {
121
+ sealed interface CacheableRequest permits ProjectUpdateRequest , ExperimentUpdateRequest {
81
122
82
123
/**
83
124
* Returns an ID that is unique to the request.
@@ -90,15 +131,15 @@ sealed interface CacheableRequest permits ProjectUpdateRequest {
90
131
}
91
132
92
133
/**
93
- * Container for passing information in an {@link UpdateRequestBody } or
94
- * {@link UpdateResponseBody }.
134
+ * Container for passing information in an {@link ProjectUpdateRequestBody } or
135
+ * {@link ProjectUpdateResponseBody }.
95
136
*
96
137
* @param title the title of the project
97
138
* @param objective the objective of the project
98
139
* @since 1.9.0
99
140
*/
100
- record ProjectDesign (String title , String objective ) implements UpdateRequestBody ,
101
- UpdateResponseBody {
141
+ record ProjectDesign (String title , String objective ) implements ProjectUpdateRequestBody ,
142
+ ProjectUpdateResponseBody {
102
143
103
144
}
104
145
@@ -111,8 +152,8 @@ record ProjectDesign(String title, String objective) implements UpdateRequestBod
111
152
* @since 1.9.0
112
153
*/
113
154
record ProjectContacts (ProjectContact investigator , ProjectContact manager ,
114
- ProjectContact responsible ) implements UpdateRequestBody ,
115
- UpdateResponseBody {
155
+ ProjectContact responsible ) implements ProjectUpdateRequestBody ,
156
+ ProjectUpdateResponseBody {
116
157
117
158
}
118
159
@@ -134,8 +175,47 @@ record ProjectContact(String fullName, String email) {
134
175
* @param grantId the grant ID
135
176
* @since 1.9.0
136
177
*/
137
- record FundingInformation (String grant , String grantId ) implements UpdateRequestBody ,
138
- UpdateResponseBody {
178
+ record FundingInformation (String grant , String grantId ) implements ProjectUpdateRequestBody ,
179
+ ProjectUpdateResponseBody {
180
+
181
+ }
182
+
183
+
184
+ record ExperimentalVariable (String name , Set <String > levels , String unit ) {
185
+
186
+ }
187
+
188
+ record ExperimentalVariables (
189
+ List <ExperimentalVariable > experimentalVariables ) implements
190
+ ExperimentUpdateRequestBody ,
191
+ ExperimentUpdateResponseBody {
192
+
193
+ }
194
+
195
+ record ExperimentDescription (String experimentName , Set <String > species , Set <String > specimen ,
196
+ Set <String > analytes ) implements ExperimentUpdateRequestBody ,
197
+ ExperimentUpdateResponseBody {
198
+
199
+
200
+ }
201
+
202
+ record ConfoundingVariables (List <ConfoundingVariableInformation > confoundingVariables ) implements
203
+ ExperimentUpdateRequestBody , ExperimentUpdateResponseBody {
204
+
205
+ }
206
+
207
+ record ExperimentUpdateRequest (String projectId , String experimentId ,
208
+ ExperimentUpdateRequestBody body ,
209
+ String requestId ) implements CacheableRequest {
210
+
211
+ public ExperimentUpdateRequest (String projectId , String experimentId ,
212
+ ExperimentUpdateRequestBody body ) {
213
+ this (projectId , experimentId , body , UUID .randomUUID ().toString ());
214
+ }
215
+ }
216
+
217
+ record ExperimentUpdateResponse (String experimentId , ExperimentUpdateResponseBody body ,
218
+ String requestId ) {
139
219
140
220
}
141
221
@@ -171,10 +251,11 @@ record ProjectCreationResponse(String projectId) {
171
251
* @param requestBody the information to be updated.
172
252
* @since 1.9.0
173
253
*/
174
- record ProjectUpdateRequest (String projectId , UpdateRequestBody requestBody , String id ) implements
254
+ record ProjectUpdateRequest (String projectId , ProjectUpdateRequestBody requestBody ,
255
+ String id ) implements
175
256
CacheableRequest {
176
257
177
- public ProjectUpdateRequest (String projectId , UpdateRequestBody requestBody ) {
258
+ public ProjectUpdateRequest (String projectId , ProjectUpdateRequestBody requestBody ) {
178
259
this (projectId , requestBody , UUID .randomUUID ().toString ());
179
260
}
180
261
@@ -191,7 +272,8 @@ public String requestId() {
191
272
* @param responseBody the information that was updated.
192
273
* @since 1.9.0
193
274
*/
194
- record ProjectUpdateResponse (String projectId , UpdateResponseBody responseBody , String requestId ) {
275
+ record ProjectUpdateResponse (String projectId , ProjectUpdateResponseBody responseBody ,
276
+ String requestId ) {
195
277
196
278
public ProjectUpdateResponse {
197
279
if (projectId == null ) {
0 commit comments