Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.76.1' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Nov 2, 2022
2 parents e0a2e7e + 2e13506 commit df6204d
Show file tree
Hide file tree
Showing 55 changed files with 461 additions and 145 deletions.
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.76.0</version>
<version>1.76.1</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 @@ -126,7 +126,6 @@ public class EventDto extends SormasToSormasShareableDto {
private EventStatus eventStatus;
private RiskLevel riskLevel;
private SpecificRisk specificRisk;
@NotNull(message = Validations.validEventInvestigationStatus)
private EventInvestigationStatus eventInvestigationStatus;
private Date eventInvestigationStartDate;
private Date eventInvestigationEndDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,28 @@

import javax.validation.constraints.Size;

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.uuid.AbstractUuidDto;

public class ExternalDataDto extends AbstractUuidDto implements HasExternalData {
@AuditedClass
public class ExternalDataDto implements HasExternalData {

@AuditInclude
private String uuid;
@AuditInclude
@Size(max = CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
private String externalId;
@AuditInclude
@Size(max = CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
private String externalToken;

public ExternalDataDto(String uuid) {
super(uuid);
public String getUuid() {
return uuid;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

public String getExternalId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package de.symeda.sormas.api.externalmessage.labmessage;

import com.fasterxml.jackson.annotation.JsonProperty;

import de.symeda.sormas.api.ReferenceDto;
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.utils.DependingOnFeatureType;
Expand All @@ -24,7 +26,7 @@ public class SampleReportReferenceDto extends ReferenceDto {

private static final long serialVersionUID = -5497058456244885735L;

public SampleReportReferenceDto(String uuid) {
public SampleReportReferenceDto(@JsonProperty("uuid") String uuid) {
setUuid(uuid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ public interface Strings {
String messageDatabaseExportFailed = "messageDatabaseExportFailed";
String messageDeleteImmunizationVaccinations = "messageDeleteImmunizationVaccinations";
String messageDeleteReasonNotFilled = "messageDeleteReasonNotFilled";
String messageDeleteWithPendingShareRequest = "messageDeleteWithPendingShareRequest";
String messageDeletionUnsupportedByExternalJournalWarning = "messageDeletionUnsupportedByExternalJournalWarning";
String messageDiseaseNotSpecifiedInLabMessage = "messageDiseaseNotSpecifiedInLabMessage";
String messageDistrictArchived = "messageDistrictArchived";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public interface Validations {
String validDisease = "validDisease";
String validDistrict = "validDistrict";
String validEmailAddress = "validEmailAddress";
String validEventInvestigationStatus = "validEventInvestigationStatus";
String validEventStatus = "validEventStatus";
String validEventTitle = "validEventTitle";
String validFacility = "validFacility";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.sormastosormas;

import de.symeda.sormas.api.i18n.I18nProperties;

public class SormasToSormasRuntimeException extends RuntimeException {

public SormasToSormasRuntimeException(SormasToSormasException exception) {
super(I18nProperties.getString(exception.getI18nTag()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ public interface SormasToSormasEntityInterface {

SormasToSormasEncryptedDataDto getShareTrees(SormasToSormasEncryptedDataDto encryptedData) throws SormasToSormasException;

boolean hasPendingRequest(List<String> entityUuids);
}
10 changes: 5 additions & 5 deletions sormas-api/src/main/resources/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ confirmationDearchiveEvent = Are you sure you want to de-archive this event? Thi
confirmationDearchiveEvents = Are you sure you want to de-archive all %d selected events?
confirmationDearchiveEventParticipant = Are you sure you want to de-archive this event participant? This will make it appear in the normal event participant list again.
confirmationDearchiveEventGroup = Are you sure you want to de-archive this event group? This will make it appear in the normal event group directory again.
confirmationDeleteCases = Are you sure you want to delete all %d selected cases? This action can not be reversed.
confirmationDeleteContacts = Are you sure you want to delete all %d selected contacts? This action can not be reversed.
confirmationDeleteEntity = Are you sure you want to delete this %s? This action can not be reversed.
confirmationDeleteCases = Are you sure you want to delete all %d selected cases?<br/><br/>This action can not be reversed.
confirmationDeleteContacts = Are you sure you want to delete all %d selected contacts?<br/><br/>This action can not be reversed.
confirmationDeleteEntity = Are you sure you want to delete this %s?<br/><br/>This action can not be reversed.
confirmationDeleteEventParticipants = Are you sure you want to delete all %d selected event participants? This action can not be reversed.
confirmationDeleteEvents = Are you sure you want to delete all %d selected events? This action can not be reversed.
confirmationDeleteEvents = Are you sure you want to delete all %d selected events?<br/><br/>This action can not be reversed.
confirmationDeleteTravelEntries = Are you sure you want to delete all %d selected travel entries? This action can not be reversed.
confirmationDeleteFile = Are you sure you want to delete "%s"?
confirmationDeletePathogenTests = Are you sure you want to delete all %d selected pathogen tests? This action can not be reversed.
Expand Down Expand Up @@ -1256,7 +1256,7 @@ messageSormasToSormasSimilarContactFound = There is at least one similar contact
messageSormasToSormasSimilarConvertedContactFound = There is at least one similar contact in your system. If you accept the request the contact maybe will be in your system as a duplicate.</br>If so, you should consolidate the contacts after accepting.</br>After consolidating the contacts, it may be necessary to perform a manual conversion of the accepted contact.</br>Please make sure that you use the accepted contact for this purpose.
messageSormasToSormasSimilarCaseToContactFound = There is at least one similar case in your system.</br>After accepting the request, it may be necessary to perform a manual conversion of the accepted contacts.
messageSormasToSormasSimilarPersonFound = There is at least one similar person in your system. If you accept the request the case/contact maybe will create a person in your system as a duplicate.</br>Please check this after accepting.

messageDeleteWithPendingShareRequest = There is a pending share request. With a deletion, the share request will be revoked and deleted.
# Notifications
notificationCaseClassificationChanged = The classification of case %s has changed to %s.
notificationCaseInvestigationDone = The investigation of case %s has been done.
Expand Down
1 change: 0 additions & 1 deletion sormas-api/src/main/resources/validations.properties
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ validDateRange = Please specify a valid date range
validDisease = You have to specify a valid disease
validDistrict = You have to specify a valid district
validResponsibleDistrict = You have to specify a valid responsible district
validEventInvestigationStatus = You have to specify a valid event investigation status
validEventStatus = You have to specify a valid event status
validEventTitle = You have to specify a valid event title
validFacility = You have to specify a valid health facility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void check(JavaClass javaClass, ConditionEvents events) {
.haveSimpleNameEndingWith("Dto")
.and()
.containAnyFieldsThat(name("uuid"))
.and()
//TODO: #10750 Remove exception from test
.doNotHaveSimpleName("ExternalDataDto")
.should()
.implement(HasUuid.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@

package de.symeda.sormas.app.backend.common;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;
import android.util.Log;

import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.GenericRawResults;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;

import org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Array;
import java.math.BigInteger;
import java.sql.SQLException;
Expand All @@ -46,6 +31,21 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;

import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.GenericRawResults;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;
import android.util.Log;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.caze.VaccinationStatus;
import de.symeda.sormas.api.caze.Vaccine;
Expand Down Expand Up @@ -186,7 +186,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_NAME = "sormas.db";
// any time you make changes to your database objects, you may have to increase the database version

public static final int DATABASE_VERSION = 342;
public static final int DATABASE_VERSION = 343;

private static DatabaseHelper instance = null;

Expand Down Expand Up @@ -3031,6 +3031,19 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
currentVersion = 341;
getDao(UserRole.class).executeRaw("ALTER TABLE userRoles ADD COLUMN linkedDefaultUserRole varchar(255);");

case 342:
currentVersion = 342;

if (columnDoesNotExist("vaccination", "lastOpenedDate")) {
getDao(Vaccination.class).executeRaw("ALTER TABLE vaccination ADD COLUMN lastOpenedDate timestamp;");
}
if (columnDoesNotExist("vaccination", "localChangeDate")) {
getDao(Vaccination.class).executeRaw("ALTER TABLE vaccination ADD COLUMN localChangeDate timestamp;");
}
if (columnDoesNotExist("vaccination", "modified")) {
getDao(Vaccination.class).executeRaw("ALTER TABLE vaccination ADD COLUMN modified SMALLINT DEFAULT 0;");
}

// ATTENTION: break should only be done after last version
break;

Expand Down
2 changes: 1 addition & 1 deletion sormas-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.76.0</version>
<version>1.76.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion sormas-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.76.0</version>
<version>1.76.1</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 @@ -176,6 +176,8 @@
import de.symeda.sormas.api.sample.SampleCriteria;
import de.symeda.sormas.api.sample.SampleDto;
import de.symeda.sormas.api.sormastosormas.ShareTreeCriteria;
import de.symeda.sormas.api.sormastosormas.SormasToSormasException;
import de.symeda.sormas.api.sormastosormas.SormasToSormasRuntimeException;
import de.symeda.sormas.api.symptoms.SymptomsDto;
import de.symeda.sormas.api.symptoms.SymptomsHelper;
import de.symeda.sormas.api.task.TaskContext;
Expand Down Expand Up @@ -308,6 +310,7 @@
import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfoFacadeEjb;
import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfoService;
import de.symeda.sormas.backend.sormastosormas.share.outgoing.ShareInfoHelper;
import de.symeda.sormas.backend.sormastosormas.share.outgoing.ShareRequestInfoService;
import de.symeda.sormas.backend.sormastosormas.share.outgoing.SormasToSormasShareInfo;
import de.symeda.sormas.backend.symptoms.Symptoms;
import de.symeda.sormas.backend.symptoms.SymptomsFacadeEjb;
Expand Down Expand Up @@ -471,6 +474,8 @@ public class CaseFacadeEjb extends AbstractCoreFacadeEjb<Case, CaseDataDto, Case
@EJB
private SormasToSormasCaseFacadeEjbLocal sormasToSormasCaseFacade;
@EJB
private ShareRequestInfoService shareRequestInfoService;
@EJB
private VaccinationFacadeEjb.VaccinationFacadeEjbLocal vaccinationFacade;
@EJB
private HealthConditionsMapper healthConditionsMapper;
Expand Down Expand Up @@ -657,10 +662,8 @@ public List<CaseIndexDetailedDto> getIndexDetailedList(CaseCriteria caseCriteria
Boolean isInJurisdiction = caze.getInJurisdiction();
pseudonymizer.pseudonymizeDto(CaseIndexDetailedDto.class, caze, isInJurisdiction, c -> {
pseudonymizer.pseudonymizeDto(AgeAndBirthDateDto.class, caze.getAgeAndBirthDate(), isInJurisdiction, null);
pseudonymizer.pseudonymizeUser(
userService.getByUuid(caze.getReportingUser().getUuid()),
userService.getCurrentUser(),
caze::setReportingUser);
pseudonymizer
.pseudonymizeUser(userService.getByUuid(caze.getReportingUser().getUuid()), userService.getCurrentUser(), caze::setReportingUser);
});
}

Expand Down Expand Up @@ -2439,7 +2442,8 @@ private void updatePersonAndCaseByOutcome(CaseDataDto existingCase, Case newCase
caseCriteria.setPerson(existingPerson.toReference());
caseCriteria.setOutcome(CaseOutcome.DECEASED);
if (count(caseCriteria, true) == 0) {
newCase.getPerson().setPresentCondition(newCase.getOutcome() == CaseOutcome.UNKNOWN ? PresentCondition.UNKNOWN : PresentCondition.ALIVE);
newCase.getPerson()
.setPresentCondition(newCase.getOutcome() == CaseOutcome.UNKNOWN ? PresentCondition.UNKNOWN : PresentCondition.ALIVE);
newCase.getPerson().setBurialDate(null);
newCase.getPerson().setDeathDate(null);
newCase.getPerson().setDeathPlaceDescription(null);
Expand Down Expand Up @@ -2481,13 +2485,14 @@ private void updatePersonAndCaseByOutcome(CaseDataDto existingCase, Case newCase
PersonDto existingPerson = PersonFacadeEjb.toPersonDto(newCase.getPerson());

if (existingPerson.getCauseOfDeath() == CauseOfDeath.EPIDEMIC_DISEASE
&& existingPerson.getCauseOfDeathDisease() == newCase.getDisease()) {
&& existingPerson.getCauseOfDeathDisease() == newCase.getDisease()) {
// Make sure no other case associated with the person has Outcome=DECEASED
CaseCriteria caseCriteria = new CaseCriteria();
caseCriteria.setPerson(existingPerson.toReference());
caseCriteria.setOutcome(CaseOutcome.DECEASED);
if (count(caseCriteria, true) == 0) {
newCase.getPerson().setPresentCondition(newCase.getOutcome() == CaseOutcome.UNKNOWN ? PresentCondition.UNKNOWN : PresentCondition.ALIVE);
newCase.getPerson()
.setPresentCondition(newCase.getOutcome() == CaseOutcome.UNKNOWN ? PresentCondition.UNKNOWN : PresentCondition.ALIVE);
newCase.getPerson().setBurialDate(null);
newCase.getPerson().setDeathDate(null);
newCase.getPerson().setDeathPlaceDescription(null);
Expand Down Expand Up @@ -2524,7 +2529,8 @@ private void updateCaseAge(CaseDataDto existingCase, Case newCase) {

@Override
@RightsAllowed(UserRight._CASE_DELETE)
public void delete(String caseUuid, DeletionDetails deletionDetails) throws ExternalSurveillanceToolRuntimeException {
public void delete(String caseUuid, DeletionDetails deletionDetails)
throws ExternalSurveillanceToolRuntimeException, SormasToSormasRuntimeException {
Case caze = service.getByUuid(caseUuid);
deleteCase(caze, deletionDetails);
}
Expand All @@ -2539,9 +2545,17 @@ public void deleteWithContacts(String caseUuid, DeletionDetails deletionDetails)
Optional.of(caze.getContacts()).ifPresent(cl -> cl.forEach(c -> contactService.delete(c, deletionDetails)));
}

private void deleteCase(Case caze, DeletionDetails deletionDetails) throws ExternalSurveillanceToolRuntimeException {
private void deleteCase(Case caze, DeletionDetails deletionDetails)
throws ExternalSurveillanceToolRuntimeException, SormasToSormasRuntimeException {

externalJournalService.handleExternalJournalPersonUpdateAsync(caze.getPerson().toReference());

try {
sormasToSormasFacade.revokePendingShareRequests(caze.getSormasToSormasShares());
} catch (SormasToSormasException e) {
throw new SormasToSormasRuntimeException(e);
}

service.delete(caze, deletionDetails);
}

Expand All @@ -2557,8 +2571,8 @@ public List<String> deleteCases(List<String> caseUuids, DeletionDetails deletion
try {
deleteCase(caseToBeDeleted, deletionDetails);
deletedCasesUuids.add(caseToBeDeleted.getUuid());
} catch (ExternalSurveillanceToolRuntimeException e) {
logger.error("The case with uuid:" + caseToBeDeleted.getUuid() + "could not be deleted");
} catch (ExternalSurveillanceToolRuntimeException | SormasToSormasRuntimeException e) {
logger.error("The case with uuid {} could not be deleted", caseToBeDeleted.getUuid(), e);
}
}
});
Expand Down Expand Up @@ -2673,12 +2687,8 @@ public void pseudonymizeDto(Case source, CaseDataDto dto, Pseudonymizer pseudony
if (dto != null) {
pseudonymizer.pseudonymizeDto(CaseDataDto.class, dto, inJurisdiction, c -> {
User currentUser = userService.getCurrentUser();
pseudonymizer
.pseudonymizeUser(source.getReportingUser(), currentUser, dto::setReportingUser);
pseudonymizer.pseudonymizeUser(
source.getClassificationUser(),
currentUser,
dto::setClassificationUser);
pseudonymizer.pseudonymizeUser(source.getReportingUser(), currentUser, dto::setReportingUser);
pseudonymizer.pseudonymizeUser(source.getClassificationUser(), currentUser, dto::setClassificationUser);

pseudonymizer.pseudonymizeDto(
EpiDataDto.class,
Expand Down
Loading

0 comments on commit df6204d

Please sign in to comment.