Skip to content

Commit

Permalink
remove optionals for record, add getters for optional fields for sample
Browse files Browse the repository at this point in the history
  • Loading branch information
wow-such-code committed Jul 12, 2023
1 parent 36adc81 commit e36ae18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Sample {

private Sample(SampleId id, SampleCode sampleCode, BatchId assignedBatch, String label,
ExperimentId experimentId, Long experimentalGroupId, SampleOrigin sampleOrigin,
BiologicalReplicateId replicateReference, Optional<String> analysisType, Optional<String> comment
BiologicalReplicateId replicateReference, String analysisType, String comment
) {
this.id = id;
this.sampleCode = Objects.requireNonNull(sampleCode);
Expand All @@ -58,8 +58,8 @@ private Sample(SampleId id, SampleCode sampleCode, BatchId assignedBatch, String
this.sampleOrigin = sampleOrigin;
this.biologicalReplicateId = replicateReference;
this.assignedBatch = assignedBatch;
this.analysisType = analysisType.orElse("");
this.comment = comment.orElse("");
this.analysisType = analysisType;
this.comment = comment;
}

protected Sample() {
Expand All @@ -82,7 +82,7 @@ public static Sample create(
sampleRegistrationRequest.label(), sampleRegistrationRequest.experimentId(),
sampleRegistrationRequest.experimentalGroupId(),
sampleRegistrationRequest.sampleOrigin(), sampleRegistrationRequest.replicateReference(),
sampleRegistrationRequest.getAnalysisType(), sampleRegistrationRequest.getComment());
sampleRegistrationRequest.analysisType(), sampleRegistrationRequest.comment());
}

public BatchId assignedBatch() {
Expand All @@ -105,6 +105,14 @@ public String label() {
return this.label;
}

public Optional<String> analysisType() {
return Optional.ofNullable(analysisType);
}

public Optional<String> comment() {
return Optional.ofNullable(comment);
}

public Long experimentalGroupId() {
return this.experimentalGroupId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,4 @@ public SampleRegistrationRequest(String label, BatchId assignedBatch, Experiment
this.analysisType = analysisType;
}

public Optional<String> getAnalysisType() {
return Optional.ofNullable(analysisType);
}
public Optional<String> getComment() {
return Optional.ofNullable(comment);
}
}

0 comments on commit e36ae18

Please sign in to comment.