8
8
import java .util .Collection ;
9
9
import java .util .List ;
10
10
import java .util .Map ;
11
- import java .util .Objects ;
12
11
import java .util .Optional ;
13
12
import java .util .Set ;
14
13
import java .util .UUID ;
@@ -123,6 +122,9 @@ public interface AsyncProjectService {
123
122
*/
124
123
Mono <ProjectDeletionResponse > delete (ProjectDeletionRequest request );
125
124
125
+
126
+ Mono <ExperimentDeletionResponse > delete (ExperimentDeletionRequest request );
127
+
126
128
/**
127
129
* Submits a project creation request and returns a {@link Mono<ProjectCreationResponse>}
128
130
* immediately.
@@ -376,7 +378,7 @@ sealed interface ProjectUpdateResponseBody permits FundingInformation,
376
378
377
379
sealed interface ExperimentUpdateRequestBody permits ConfoundingVariableAdditions ,
378
380
ConfoundingVariableDeletions , ConfoundingVariableUpdates , ExperimentDescription ,
379
- ExperimentalGroups , ExperimentalVariableAdditions , ExperimentalVariableDeletions {
381
+ ExperimentalGroups , ExperimentalVariableAdditions {
380
382
381
383
}
382
384
@@ -428,6 +430,15 @@ sealed interface ProjectDeletionRequestBody permits FundingDeletion,
428
430
429
431
}
430
432
433
+ sealed interface ExperimentDeletionRequestBody permits ExperimentalVariableDeletions {
434
+
435
+ }
436
+
437
+
438
+ sealed interface ExperimentDeletionResponseBody permits ExperimentalVariables {
439
+
440
+ }
441
+
431
442
/**
432
443
* Container for passing information in an {@link ProjectUpdateRequestBody} or
433
444
* {@link ProjectUpdateResponseBody}.
@@ -500,7 +511,11 @@ record PrincipalInvestigator(ProjectContact contact) implements ProjectUpdateReq
500
511
* @param unit the unit of the experimental variable. Can be null if no unit is set
501
512
* @since 1.9.0
502
513
*/
503
- record ExperimentalVariable (Long id , String name , Set <String > levels , @ Nullable String unit ) {
514
+ record ExperimentalVariable (String name , Set <String > levels , @ Nullable String unit ) {
515
+
516
+ public ExperimentalVariable (String name , Set <String > levels ) {
517
+ this (name , levels , "" );
518
+ }
504
519
505
520
public ExperimentalVariable {
506
521
levels = Set .copyOf (levels );
@@ -537,7 +552,7 @@ public List<ExperimentalVariable> experimentalVariables() {
537
552
* @param experimentalVariables
538
553
*/
539
554
record ExperimentalVariableDeletions (List <ExperimentalVariable > experimentalVariables ) implements
540
- ExperimentUpdateRequestBody {
555
+ ExperimentDeletionRequestBody {
541
556
542
557
public ExperimentalVariableDeletions {
543
558
experimentalVariables = List .copyOf (experimentalVariables );
@@ -556,7 +571,7 @@ public List<ExperimentalVariable> experimentalVariables() {
556
571
* @since 1.9.0
557
572
*/
558
573
record ExperimentalVariables (List <ExperimentalVariable > experimentalVariables ) implements
559
- ExperimentUpdateResponseBody {
574
+ ExperimentUpdateResponseBody , ExperimentDeletionResponseBody {
560
575
561
576
562
577
public ExperimentalVariables {
@@ -1068,7 +1083,6 @@ record ProjectResponsibleDeletion() implements ProjectDeletionRequestBody {
1068
1083
*/
1069
1084
record ProjectUpdateResponse (String projectId , ProjectUpdateResponseBody responseBody ,
1070
1085
String requestId ) {
1071
-
1072
1086
public ProjectUpdateResponse {
1073
1087
if (projectId == null ) {
1074
1088
throw new IllegalArgumentException ("Project ID cannot be null" );
@@ -1078,7 +1092,6 @@ record ProjectUpdateResponse(String projectId, ProjectUpdateResponseBody respons
1078
1092
}
1079
1093
if (requestId == null || requestId .isBlank ()) {
1080
1094
requestId = UUID .randomUUID ().toString ();
1081
- ;
1082
1095
}
1083
1096
}
1084
1097
@@ -1095,6 +1108,50 @@ public Optional<String> retrieveRequestId() {
1095
1108
boolean hasRequestId () {
1096
1109
return nonNull (requestId );
1097
1110
}
1111
+
1112
+ }
1113
+
1114
+ record ExperimentDeletionRequest (String projectId , String experimentId , String requestId ,
1115
+ ExperimentDeletionRequestBody body ) {
1116
+
1117
+ public ExperimentDeletionRequest {
1118
+ if (projectId == null ) {
1119
+ throw new IllegalArgumentException ("Project ID cannot be null" );
1120
+ }
1121
+ if (projectId .isBlank ()) {
1122
+ throw new IllegalArgumentException ("Project ID cannot be blank" );
1123
+ }
1124
+ if (experimentId == null || experimentId .isBlank ()) {
1125
+ throw new IllegalArgumentException ("Experiment ID cannot be empty" );
1126
+ }
1127
+ if (requestId == null || requestId .isBlank ()) {
1128
+ requestId = UUID .randomUUID ().toString ();
1129
+ }
1130
+ }
1131
+
1132
+ public ExperimentDeletionRequest (String projectId , String experimentId ,
1133
+ ExperimentDeletionRequestBody body ) {
1134
+ this (projectId , experimentId , null , body );
1135
+ }
1136
+ }
1137
+
1138
+ record ExperimentDeletionResponse (String projectId , String experimentId , String requestId ,
1139
+ ExperimentDeletionResponseBody body ) {
1140
+
1141
+ public ExperimentDeletionResponse {
1142
+ if (projectId == null ) {
1143
+ throw new IllegalArgumentException ("Project ID cannot be null" );
1144
+ }
1145
+ if (projectId .isBlank ()) {
1146
+ throw new IllegalArgumentException ("Project ID cannot be blank" );
1147
+ }
1148
+ if (experimentId == null || experimentId .isBlank ()) {
1149
+ throw new IllegalArgumentException ("Experiment ID cannot be empty" );
1150
+ }
1151
+ if (requestId == null || requestId .isBlank ()) {
1152
+ throw new IllegalArgumentException ("Request information cannot be empty" );
1153
+ }
1154
+ }
1098
1155
}
1099
1156
1100
1157
/**
0 commit comments