Skip to content

Commit bc24bf2

Browse files
authored
Merge pull request #13479 from SORMAS-Foundation/13466-error-when-opening-the-sample-directory-as-environmental-surveillance-user
Validating disease for environment samples
2 parents 2320c77 + 190c580 commit bc24bf2

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ private CustomizableEnumValueIndexDto toIndexDto(CustomizableEnumValue entity) {
277277
@Override
278278
@SuppressWarnings("unchecked")
279279
public <T extends CustomizableEnum> T getEnumValue(CustomizableEnumType type, Disease disease, String value) {
280-
if (!enumValues.get(type).getOrDefault(disease, Collections.emptyList()).contains(value)) {
280+
//As of today diseases are not applicable for environment.
281+
if (disease!=null && !enumValues.get(type).getOrDefault(disease, Collections.emptyList()).contains(value)) {
281282
throw new IllegalArgumentException(String.format("Invalid enum value %s for customizable enum type %s", value, type.toString()));
282283
}
283284

@@ -360,7 +361,8 @@ private <T extends CustomizableEnum> T buildCustomizableEnum(
360361
T enumValue = enumClass.getDeclaredConstructor().newInstance();
361362
enumValue.setValue(value);
362363
enumValue.setCaption(enumValuesByLanguage.get(enumClass).get(language).get(value));
363-
enumValue.setProperties(getEnumInfo(type, disease, value).getProperties());
364+
// set the properties if the disease is not null, this disease check is happening in the getEnumInfo method
365+
enumValue.setProperties(getEnumInfo(type, disease, value)!=null?getEnumInfo(type, disease, value).getProperties():null);
364366
return enumValue;
365367
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
366368
throw new RuntimeException(e);

sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataView.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,12 @@ protected void initView(String params) {
254254
layout.addSidePanelComponent(new SideComponentLayout(specialAccessListComponent), SPECIAL_ACCESSES_LOC);
255255
}
256256

257-
SelfReportListComponent selfReportListComponent =
258-
new SelfReportListComponent(SelfReportType.CASE, new SelfReportCriteria().setCaze(new CaseReferenceDto(caze.getUuid())));
259-
SelfReportListComponentLayout selfReportListComponentLayout = new SelfReportListComponentLayout(selfReportListComponent);
260-
layout.addSidePanelComponent(selfReportListComponentLayout, SELF_REPORT_LOC);
261-
257+
if (UiUtil.permitted(FeatureType.SELF_REPORTING)) {
258+
SelfReportListComponent selfReportListComponent =
259+
new SelfReportListComponent(SelfReportType.CASE, new SelfReportCriteria().setCaze(new CaseReferenceDto(caze.getUuid())));
260+
SelfReportListComponentLayout selfReportListComponentLayout = new SelfReportListComponentLayout(selfReportListComponent);
261+
layout.addSidePanelComponent(selfReportListComponentLayout, SELF_REPORT_LOC);
262+
}
262263
if (UiUtil.permitted(FeatureType.SURVEYS)) {
263264
SurveyListComponentLayout surveyList = new SurveyListComponentLayout(
264265
caze.toReference(),

0 commit comments

Comments
 (0)