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

Commit bd5e7dd

Browse files
Merge pull request SORMAS-Foundation#3219 from hzi-braunschweig/#3136_sormas-to-sormas-bulk
SORMAS-Foundation#3136 sormas to sormas bulk
2 parents 94e437b + a38f165 commit bd5e7dd

22 files changed

Lines changed: 738 additions & 206 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ public interface Captions {
272272
String CaseData_sharedToCountry = "CaseData.sharedToCountry";
273273
String CaseData_smallpoxVaccinationReceived = "CaseData.smallpoxVaccinationReceived";
274274
String CaseData_smallpoxVaccinationScar = "CaseData.smallpoxVaccinationScar";
275+
String CaseData_sormasToSormasOriginInfo = "CaseData.sormasToSormasOriginInfo";
275276
String CaseData_surveillanceOfficer = "CaseData.surveillanceOfficer";
276277
String CaseData_symptoms = "CaseData.symptoms";
277278
String CaseData_therapy = "CaseData.therapy";

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,11 @@ public interface Strings {
172172
String errorSormasToSormasDecrypt = "errorSormasToSormasDecrypt";
173173
String errorSormasToSormasEncrypt = "errorSormasToSormasEncrypt";
174174
String errorSormasToSormasInfrastructure = "errorSormasToSormasInfrastructure";
175+
String errorSormasToSormasNotEditable = "errorSormasToSormasNotEditable";
175176
String errorSormasToSormasResult = "errorSormasToSormasResult";
176177
String errorSormasToSormasSend = "errorSormasToSormasSend";
177178
String errorSormasToSormasServerAccess = "errorSormasToSormasServerAccess";
179+
String errorSormasToSormasShare = "errorSormasToSormasShare";
178180
String errorViewNotFound = "errorViewNotFound";
179181
String errorWasReported = "errorWasReported";
180182
String forCase = "forCase";

sormas-api/src/main/java/de/symeda/sormas/api/sormastosormas/SormasToSormasApiConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class SormasToSormasApiConstants {
2121

2222
public static final String RESOURCE_PATH = "/sormasToSormas";
2323

24-
public static final String CASE_ENDPOINT = "/case";
24+
public static final String CASE_ENDPOINT = "/cases";
2525

26-
public static final String CONTACT_ENDPOINT = "/contact";
26+
public static final String CONTACT_ENDPOINT = "/contacts";
2727

2828
}

sormas-api/src/main/java/de/symeda/sormas/api/sormastosormas/SormasToSormasErrorResponse.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@
1616
package de.symeda.sormas.api.sormastosormas;
1717

1818
import java.io.Serializable;
19+
import java.util.Map;
1920

2021
public class SormasToSormasErrorResponse implements Serializable {
2122

22-
private String message;
23+
private Map<String, ValidationErrors> errors;
2324

2425
public SormasToSormasErrorResponse() {
2526
}
2627

27-
public SormasToSormasErrorResponse(String message) {
28-
this.message = message;
28+
public SormasToSormasErrorResponse(Map<String, ValidationErrors> errors) {
29+
this.errors = errors;
2930
}
3031

31-
public String getMessage() {
32-
return message;
32+
public Map<String, ValidationErrors> getErrors() {
33+
return errors;
3334
}
3435

35-
public void setMessage(String message) {
36-
this.message = message;
36+
public void setErrors(Map<String, ValidationErrors> errors) {
37+
this.errors = errors;
3738
}
3839
}

sormas-api/src/main/java/de/symeda/sormas/api/sormastosormas/SormasToSormasException.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,26 @@
1515

1616
package de.symeda.sormas.api.sormastosormas;
1717

18+
import java.util.Map;
19+
1820
public class SormasToSormasException extends Exception {
1921

22+
private Map<String, ValidationErrors> errors;
23+
2024
public SormasToSormasException(String message) {
2125
super(message);
2226
}
27+
28+
public SormasToSormasException(String message, Map<String, ValidationErrors> errors) {
29+
super(message);
30+
this.errors = errors;
31+
}
32+
33+
public Map<String, ValidationErrors> getErrors() {
34+
return errors;
35+
}
36+
37+
public void setErrors(Map<String, ValidationErrors> errors) {
38+
this.errors = errors;
39+
}
2340
}

sormas-api/src/main/java/de/symeda/sormas/api/sormastosormas/SormasToSormasFacade.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
@Remote
2323
public interface SormasToSormasFacade {
2424

25-
void saveSharedCase(SormasToSormasEncryptedDataDto encryptedData) throws SormasToSormasException;
25+
void saveSharedCases(SormasToSormasEncryptedDataDto encryptedData) throws SormasToSormasException, SormasToSormasValidationException;
2626

27-
void saveSharedContact(SormasToSormasEncryptedDataDto sharedContact) throws SormasToSormasException;
27+
void saveSharedContacts(SormasToSormasEncryptedDataDto sharedContact) throws SormasToSormasException, SormasToSormasValidationException;
2828

29-
void shareCase(String uuid, SormasToSormasOptionsDto options) throws SormasToSormasException;
29+
void shareCases(List<String> caseUuids, SormasToSormasOptionsDto options) throws SormasToSormasException;
3030

31-
void shareContact(String uuid, SormasToSormasOptionsDto options) throws SormasToSormasException;
31+
void shareContacts(List<String> contactUuids, SormasToSormasOptionsDto options) throws SormasToSormasException;
3232

3333
List<ServerAccessDataReferenceDto> getAvailableOrganizations();
3434

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.sormastosormas;
17+
18+
import java.util.Map;
19+
20+
public class SormasToSormasValidationException extends Exception {
21+
22+
private final Map<String, ValidationErrors> errors;
23+
24+
public SormasToSormasValidationException(Map<String, ValidationErrors> errors) {
25+
this.errors = errors;
26+
}
27+
28+
public Map<String, ValidationErrors> getErrors() {
29+
return errors;
30+
}
31+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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.sormastosormas;
17+
18+
import java.io.Serializable;
19+
import java.util.ArrayList;
20+
import java.util.HashMap;
21+
import java.util.List;
22+
import java.util.Map;
23+
24+
public class ValidationErrors implements Serializable {
25+
26+
private static final long serialVersionUID = 1635651082132555214L;
27+
28+
private final Map<String, List<String>> errors;
29+
30+
public ValidationErrors() {
31+
errors = new HashMap<>();
32+
}
33+
34+
public void add(String group, String message) {
35+
List<String> groupErrors;
36+
37+
if (errors.containsKey(group)) {
38+
groupErrors = errors.get(group);
39+
} else {
40+
groupErrors = new ArrayList<>();
41+
errors.put(group, groupErrors);
42+
}
43+
44+
groupErrors.add(message);
45+
}
46+
47+
public void addAll(ValidationErrors errors) {
48+
for (Map.Entry<String, List<String>> error : errors.errors.entrySet()) {
49+
for (String message : error.getValue()) {
50+
add(error.getKey(), message);
51+
}
52+
}
53+
}
54+
55+
public Map<String, List<String>> getErrors() {
56+
return errors;
57+
}
58+
59+
public boolean hasError() {
60+
return errors.size() > 0;
61+
}
62+
63+
public static ValidationErrors create(String group, String message) {
64+
ValidationErrors errors = new ValidationErrors();
65+
66+
errors.add(group, message);
67+
68+
return errors;
69+
}
70+
}

sormas-api/src/main/java/de/symeda/sormas/api/user/UserRight.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,23 @@ public enum UserRight {
11481148
CONTACT_SUPERVISOR,
11491149
POE_SUPERVISOR,
11501150
LAB_USER
1151+
),
1152+
SORMAS_TO_SORMAS_SHARE(
1153+
ADMIN,
1154+
NATIONAL_USER,
1155+
SURVEILLANCE_SUPERVISOR,
1156+
SURVEILLANCE_OFFICER,
1157+
CASE_SUPERVISOR,
1158+
CASE_OFFICER,
1159+
CONTACT_SUPERVISOR,
1160+
CONTACT_OFFICER,
1161+
EVENT_OFFICER,
1162+
NATIONAL_OBSERVER,
1163+
STATE_OBSERVER,
1164+
DISTRICT_OBSERVER,
1165+
NATIONAL_CLINICIAN,
1166+
POE_SUPERVISOR,
1167+
POE_NATIONAL_USER
11511168
);
11521169
//@formatter:on
11531170

sormas-api/src/main/resources/captions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ CaseData.quarantineReasonBeforeIsolation=Reason why the case was in quarantine b
379379
CaseData.quarantineReasonBeforeIsolationDetails=Other reason
380380
CaseData.endOfIsolationReason=Reason for end of isolation
381381
CaseData.endOfIsolationReasonDetails=Other reason
382+
CaseData.sormasToSormasOriginInfo=Shared by
382383

383384
# CaseExport
384385
CaseExport.address=Address

0 commit comments

Comments
 (0)