Skip to content

Commit

Permalink
[GITFLOW]merging 'release-1.76.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Oct 14, 2022
2 parents 73d16a9 + df8f67d commit e0a2e7e
Show file tree
Hide file tree
Showing 1,032 changed files with 26,166 additions and 8,913 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sormas_app_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
matrix:
# 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)
# 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
api-level: [24, 25, 26, 27, 28]
api-level: [26, 27, 28]

steps:
- name: Checkout repository (with token)
Expand Down
3 changes: 3 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ If you're interested in participating in the development of SORMAS, please follo
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 [email protected].
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.

* [Technical User Guides](https://github.com/hzi-braunschweig/SORMAS-Project/wiki#technical-user-guides)
* [Development Guides](https://github.com/hzi-braunschweig/SORMAS-Project/wiki#development-guides)

### Development Contributing Guidelines

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:
Expand Down
22 changes: 12 additions & 10 deletions docs/SERVER_CUSTOMIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ Changing these entries overrides that default value. Unlike with features, disea
[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.

## Deletion Configuration
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:
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:

* **`entityType`:** The name of the entity that supports automatic deletion.
* **`deletionReference`:** The reference date for the calculation of the date on which deletion takes place (see below).
Expand All @@ -57,7 +60,8 @@ SORMAS can be set up to automatically delete entities after a specific time peri
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.

### Deletion Reference
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.
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.

* **`CREATION`**: The creation date of the entity will be used.
* **`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.
Expand Down Expand Up @@ -92,16 +96,14 @@ SORMAS comes with an extensive list of user rights that are used to check which
To cover the typical use cases, SORMAS defines a set of default user roles that are automatically created when setting up a SORMAS instance.

Most user rights define an action related to an entity type, e.g. the user right *CASE_EDIT* allows users to edit case data.
The following automatically generated document **lists and describes all user rights and the default user roles**:
https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-api/src/main/resources/doc/SORMAS_User_Rights.xlsx
The following automatically generated documents list and describe **all user rights and the default user roles**:
* [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)

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.

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).
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.

### Related topics

* Epic that introduced configurable user roles: #898
* Data access based on user rights and user's jurisdiction: https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/sormas-backend/doc/UserDataAccess.md
* Using keycloak as authentication provider: https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/docs/SERVER_SETUP.md#keycloak-server
* 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)
* 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)
* 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)
* 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)
16 changes: 15 additions & 1 deletion docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,25 @@ Performance logging can be used to find out which part of the code or system mig
Performance logs can be analyzed in detail using the `PerformanceLogAnalysisGenerator`. To use this tool, set the `PerformanceLoggingInterceptor`'s log level
to `TRACE` as described above and reproduce the scenario you want to investigate on the server instance.

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

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

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
of the scenarios to be investigated:

1. start `tail -f <logfileName> > <snippetDirectory>/<snippet.debug>`

2. replay the steps to be analyzed

3. stop `tail -f`

The `PerformanceLogAnalysisGenerator` can now batch process all of the snippets by pointing to the directory instead of a log file.
Calling `PerformanceLogAnalysisGenerator.main` with argument `<snippetDirectory>` generates the analysis files (`.csv`, `.txt`, `.html`)
for each file `*.debug` in this directory. The generated files will be placed in `<snippetDirectory>`, too.

### Log Slow SQL Queries in PostgreSQL

You can enable the logging of slow SQL queries in your PostgreSQL server in `postgresql.conf`:
Expand Down
3 changes: 3 additions & 0 deletions openapi/external_visits_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
"type" : "object",
"properties" : {
"uuid" : {
"maxLength" : 36,
"minLength" : 20,
"pattern" : "^[0-9a-zA-Z-]*$",
"type" : "string"
},
"pseudonymized" : {
Expand Down
3 changes: 3 additions & 0 deletions openapi/external_visits_API.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ components:
type: object
properties:
uuid:
maxLength: 36
minLength: 20
pattern: "^[0-9a-zA-Z-]*$"
type: string
pseudonymized:
type: boolean
Expand Down
13 changes: 7 additions & 6 deletions sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.75.4</version>
<version>1.76.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -32,11 +32,6 @@
<artifactId>javaee-web-api</artifactId>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>

<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
Expand Down Expand Up @@ -103,6 +98,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
8 changes: 5 additions & 3 deletions sormas-api/src/main/java/de/symeda/sormas/api/CoreFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializabl
void dearchive(List<String> entityUuids, String dearchiveReason);

default void setArchiveInExternalSurveillanceToolForEntity(String uuid, boolean archived) throws ExternalSurveillanceToolException {
};
}

default void setArchiveInExternalSurveillanceToolForEntities(List<String> uuid, boolean archived) throws ExternalSurveillanceToolException {
};
}

Date calculateEndOfProcessingDate(String entityUuids);

EditPermissionType isEditAllowed(String uuid);
EditPermissionType getEditPermissionType(String uuid);

boolean isEditAllowed(String uuid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public enum EditPermissionType {
ALLOWED,
ARCHIVING_STATUS_ONLY,
REFUSED
REFUSED,
DOCUMENTS_ONLY
}
14 changes: 8 additions & 6 deletions sormas-api/src/main/java/de/symeda/sormas/api/EntityDto.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
/*******************************************************************************
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*******************************************************************************/
*/
package de.symeda.sormas.api;

import java.io.Serializable;
Expand All @@ -28,9 +25,12 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

import de.symeda.sormas.api.audit.AuditInclude;
import de.symeda.sormas.api.audit.AuditedClass;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.utils.FieldConstraints;
import de.symeda.sormas.api.utils.Outbreaks;
import de.symeda.sormas.api.uuid.HasUuid;

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

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

protected EntityDto() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;

import de.symeda.sormas.api.uuid.HasUuid;
import org.apache.commons.lang3.StringUtils;

import de.symeda.sormas.api.caze.BirthDateDto;
Expand Down
17 changes: 11 additions & 6 deletions sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@
import de.symeda.sormas.api.share.ExternalShareInfoFacade;
import de.symeda.sormas.api.sormastosormas.SormasToSormasEncryptionFacade;
import de.symeda.sormas.api.sormastosormas.SormasToSormasFacade;
import de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseFacade;
import de.symeda.sormas.api.sormastosormas.contact.SormasToSormasContactFacade;
import de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventFacade;
import de.symeda.sormas.api.sormastosormas.externalmessage.SormasToSormasExternalMessageFacade;
import de.symeda.sormas.api.sormastosormas.shareinfo.SormasToSormasShareInfoFacade;
import de.symeda.sormas.api.sormastosormas.sharerequest.SormasToSormasShareRequestFacade;
import de.symeda.sormas.api.sormastosormas.entities.caze.SormasToSormasCaseFacade;
import de.symeda.sormas.api.sormastosormas.entities.contact.SormasToSormasContactFacade;
import de.symeda.sormas.api.sormastosormas.entities.event.SormasToSormasEventFacade;
import de.symeda.sormas.api.sormastosormas.entities.externalmessage.SormasToSormasExternalMessageFacade;
import de.symeda.sormas.api.sormastosormas.share.incoming.SormasToSormasShareRequestFacade;
import de.symeda.sormas.api.sormastosormas.share.outgoing.ShareRequestInfoFacade;
import de.symeda.sormas.api.sormastosormas.share.outgoing.SormasToSormasShareInfoFacade;
import de.symeda.sormas.api.symptoms.SymptomsFacade;
import de.symeda.sormas.api.systemevents.SystemEventFacade;
import de.symeda.sormas.api.systemevents.sync.SyncFacade;
Expand Down Expand Up @@ -459,6 +460,10 @@ public static SormasToSormasShareRequestFacade getSormasToSormasShareRequestFaca
return get().lookupEjbRemote(SormasToSormasShareRequestFacade.class);
}

public static ShareRequestInfoFacade getShareRequestInfoFacade() {
return get().lookupEjbRemote(ShareRequestInfoFacade.class);
}

public static CustomizableEnumFacade getCustomizableEnumFacade() {
return get().lookupEjbRemote(CustomizableEnumFacade.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package de.symeda.sormas.api;

import de.symeda.sormas.api.uuid.HasUuid;

public interface MergeableIndexDto extends HasUuid {
/**
*
Expand Down
22 changes: 12 additions & 10 deletions sormas-api/src/main/java/de/symeda/sormas/api/ReferenceDto.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*******************************************************************************
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*******************************************************************************/
*/

package de.symeda.sormas.api;

import java.io.Serializable;
Expand All @@ -23,29 +21,33 @@

import org.apache.commons.lang3.ObjectUtils;

import de.symeda.sormas.api.audit.AuditInclude;
import de.symeda.sormas.api.audit.AuditedClass;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.utils.Required;
import de.symeda.sormas.api.uuid.HasUuid;

@SuppressWarnings("serial")
@AuditedClass
public abstract class ReferenceDto implements Serializable, HasUuid, Comparable<ReferenceDto> {

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

@Required
@AuditInclude
@Pattern(regexp = UUID_REGEX, message = Validations.uuidPatternNotMatching)
private String uuid;
private String caption;

public ReferenceDto() {
protected ReferenceDto() {

}

public ReferenceDto(String uuid) {
protected ReferenceDto(String uuid) {
this.uuid = uuid;
}

public ReferenceDto(String uuid, String caption) {
protected ReferenceDto(String uuid, String caption) {
this.uuid = uuid;
this.caption = caption;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.util.Date;

import org.joda.time.DateTime;
import de.symeda.sormas.api.utils.UtilDate;

public final class ActionHelper {

Expand All @@ -28,6 +28,6 @@ private ActionHelper() {
}

public static Date getDefaultDate() {
return new DateTime().toDate();
return UtilDate.now();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.symeda.sormas.api.audit;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* This annotation is used to mark fields (in DTOs or certain important classes referenced by DTO fields) which should
* be included in the audit log. It can be applied to fields and, if need be, to methods returning a specifically
* crafted audit representation. The audit logger will pick up the field if the containing class is annotated
* with {@link AuditedClass}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({
ElementType.FIELD,
ElementType.METHOD })
public @interface AuditInclude {
}
Loading

0 comments on commit e0a2e7e

Please sign in to comment.