Skip to content

Commit

Permalink
[GITFLOW]merging 'release-1.74.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Jul 13, 2022
2 parents bfafc49 + 9f8f00a commit 7ed7604
Show file tree
Hide file tree
Showing 856 changed files with 13,692 additions and 3,752 deletions.
12 changes: 1 addition & 11 deletions docs/SERVER_CUSTOMIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,7 @@ Changing these entries overrides that default value. Unlike with features, disea

**Important: If you're using the mobile app, you also need to update the `changedate` to the current date and time whenever you change a disease configuration!** Otherwise the mobile applications will not be notified about the change.

It is possible to adjust the following properties that define how the diseases are handled:

* **`active`:** Whether this disease is used in this SORMAS instance. The concrete type of usage is specified by the other properties.
* **`primaryDisease`:** Primary diseases are enabled for case surveillance while non-primary diseases can only be used for pathogen testing.
* **`caseBased`:** Case-based diseases can be used to create cases while non-case-based diseases can be used for aggregate reporting.
* **`followUpEnabled`:** Whether follow-up is enabled for this disease, i.e. the follow-up status can be managed and visits can be created.
* **`followUpDuration`:** The minimum duration of follow-up for contacts of this disease.
* **`caseFollowUpDuration`:** The minimum duration of follow-up for cases of this disease.
* **`eventParticipantFollowUpDuration`:** The minimum duration of follow-up for event participants of this disease. Please note that event participant follow-up is not yet implemented.
* **`extendedClassification`:** Whether this disease uses an extended case classification system that allows users to specify whether a case has been clinically, epidemiologically or laboratory-diagnostically confirmed.
* **`extendedClassificationMulti`:** Whether the three confirmation properties used for extended classification can be specified individually, i.e. users can enter multiple sources of confirmation.
[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:
Expand Down
14 changes: 7 additions & 7 deletions docs/SERVER_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ Keycloak can be set up in two ways:

**Setup**

Setting Keycloak up as a standalone installation [Server Installation and Configuration Guide](https://www.keycloak.org/docs/16.1/server_installation/#installation)
* Make sure to configure Keycloak with PostgreSQL Database [Relational Database Setup](https://www.keycloak.org/docs/16.1/server_installation/#_database)
* Set up an Admin User
* Copy the `themes` folder content to `${KEYCLOAK_HOME}/themes` [Deploying Themes](https://www.keycloak.org/docs/16.1/server_development/#deploying-themes)
* Deploy the `sormas-keycloak-service-provider` [Using Keycloak Deployer](https://www.keycloak.org/docs/16.1/server_development/#using-the-keycloak-deployer)
Setting Keycloak up as a standalone installation as described in the [Getting started](https://www.keycloak.org/guides) section of the official guide
* Make sure to configure Keycloak with PostgreSQL [Database](https://www.keycloak.org/server/db)
* Set up an [Admin User](https://www.keycloak.org/docs/latest/server_admin/#creating-the-account-remotely)
* Copy the `themes` folder content to `${KEYCLOAK_HOME}/themes` as described [here](https://www.keycloak.org/docs/18.0/server_development/#_themes)
* Deploy the `sormas-keycloak-service-provider` as described [here](https://www.keycloak.org/docs/18.0/server_development/#_providers)
* Update the `sormas-base/setup/keycloak/SORMAS.json` file by replacing the following placeholders: `${SORMAS_SERVER_URL}`, `${KEYCLOAK_SORMAS_UI_SECRET}`, `${KEYCLOAK_SORMAS_BACKEND_SECRET}`, `${KEYCLOAK_SORMAS_REST_SECRET}`
* Create the SORMAS Realm by importing `sormas-base/setup/keycloak/SORMAS.json` see [Create a New Realm](https://www.keycloak.org/docs/16.1/server_admin/#proc-creating-a-realm_server_administration_guide)
* Create the SORMAS Realm by importing `sormas-base/setup/keycloak/SORMAS.json` see [Create a New Realm](https://www.keycloak.org/docs/18.0/server_admin/#proc-creating-a-realm_server_administration_guide)
* Update the `sormas-*` clients by generating new secrets for them
* Update the realm's email settings to allow sending emails to users

Expand Down Expand Up @@ -182,7 +182,7 @@ Then update `sormas.properties` file in the SORMAS domain with the property `aut
*after setting up Keycloak as one of the described options above*

In case Keycloak is set up alongside an already running instance of SORMAS, these are the steps to follow to make sure already existing users can access the system:
1. Manually create an admin user in Keycloak for the SORMAS realm [Creating a user](https://www.keycloak.org/docs/16.1/server_admin/#proc-creating-user_server_administration_guide) *(username has to be the same as admin's username in SORMAS)*
1. Manually create an admin user in Keycloak for the SORMAS realm [Creating a user](https://www.keycloak.org/docs/18.0/server_admin/#proc-creating-user_server_administration_guide) *(username has to be the same as admin's username in SORMAS)*
2. Login to SORMAS and trigger the **Sync Users** button from the **Users** page
3. This will sync users to Keycloak keeping their original password - see [SORMAS Keycloak Service Provider](sormas-keycloak-service-provider/README.md) for more information about this

Expand Down
71 changes: 9 additions & 62 deletions docs/SERVER_UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,77 +59,24 @@ These are the default users for most user roles, intended to be used on developm

### Standalone installation

Upgrading from Keycloak 12 to 16 following the steps from here <https://www.keycloak.org/docs/16.1/upgrading/#_upgrading>

*16.1.0 doesn't provide a way to upgrade host based installations as there were a lot of changes due to the Wildfly update <https://www.keycloak.org/docs/16.1/upgrading/#migrating-to-16-0-0>*
Follow the official Keycloak upgrade [guide](https://www.keycloak.org/docs/latest/upgrading/).

To update follow this steps:

1. Prerequisites
* Backup the DB
* Backup the current Keycloak configuration
* Download 16.1.0 zip from <https://www.keycloak.org/downloads>
* Extract everything from the archive somewhere on your disk (will call this `KEYCLOAK_HOME_16`)
2. From you current installation (will call this `KEYCLOAK_HOME_12`) directory copy the following into the new installation
* Copy directory `KEYCLOAK_HOME_12/themes/sormas` over to `KEYCLOAK_HOME_16/themes`
* Copy directory `KEYCLOAK_HOME_12/modules/system/layers/keycloak/org/postgresql` over into `KEYCLOAK_HOME_16/modules/system/layers/keycloak/org`
* Copy `KEYCLOAK_HOME_12/standalone/deployments/sormas-keycloak-service-provider-*.jar` over to `KEYCLOAK_HOME_16/standalone/deployments`
3. Edit the `KEYCLOAK_HOME_16/standalone/configuration/standalone.xml`
* Search for `java:jboss/datasources/KeycloakDS` and you should find something like this
```xml
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
```
* Replace it's content with the content from `KEYCLOAK_HOME_12/standalone/configuration/standalone.xml` and you should end up with something like this
```xml
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:postgresql://host:5432/keycloak-db-name</connection-url>
<driver>postgresql</driver>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>keycloak-db-username</user-name>
<password>keycloak-db-password</password>
</security>
</datasource>
```
* Make sure that you replace `keycloak-db-name`, `keycloak-db-username` and `keycloak-db-password` with your actual values
* In the section `<drivers>` bellow, add also this option
```xml
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
```
* You should end up with something like this

```xml
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
```
4. Start Keycloak
* Database will be migrated automatically
* Download the 18.0.1 zip from <https://www.keycloak.org/downloads>
* Extract everything from the archive somewhere on your disk (will call this `KEYCLOAK_HOME_NEW`)

2. From you current installation (will call this `KEYCLOAK_HOME_OLD`) directory copy the following into the new installation
* Copy directory `KEYCLOAK_HOME_OLD/themes/sormas` over to `KEYCLOAK_HOME_NEW/themes`
* Copy `KEYCLOAK_HOME_OLD/providers/sormas-keycloak-service-provider-*.jar` over to `KEYCLOAK_HOME_16/providers`

Upgrading from Keycloak 11 to 12 following the steps from here <https://www.keycloak.org/docs/12.0/upgrading/#_upgrading>
3. Setup Keycloak to use the [Database](https://www.keycloak.org/server/db)
4. Start Keycloak
* Database will be migrated automatically

1. Stop the old server and make sure to remove any open connections to the DB
2. Backup the DB *(once the upgrade is done the old version cannot be used with the new DB version)*
3. Backup the old installation
4. Remove `${OLD_KEYCLOAK_HOME}/standalone/data/tx-object-store/`
5. Download the new Keycloak installation from <https://www.keycloak.org/downloads>
6. Copy the `${NEW_KEYCLOAK_HOME}/standalone/` directory from the previous installation over the directory in the new installation
7. Copy the postgres module from `${OLD_KEYCLOAK_HOME}/modules/system/layers/keycloak/org/` over to the new installation directory
8. Copy the SORMAS themes from `{OLD_KEYCLOAK_HOME}/themes/` over to the new installation directory
9. While the new installation is stopped, run `${NEW_KEYCLOAK_HOME}/bin/jboss-cli.sh ----file=${NEW_KEYCLOAK_HOME}/bin/migrate-standalone.cli` *(`.bat` for Windows)*
10. Start the new Keycloak installation from `${NEW_KEYCLOAK_HOME}/bin/standalone.sh` *(`.bat` for Windows)*

### Docker installation

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.73.2</version>
<version>1.74.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 @@ -22,6 +22,7 @@ public enum AgeGroup {
AGE_75_79,
AGE_80_PLUS;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public enum CaseMeasure {
*/
CASE_INCIDENCE;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
};
}
}
13 changes: 11 additions & 2 deletions sormas-api/src/main/java/de/symeda/sormas/api/CoreFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import java.util.List;

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

public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializable, REF_DTO extends ReferenceDto, CRITERIA extends BaseCriteria>
Expand All @@ -34,14 +35,22 @@ public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializabl

List<DTO> getAllAfter(Date date, Integer batchSize, String lastSynchronizedUuid);

AutomaticDeletionInfoDto getAutomaticDeletionInfo(String uuid);
DeletionInfoDto getAutomaticDeletionInfo(String uuid);

DeletionInfoDto getManuallyDeletionInfo(String uuid);

void archive(String entityUuid, Date endOfProcessingDate);

void archive(List<String> entityUuid);

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);
Expand Down
2 changes: 2 additions & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/Disease.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public enum Disease
this.defaultExtendedClassificationMulti = defaultExtendedClassificationMulti;
}

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand All @@ -130,6 +131,7 @@ public boolean usesSimpleViewForOutbreaks() {
switch (this) {
case CSM:
return true;
//$CASES-OMITTED$
default:
return false;
}
Expand Down
17 changes: 17 additions & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/EntityDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

import de.symeda.sormas.api.i18n.Validations;
Expand Down Expand Up @@ -128,4 +131,18 @@ public EntityDto clone() throws CloneNotSupportedException {

return (EntityDto) super.clone();
}

@JsonIgnore
public String buildCaption() {
return toString();
}

public String i18nPrefix() {
return null;
}

@Override
public String toString() {
return (i18nPrefix() != null ? i18nPrefix() : getClass().getSimpleName()) + StringUtils.SPACE + this.getUuid();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum EntityRelevanceStatus {
ARCHIVED,
ALL;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
4 changes: 3 additions & 1 deletion sormas-api/src/main/java/de/symeda/sormas/api/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public enum Language {
FI(new Locale("fi", "FI"), "dd.MM.yyyy", "dd.MM.yyyy H.mm", "dd.MM"),
PS(new Locale("ps", "AF"), "dd/MM/yyyy", "dd/MM/yyyy HH:mm", "dd/MM"),
FA(new Locale("fa", "AF"), "dd/MM/yyyy", "dd/MM/yyyy HH:mm", "dd/MM"),
CZ(new Locale("cs", "CZ"), "dd.MM.yyyy", "dd.MM.yyyy HH:mm", "dd.MM.");
CZ(new Locale("cs", "CZ"), "dd.MM.yyyy", "dd.MM.yyyy HH:mm", "dd.MM."),
UR_PK(new Locale("ur", "PK"), "dd/MM/yyyy", "dd/MM/yyyy HH:mm", "dd/MM");

/**
* Links locale strings to Languages
Expand Down Expand Up @@ -58,6 +59,7 @@ public enum Language {
this.dayMonthFormat = dayMonthFormat;
}

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
1 change: 1 addition & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/Month.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum Month
NOVEMBER,
DECEMBER;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public String getName() {
return this.name();
}

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
public enum ActionContext {

// XXX: add here new contexts (case, contact, …)
EVENT;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public enum ActionMeasure {
POPULATION_INFORMATION,
OTHER;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum ActionPriority {
NORMAL,
LOW;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum ActionStatus {
IN_PROGRESS,
DONE;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public enum ActivityAsCaseType {
OTHER,
UNKNOWN;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public enum CampaignJurisdictionLevel {
COMMUNITY;

public static CampaignJurisdictionLevel getByJurisdictionLevel(JurisdictionLevel jurisdictionLevel) {
switch (jurisdictionLevel) {

switch (jurisdictionLevel) {
case NATION:
case NONE:
return AREA;
Expand All @@ -22,11 +22,13 @@ public static CampaignJurisdictionLevel getByJurisdictionLevel(JurisdictionLevel
return DISTRICT;
case COMMUNITY:
return COMMUNITY;
//$CASES-OMITTED$
default:
throw new UnsupportedOperationException();
}
}

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum CampaignPhase {
INTRA,
POST;

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public enum CampaignFormElementStyle {
COL_11,
COL_12;

@Override
public String toString() {
return name().toLowerCase().replaceAll("_", "-");
}

public static CampaignFormElementStyle fromString(String stringValue) {
return valueOf(stringValue.toUpperCase().replaceAll("-", "_"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public String[] getAllowedValues() {
return allowedValues;
}

@Override
public String toString() {
return name().toLowerCase().replaceAll("_", "-");
}

public static CampaignFormElementType fromString(String stringValue) {
return valueOf(stringValue.toUpperCase().replaceAll("-", "_"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public String getName() {
return this.name();
}

@Override
public String toString() {
return I18nProperties.getEnumCaption(this);
}
Expand Down
Loading

0 comments on commit 7ed7604

Please sign in to comment.