Skip to content

Commit

Permalink
[GITFLOW]merging 'release-1.80.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Feb 15, 2023
2 parents c09a6cb + a4f6b35 commit 721d576
Show file tree
Hide file tree
Showing 219 changed files with 5,464 additions and 1,762 deletions.
45 changes: 43 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,55 @@ jobs:
key: ${{ runner.os }}-java-${{ env.JAVA }}-m2-${{ hashFiles('**/pom.xml', '**/*.pom') }}
restore-keys: ${{ runner.os }}-java-${{ env.JAVA }}-m2

- name: Run mvn verify
- name: Cache SonarCloud packages
# Check if PR results from the repository: if yes, it is safe to cache dependencies.
# This is to keep us safe from cache poisoning through 3rd party PRs.
if: ${{ fromJSON(env.PRIVILEGED_RUN) }}
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Run mvn verify and sonar analysis
# FIXME(@JonasCir) see https://github.com/hzi-braunschweig/SORMAS-Project/issues/3730#issuecomment-745165678
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ./sormas-base
run: mvn verify -B -ntp
run: mvn -B -ntp verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=SORMAS-Project

- name: Comment with SonarCloud analysis
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.SORMAS_VITAGROUP_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `SonarCloud analysis: https://sonarcloud.io/dashboard?id=SORMAS-Project&pullRequest=${{ github.event.pull_request.number }}`
})
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
security-checks: 'vuln,secret,config'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
# needed as codeQL also performs an upload and they clash otherwise
category: 'code-scanning/trivy-repo'

- name: Commit external visits API spec to development
# Privileged action needing a secret token. Since this only runs on development in our own repo
# the token will be available through a privileged checkout.
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.79.0</version>
<version>1.80.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 @@ -18,6 +18,7 @@
package de.symeda.sormas.api.caze;

import java.util.Date;
import java.util.Set;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.EntityRelevanceStatus;
Expand Down Expand Up @@ -149,6 +150,10 @@ public class CaseCriteria extends CriteriaWithDateType implements ExternalShareC
private Boolean onlyShowCasesWithFulfilledReferenceDefinition;
private String personLike;
private Boolean withOwnership;
/**
* Used for filtering merge-able cases to filter both lead and similar cases.
*/
private Set<String> caseUuidsForMerge;

public CaseCriteria() {
super(NewCaseDateType.class);
Expand Down Expand Up @@ -772,4 +777,15 @@ public Boolean getWithOwnership() {
public void setWithOwnership(Boolean withOwnership) {
this.withOwnership = withOwnership;
}

@IgnoreForUrl
public Set<String> getCaseUuidsForMerge() {
return caseUuidsForMerge;
}

public CaseCriteria caseUuidsForMerge(Set<String> caseUuidsForMerge) {
this.caseUuidsForMerge = caseUuidsForMerge;

return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public class CaseExportDto extends AbstractUuidDto {
@PersonalData
@SensitiveData
private String community;
@PersonalData
@SensitiveData
private FacilityType facilityType;
@PersonalData
@SensitiveData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import javax.ejb.Remote;
import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.databind.JsonNode;
Expand Down Expand Up @@ -57,6 +59,9 @@
@Remote
public interface CaseFacade extends CoreFacade<CaseDataDto, CaseIndexDto, CaseReferenceDto, CaseCriteria> {

int DUPLICATE_MERGING_LIMIT_DEFAULT = 100;
int DUPLICATE_MERGING_LIMIT_MAX = 1000;

long count(CaseCriteria caseCriteria, boolean ignoreUserFilter);

List<CaseSelectionDto> getCaseSelectionList(CaseCriteria caseCriteria);
Expand Down Expand Up @@ -148,7 +153,7 @@ Long countCasesForMap(

List<CaseSelectionDto> getSimilarCases(CaseSimilarityCriteria criteria);

List<CaseIndexDto[]> getCasesForDuplicateMerging(CaseCriteria criteria, boolean showDuplicatesWithDifferentRegion);
List<CaseIndexDto[]> getCasesForDuplicateMerging(CaseCriteria criteria, @Min(1) @Max(DUPLICATE_MERGING_LIMIT_MAX) int limit, boolean showDuplicatesWithDifferentRegion);

void updateCompleteness(String caseUuid);

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

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.EntityRelevanceStatus;
Expand Down Expand Up @@ -140,6 +141,12 @@ public class ContactCriteria extends BaseCriteria implements Serializable {
private boolean excludeLimitedSyncRestrictions;
private Boolean withOwnership = true;

private Set<String> uuids;
/**
* Used for filtering merge-able cases to filter both lead and similar cases.
*/
private Set<String> contactUuidsForMerge;

public UserRoleReferenceDto getReportingUserRole() {
return reportingUserRole;
}
Expand Down Expand Up @@ -723,4 +730,26 @@ public Boolean getWithOwnership() {
public void setWithOwnership(Boolean withOwnership) {
this.withOwnership = withOwnership;
}

@IgnoreForUrl
public Set<String> getUuids() {
return uuids;
}

public ContactCriteria uuids(Set<String> uuids) {
this.uuids = uuids;

return this;
}

@IgnoreForUrl
public Set<String> getContactUuidsForMerge() {
return contactUuidsForMerge;
}

public ContactCriteria contactUuidsForMerge(Set<String> contactUuidsForMerge) {
this.contactUuidsForMerge = contactUuidsForMerge;

return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.symeda.sormas.api.contact;

import java.util.Collection;
import java.util.Date;
import java.util.List;

Expand All @@ -14,7 +15,7 @@ public class ContactSimilarityCriteria extends BaseCriteria implements Cloneable
private static final long serialVersionUID = 6902101244020083789L;

private PersonReferenceDto person;
private List<PersonReferenceDto> persons;
private Collection<PersonReferenceDto> persons;
private CaseReferenceDto caze;
private List<CaseReferenceDto> resultingCases;
private Disease disease;
Expand Down Expand Up @@ -52,11 +53,11 @@ public ContactSimilarityCriteria withPerson(PersonReferenceDto person) {
return this;
}

public List<PersonReferenceDto> getPersons() {
public Collection<PersonReferenceDto> getPersons() {
return persons;
}

public ContactSimilarityCriteria withPersons(List<PersonReferenceDto> persons) {
public ContactSimilarityCriteria withPersons(Collection<PersonReferenceDto> persons) {
this.persons = persons;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,7 @@ public interface Captions {
String personLinkToCases = "personLinkToCases";
String personLinkToContacts = "personLinkToContacts";
String personLinkToEvents = "personLinkToEvents";
String personLinkToSamples = "personLinkToSamples";
String personNoCaseLinkedToPerson = "personNoCaseLinkedToPerson";
String personNoContactLinkedToPerson = "personNoContactLinkedToPerson";
String personNoEventParticipantLinkedToPerson = "personNoEventParticipantLinkedToPerson";
Expand Down Expand Up @@ -1839,6 +1840,7 @@ public interface Captions {
String prescriptionNewPrescription = "prescriptionNewPrescription";
String prescriptionWithTreatment = "prescriptionWithTreatment";
String prescriptionWithTreatmentTitleDelete = "prescriptionWithTreatmentTitleDelete";
String QueryDetails_resultLimit = "QueryDetails.resultLimit";
String Region = "Region";
String Region_archived = "Region.archived";
String Region_country = "Region.country";
Expand Down Expand Up @@ -1989,6 +1991,7 @@ public interface Captions {
String sampleNoSamplesForCase = "sampleNoSamplesForCase";
String sampleNoSamplesForContact = "sampleNoSamplesForContact";
String sampleNoSamplesForEventParticipant = "sampleNoSamplesForEventParticipant";
String sampleNoSamplesForPerson = "sampleNoSamplesForPerson";
String sampleNotShipped = "sampleNotShipped";
String sampleNotShippedLong = "sampleNotShippedLong";
String samplePending = "samplePending";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ public interface Strings {
String messageCaseFound = "messageCaseFound";
String messageCaseFoundNoValidPathogenTest = "messageCaseFoundNoValidPathogenTest";
String messageCaseIncidenceUnsupportedAgeGroup = "messageCaseIncidenceUnsupportedAgeGroup";
String messageCaseOutsideJurisdictionDeletionDenied = "messageCaseOutsideJurisdictionDeletionDenied";
String messageCaseReferredFromPoe = "messageCaseReferredFromPoe";
String messageCaseRelationToEventWithoutDisease = "messageCaseRelationToEventWithoutDisease";
String messageCasesArchived = "messageCasesArchived";
Expand Down Expand Up @@ -1017,6 +1018,7 @@ public interface Strings {
String messageContactDearchived = "messageContactDearchived";
String messageContactDuplicateDeleted = "messageContactDuplicateDeleted";
String messageContactExternalTokenWarning = "messageContactExternalTokenWarning";
String messageContactOutsideJurisdictionDeletionDenied = "messageContactOutsideJurisdictionDeletionDenied";
String messageContactSaved = "messageContactSaved";
String messageContactsDeleted = "messageContactsDeleted";
String messageContactsEdited = "messageContactsEdited";
Expand Down Expand Up @@ -1181,6 +1183,7 @@ public interface Strings {
String messagePathogenTestSaved = "messagePathogenTestSaved";
String messagePathogenTestSavedShort = "messagePathogenTestSavedShort";
String messagePathogenTestsDeleted = "messagePathogenTestsDeleted";
String messagePathogenTestsSavedShort = "messagePathogenTestsSavedShort";
String messagePersonAddedAsEventParticipant = "messagePersonAddedAsEventParticipant";
String messagePersonAlreadyCaseInEvent = "messagePersonAlreadyCaseInEvent";
String messagePersonAlreadyEventParticipant = "messagePersonAlreadyEventParticipant";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public class LocationDto extends PseudonymizableDto {
@Size(max = FieldConstraints.CHARACTER_LIMIT_SMALL, message = Validations.textTooLong)
private String addressTypeDetails;
@PersonalData
@SensitiveData
private FacilityType facilityType;
@PersonalData
@SensitiveData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package de.symeda.sormas.api.person;

import java.util.Set;

import de.symeda.sormas.api.infrastructure.community.CommunityReferenceDto;
import de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto;
import de.symeda.sormas.api.infrastructure.region.RegionReferenceDto;
import de.symeda.sormas.api.utils.IgnoreForUrl;
import de.symeda.sormas.api.utils.criteria.BaseCriteria;

public class PersonCriteria extends BaseCriteria implements Cloneable {
Expand Down Expand Up @@ -33,6 +36,7 @@ public class PersonCriteria extends BaseCriteria implements Cloneable {
private DistrictReferenceDto district;
private CommunityReferenceDto community;
private PersonAssociation personAssociation;
private Set<String> uuids;

public PersonCriteria() {

Expand Down Expand Up @@ -123,6 +127,17 @@ public PersonCriteria personAssociation(PersonAssociation personAssociation) {
return this;
}

@IgnoreForUrl
public Set<String> getUuids() {
return uuids;
}

public PersonCriteria uuids(Set<String> uuids) {
this.uuids = uuids;

return this;
}

private void validate(PersonAssociation personAssociation) {

if (personAssociation == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public enum SampleAssociationType {
ALL,
CASE,
CONTACT,
EVENT_PARTICIPANT;
EVENT_PARTICIPANT,
PERSON;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public String getCaseCodeIdLike() {
return caseCodeIdLike;
}

@IgnoreForUrl
public List<String> getCaseUuids() {
return caseUuids;
}
Expand All @@ -270,6 +271,7 @@ public SampleCriteria caseUuids(List<String> caseUuids) {
return this;
}

@IgnoreForUrl
public List<String> getContactUuids() {
return contactUuids;
}
Expand All @@ -280,6 +282,7 @@ public SampleCriteria contactUuids(List<String> contactUuids) {
return this;
}

@IgnoreForUrl
public List<String> getEventParticipantUuids() {
return eventParticipantUuids;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2023 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 java.io.Serializable;
import java.util.Collections;
import java.util.Set;

import de.symeda.sormas.api.audit.AuditedClass;
import de.symeda.sormas.api.sormastosormas.entities.DuplicateResultType;

@AuditedClass
public class DuplicateResult implements Serializable {

private static final long serialVersionUID = 1647535939211815787L;

private final DuplicateResultType type;

private final Set<String> uuids;

public DuplicateResult(DuplicateResultType type, Set<String> uuids) {
this.type = type;
this.uuids = uuids;
}

public static DuplicateResult none() {
return new DuplicateResult(DuplicateResultType.NONE, Collections.emptySet());
}

public DuplicateResultType getType() {
return type;
}

public Set<String> getUuids() {
return uuids;
}
}
Loading

0 comments on commit 721d576

Please sign in to comment.