Skip to content

Commit a37b920

Browse files
committed
Merge branch 'development' of https://github.com/SORMAS-Foundation/SORMAS-Project into feat/ngsurvey-v2
2 parents 3dde832 + 5d78b2f commit a37b920

10 files changed

Lines changed: 504 additions & 91 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/exposure/ExposureDto.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Set;
2121

2222
import javax.validation.Valid;
23+
import javax.validation.constraints.NotNull;
2324
import javax.validation.constraints.Size;
2425

2526
import de.symeda.sormas.api.CountryHelper;
@@ -153,6 +154,7 @@ public class ExposureDto extends PseudonymizableDto {
153154
@SensitiveData
154155
@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)
155156
private String description;
157+
@NotNull(message = Validations.requiredField)
156158
private ExposureType exposureType;
157159
@SensitiveData
158160
@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)

sormas-api/src/main/java/de/symeda/sormas/api/exposure/ExposureType.java

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515

1616
package de.symeda.sormas.api.exposure;
1717

18+
import java.util.Arrays;
19+
import java.util.Collection;
20+
import java.util.Collections;
21+
import java.util.EnumSet;
22+
import java.util.List;
23+
import java.util.Set;
24+
import java.util.stream.Collectors;
25+
1826
import de.symeda.sormas.api.Disease;
1927
import de.symeda.sormas.api.i18n.I18nProperties;
2028
import de.symeda.sormas.api.utils.Diseases;
@@ -24,63 +32,94 @@ public enum ExposureType {
2432
@Diseases(value = {
2533
Disease.CRYPTOSPORIDIOSIS,
2634
Disease.GIARDIASIS }, hide = true)
27-
WORK,
35+
WORK(true),
2836
@Diseases({
2937
Disease.CRYPTOSPORIDIOSIS,
3038
Disease.GIARDIASIS })
31-
TRAVEL,
39+
TRAVEL(true),
3240
@Diseases(value = {
3341
Disease.CRYPTOSPORIDIOSIS,
3442
Disease.GIARDIASIS }, hide = true)
35-
SPORT,
43+
SPORT(false),
3644
@Diseases(value = {
3745
Disease.CRYPTOSPORIDIOSIS,
3846
Disease.GIARDIASIS }, hide = true)
39-
VISIT,
47+
VISIT(false),
4048
@Diseases(value = {
4149
Disease.CRYPTOSPORIDIOSIS,
4250
Disease.GIARDIASIS }, hide = true)
43-
GATHERING,
51+
GATHERING(true),
4452
@Diseases(value = {
4553
Disease.CRYPTOSPORIDIOSIS,
4654
Disease.GIARDIASIS }, hide = true)
47-
HABITATION,
55+
HABITATION(false),
4856
@Diseases(value = {
4957
Disease.CRYPTOSPORIDIOSIS,
5058
Disease.GIARDIASIS }, hide = true)
51-
PERSONAL_SERVICES,
59+
PERSONAL_SERVICES(false),
5260
@Diseases(value = {
5361
Disease.RESPIRATORY_SYNCYTIAL_VIRUS })
54-
CHILDCARE_FACILITY,
62+
CHILDCARE_FACILITY(false),
5563
@Diseases(value = {
5664
Disease.CORONAVIRUS,
5765
Disease.GIARDIASIS,
5866
Disease.CRYPTOSPORIDIOSIS }, hide = true)
59-
BURIAL,
67+
BURIAL(false),
6068
@Diseases(value = {
6169
Disease.CORONAVIRUS }, hide = true)
62-
ANIMAL_CONTACT,
70+
ANIMAL_CONTACT(false),
6371
@Diseases({
6472
Disease.GIARDIASIS,
6573
Disease.CRYPTOSPORIDIOSIS })
66-
RECREATIONAL_WATER,
74+
RECREATIONAL_WATER(false, ExposureCategory.WATER_BORNE),
6775
@Diseases({
6876
Disease.GIARDIASIS,
6977
Disease.CRYPTOSPORIDIOSIS })
70-
FOOD,
78+
FOOD(false, ExposureCategory.FOOD_BORNE),
7179
@Diseases({
7280
Disease.GIARDIASIS,
7381
Disease.CRYPTOSPORIDIOSIS })
74-
SEXUAL_CONTACT,
82+
SEXUAL_CONTACT(false, ExposureCategory.DIRECT_CONTACT),
7583
@Diseases({
7684
Disease.CRYPTOSPORIDIOSIS })
77-
SYMPTOMATIC_CONTACT,
85+
SYMPTOMATIC_CONTACT(false, ExposureCategory.DIRECT_CONTACT),
7886
@Diseases({
7987
Disease.CRYPTOSPORIDIOSIS,
8088
Disease.GIARDIASIS })
81-
FLOOD_EXPOSURE,
82-
OTHER,
83-
UNKNOWN;
89+
FLOOD_EXPOSURE(false, ExposureCategory.WATER_BORNE),
90+
OTHER(true),
91+
UNKNOWN(true);
92+
93+
private final boolean defaultType;
94+
private final Set<ExposureCategory> categories;
95+
96+
ExposureType(boolean defaultType, ExposureCategory... categories) {
97+
this.defaultType = defaultType;
98+
this.categories = categories.length == 0 ? Collections.emptySet() : Collections.unmodifiableSet(EnumSet.copyOf(Arrays.asList(categories)));
99+
}
100+
101+
public boolean isDefaultType() {
102+
return defaultType;
103+
}
104+
105+
public Set<ExposureCategory> getCategories() {
106+
return categories;
107+
}
108+
109+
public static List<ExposureType> getValues(Collection<ExposureCategory> diseaseCategories) {
110+
boolean hasConfig = diseaseCategories != null && !diseaseCategories.isEmpty();
111+
Set<ExposureCategory> configured = hasConfig ? EnumSet.copyOf(diseaseCategories) : EnumSet.noneOf(ExposureCategory.class);
112+
113+
return Arrays.stream(values()).filter(type -> {
114+
if (type.isDefaultType()) {
115+
return true;
116+
}
117+
if (!hasConfig) {
118+
return false;
119+
}
120+
return type.getCategories().stream().anyMatch(configured::contains);
121+
}).collect(Collectors.toList());
122+
}
84123

85124
@Override
86125
public String toString() {

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,6 +3381,7 @@ public interface Captions {
33813381
String titleDiseaseConfigurationGeneral = "titleDiseaseConfigurationGeneral";
33823382
String titleExposureActivitySection = "titleExposureActivitySection";
33833383
String titleExposureLocationSection = "titleExposureLocationSection";
3384+
String titleExposuresGeneralSection = "titleExposuresGeneralSection";
33843385
String titleExposuresSection = "titleExposuresSection";
33853386
String titleNoComplications = "titleNoComplications";
33863387
String to = "to";

sormas-api/src/main/resources/captions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ Exposure.travelPurposeDetails=Reason for travel details
16221622
Exposure.eatingOutVenues=Eating out venues
16231623
Exposure.eatingOutVenueOther=Other venue (please specify)
16241624
Exposure.shoppingForFoodDetails=Shopping for food (location/details)
1625+
titleExposuresGeneralSection=General information
16251626
titleExposuresSection=Exposure details
16261627
titleExposureActivitySection=Activity details
16271628
titleExposureLocationSection=Location of exposure

sormas-backend/src/main/java/de/symeda/sormas/backend/exposure/Exposure.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public void setDescription(String description) {
262262
}
263263

264264
@Enumerated(EnumType.STRING)
265+
@Column(nullable = false)
265266
public ExposureType getExposureType() {
266267
return exposureType;
267268
}

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15996,7 +15996,16 @@ ALTER TABLE symptoms_history ADD COLUMN IF NOT EXISTS flatulence text;
1599615996
ALTER TABLE symptoms_history ADD COLUMN IF NOT EXISTS lossofappetite text;
1599715997
ALTER TABLE symptoms_history ADD COLUMN IF NOT EXISTS smellyburps text;
1599815998

15999-
INSERT INTO schema_version (version_number, comment)
16000-
VALUES (629, '#13832 - External Survey integration');
15999+
INSERT INTO schema_version (version_number, comment) VALUES (629, '#13832 - External Survey integration');
16000+
16001+
UPDATE featureconfiguration
16002+
SET properties = json_build_object(
16003+
'FETCH_MODE', false,
16004+
'FORCE_AUTOMATIC_PROCESSING', true,
16005+
'SURVEY_FETCH_ENABLED', true
16006+
)
16007+
WHERE featuretype = 'EXTERNAL_MESSAGES';
16008+
16009+
INSERT INTO schema_version (version_number, comment) VALUES (630, 'Fix corrupt JSON in featureconfiguration.properties for EXTERNAL_MESSAGES from 629');
1600116010

1600216011
-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. ***

sormas-rest/swagger.json

Lines changed: 163 additions & 7 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)