Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 62e3f81

Browse files
author
barnabartha
committed
Merge branch 'development' into feature-2642-PlaceOfResidenceFilterStatistics
# Conflicts: # sormas-api/src/main/java/de/symeda/sormas/api/statistics/StatisticsCaseAttribute.java # sormas-api/src/main/java/de/symeda/sormas/api/statistics/StatisticsCaseCriteria.java # sormas-api/src/main/java/de/symeda/sormas/api/statistics/StatisticsCaseSubAttribute.java # sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseStatisticsFacadeEjb.java # sormas-ui/src/main/java/de/symeda/sormas/ui/statistics/StatisticsFilterResidenceElement.java # sormas-ui/src/main/java/de/symeda/sormas/ui/statistics/StatisticsFilterValuesElement.java # sormas-ui/src/main/java/de/symeda/sormas/ui/statistics/StatisticsView.java
2 parents eaf116b + fadbea1 commit 62e3f81

39 files changed

Lines changed: 1620 additions & 699 deletions

GUIDE_CREATE_CERTIFICATE.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# How to create a new certificate?
2+
3+
This guide explains how to create a new self-signed certificate, used for SORMAS to SORMAS communication.
4+
5+
### Using the certificate generation script
6+
7+
1. Run ``bash ./generate-cert.sh``
8+
2. For the generation of the certificate, the following data is needed: a password, a *Common Name* (CN)
9+
and an *Organization* (O). These may be set in environment variables (recommended), or provided
10+
manually as the script executes.
11+
* The password environment variable should be named ``SORMAS_S2S_CERT_PASS``.
12+
* the *Common Name* environment variable should be named ``SORMAS_S2S_CERT_CN``.<br/>
13+
**Important**: for Germany, this value should be the SurvNet Code Site. <br/>
14+
E.g. *2.03.1.01.*
15+
* the *Organization* (O) environment variable should be named ``SORMAS_S2S_CERT_ORG``.<br/>
16+
**Important**: for Germany, this value should be the name of the Health Department (Gesundheitsamt)
17+
to which the SORMAS instance will be assigned. <br/>
18+
E.g. *GA Braunschweig*
19+
3. After providing the requested data, the certificate files will be generated. <br/>
20+
The generated certificate has a validity of 3 years.
21+
The certificate files will be available in the root SORMAS directory, in the folder ``/sormas2sormas``.
22+
4. The generated ``.p12`` file should not be shared with third parties. <br/>
23+
The generated ``.crt`` file will be verified and shared with other SORMAS instances, from which this instance
24+
will be able to request data. Conversely, in order to enable other SORMAS instances to request data from this
25+
instance, their certificate files should be obtained and added to the local truststore. More details can be found
26+
in the next section.
27+
5. If the ``SORMAS_PROPERTIES`` environment variable is available, the relevant properties will be
28+
automatically set by the script.
29+
* Else, the properties which need to be added will be displayed in the console after the script finishes executing.
30+
* Please note these properties and add them to the ``sormas.properties`` file. This should be located in the
31+
``/domains/sormas`` folder.
32+
* Example output:
33+
```
34+
sormas.properties file was not found.
35+
Please add the following properties to the sormas.properties file:
36+
sormas2sormas.keyAlias=mycertificate
37+
sormas2sormas.keyPassword=changeit
38+
```
39+
40+
### Adding a new certificate to the Truststore
41+

SERVER_CUSTOMIZATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The following properties are currently configurable:
2727
* **Name similarity threshold** *(namesimilaritythreshold)*: This is used when comparing cases or contacts to find duplicates in the system, either in retrospection or during creation or import. The higher the value, the more restrictive the algorithm, i.e. less potential duplicates will be found. It is suggested to play around with this setting to see which value works for your country and language.
2828
* **Dev mode** *(devmode)*: Enabling developer mode will give you access to a tab in the Configuration menu that allows admins to create dummy cases and contacts to quickly fill the database. This is only meant to be used on development or demo systems and should be left disabled for production servers.
2929
* **Infrastructure sync threshold** *(infrastructuresyncthreshold)*: Synchronizing infrastructure data to mobile apps (e.g. regions or health facilities) is done in chunks to avoid connection timeouts. If you expect your users to have very bad internet connection, lowering this threshold could make it easier for them to synchronize this data.
30-
* **Archiving thresholds** *(daysAfterCaseGetsArchived and daysAfterEventGetsArchived)*: The number of days without any changes after which cases/events are automatically archived (i.e. they will no longer be displayed in the normal directories, but still count towards statistics or counts on the dashboard and can still be viewed by users with the respective user right).
30+
* **Archiving thresholds** *(daysAfterCaseGetsArchived and daysAfterEventGetsArchived)*: The number of days without any changes after which cases/events are automatically archived (i.e. they will no longer be displayed in the normal directories, but still count towards statistics or counts on the dashboard and can still be viewed by users with the respective user right). If set to 0, automatic archiving is disabled.
3131
* **Rscript executable** *(rscript.executable)*: The location of the Rscript executable. If you've installed Rscript on your server and specify the path here (the default should work for Linux systems as long as you've used the default install path), network diagrams for transmission chains will be shown in the web app.
3232
* **Symptom journal interface**: Properties used to connect to an external symptom journal service. *interface.symptomjournal.url* is the URL to the website that SORMAS should connect to; *interface.symptomjournal.authurl* is the URL used to authenticate SORMAS at the external service; *interface.symptomjournal.clientid* and *interface.symptomjournal.secret* are the credentials used for the authentication process.
3333
* **Custom branding**: Properties used to apply a custom branding to SORMAS that overrides its name and default logo. Using these properties also alters the sidebar and adds another customizable area to it. If you want to use this feature, set *custombranding* to true. *custombranding.name* is the name that you want to use, *custombranding.logo.path* is the path to the logo that should be used.

SERVER_SETUP.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ This can be conveniently accomplished by executing the R setup script from the S
236236

237237
* Follow the instructions of the script.
238238

239+
## SORMAS to SORMAS Certificate Setup
240+
241+
To be able to communicate with other SORMAS instances, there are some additional steps which need to be taken, in order to set
242+
up the certificate and the truststore. Please see the [related guide](GUIDE_CREATE_CERTIFICATE.md) for detailed instructions regarding
243+
SORMAS to SORMAS setup.
244+
<br/>
239245

240246
## Troubleshooting
241247

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
*******************************************************************************/
1818
package de.symeda.sormas.api;
1919

20+
import javax.naming.InitialContext;
21+
import javax.naming.NamingException;
22+
2023
import de.symeda.sormas.api.action.ActionFacade;
2124
import de.symeda.sormas.api.campaign.CampaignFacade;
2225
import de.symeda.sormas.api.campaign.data.CampaignFormDataFacade;
2326
import de.symeda.sormas.api.campaign.form.CampaignFormMetaFacade;
2427
import de.symeda.sormas.api.caze.CaseFacade;
2528
import de.symeda.sormas.api.caze.CaseStatisticsFacade;
29+
import de.symeda.sormas.api.caze.caseimport.CaseImportFacade;
2630
import de.symeda.sormas.api.caze.classification.CaseClassificationFacade;
2731
import de.symeda.sormas.api.caze.maternalhistory.MaternalHistoryFacade;
2832
import de.symeda.sormas.api.clinicalcourse.ClinicalCourseFacade;
@@ -64,9 +68,6 @@
6468
import de.symeda.sormas.api.visit.VisitFacade;
6569
import de.symeda.sormas.api.visualization.VisualizationFacade;
6670

67-
import javax.naming.InitialContext;
68-
import javax.naming.NamingException;
69-
7071
public class FacadeProvider {
7172

7273
private static final String JNDI_PREFIX = "java:global/sormas-ear/sormas-backend/";
@@ -99,6 +100,10 @@ public static CaseStatisticsFacade getCaseStatisticsFacade() {
99100
return get().lookupEjbRemote(CaseStatisticsFacade.class);
100101
}
101102

103+
public static CaseImportFacade getCaseImportFacade() {
104+
return get().lookupEjbRemote(CaseImportFacade.class);
105+
}
106+
102107
public static ContactFacade getContactFacade() {
103108
return get().lookupEjbRemote(ContactFacade.class);
104109
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.caze.caseimport;
17+
18+
import java.io.Serializable;
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
import de.symeda.sormas.api.caze.CaseDataDto;
23+
import de.symeda.sormas.api.person.PersonDto;
24+
import de.symeda.sormas.api.sample.PathogenTestDto;
25+
import de.symeda.sormas.api.sample.SampleDto;
26+
import de.symeda.sormas.api.user.UserReferenceDto;
27+
28+
public class CaseImportEntities implements Serializable {
29+
30+
private static final long serialVersionUID = -4565794925738392508L;
31+
32+
private final PersonDto person;
33+
private final CaseDataDto caze;
34+
private final List<SampleDto> samples;
35+
private final List<PathogenTestDto> pathogenTests;
36+
37+
public CaseImportEntities(UserReferenceDto reportingUser) {
38+
person = PersonDto.build();
39+
caze = createCase(person, reportingUser);
40+
41+
samples = new ArrayList<>();
42+
pathogenTests = new ArrayList<>();
43+
}
44+
45+
public static CaseDataDto createCase(PersonDto person, UserReferenceDto reportingUser) {
46+
CaseDataDto caze = CaseDataDto.build(person.toReference(), null);
47+
caze.setReportingUser(reportingUser);
48+
49+
return caze;
50+
}
51+
52+
public CaseImportEntities(PersonDto person, CaseDataDto caze) {
53+
this.person = person;
54+
this.caze = caze;
55+
56+
samples = new ArrayList<>();
57+
pathogenTests = new ArrayList<>();
58+
}
59+
60+
public PersonDto getPerson() {
61+
return person;
62+
}
63+
64+
public CaseDataDto getCaze() {
65+
return caze;
66+
}
67+
68+
public List<SampleDto> getSamples() {
69+
return samples;
70+
}
71+
72+
public List<PathogenTestDto> getPathogenTests() {
73+
return pathogenTests;
74+
}
75+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.caze.caseimport;
17+
18+
import javax.ejb.Remote;
19+
20+
import de.symeda.sormas.api.importexport.InvalidColumnException;
21+
22+
@Remote
23+
public interface CaseImportFacade {
24+
25+
ImportLineResultDto<CaseImportEntities> importCaseData(
26+
String[] values,
27+
String[] entityClasses,
28+
String[] entityProperties,
29+
String[][] entityPropertyPaths,
30+
boolean ignoreEmptyEntries)
31+
throws InvalidColumnException;
32+
33+
ImportLineResultDto<CaseImportEntities> updateCaseWithImportData(
34+
String personUuid,
35+
String caseUuid,
36+
String[] values,
37+
String[] entityClasses,
38+
String[][] entityPropertyPaths)
39+
throws InvalidColumnException;
40+
41+
ImportLineResultDto<CaseImportEntities> saveImportedEntities(CaseImportEntities entities);
42+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
package de.symeda.sormas.api.caze.caseimport;
16+
17+
public enum ImportLineResult {
18+
19+
SUCCESS,
20+
ERROR,
21+
DUPLICATE;
22+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.caze.caseimport;
17+
18+
import java.io.Serializable;
19+
20+
public class ImportLineResultDto<E> implements Serializable {
21+
22+
private static final long serialVersionUID = -9004769653154669800L;
23+
24+
private final ImportLineResult result;
25+
private final String message;
26+
private final E importEntities;
27+
28+
private ImportLineResultDto(ImportLineResult result, String message, E importEntities) {
29+
this.result = result;
30+
this.message = message;
31+
this.importEntities = importEntities;
32+
}
33+
34+
public ImportLineResult getResult() {
35+
return result;
36+
}
37+
38+
public String getMessage() {
39+
return message;
40+
}
41+
42+
public E getImportEntities() {
43+
return importEntities;
44+
}
45+
46+
public boolean isError() {
47+
return result == ImportLineResult.ERROR;
48+
}
49+
50+
public boolean isDuplicate() {
51+
return result == ImportLineResult.DUPLICATE;
52+
}
53+
54+
public boolean isSuccess() {
55+
return result == ImportLineResult.SUCCESS;
56+
}
57+
58+
public static <E> ImportLineResultDto<E> successResult() {
59+
return new ImportLineResultDto<>(ImportLineResult.SUCCESS, null, null);
60+
}
61+
62+
public static <E> ImportLineResultDto<E> errorResult(String message) {
63+
return new ImportLineResultDto<>(ImportLineResult.ERROR, message, null);
64+
}
65+
66+
public static <E> ImportLineResultDto<E> duplicateResult(E entities) {
67+
return new ImportLineResultDto<>(ImportLineResult.DUPLICATE, null, entities);
68+
}
69+
}

sormas-api/src/main/java/de/symeda/sormas/api/contact/ContactFacade.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public interface ContactFacade {
4242

4343
ContactDto saveContact(ContactDto dto);
4444

45+
ContactDto saveContact(ContactDto dto, boolean handleChanges);
46+
4547
ContactReferenceDto getReferenceByUuid(String uuid);
4648

4749
List<String> getAllActiveUuids();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ public interface Strings {
460460
String messageAdditionalTestSaved = "messageAdditionalTestSaved";
461461
String messageAggregateReportFound = "messageAggregateReportFound";
462462
String messageAllCampaignFormsValid = "messageAllCampaignFormsValid";
463+
String messageAlreadyEventParticipant = "messageAlreadyEventParticipant";
463464
String messageAnimalContactsHint = "messageAnimalContactsHint";
464465
String messageAreaArchived = "messageAreaArchived";
465466
String messageAreaArchivingNotPossible = "messageAreaArchivingNotPossible";

0 commit comments

Comments
 (0)