|
15 | 15 | import life.qbic.projectmanagement.application.sample.SampleRegistrationService;
|
16 | 16 | import life.qbic.projectmanagement.domain.model.batch.Batch;
|
17 | 17 | import life.qbic.projectmanagement.domain.model.batch.BatchId;
|
| 18 | +import life.qbic.projectmanagement.domain.model.experiment.ExperimentId; |
18 | 19 | import life.qbic.projectmanagement.domain.model.project.ProjectId;
|
19 | 20 | import life.qbic.projectmanagement.domain.model.sample.Sample;
|
20 | 21 | import life.qbic.projectmanagement.domain.model.sample.SampleId;
|
@@ -70,21 +71,23 @@ public BatchRegistrationService(BatchRepository batchRepository,
|
70 | 71 | * are usually followed by a complete batch that represents the measurements of
|
71 | 72 | * the complete experiment.
|
72 | 73 | * @param projectId id of the project this batch is added to
|
| 74 | + * @param experimentId id of the experiment this batch is added to |
73 | 75 | * @return a result object with the response. If the registration failed, a response code will be
|
74 | 76 | * provided.
|
75 | 77 | * @since 1.0.0
|
76 | 78 | */
|
77 | 79 | @PreAuthorize("hasPermission(#projectId, 'life.qbic.projectmanagement.domain.model.project.Project', 'WRITE')")
|
78 | 80 | public Result<BatchId, ResponseCode> registerBatch(String label, boolean isPilot,
|
79 |
| - ProjectId projectId) { |
| 81 | + ProjectId projectId, ExperimentId experimentId) { |
80 | 82 | var project = projectInformationService.find(projectId);
|
81 | 83 | if (project.isEmpty()) {
|
82 | 84 | log.error(
|
83 | 85 | "Batch registration aborted. Reason: project with id:" + projectId + " was not found");
|
84 | 86 | return Result.fromError(ResponseCode.BATCH_CREATION_FAILED);
|
85 | 87 | }
|
86 | 88 | String projectTitle = project.get().getProjectIntent().projectTitle().title();
|
87 |
| - var result = batchDomainService.register(label, isPilot, projectTitle, projectId); |
| 89 | + var result = batchDomainService.register(label, isPilot, projectTitle, projectId, |
| 90 | + experimentId); |
88 | 91 | if (result.isError()) {
|
89 | 92 | return Result.fromError(ResponseCode.BATCH_REGISTRATION_FAILED);
|
90 | 93 | }
|
|
0 commit comments