Skip to content

Commit 8e337ea

Browse files
committed
Resolves PR comments
1 parent c79835c commit 8e337ea

9 files changed

Lines changed: 51 additions & 9 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/epidata/EpiDataDto.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ public EpiDataDto clone() throws CloneNotSupportedException {
476476
clone.getExposures().clear();
477477
clone.getExposures().addAll(exposureDtos);
478478

479+
if (foodHistory != null) {
480+
clone.setFoodHistory(foodHistory.clone());
481+
}
482+
479483
return clone;
480484
}
481485
}

sormas-api/src/main/java/de/symeda/sormas/api/epidata/FoodHistoryDto.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public Map<FoodConsumptionItem, String> getConsumedItemsDetails() {
5555
}
5656

5757
public void setConsumedItemsDetails(Map<FoodConsumptionItem, String> consumedItemsDetails) {
58-
this.consumedItemsDetails = consumedItemsDetails;
58+
this.consumedItemsDetails =
59+
consumedItemsDetails == null ? new EnumMap<>(FoodConsumptionItem.class) : new EnumMap<>(consumedItemsDetails);
5960
}
6061

6162
public String getOtherFoodDetails() {
@@ -65,4 +66,11 @@ public String getOtherFoodDetails() {
6566
public void setOtherFoodDetails(String otherFoodDetails) {
6667
this.otherFoodDetails = otherFoodDetails;
6768
}
69+
70+
@Override
71+
public FoodHistoryDto clone() throws CloneNotSupportedException {
72+
FoodHistoryDto clone = (FoodHistoryDto) super.clone();
73+
clone.setConsumedItemsDetails(consumedItemsDetails);
74+
return clone;
75+
}
6876
}

sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ public String toString() {
342342
}
343343

344344
public static String toString(PathogenTestType value, String details) {
345+
return toString(value, details, null);
346+
}
347+
348+
public static String toString(PathogenTestType value, String details, Disease disease) {
345349
if (value == null) {
346350
return "";
347351
}
@@ -350,6 +354,10 @@ public static String toString(PathogenTestType value, String details) {
350354
return DataHelper.toStringNullable(details);
351355
}
352356

357+
if (revealsTestTypeText(value, disease) && !DataHelper.isNullOrEmpty(details)) {
358+
return value + " (" + details + ")";
359+
}
360+
353361
return value.toString();
354362
}
355363

sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleExportDto.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ public static class SampleExportPathogenTest implements Serializable {
10041004
@SensitiveData
10051005
private String testTypeText;
10061006
private String disease;
1007+
private Disease testedDisease;
10071008
private Date dateTime;
10081009
private String lab;
10091010
private PathogenTestResultType testResult;
@@ -1020,17 +1021,30 @@ public SampleExportPathogenTest(
10201021
String lab,
10211022
PathogenTestResultType testResult,
10221023
Boolean verified) {
1024+
this(testType, testTypeText, disease, null, dateTime, lab, testResult, verified);
1025+
}
1026+
1027+
public SampleExportPathogenTest(
1028+
PathogenTestType testType,
1029+
String testTypeText,
1030+
String disease,
1031+
Disease testedDisease,
1032+
Date dateTime,
1033+
String lab,
1034+
PathogenTestResultType testResult,
1035+
Boolean verified) {
10231036
this.testType = testType;
10241037
this.testTypeText = testTypeText;
10251038
this.disease = disease;
1039+
this.testedDisease = testedDisease;
10261040
this.dateTime = dateTime;
10271041
this.lab = lab;
10281042
this.testResult = testResult;
10291043
this.verified = verified;
10301044
}
10311045

10321046
public String formatType() {
1033-
return PathogenTestType.toString(testType, testTypeText);
1047+
return PathogenTestType.toString(testType, testTypeText, testedDisease);
10341048
}
10351049

10361050
public String formatString() {

sormas-backend/src/main/java/de/symeda/sormas/backend/epidata/EpiData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public void setActivityAsCaseToDate(Date activityAsCaseToDate) {
347347
this.activityAsCaseToDate = activityAsCaseToDate;
348348
}
349349

350-
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
350+
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
351351
public FoodHistory getFoodHistory() {
352352
return foodHistory;
353353
}

sormas-backend/src/main/java/de/symeda/sormas/backend/sample/SampleFacadeEjb.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ private List<SampleExportDto> getExportList(
674674
pathogenTest.getTestType(),
675675
pathogenTest.getTestTypeText(),
676676
DiseaseHelper.toString(pathogenTest.getTestedDisease(), pathogenTest.getTestedDiseaseDetails()),
677+
pathogenTest.getTestedDisease(),
677678
pathogenTest.getTestDateTime(),
678679
lab,
679680
pathogenTest.getTestResult(),

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16033,9 +16033,6 @@ CREATE TRIGGER versioning_trigger
1603316033
BEFORE INSERT OR UPDATE OR DELETE ON foodhistory_consumeditems
1603416034
FOR EACH ROW EXECUTE PROCEDURE versioning('sys_period', 'foodhistory_consumeditems_history', true);
1603516035
DROP TRIGGER IF EXISTS delete_history_trigger ON foodhistory_consumeditems;
16036-
CREATE TRIGGER delete_history_trigger
16037-
AFTER DELETE ON foodhistory_consumeditems
16038-
FOR EACH ROW EXECUTE PROCEDURE delete_history_trigger('foodhistory_consumeditems_history', 'foodhistory_id');
1603916036
ALTER TABLE foodhistory_consumeditems_history OWNER TO sormas_user;
1604016037

1604116038
ALTER TABLE epidata ADD COLUMN IF NOT EXISTS foodhistory_id bigint REFERENCES foodhistory(id);

sormas-ui/src/main/java/de/symeda/sormas/ui/contact/ContactDataView.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ protected void initView(String params) {
258258
.isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
259259
layout.addSidePanelComponent(new SideComponentLayout(new ImmunizationListComponent(() -> {
260260
ContactDto refreshedContact = FacadeProvider.getContactFacade().getByUuid(getContactRef().getUuid());
261-
return new ImmunizationListCriteria.Builder(refreshedContact.getPerson()).withDisease(refreshedContact.getDisease()).build();
261+
Disease criteriaDisease = refreshedContact.getDisease();
262+
if (criteriaDisease == null && refreshedContact.getCaze() != null) {
263+
CaseDataDto refreshedCase = FacadeProvider.getCaseFacade().getCaseDataByUuid(refreshedContact.getCaze().getUuid());
264+
criteriaDisease = refreshedCase != null ? refreshedCase.getDisease() : null;
265+
}
266+
return new ImmunizationListCriteria.Builder(refreshedContact.getPerson()).withDisease(criteriaDisease).build();
262267
}, null, this::showUnsavedChangesPopup, editAllowed)), IMMUNIZATION_LOC);
263268
} else {
264269
layout.addSidePanelComponent(new SideComponentLayout(new VaccinationListComponent(() -> {
@@ -267,7 +272,11 @@ protected void initView(String params) {
267272
if (refreshedContact.getCaze() != null) {
268273
refreshedCase = FacadeProvider.getCaseFacade().getCaseDataByUuid(refreshedContact.getCaze().getUuid());
269274
}
270-
return new VaccinationCriteria.Builder(refreshedContact.getPerson()).withDisease(refreshedContact.getDisease())
275+
Disease criteriaDisease = refreshedContact.getDisease();
276+
if (criteriaDisease == null && refreshedCase != null) {
277+
criteriaDisease = refreshedCase.getDisease();
278+
}
279+
return new VaccinationCriteria.Builder(refreshedContact.getPerson()).withDisease(criteriaDisease)
271280
.build()
272281
.vaccinationAssociationType(VaccinationAssociationType.CONTACT)
273282
.contactReference(getContactRef())

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/pathogentestlink/PathogenTestListEntry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public PathogenTestListEntry(PathogenTestDto pathogenTest, boolean showTestResul
7373
topLabelLayout.setMargin(false);
7474
topLabelLayout.setWidth(100, Unit.PERCENTAGE);
7575
addComponentToField(topLabelLayout);
76-
Label labelTopLeft = new Label(PathogenTestType.toString(pathogenTest.getTestType(), pathogenTest.getTestTypeText()));
76+
Label labelTopLeft = new Label(
77+
PathogenTestType.toString(pathogenTest.getTestType(), pathogenTest.getTestTypeText(), pathogenTest.getTestedDisease()));
7778
CssStyles.style(labelTopLeft, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
7879
topLabelLayout.addComponent(labelTopLeft);
7980

0 commit comments

Comments
 (0)