Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.76.6' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Nov 18, 2022
2 parents b7bc62c + 3fa5cf3 commit 48a8d28
Show file tree
Hide file tree
Showing 29 changed files with 107 additions and 58 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.5</version>
<version>1.76.6</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
22 changes: 20 additions & 2 deletions sormas-api/src/main/java/de/symeda/sormas/api/caze/Vaccine.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,36 @@ public enum Vaccine {
@Diseases(value = {
Disease.CORONAVIRUS })
COMIRNATY(VaccineManufacturer.BIONTECH_PFIZER),
@Diseases(value = {
Disease.CORONAVIRUS })
MRNA_BIVALENT_BA_1_BIONTECH_PFIZER(VaccineManufacturer.BIONTECH_PFIZER),
@Diseases(value = {
Disease.CORONAVIRUS })
MRNA_BIVALENT_BA_4_5_BIONTECH_PFIZER(VaccineManufacturer.BIONTECH_PFIZER),
@Diseases(value = {
Disease.CORONAVIRUS })
MRNA_1273(VaccineManufacturer.MODERNA),
@Diseases(value = {
Disease.CORONAVIRUS })
OXFORD_ASTRA_ZENECA(VaccineManufacturer.ASTRA_ZENECA),
MRNA_BIVALENT_BA_1_MODERNA(VaccineManufacturer.MODERNA),
@Diseases(value = {
Disease.CORONAVIRUS })
AD26_COV2_S(VaccineManufacturer.JOHNSON_JOHNSON),
MRNA_BIVALENT_BA_4_5_MODERNA(VaccineManufacturer.MODERNA),
@Diseases(value = {
Disease.CORONAVIRUS })
VALNEVA(VaccineManufacturer.VALNEVA),
@Diseases(value = {
Disease.CORONAVIRUS })
NVX_COV_2373(VaccineManufacturer.NOVAVAX),
@Diseases(value = {
Disease.CORONAVIRUS })
NUVAXOVID(VaccineManufacturer.NOVAVAX),
@Diseases(value = {
Disease.CORONAVIRUS })
OXFORD_ASTRA_ZENECA(VaccineManufacturer.ASTRA_ZENECA),
@Diseases(value = {
Disease.CORONAVIRUS })
AD26_COV2_S(VaccineManufacturer.JOHNSON_JOHNSON),
@Diseases(value = {
Disease.CORONAVIRUS })
SANOFI_GSK(VaccineManufacturer.SANOFI_GSK),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public enum VaccineManufacturer {
@Diseases(value = {
Disease.CORONAVIRUS })
SANOFI_GSK,
VALNEVA,
UNKNOWN,
OTHER;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public interface Strings {
String confirmationDeleteCases = "confirmationDeleteCases";
String confirmationDeleteContacts = "confirmationDeleteContacts";
String confirmationDeleteEntity = "confirmationDeleteEntity";
String confirmationDeleteEntityWithDetails = "confirmationDeleteEntityWithDetails";
String confirmationDeleteEventParticipants = "confirmationDeleteEventParticipants";
String confirmationDeleteEvents = "confirmationDeleteEvents";
String confirmationDeleteExternalMessages = "confirmationDeleteExternalMessages";
Expand Down
7 changes: 7 additions & 0 deletions sormas-api/src/main/resources/enum.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,12 @@ Vaccine.NVX_COV_2373=Novavax COVID-19 vaccine
Vaccine.SANOFI_GSK=Sanofi-GSK
Vaccine.ASTRA_ZENECA_COMIRNATY=Combination AstraZeneca & Pfizer-BioNTech
Vaccine.ASTRA_ZENECA_MRNA_1273=Combination AstraZeneca & Moderna
Vaccine.MRNA_BIVALENT_BA_1_BIONTECH_PFIZER=mRNA/bivalent BA.1 (BioNTech/Pfizer)
Vaccine.MRNA_BIVALENT_BA_1_MODERNA=mRNA/bivalent BA.1 (Moderna)
Vaccine.VALNEVA=inactivated (Valneva)
Vaccine.NUVAXOVID=protein-based, recombinant (Novavax)
Vaccine.MRNA_BIVALENT_BA_4_5_BIONTECH_PFIZER=mRNA/bivalent BA.4/5 (BioNTech/Pfizer)
Vaccine.MRNA_BIVALENT_BA_4_5_MODERNA=mRNA/bivalent BA.1 (Moderna)
Vaccine.UNKNOWN=Unknown
Vaccine.OTHER=Other

Expand All @@ -1915,6 +1921,7 @@ VaccineManufacturer.NOVAVAX=Novavax
VaccineManufacturer.SANOFI_GSK=Sanofi-GSK
VaccineManufacturer.ASTRA_ZENECA_BIONTECH_PFIZER=AstraZeneca & BioNTech/Pfizer
VaccineManufacturer.ASTRA_ZENECA_MODERNA=AstraZeneca & Moderna
VaccineManufacturer.VALNEVA=Valneva
VaccineManufacturer.UNKNOWN=Unknown
VaccineManufacturer.OTHER=Other

Expand Down
6 changes: 6 additions & 0 deletions sormas-api/src/main/resources/enum_de-DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,12 @@ Vaccine.NVX_COV_2373=NVX-CoV2373 COVID-19 Impfstoff (Novavax)
Vaccine.SANOFI_GSK=MRT5500 COVID-19 Impfstoff (Sanofi-GSK)
Vaccine.ASTRA_ZENECA_COMIRNATY=Kombination AstraZeneca & BioNTech/Pfizer
Vaccine.ASTRA_ZENECA_MRNA_1273=Kombination AstraZeneca & Moderna
Vaccine.MRNA_BIVALENT_BA_1_BIONTECH_PFIZER=mRNA/bivalent BA.1 (BioNTech/Pfizer)
Vaccine.MRNA_BIVALENT_BA_1_MODERNA=mRNA/bivalent BA.1 (Moderna)
Vaccine.VALNEVA=inaktiviert (Valneva)
Vaccine.NUVAXOVID=proteinbasiert, rekombinant (Novavax)
Vaccine.MRNA_BIVALENT_BA_4_5_BIONTECH_PFIZER=mRNA/bivalent BA.4/5 (BioNTech/Pfizer)
Vaccine.MRNA_BIVALENT_BA_4_5_MODERNA=mRNA/bivalent BA.1 (Moderna)
Vaccine.UNKNOWN=Unbekannt
Vaccine.OTHER=Sonstiges

Expand Down
9 changes: 5 additions & 4 deletions sormas-api/src/main/resources/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ 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?<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.
confirmationDeleteCases = Are you sure you want to delete all %d selected cases?<br/>%s<br/>This action can not be reversed.
confirmationDeleteContacts = Are you sure you want to delete all %d selected contacts?<br/>%s<br/>This action can not be reversed.
confirmationDeleteEntity = Are you sure you want to delete this %s?<br/>This action can not be reversed.
confirmationDeleteEntityWithDetails = Are you sure you want to delete this %s?<br/>%s<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?<br/><br/>This action can not be reversed.
confirmationDeleteEvents = Are you sure you want to delete all %d selected events?<br/>%s<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
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.5</version>
<version>1.76.6</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.5</version>
<version>1.76.6</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 @@ -2551,7 +2551,7 @@ private void deleteCase(Case caze, DeletionDetails deletionDetails)
externalJournalService.handleExternalJournalPersonUpdateAsync(caze.getPerson().toReference());

try {
sormasToSormasFacade.revokePendingShareRequests(caze.getSormasToSormasShares());
sormasToSormasFacade.revokePendingShareRequests(caze.getSormasToSormasShares(), true);
} catch (SormasToSormasException e) {
throw new SormasToSormasRuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,10 +1032,11 @@ public void deletePermanent(Case caze) {
sormasToSormasShareInfoService.ensurePersisted(s);
} else {
try {
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s));
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s), false);
} catch (SormasToSormasException e) {
logger.warn("Could not revoke share requests of share info {}", s.getUuid(), e);
}

sormasToSormasShareInfoService.deletePermanent(s);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public void delete(String contactUuid, DeletionDetails deletionDetails) {
private void deleteContact(Contact contact, DeletionDetails deletionDetails) {
externalJournalService.handleExternalJournalPersonUpdateAsync(contact.getPerson().toReference());
try {
sormasToSormasFacade.revokePendingShareRequests(contact.getSormasToSormasShares());
sormasToSormasFacade.revokePendingShareRequests(contact.getSormasToSormasShares(), true);
} catch (SormasToSormasException e) {
throw new SormasToSormasRuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ public void deletePermanent(Contact contact) {
sormasToSormasShareInfoService.ensurePersisted(s);
} else {
try {
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s));
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s), false);
} catch (SormasToSormasException e) {
logger.warn("Could not revoke share requests of share info {}", s.getUuid(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void deleteOrphanEntities() {
batchedUuids -> sormasToSormasShareRequestService.deletePermanentByUuids(batchedUuids));

List<String> nonReferencedShareRequestInfoUuids = shareRequestInfoService.getAllNonReferencedShareRequestInfo();
logger.debug("executeAutomaticDeletion(): Detected non referenced ShareRequestInfo: n={}", nonReferencedShareRequestInfoUuids.size());
logger.debug("executeAutomaticDeletion(): Detected orphan ShareRequestInfo: n={}", nonReferencedShareRequestInfoUuids.size());
IterableHelper.executeBatched(
nonReferencedShareRequestInfoUuids,
DELETE_BATCH_SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void delete(String eventUuid, DeletionDetails deletionDetails) {
Event event = service.getByUuid(eventUuid);

try {
sormasToSormasFacade.revokePendingShareRequests(event.getSormasToSormasShares());
sormasToSormasFacade.revokePendingShareRequests(event.getSormasToSormasShares(), true);
} catch (SormasToSormasException e) {
throw new SormasToSormasRuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public void deletePermanent(Event event) {
sormasToSormasShareInfoService.ensurePersisted(s);
} else {
try {
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s));
sormasToSormasFacade.revokePendingShareRequests(Collections.singletonList(s), false);
} catch (SormasToSormasException e) {
logger.warn("Could not revoke share requests of share info {}", s.getUuid(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import de.symeda.sormas.api.sormastosormas.share.incoming.SormasToSormasShareRequestDto;
import de.symeda.sormas.api.sormastosormas.validation.SormasToSormasValidationException;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.DataHelper.Pair;
import de.symeda.sormas.backend.caze.Case;
import de.symeda.sormas.backend.common.ConfigFacadeEjb;
import de.symeda.sormas.backend.contact.Contact;
Expand Down Expand Up @@ -197,17 +198,16 @@ public void revokeShare(String shareInfoUuid) throws SormasToSormasException {
}

for (ShareRequestInfo pendingRequest : pendingRequests) {
revokeShareRequest(pendingRequest);
revokeShareRequest(pendingRequest, shareInfo.getOrganizationId());
}
}

private void revokeShareRequest(ShareRequestInfo request) throws SormasToSormasException {
private void revokeShareRequest(ShareRequestInfo request, String targetOrganizationId) throws SormasToSormasException {
if (request.getRequestStatus() != ShareRequestStatus.PENDING) {
throw SormasToSormasException.fromStringProperty(Strings.errorSormasToSormasRequestProcessed);
}

sormasToSormasRestClient
.post(request.getShares().get(0).getOrganizationId(), REVOKE_REQUEST_ENDPOINT, Collections.singletonList(request.getUuid()), null);
sormasToSormasRestClient.post(targetOrganizationId, REVOKE_REQUEST_ENDPOINT, Collections.singletonList(request.getUuid()), null);

request.setRequestStatus(ShareRequestStatus.REVOKED);
shareRequestInfoService.ensurePersisted(request);
Expand All @@ -220,7 +220,7 @@ private void revokeShareRequest(ShareRequestInfo request) throws SormasToSormasE
public void revokeShareRequest(String requestUuid) throws SormasToSormasException {
ShareRequestInfo request = shareRequestInfoService.getByUuid(requestUuid);

revokeShareRequest(request);
revokeShareRequest(request, request.getShares().get(0).getOrganizationId());
}

/**
Expand Down Expand Up @@ -369,20 +369,40 @@ public boolean isSharingExternalMessagesEnabledForUser() {
return isShareEnabledForUser() && featureConfigurationFacade.isFeatureEnabled(FeatureType.SORMAS_TO_SORMAS_SHARE_EXTERNAL_MESSAGES);
}

/**
*
* @param sormasToSormasShares
* - tha shares to be checked
* @param doDelete
* - whether to delete the revoked request or not - for automatic deletion it will be deleted separately
* @throws SormasToSormasException
* when something goes wring during reject on the target system
*/
@RightsAllowed({
UserRight._CASE_DELETE,
UserRight._CONTACT_DELETE,
UserRight._EVENT_DELETE,
UserRight._SYSTEM })
public void revokePendingShareRequests(List<SormasToSormasShareInfo> sormasToSormasShares) throws SormasToSormasException {
List<ShareRequestInfo> pendingRequests = sormasToSormasShares.stream()
.map(SormasToSormasShareInfo::getRequests)
public void revokePendingShareRequests(List<SormasToSormasShareInfo> sormasToSormasShares, boolean doDelete) throws SormasToSormasException {
List<Pair<ShareRequestInfo, String>> pendingRequests = sormasToSormasShares.stream()
.map(
s -> s.getRequests()
.stream()
.filter(r -> r.getRequestStatus() == ShareRequestStatus.PENDING)
.map(r -> Pair.createPair(r, s.getOrganizationId()))
.collect(Collectors.toList()))
.flatMap(Collection::stream)
.filter(r -> r.getRequestStatus() == ShareRequestStatus.PENDING)
.collect(Collectors.toList());

for (ShareRequestInfo r : pendingRequests) {
revokeShareRequest(r.getUuid());
for (Pair<ShareRequestInfo, String> requestAndOrganization : pendingRequests) {
ShareRequestInfo request = requestAndOrganization.getElement0();
String organizationId = requestAndOrganization.getElement1();

revokeShareRequest(request, organizationId);

if (doDelete) {
shareRequestInfoService.deletePermanent(request);
}
}
}

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

package de.symeda.sormas.backend.sormastosormas.share.outgoing;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.LocalBean;
Expand All @@ -31,7 +30,6 @@
import org.springframework.util.CollectionUtils;

import de.symeda.sormas.api.sormastosormas.share.ShareRequestCriteria;
import de.symeda.sormas.api.sormastosormas.share.incoming.ShareRequestStatus;
import de.symeda.sormas.backend.common.AdoServiceWithUserFilter;
import de.symeda.sormas.backend.common.CriteriaBuilderHelper;

Expand Down Expand Up @@ -72,20 +70,6 @@ public List<String> getAllNonReferencedShareRequestInfo() {
cq.select(from.get(ShareRequestInfo.UUID));
cq.groupBy(from.get(ShareRequestInfo.ID));

//All the ShareRequestInfos in REVOKED status which still have joins but should be considered as non referenced
Predicate revokedStatus = cb.equal(from.get(ShareRequestInfo.REQUEST_STATUS), ShareRequestStatus.REVOKED);
List<String> revokedRequests = em.createQuery(cq.where(revokedStatus)).getResultList();
//All the ShareRequestInfos which do not have joins
List<String> requestsWithoutJoins = em.createQuery(cq.having(cb.equal(cb.count(shareRequestJoin), 0))).getResultList();

List<String> allNonReferencedShareRequestInfo = new ArrayList<>();
allNonReferencedShareRequestInfo.addAll(revokedRequests);
allNonReferencedShareRequestInfo.addAll(requestsWithoutJoins);

return allNonReferencedShareRequestInfo;
}

public void executePermanentDeletion() {

return em.createQuery(cq.having(cb.equal(cb.count(shareRequestJoin.get(SormasToSormasShareInfo.ID)), 0))).getResultList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -806,17 +806,27 @@ public void testSormasToSormasShareInfoPermanentDeletion() {
CaseDataDto caze = creator.createCase(officer, person.toReference(), rdcf);

User officerUser = getUserService().getByReferenceDto(officer);
ShareRequestInfo shareRequestInfo = createShareRequestInfo(
ShareRequestInfo pendingRequestInfo = createShareRequestInfo(
ShareRequestDataType.CASE,
officerUser,
DEFAULT_SERVER_ID,
true,
i -> i.setCaze(getCaseService().getByReferenceDto(caze.toReference())));
getShareRequestInfoService().persist(shareRequestInfo);
pendingRequestInfo.setRequestStatus(ShareRequestStatus.PENDING);
getShareRequestInfoService().persist(pendingRequestInfo);

ShareRequestInfo acceptedRequestInfo = createShareRequestInfo(
ShareRequestDataType.CASE,
officerUser,
SECOND_SERVER_ID,
true,
i -> i.setCaze(getCaseService().getByReferenceDto(caze.toReference())));
acceptedRequestInfo.setRequestStatus(ShareRequestStatus.ACCEPTED);
getShareRequestInfoService().persist(acceptedRequestInfo);

assertEquals(1, getCaseService().count());
assertEquals(1, getShareRequestInfoService().count());
assertEquals(1, getSormasToSormasShareInfoService().count());
assertEquals(2, getShareRequestInfoService().count());
assertEquals(2, getSormasToSormasShareInfoService().count());

final Date tenYearsPlusAgoForCase = DateUtils.addDays(new Date(), (-1) * caseDeletionConfiguration.deletionPeriod - 1);
SessionImpl em1 = (SessionImpl) getEntityManager();
Expand Down
2 changes: 1 addition & 1 deletion sormas-base/dependencies/serverlibs.pom
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.76.5</version>
<version>1.76.6</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<packaging>pom</packaging>
<version>1.76.5</version>
<version>1.76.6</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion sormas-cargoserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.76.5</version>
<version>1.76.6</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-ear/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.76.5</version>
<version>1.76.6</version>
<relativePath>../sormas-base</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sormas-keycloak-service-provider/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.5</version>
<version>1.76.6</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit 48a8d28

Please sign in to comment.