Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit daa90d5

Browse files
Merge pull request #54 from Breeding-Insight/bug/BI-2650
BI-2650 - BrAPI server changes for issues found with bi-api automated tests
2 parents 979e367 + b16b865 commit daa90d5

File tree

11 files changed

+69
-37
lines changed

11 files changed

+69
-37
lines changed

src/main/java/org/brapi/test/BrAPITestServer/controller/geno/SamplesApiController.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ public SamplesApiController(SampleService sampleService, SearchService searchSer
5252
@Override
5353
public ResponseEntity<SampleListResponse> samplesGet(
5454
@Valid @RequestParam(value = "batchDeleteDbId", required = false) String batchDeleteDbId,
55-
@RequestParam(value = "sampleDbId", required = false) String sampleDbId,
56-
@RequestParam(value = "sampleName", required = false) String sampleName,
57-
@RequestParam(value = "sampleGroupDbId", required = false) String sampleGroupDbId,
58-
@RequestParam(value = "observationUnitDbId", required = false) String observationUnitDbId,
59-
@RequestParam(value = "plateDbId", required = false) String plateDbId,
60-
@RequestParam(value = "plateName", required = false) String plateName,
61-
@RequestParam(value = "germplasmDbId", required = false) String germplasmDbId,
62-
@RequestParam(value = "studyDbId", required = false) String studyDbId,
63-
@RequestParam(value = "trialDbId", required = false) String trialDbId,
64-
@RequestParam(value = "commonCropName", required = false) String commonCropName,
65-
@RequestParam(value = "programDbId", required = false) String programDbId,
66-
@RequestParam(value = "externalReferenceID", required = false) String externalReferenceId,
67-
@RequestParam(value = "externalReferenceID", required = false) String externalReferenceID,
68-
@RequestParam(value = "externalReferenceSource", required = false) String externalReferenceSource,
69-
@RequestParam(value = "page", required = false) Integer page,
70-
@RequestParam(value = "pageSize", required = false) Integer pageSize,
55+
@Valid @RequestParam(value = "sampleDbId", required = false) String sampleDbId,
56+
@Valid @RequestParam(value = "sampleName", required = false) String sampleName,
57+
@Valid @RequestParam(value = "sampleGroupDbId", required = false) String sampleGroupDbId,
58+
@Valid @RequestParam(value = "observationUnitDbId", required = false) String observationUnitDbId,
59+
@Valid @RequestParam(value = "plateDbId", required = false) String plateDbId,
60+
@Valid @RequestParam(value = "plateName", required = false) String plateName,
61+
@Valid @RequestParam(value = "germplasmDbId", required = false) String germplasmDbId,
62+
@Valid @RequestParam(value = "studyDbId", required = false) String studyDbId,
63+
@Valid @RequestParam(value = "trialDbId", required = false) String trialDbId,
64+
@Valid @RequestParam(value = "commonCropName", required = false) String commonCropName,
65+
@Valid @RequestParam(value = "programDbId", required = false) String programDbId,
66+
@Valid @RequestParam(value = "externalReferenceID", required = false) String externalReferenceId,
67+
@Valid @RequestParam(value = "externalReferenceID", required = false) String externalReferenceID,
68+
@Valid @RequestParam(value = "externalReferenceSource", required = false) String externalReferenceSource,
69+
@Valid @RequestParam(value = "page", required = false) Integer page,
70+
@Valid @RequestParam(value = "pageSize", required = false) Integer pageSize,
7171
@RequestHeader(value = "Authorization", required = false) String authorization)
7272
throws BrAPIServerException {
7373

src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/PlateEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@Where(clause = "soft_deleted = false")
2020
public class PlateEntity extends BrAPIPrimaryEntity {
2121
@Column
22-
private UUID clientPlateDbId;
22+
private String clientPlateDbId;
2323
@Column
2424
private String clientPlateBarcode;
2525
@Column
@@ -93,10 +93,10 @@ public VendorPlateSubmissionEntity getSubmission() {
9393
public void setSubmission(VendorPlateSubmissionEntity submission) {
9494
this.submission = submission;
9595
}
96-
public UUID getClientPlateDbId() {
96+
public String getClientPlateDbId() {
9797
return clientPlateDbId;
9898
}
99-
public void setClientPlateDbId(UUID clientPlateDbId) {
99+
public void setClientPlateDbId(String clientPlateDbId) {
100100
this.clientPlateDbId = clientPlateDbId;
101101
}
102102
public String getClientPlateBarcode() {

src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/vendor/VendorOrderEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@Table(name = "vendor_order")
1515
public class VendorOrderEntity extends BrAPIPrimaryEntity {
1616
@Column
17-
private UUID clientPlateDbId;
17+
private String clientPlateDbId;
1818
@Column
1919
private String clientPlateBarcode;
2020
@Column
@@ -73,11 +73,11 @@ public void setPlateSubmission(VendorPlateSubmissionEntity plateSubmission) {
7373
this.plateSubmission = plateSubmission;
7474
}
7575

76-
public UUID getClientPlateDbId() {
76+
public String getClientPlateDbId() {
7777
return clientPlateDbId;
7878
}
7979

80-
public void setClientPlateDbId(UUID clientPlateDbId) {
80+
public void setClientPlateDbId(String clientPlateDbId) {
8181
this.clientPlateDbId = clientPlateDbId;
8282
}
8383

src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/vendor/VendorPlateSubmissionEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public class VendorPlateSubmissionEntity extends BrAPIPrimaryEntity {
1414

1515
@Column
16-
private UUID clientId;
16+
private String clientId;
1717
@Column
1818
private Integer numberOfSamples;
1919
@Column
@@ -30,10 +30,10 @@ public VendorOrderEntity getOrder() {
3030
public void setOrder(VendorOrderEntity order) {
3131
this.order = order;
3232
}
33-
public UUID getClientId() {
33+
public String getClientId() {
3434
return clientId;
3535
}
36-
public void setClientId(UUID clientId) {
36+
public void setClientId(String clientId) {
3737
this.clientId = clientId;
3838
}
3939
public Integer getNumberOfSamples() {

src/main/java/org/brapi/test/BrAPITestServer/repository/core/ListRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ public interface ListRepository extends BrAPIRepository<ListEntity, UUID>{
1414
@Modifying
1515
@Transactional
1616
@Query("UPDATE ListEntity l SET l.softDeleted = :softDeleted WHERE l.id = :listId")
17-
int updateSoftDeletedStatus(@Param("listId") String listId, @Param("softDeleted") boolean softDeleted);
17+
int updateSoftDeletedStatus(@Param("listId") UUID listId, @Param("softDeleted") boolean softDeleted);
1818

1919
@Modifying
2020
@Transactional
2121
@Query("UPDATE ListEntity l SET l.softDeleted = :softDeleted WHERE l.id IN :listIds")
22-
int updateSoftDeletedStatusBatch(@Param("listIds") List<String> listIds, @Param("softDeleted") boolean softDeleted);
22+
int updateSoftDeletedStatusBatch(@Param("listIds") List<UUID> listIds, @Param("softDeleted") boolean softDeleted);
2323
}

src/main/java/org/brapi/test/BrAPITestServer/repository/core/TrialRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Page<TrialEntity> findBySearch(
2929
@Modifying
3030
@Transactional
3131
@Query("UPDATE TrialEntity t SET t.softDeleted = :softDeleted WHERE t.id = :trialId")
32-
int updateSoftDeletedStatus(@Param("trialId") String trialId, @Param("softDeleted") boolean softDeleted);
32+
int updateSoftDeletedStatus(@Param("trialId") UUID trialId, @Param("softDeleted") boolean softDeleted);
3333

3434
@Modifying
3535
@Transactional
3636
@Query("UPDATE TrialEntity t SET t.softDeleted = :softDeleted WHERE t.id IN :trialIds")
37-
int updateSoftDeletedStatusBatch(@Param("trialIds") List<String> trialIds, @Param("softDeleted") boolean softDeleted);
37+
int updateSoftDeletedStatusBatch(@Param("trialIds") List<UUID> trialIds, @Param("softDeleted") boolean softDeleted);
3838

3939
}

src/main/java/org/brapi/test/BrAPITestServer/service/core/ListService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void deleteListBatch(List<String> listDbIds) {
169169
}
170170

171171
public void softDeleteListBatch(List<String> listDbIds) {
172-
listRepository.updateSoftDeletedStatusBatch(listDbIds, true);
172+
listRepository.updateSoftDeletedStatusBatch(listDbIds.stream().map(UUID::fromString).toList(), true);
173173
}
174174

175175
public void deleteList(String listDbId) throws BrAPIServerException {
@@ -181,7 +181,7 @@ public void deleteList(String listDbId) throws BrAPIServerException {
181181
}
182182

183183
public void softDeleteList(String listDbId) throws BrAPIServerDbIdNotFoundException {
184-
int updatedCount = listRepository.updateSoftDeletedStatus(listDbId, true);
184+
int updatedCount = listRepository.updateSoftDeletedStatus(UUID.fromString(listDbId), true);
185185
if (updatedCount == 0) {
186186
throw new BrAPIServerDbIdNotFoundException("list", listDbId, "list database ID", HttpStatus.NOT_FOUND);
187187
}

src/main/java/org/brapi/test/BrAPITestServer/service/core/TrialService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ public void deleteTrialBatch(List<String> trialDbIds) {
175175
}
176176

177177
public void softDeleteTrialBatch(List<String> trialDbIds) {
178-
trialRepository.updateSoftDeletedStatusBatch(trialDbIds, true);
178+
trialRepository.updateSoftDeletedStatusBatch(trialDbIds.stream().map(UUID::fromString).toList(), true);
179179
}
180180

181181
public void softDeleteTrial(String trialDbId) throws BrAPIServerDbIdNotFoundException {
182-
int updatedCount = trialRepository.updateSoftDeletedStatus(trialDbId, true);
182+
int updatedCount = trialRepository.updateSoftDeletedStatus(UUID.fromString(trialDbId), true);
183183
if (updatedCount == 0) {
184184
throw new BrAPIServerDbIdNotFoundException("trial", trialDbId, "trial database ID", HttpStatus.NOT_FOUND);
185185
}

src/main/java/org/brapi/test/BrAPITestServer/service/geno/SampleService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ private Sample convertFromEntity(SampleEntity entity) {
258258
sample.setSampleBarcode(entity.getSampleBarcode());
259259
sample.setSampleDbId(entity.getId().toString());
260260
sample.setSampleDescription(entity.getSampleDescription());
261-
sample.setSampleGroupDbId(entity.getSampleGroupDbId().toString());
261+
sample.setSampleGroupDbId(entity.getSampleGroupDbId() != null ? entity.getSampleGroupDbId().toString(): null);
262262
sample.setSampleName(entity.getSampleName());
263263
sample.setSamplePUI(entity.getSamplePUI());
264264
sample.setSampleTimestamp(DateUtility.toOffsetDateTime(entity.getSampleTimestamp()));

src/main/java/org/brapi/test/BrAPITestServer/service/geno/VendorSampleService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private VendorPlateSubmissionPlates convertFromEntityToSummary(PlateEntity entit
161161
private VendorOrderEntity convertToEntity(VendorOrderSubmissionRequest request) {
162162
VendorOrderEntity entity = new VendorOrderEntity();
163163
entity.setClientPlateBarcode(request.getClientId());
164-
entity.setClientPlateDbId(UUID.fromString(request.getClientId()));
164+
entity.setClientPlateDbId(request.getClientId());
165165
entity.setRequiredServiceInfo(request.getRequiredServiceInfo());
166166
entity.setSampleType(request.getSampleType());
167167
entity.setServiceIds(request.getServiceIds());
@@ -190,7 +190,7 @@ private VendorPlateSubmissionEntity convertToEntity(VendorOrderSubmissionRequest
190190

191191
private PlateEntity convertToEntity(VendorPlateSubmissionRequestPlates newPlate) {
192192
PlateEntity plateEntity = new PlateEntity();
193-
plateEntity.setClientPlateDbId(UUID.fromString(newPlate.getClientPlateId()));
193+
plateEntity.setClientPlateDbId(newPlate.getClientPlateId());
194194
plateEntity.setStatusTimeStamp(new Date());
195195

196196
return plateEntity;
@@ -199,7 +199,7 @@ private PlateEntity convertToEntity(VendorPlateSubmissionRequestPlates newPlate)
199199
private VendorOrderEntity convertToEntity(VendorPlateSubmissionRequest request) {
200200
VendorOrderEntity entity = new VendorOrderEntity();
201201
entity.setClientPlateBarcode(request.getClientId());
202-
entity.setClientPlateDbId(UUID.fromString(request.getClientId()));
202+
entity.setClientPlateDbId(request.getClientId());
203203
entity.setSampleType(request.getSampleType());
204204
entity.setStatus(StatusEnum.RECEIVED);
205205
entity.setStatusTimeStamp(new Date());

0 commit comments

Comments
 (0)