Skip to content

Commit

Permalink
[GITFLOW]merging 'release-1.72.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed May 18, 2022
2 parents 8655c59 + db4da56 commit 1715a54
Show file tree
Hide file tree
Showing 481 changed files with 15,477 additions and 4,073 deletions.
2 changes: 1 addition & 1 deletion docs/DEVELOPMENT_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ If you plan to work on the Android App as well, you will also need the **Java 8
- Ensure that the Android SDK installation path does not contain whitespaces; you can also change this later via `Tools -> SDK Manager -> Android SDK Location`
- Open Android Studio and import the `sormas-app` module from the SORMAS-Project repository
- Make a copy of `keystore.properties.example` and rename it to `keystore.properties`
- Make sure to use the JDK version 8 (`File -> Project Structure -> SDK Location -> JDK Location`)
- Make sure to use the JDK version 11 (`File -> Project Structure -> SDK Location -> JDK Location`)
- Build the Android Studio project by executing the Gradle build (this may be done automatically)
- Add an emulator and set the SDK version to the `minSdkVersion` or `targetSdkVersion` from `build.gradle`; we suggest to test your code on both, but `minSdkVersion` should be preferred to ensure compatibility to the minimum supported SDK
- Click on `Run 'app'` to install and run the app on your emulator; enter `http://10.0.2.2:6080/sormas-rest` as the server URL when you start the newly installed app for the first time
Expand Down
5 changes: 3 additions & 2 deletions docs/SERVER_CUSTOMIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ It is possible to adjust the following properties that define how the diseases a
* **`extendedClassificationMulti`:** Whether the three confirmation properties used for extended classification can be specified individually, i.e. users can enter multiple sources of confirmation.

## 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 a row 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 @@ -67,11 +67,12 @@ 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 three 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).
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.
* **`ORIGIN`**: This is currently only implemented for travel entries and means that the report date of the entity will be used. If this is specified for any other entity, the deletion job will be stopped and throw an error.
* **`MANUAL_DELETION`**: The date on which the entity was manually deleted by a user.

## Infrastructure Data
When you start a SORMAS server for the first time and the `createDefaultEntities` property is enabled, some default infrastructure data is generated to ensure that the server is usable and the default users can be created.
Expand Down
2 changes: 1 addition & 1 deletion 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.71.0</version>
<version>1.72.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ public interface ConfigFacade {

SormasToSormasConfig getS2SConfig();

Boolean isS2SConfigured();

String getExternalSurveillanceToolGatewayUrl();

boolean isExternalSurveillanceToolGatewayConfigured();

String getExternalSurveillanceToolVersionEndpoint();

String getAuthenticationProvider();
Expand Down Expand Up @@ -145,4 +149,8 @@ public interface ConfigFacade {
String getAuditLoggerConfig();

String getAuditSourceSite();

void setRequestContext(RequestContextTO requestContext);

void resetRequestContext();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Date;
import java.util.List;

import de.symeda.sormas.api.common.DeletionDetails;
import de.symeda.sormas.api.deletionconfiguration.AutomaticDeletionInfoDto;
import de.symeda.sormas.api.utils.criteria.BaseCriteria;

Expand All @@ -28,7 +29,7 @@ public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializabl

boolean isArchived(String uuid);

void delete(String uuid);
void delete(String uuid, DeletionDetails deletionDetails);

boolean exists(String uuid);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* 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;

public final class RequestContextHolder {

private static final ThreadLocal<RequestContextTO> threadLocalContext = new ThreadLocal<>();

private RequestContextHolder() {
}

public static void reset() {
threadLocalContext.remove();
}

public static boolean isMobileSync() {
return threadLocalContext.get() != null ? threadLocalContext.get().isMobileSync() : false;
}

public static void setRequestContext(RequestContextTO requestContext) {
if (requestContext == null) {
reset();
} else {
threadLocalContext.set(requestContext);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* 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;

public class RequestContextTO implements Serializable {

private boolean isMobileSync;

public RequestContextTO(boolean isMobileSync) {
this.isMobileSync = isMobileSync;
}

public boolean isMobileSync() {
return isMobileSync;
}

public void setMobileSync(boolean mobileSync) {
isMobileSync = mobileSync;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
import de.symeda.sormas.api.EntityDto;
import de.symeda.sormas.api.ReferenceDto;
import de.symeda.sormas.api.event.EventReferenceDto;
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.user.UserReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.DependingOnFeatureType;
import de.symeda.sormas.api.utils.FieldConstraints;
import de.symeda.sormas.api.utils.HtmlHelper;
import de.symeda.sormas.api.utils.Required;

@DependingOnFeatureType(featureType = FeatureType.EVENT_SURVEILLANCE)
public class ActionDto extends EntityDto {

private static final long serialVersionUID = 2439546041916003652L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,21 @@
import de.symeda.sormas.api.exposure.GatheringType;
import de.symeda.sormas.api.exposure.HabitationType;
import de.symeda.sormas.api.exposure.WorkEnvironment;
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.location.LocationDto;
import de.symeda.sormas.api.user.UserReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.DependingOnFeatureType;
import de.symeda.sormas.api.utils.FieldConstraints;
import de.symeda.sormas.api.utils.HideForCountries;
import de.symeda.sormas.api.utils.Required;
import de.symeda.sormas.api.utils.SensitiveData;
import de.symeda.sormas.api.utils.pseudonymization.PseudonymizableDto;

@DependingOnFeatureType(featureType = {
FeatureType.CASE_SURVEILANCE,
FeatureType.CONTACT_TRACING })
public class ActivityAsCaseDto extends PseudonymizableDto {

private static final long serialVersionUID = 6551672739041643942L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
package de.symeda.sormas.api.audit;

import javax.ejb.Remote;
import java.util.Date;
import java.util.List;

@Remote
public interface AuditLoggerFacade {

void logRestCall(String path, String method);

void logFailedUiLogin(String caller, String method, String pathInfo);

void logFailedRestLogin(String authorizationHeader, String method, String pathInfo);

void logGetExternalLabMessagesSuccess(Date since, List<String> externalLabMessages, Date start, Date end, String authAlias);

void logExternalLabMessagesHtmlSuccess(String uuid, int length, Date start, Date end, String authAlias);

void logExternalLabMessagesPdfSuccess(String uuid, int length, Date start, Date end, String authAlias);

void logGetExternalLabMessagesError(String outcome, String error, Date start, Date end, String authAlias);

void logExternalLabMessagesHtmlError(String messageUuid, String outcome, String error, Date start, Date end, String authAlias);

void logExternalLabMessagesPdfError(String messageUuid, String outcome, String error, Date start, Date end, String authAlias);

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import de.symeda.sormas.api.EntityDto;
import de.symeda.sormas.api.campaign.diagram.CampaignDashboardElement;
import de.symeda.sormas.api.campaign.form.CampaignFormMetaReferenceDto;
import de.symeda.sormas.api.common.DeletionReason;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.user.UserReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
Expand All @@ -27,6 +28,8 @@ public class CampaignDto extends EntityDto {
public static final String END_DATE = "endDate";
public static final String CREATING_USER = "creatingUser";
public static final String CAMPAIGN_FORM_METAS = "campaignFormMetas";
public static final String DELETION_REASON = "deletionReason";
public static final String OTHER_DELETION_REASON = "otherDeletionReason";

@Size(max = FieldConstraints.CHARACTER_LIMIT_SMALL, message = Validations.textTooLong)
private String name;
Expand All @@ -39,6 +42,11 @@ public class CampaignDto extends EntityDto {
@Valid
private List<CampaignDashboardElement> campaignDashboardElements;

private boolean deleted;
private DeletionReason deletionReason;
@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)
private String otherDeletionReason;

public static CampaignDto build() {
CampaignDto campaign = new CampaignDto();
campaign.setUuid(DataHelper.createUuid());
Expand Down Expand Up @@ -100,4 +108,28 @@ public List<CampaignDashboardElement> getCampaignDashboardElements() {
public void setCampaignDashboardElements(List<CampaignDashboardElement> campaignDashboardElements) {
this.campaignDashboardElements = campaignDashboardElements;
}

public boolean isDeleted() {
return deleted;
}

public void setDeleted(boolean deleted) {
this.deleted = deleted;
}

public DeletionReason getDeletionReason() {
return deletionReason;
}

public void setDeletionReason(DeletionReason deletionReason) {
this.deletionReason = deletionReason;
}

public String getOtherDeletionReason() {
return otherDeletionReason;
}

public void setOtherDeletionReason(String otherDeletionReason) {
this.otherDeletionReason = otherDeletionReason;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import static de.symeda.sormas.api.CountryHelper.COUNTRY_CODE_SWITZERLAND;
import static de.symeda.sormas.api.utils.FieldConstraints.CHARACTER_LIMIT_BIG;

import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.DependingOnUserRight;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand All @@ -37,13 +35,15 @@
import de.symeda.sormas.api.caze.porthealthinfo.PortHealthInfoDto;
import de.symeda.sormas.api.clinicalcourse.ClinicalCourseDto;
import de.symeda.sormas.api.clinicalcourse.HealthConditionsDto;
import de.symeda.sormas.api.common.DeletionReason;
import de.symeda.sormas.api.contact.ContactDto;
import de.symeda.sormas.api.contact.FollowUpStatus;
import de.symeda.sormas.api.contact.QuarantineType;
import de.symeda.sormas.api.disease.DiseaseVariant;
import de.symeda.sormas.api.epidata.EpiDataDto;
import de.symeda.sormas.api.event.EventParticipantDto;
import de.symeda.sormas.api.exposure.ExposureDto;
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.hospitalization.HospitalizationDto;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.infrastructure.community.CommunityReferenceDto;
Expand All @@ -61,7 +61,10 @@
import de.symeda.sormas.api.therapy.TherapyDto;
import de.symeda.sormas.api.travelentry.TravelEntryDto;
import de.symeda.sormas.api.user.UserReferenceDto;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.DependingOnFeatureType;
import de.symeda.sormas.api.utils.DependingOnUserRight;
import de.symeda.sormas.api.utils.Diseases;
import de.symeda.sormas.api.utils.EmbeddedPersonalData;
import de.symeda.sormas.api.utils.FieldConstraints;
Expand All @@ -76,6 +79,7 @@
import de.symeda.sormas.api.utils.pseudonymization.valuepseudonymizers.LatitudePseudonymizer;
import de.symeda.sormas.api.utils.pseudonymization.valuepseudonymizers.LongitudePseudonymizer;

@DependingOnFeatureType(featureType = FeatureType.CASE_SURVEILANCE)
public class CaseDataDto extends SormasToSormasShareableDto {

private static final long serialVersionUID = 5007131477733638086L;
Expand Down Expand Up @@ -214,6 +218,8 @@ public class CaseDataDto extends SormasToSormasShareableDto {
public static final String QUARANTINE_CHANGE_COMMENT = "quarantineChangeComment";

public static final String EXTERNAL_DATA = "externalData";
public static final String DELETION_REASON = "deletionReason";
public static final String OTHER_DELETION_REASON = "otherDeletionReason";

// Fields are declared in the order they should appear in the import template

Expand Down Expand Up @@ -580,6 +586,10 @@ public class CaseDataDto extends SormasToSormasShareableDto {
private String quarantineChangeComment;

private Map<String, String> externalData;
private boolean deleted;
private DeletionReason deletionReason;
@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)
private String otherDeletionReason;

public static CaseDataDto build(PersonReferenceDto person, Disease disease) {
return build(person, disease, HealthConditionsDto.build());
Expand Down Expand Up @@ -1671,6 +1681,30 @@ public void setQuarantineChangeComment(String quarantineChangeComment) {
this.quarantineChangeComment = quarantineChangeComment;
}

public boolean isDeleted() {
return deleted;
}

public void setDeleted(boolean deleted) {
this.deleted = deleted;
}

public DeletionReason getDeletionReason() {
return deletionReason;
}

public void setDeletionReason(DeletionReason deletionReason) {
this.deletionReason = deletionReason;
}

public String getOtherDeletionReason() {
return otherDeletionReason;
}

public void setOtherDeletionReason(String otherDeletionReason) {
this.otherDeletionReason = otherDeletionReason;
}

public Map<String, String> getExternalData() {
return externalData;
}
Expand Down
Loading

0 comments on commit 1715a54

Please sign in to comment.