|
5 | 5 | import life.qbic.domain.concepts.DomainEventDispatcher;
|
6 | 6 | import life.qbic.projectmanagement.domain.model.batch.Batch;
|
7 | 7 | import life.qbic.projectmanagement.domain.model.batch.BatchId;
|
| 8 | +import life.qbic.projectmanagement.domain.model.experiment.ExperimentId; |
8 | 9 | import life.qbic.projectmanagement.domain.model.project.ProjectId;
|
9 | 10 | import life.qbic.projectmanagement.domain.model.project.event.ProjectChanged;
|
10 | 11 | import life.qbic.projectmanagement.domain.model.sample.event.BatchDeleted;
|
@@ -42,25 +43,28 @@ public BatchDomainService(BatchRepository batchRepository) {
|
42 | 43 | * measurements of the complete experiment.
|
43 | 44 | * @param projectName the title of the project the batch is added to
|
44 | 45 | * @param projectId id of the project this batch is added to
|
| 46 | + * @param experimentId id of the experiment this batch is added to |
45 | 47 | * @return a result object with the response. If the registration failed, a response code will be
|
46 | 48 | * provided.
|
47 | 49 | * @since 1.0.0
|
48 | 50 | */
|
49 | 51 | public Result<BatchId, ResponseCode> register(String label, boolean isPilot, String projectName,
|
50 |
| - ProjectId projectId) { |
| 52 | + ProjectId projectId, ExperimentId experimentId) { |
51 | 53 | Batch batch = Batch.create(label, isPilot);
|
52 | 54 | var result = batchRepository.add(batch);
|
53 | 55 | if (result.isError()) {
|
54 | 56 | return Result.fromError(ResponseCode.BATCH_REGISTRATION_FAILED);
|
55 | 57 | } else {
|
56 |
| - dispatchRegistration(label, batch.batchId(), projectName, projectId); |
| 58 | + dispatchRegistration(label, batch.batchId(), projectName, projectId, |
| 59 | + experimentId); |
57 | 60 | }
|
58 | 61 | return Result.fromValue(result.getValue().batchId());
|
59 | 62 | }
|
60 | 63 |
|
61 | 64 | private void dispatchRegistration(String name, BatchId id, String projectName,
|
62 |
| - ProjectId projectId) { |
63 |
| - BatchRegistered batchRegistered = BatchRegistered.create(name, id, projectName, projectId); |
| 65 | + ProjectId projectId, ExperimentId experimentId) { |
| 66 | + BatchRegistered batchRegistered = BatchRegistered.create(name, id, projectName, projectId, |
| 67 | + experimentId); |
64 | 68 | DomainEventDispatcher.instance().dispatch(batchRegistered);
|
65 | 69 | }
|
66 | 70 |
|
|
0 commit comments