Skip to content

Commit e0a2e7e

Browse files
author
jenkins
committed
[GITFLOW]merging 'release-1.76.0' into 'master'
2 parents 73d16a9 + df8f67d commit e0a2e7e

File tree

1,032 files changed

+26166
-8913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,032 files changed

+26166
-8913
lines changed

.github/workflows/sormas_app_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
# Even though we are using macos machines which should be faster thanks to hardware accelerations (explanation here https://github.com/ReactiveCircus/android-emulator-runner/issues/46)
2929
# The memory footprint of newer android versions (>= 29) and the limitations of the GitHub provided machines is usually resulting in timeout when starting the emulator
30-
api-level: [24, 25, 26, 27, 28]
30+
api-level: [26, 27, 28]
3131

3232
steps:
3333
- name: Checkout repository (with token)

docs/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ If you're interested in participating in the development of SORMAS, please follo
8585
If you have problems setting up your development environment or need assistance in choosing the first issue to work on, please get in touch with us by joining our [Gitter channel](https://gitter.im/SORMAS-Project) or contacting us at sormas@helmholtz-hzi.de.
8686
Additionally, our [Wiki](https://github.com/hzi-braunschweig/SORMAS-Project/wiki) contains some specific development guides that cover common issues like adding new fields to an entity that we suggest to check out before you start implementing something related to those topics.
8787

88+
* [Technical User Guides](https://github.com/hzi-braunschweig/SORMAS-Project/wiki#technical-user-guides)
89+
* [Development Guides](https://github.com/hzi-braunschweig/SORMAS-Project/wiki#development-guides)
90+
8891
### Development Contributing Guidelines
8992

9093
In addition to the guidelines covered in the Development Environment Setup Instructions, please ensure to adhere to the following principles and procedures while developing code for SORMAS:

docs/SERVER_CUSTOMIZATION.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ Changing these entries overrides that default value. Unlike with features, disea
4848
[This Wiki page](https://github.com/hzi-braunschweig/SORMAS-Project/wiki/Disease-Configuration-Options) contains a list and explanation of all currently configurable disease properties.
4949

5050
## Deletion Configuration
51-
SORMAS can be set up to automatically delete entities after a specific time period. There are seven core entities for which automatic deletion can be enabled and configured: *Case, Contact, Event, Event Participant, Immunization, Travel Entry, and Campaign.* This configuration is currently only possible directly in the database via the `deleteconfiguration` table, which already contains rows for each of these entities. The table consists of the following columns:
51+
SORMAS can be set up to automatically delete entities after a specific time period.
52+
There are seven core entities for which automatic deletion can be enabled and configured: *Case, Contact, Event, Event Participant, Immunization, Travel Entry, and Campaign.*
53+
This configuration is currently only possible directly in the database via the `deleteconfiguration` table, which already contains rows for each of these entities.
54+
The table consists of the following columns:
5255

5356
* **`entityType`:** The name of the entity that supports automatic deletion.
5457
* **`deletionReference`:** The reference date for the calculation of the date on which deletion takes place (see below).
@@ -57,7 +60,8 @@ SORMAS can be set up to automatically delete entities after a specific time peri
5760
Both `deletionReference` and `deletionPeriod` need to be filled in order for the automatic deletion to take place. Entities for which at least one of these fields is left empty will not be automatically deleted. Deletion is executed via a nightly cron job and might therefore not happen immediately when the deletion date has been reached.
5861

5962
### Deletion Reference
60-
The `deletionReference` field has four possible values which define the date that is used to calculate whether an entity needs to be deleted (i.e., when the date calculated by subtracting the deletion period from the current date is before the deletion reference date, the entity is deleted). A `MANUAL_DELETION` entry can exist in parallel to one of the other entries, and if both entries are configured, deletion is executed as soon as the threshold of one of these entries is met.
63+
The `deletionReference` field has four possible values which define the date that is used to calculate whether an entity needs to be deleted (i.e., when the date calculated by subtracting the deletion period from the current date is before the deletion reference date, the entity is deleted).
64+
A `MANUAL_DELETION` entry can exist in parallel to one of the other entries, and if both entries are configured, deletion is executed as soon as the threshold of one of these entries is met.
6165

6266
* **`CREATION`**: The creation date of the entity will be used.
6367
* **`END`**: The latest change date of the entity itself and any of its depending entities will be used. E.g. for cases, this includes but is not limited to its epi data, symptoms, or hospitalization.
@@ -92,16 +96,14 @@ SORMAS comes with an extensive list of user rights that are used to check which
9296
To cover the typical use cases, SORMAS defines a set of default user roles that are automatically created when setting up a SORMAS instance.
9397

9498
Most user rights define an action related to an entity type, e.g. the user right *CASE_EDIT* allows users to edit case data.
95-
The following automatically generated document **lists and describes all user rights and the default user roles**:
96-
https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/resources/doc/SORMAS_User_Rights.xlsx
99+
The following automatically generated documents list and describe **all user rights and the default user roles**:
100+
* [https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/resources/doc/SORMAS_User_Roles.xlsx](https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/resources/doc/SORMAS_User_Roles.xlsx)
97101

98-
User roles are fully configurable, allowing admins to create new user roles and edit existing ones, to customize the instance to the given needs and to make sure data protection requirements are fulfilled.
99-
100-
At this point the configuration has to be done in the database, a user interface to configure user roles will be implemented starting sprint 117 (see #4462 and #4463).
102+
User roles are fully configurable, allowing admins to create new user roles and edit existing ones, to customize the instance to the given needs and to make sure data protection requirements are fulfilled.
101103

102104
### Related topics
103105

104106
* Epic that introduced configurable user roles: #898
105-
* Data access based on user rights and user's jurisdiction: https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-backend/doc/UserDataAccess.md
106-
* Using keycloak as authentication provider: https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/docs/SERVER_SETUP.md#keycloak-server
107-
* The available jurisdiction levels (nation, region, district, health facility, etc.) are defined in Java code (https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/java/de/symeda/sormas/api/user/JurisdictionLevel.java)
107+
* Data access based on user rights and user's jurisdiction: [https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-backend/doc/UserDataAccess.md](https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-backend/doc/UserDataAccess.md)
108+
* Using keycloak as authentication provider: [https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/docs/SERVER_SETUP.md#keycloak-server](https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/docs/SERVER_SETUP.md#keycloak-server)
109+
* The available jurisdiction levels (nation, region, district, health facility, etc.) are defined in Java code [https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/java/de/symeda/sormas/api/user/JurisdictionLevel.java](https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/java/de/symeda/sormas/api/user/JurisdictionLevel.java)

docs/TROUBLESHOOTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,25 @@ Performance logging can be used to find out which part of the code or system mig
3333
Performance logs can be analyzed in detail using the `PerformanceLogAnalysisGenerator`. To use this tool, set the `PerformanceLoggingInterceptor`'s log level
3434
to `TRACE` as described above and reproduce the scenario you want to investigate on the server instance.
3535

36-
After this, process the debug log file (default path: `/opt/domains/sormas/logs/application.debug`) using the `PerformanceLogAnalysisGenerator`. This will
36+
After this, process the debug log file (default path: `/opt/domains/sormas/logs/application.debug`) using the `PerformanceLogAnalysisGenerator`.
37+
The log file's path is specified as the program argument when calling `PerformanceLogAnalysisGenerator`'s `main` method. Processing the log file will
3738
generate three files (`<logfileName>.csv`, `<logfileName>.txt`, `<logfileName>.html`) to further investigate method runtimes.
3839

3940
`<logfileName>.html` provides a navigable overview of methods along with runtime statistics (total, min, max and average time) and calls to sub methods.
4041

42+
Sometimes it is convenient to analyze a number of different scenarios in a row. To do so, produce snippets of the `application.debug` log using `tail` for each
43+
of the scenarios to be investigated:
44+
45+
1. start `tail -f <logfileName> > <snippetDirectory>/<snippet.debug>`
46+
47+
2. replay the steps to be analyzed
48+
49+
3. stop `tail -f`
50+
51+
The `PerformanceLogAnalysisGenerator` can now batch process all of the snippets by pointing to the directory instead of a log file.
52+
Calling `PerformanceLogAnalysisGenerator.main` with argument `<snippetDirectory>` generates the analysis files (`.csv`, `.txt`, `.html`)
53+
for each file `*.debug` in this directory. The generated files will be placed in `<snippetDirectory>`, too.
54+
4155
### Log Slow SQL Queries in PostgreSQL
4256

4357
You can enable the logging of slow SQL queries in your PostgreSQL server in `postgresql.conf`:

openapi/external_visits_API.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@
210210
"type" : "object",
211211
"properties" : {
212212
"uuid" : {
213+
"maxLength" : 36,
214+
"minLength" : 20,
215+
"pattern" : "^[0-9a-zA-Z-]*$",
213216
"type" : "string"
214217
},
215218
"pseudonymized" : {

openapi/external_visits_API.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ components:
355355
type: object
356356
properties:
357357
uuid:
358+
maxLength: 36
359+
minLength: 20
360+
pattern: "^[0-9a-zA-Z-]*$"
358361
type: string
359362
pseudonymized:
360363
type: boolean

sormas-api/pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<groupId>de.symeda.sormas</groupId>
44
<artifactId>sormas-base</artifactId>
5-
<version>1.75.4</version>
5+
<version>1.76.0</version>
66
<relativePath>../sormas-base</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
@@ -32,11 +32,6 @@
3232
<artifactId>javaee-web-api</artifactId>
3333
</dependency>
3434

35-
<dependency>
36-
<groupId>joda-time</groupId>
37-
<artifactId>joda-time</artifactId>
38-
</dependency>
39-
4035
<dependency>
4136
<groupId>com.opencsv</groupId>
4237
<artifactId>opencsv</artifactId>
@@ -103,6 +98,12 @@
10398
<scope>test</scope>
10499
</dependency>
105100

101+
<dependency>
102+
<groupId>ch.qos.logback</groupId>
103+
<artifactId>logback-classic</artifactId>
104+
<scope>test</scope>
105+
</dependency>
106+
106107
</dependencies>
107108

108109
</project>

sormas-api/src/main/java/de/symeda/sormas/api/CoreFacade.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializabl
4646
void dearchive(List<String> entityUuids, String dearchiveReason);
4747

4848
default void setArchiveInExternalSurveillanceToolForEntity(String uuid, boolean archived) throws ExternalSurveillanceToolException {
49-
};
49+
}
5050

5151
default void setArchiveInExternalSurveillanceToolForEntities(List<String> uuid, boolean archived) throws ExternalSurveillanceToolException {
52-
};
52+
}
5353

5454
Date calculateEndOfProcessingDate(String entityUuids);
5555

56-
EditPermissionType isEditAllowed(String uuid);
56+
EditPermissionType getEditPermissionType(String uuid);
57+
58+
boolean isEditAllowed(String uuid);
5759

5860
}

sormas-api/src/main/java/de/symeda/sormas/api/EditPermissionType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
public enum EditPermissionType {
44
ALLOWED,
55
ARCHIVING_STATUS_ONLY,
6-
REFUSED
6+
REFUSED,
7+
DOCUMENTS_ONLY
78
}

sormas-api/src/main/java/de/symeda/sormas/api/EntityDto.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
/*******************************************************************************
1+
/*
22
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3-
* Copyright © 2016-2018 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4-
*
3+
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
54
* This program is free software: you can redistribute it and/or modify
65
* it under the terms of the GNU General Public License as published by
76
* the Free Software Foundation, either version 3 of the License, or
87
* (at your option) any later version.
9-
*
108
* This program is distributed in the hope that it will be useful,
119
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1210
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1311
* GNU General Public License for more details.
14-
*
1512
* You should have received a copy of the GNU General Public License
1613
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17-
*******************************************************************************/
14+
*/
1815
package de.symeda.sormas.api;
1916

2017
import java.io.Serializable;
@@ -28,9 +25,12 @@
2825
import com.fasterxml.jackson.annotation.JsonIgnore;
2926
import com.fasterxml.jackson.annotation.JsonInclude;
3027

28+
import de.symeda.sormas.api.audit.AuditInclude;
29+
import de.symeda.sormas.api.audit.AuditedClass;
3130
import de.symeda.sormas.api.i18n.Validations;
3231
import de.symeda.sormas.api.utils.FieldConstraints;
3332
import de.symeda.sormas.api.utils.Outbreaks;
33+
import de.symeda.sormas.api.uuid.HasUuid;
3434

3535
/**
3636
* All inheriting classes of EntityDto must include a build() method that sets
@@ -41,6 +41,7 @@
4141
* will reduce data transferred to something between 20% and 50% -
4242
* especially for fields that are not needed for all diseases
4343
*/
44+
@AuditedClass
4445
@JsonInclude(JsonInclude.Include.NON_NULL)
4546
public abstract class EntityDto implements Serializable, Cloneable, HasUuid {
4647

@@ -56,6 +57,7 @@ public abstract class EntityDto implements Serializable, Cloneable, HasUuid {
5657
@Outbreaks
5758
@Pattern(regexp = UUID_REGEX, message = Validations.uuidPatternNotMatching)
5859
@Size(min = FieldConstraints.CHARACTER_LIMIT_UUID_MIN, max = FieldConstraints.CHARACTER_LIMIT_UUID_MAX, message = Validations.textSizeNotInRange)
60+
@AuditInclude
5961
private String uuid;
6062

6163
protected EntityDto() {

sormas-api/src/main/java/de/symeda/sormas/api/EntityDtoAccessHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.HashMap;
2323
import java.util.Map;
2424

25+
import de.symeda.sormas.api.uuid.HasUuid;
2526
import org.apache.commons.lang3.StringUtils;
2627

2728
import de.symeda.sormas.api.caze.BirthDateDto;

sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@
8282
import de.symeda.sormas.api.share.ExternalShareInfoFacade;
8383
import de.symeda.sormas.api.sormastosormas.SormasToSormasEncryptionFacade;
8484
import de.symeda.sormas.api.sormastosormas.SormasToSormasFacade;
85-
import de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseFacade;
86-
import de.symeda.sormas.api.sormastosormas.contact.SormasToSormasContactFacade;
87-
import de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventFacade;
88-
import de.symeda.sormas.api.sormastosormas.externalmessage.SormasToSormasExternalMessageFacade;
89-
import de.symeda.sormas.api.sormastosormas.shareinfo.SormasToSormasShareInfoFacade;
90-
import de.symeda.sormas.api.sormastosormas.sharerequest.SormasToSormasShareRequestFacade;
85+
import de.symeda.sormas.api.sormastosormas.entities.caze.SormasToSormasCaseFacade;
86+
import de.symeda.sormas.api.sormastosormas.entities.contact.SormasToSormasContactFacade;
87+
import de.symeda.sormas.api.sormastosormas.entities.event.SormasToSormasEventFacade;
88+
import de.symeda.sormas.api.sormastosormas.entities.externalmessage.SormasToSormasExternalMessageFacade;
89+
import de.symeda.sormas.api.sormastosormas.share.incoming.SormasToSormasShareRequestFacade;
90+
import de.symeda.sormas.api.sormastosormas.share.outgoing.ShareRequestInfoFacade;
91+
import de.symeda.sormas.api.sormastosormas.share.outgoing.SormasToSormasShareInfoFacade;
9192
import de.symeda.sormas.api.symptoms.SymptomsFacade;
9293
import de.symeda.sormas.api.systemevents.SystemEventFacade;
9394
import de.symeda.sormas.api.systemevents.sync.SyncFacade;
@@ -459,6 +460,10 @@ public static SormasToSormasShareRequestFacade getSormasToSormasShareRequestFaca
459460
return get().lookupEjbRemote(SormasToSormasShareRequestFacade.class);
460461
}
461462

463+
public static ShareRequestInfoFacade getShareRequestInfoFacade() {
464+
return get().lookupEjbRemote(ShareRequestInfoFacade.class);
465+
}
466+
462467
public static CustomizableEnumFacade getCustomizableEnumFacade() {
463468
return get().lookupEjbRemote(CustomizableEnumFacade.class);
464469
}

sormas-api/src/main/java/de/symeda/sormas/api/MergeableIndexDto.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package de.symeda.sormas.api;
2020

21+
import de.symeda.sormas.api.uuid.HasUuid;
22+
2123
public interface MergeableIndexDto extends HasUuid {
2224
/**
2325
*

sormas-api/src/main/java/de/symeda/sormas/api/ReferenceDto.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
/*******************************************************************************
1+
/*
22
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3-
* Copyright © 2016-2018 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4-
*
3+
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
54
* This program is free software: you can redistribute it and/or modify
65
* it under the terms of the GNU General Public License as published by
76
* the Free Software Foundation, either version 3 of the License, or
87
* (at your option) any later version.
9-
*
108
* This program is distributed in the hope that it will be useful,
119
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1210
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1311
* GNU General Public License for more details.
14-
*
1512
* You should have received a copy of the GNU General Public License
1613
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17-
*******************************************************************************/
14+
*/
15+
1816
package de.symeda.sormas.api;
1917

2018
import java.io.Serializable;
@@ -23,29 +21,33 @@
2321

2422
import org.apache.commons.lang3.ObjectUtils;
2523

24+
import de.symeda.sormas.api.audit.AuditInclude;
25+
import de.symeda.sormas.api.audit.AuditedClass;
2626
import de.symeda.sormas.api.i18n.Validations;
2727
import de.symeda.sormas.api.utils.Required;
28+
import de.symeda.sormas.api.uuid.HasUuid;
2829

29-
@SuppressWarnings("serial")
30+
@AuditedClass
3031
public abstract class ReferenceDto implements Serializable, HasUuid, Comparable<ReferenceDto> {
3132

3233
public static final String CAPTION = "caption";
3334
public static final String NO_REFERENCE_UUID = "SORMAS-CONSTID-NO-REFERENCE";
3435

3536
@Required
37+
@AuditInclude
3638
@Pattern(regexp = UUID_REGEX, message = Validations.uuidPatternNotMatching)
3739
private String uuid;
3840
private String caption;
3941

40-
public ReferenceDto() {
42+
protected ReferenceDto() {
4143

4244
}
4345

44-
public ReferenceDto(String uuid) {
46+
protected ReferenceDto(String uuid) {
4547
this.uuid = uuid;
4648
}
4749

48-
public ReferenceDto(String uuid, String caption) {
50+
protected ReferenceDto(String uuid, String caption) {
4951
this.uuid = uuid;
5052
this.caption = caption;
5153
}

sormas-api/src/main/java/de/symeda/sormas/api/action/ActionHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import java.util.Date;
2121

22-
import org.joda.time.DateTime;
22+
import de.symeda.sormas.api.utils.UtilDate;
2323

2424
public final class ActionHelper {
2525

@@ -28,6 +28,6 @@ private ActionHelper() {
2828
}
2929

3030
public static Date getDefaultDate() {
31-
return new DateTime().toDate();
31+
return UtilDate.now();
3232
}
3333
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package de.symeda.sormas.api.audit;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* This annotation is used to mark fields (in DTOs or certain important classes referenced by DTO fields) which should
10+
* be included in the audit log. It can be applied to fields and, if need be, to methods returning a specifically
11+
* crafted audit representation. The audit logger will pick up the field if the containing class is annotated
12+
* with {@link AuditedClass}.
13+
*/
14+
@Retention(RetentionPolicy.RUNTIME)
15+
@Target({
16+
ElementType.FIELD,
17+
ElementType.METHOD })
18+
public @interface AuditInclude {
19+
}

0 commit comments

Comments
 (0)