Skip to content

Commit

Permalink
Update registration service
Browse files Browse the repository at this point in the history
  • Loading branch information
sven1103 committed Sep 24, 2024
1 parent ae7c0bb commit 828d45d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import life.qbic.projectmanagement.domain.model.project.ProjectId;
import life.qbic.projectmanagement.domain.model.sample.Sample;
import life.qbic.projectmanagement.domain.model.sample.SampleId;
import life.qbic.projectmanagement.domain.model.sample.SampleRegistrationRequest;
import life.qbic.projectmanagement.domain.repository.SampleRepository;
import org.springframework.security.access.prepost.PreAuthorize;

Expand Down Expand Up @@ -40,7 +39,7 @@ public SampleRegistrationServiceV2(BatchRegistrationService batchRegistrationSer
}

@PreAuthorize("hasPermission(#projectId, 'life.qbic.projectmanagement.domain.model.project.Project', 'WRITE')")
public CompletableFuture<Void> registerNewSamples(Collection<SampleRegistrationRequest> sampleRegistrationRequests,
public CompletableFuture<Void> registerNewSamples(Collection<SampleMetadata> sampleRegistrationRequests,
ProjectId projectId, String batchLabel, boolean batchIsPilot)
throws RegistrationException {
var result = batchRegistrationService.registerBatch(batchLabel, batchIsPilot, projectId);
Expand All @@ -53,12 +52,12 @@ public CompletableFuture<Void> registerNewSamples(Collection<SampleRegistrationR
}

@PreAuthorize("hasPermission(#projectId, 'life.qbic.projectmanagement.domain.model.project.Project', 'WRITE')")
public CompletableFuture<Void> updateSamples(Collection<SampleRegistrationRequest> sampleRegistrationRequests,
public CompletableFuture<Void> updateSamples(Collection<SampleMetadata> sampleRegistrationRequests,
ExperimentId experimentId, ProjectId projectId) throws RegistrationException {
throw new UnsupportedOperationException("Not implemented yet");
}

private void registerSamples(Collection<SampleRegistrationRequest> sampleRegistrationRequests, BatchId batchId, ExperimentId experimentId, ProjectId projectId)
private void registerSamples(Collection<SampleMetadata> sampleMetadata, BatchId batchId, ExperimentId experimentId, ProjectId projectId)
throws RegistrationException {
var experimentQuery = experimentInformationService.find(projectId.value(), experimentId);
if (experimentQuery.isEmpty()) {
Expand All @@ -76,17 +75,9 @@ private void rollbackSampleRegistration(Collection<SampleId> registeredSamples)

}

private Sample buildSample(SampleRegistrationRequest sampleRegistrationRequest, ProjectId projectId) {
var result = sampleCodeService.generateFor(projectId);
if (result.isError()) {
throw new RegistrationException("Sample code generation failed");
}
return Sample.create(result.getValue(), sampleRegistrationRequest);
}

public static class RegistrationException extends RuntimeException {

public RegistrationException(String message) {
super(message);
}
}

Expand Down
Binary file modified user-interface/src/main/bundles/dev.bundle
Binary file not shown.

0 comments on commit 828d45d

Please sign in to comment.