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

Commit d69ca03

Browse files
authored
Merge pull request SORMAS-Foundation#3547 from hzi-braunschweig/feature-3253-SendSMSToCases
Feature 3253 send sms to cases
2 parents deb79bc + e074595 commit d69ca03

42 files changed

Lines changed: 808 additions & 68 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseFacade.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import de.symeda.sormas.api.CaseMeasure;
2828
import de.symeda.sormas.api.Disease;
2929
import de.symeda.sormas.api.Language;
30+
import de.symeda.sormas.api.messaging.ManualMessageLogDto;
31+
import de.symeda.sormas.api.messaging.MessageType;
3032
import de.symeda.sormas.api.contact.ContactReferenceDto;
3133
import de.symeda.sormas.api.contact.DashboardQuarantineDataDto;
3234
import de.symeda.sormas.api.event.EventParticipantReferenceDto;
@@ -175,4 +177,10 @@ List<DashboardQuarantineDataDto> getQuarantineDataForDashBoard(
175177
Date to);
176178

177179
long countCasesConvertedFromContacts(CaseCriteria caseCriteria);
180+
181+
void sendMessage(List<String> caseUuids, String subject, String messageContent, MessageType... messageTypes);
182+
183+
long countCasesWithMissingContactInformation(List<String> caseUuids, MessageType messageType);
184+
185+
List<ManualMessageLogDto> getMessageLog(String caseUuid, MessageType messageType);
178186
}

sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public enum FeatureType {
5050
true,
5151
new FeatureType[] {
5252
TASK_MANAGEMENT }),
53+
MANUAL_EXTERNAL_MESSAGES(true, true, null),
5354
OTHER_NOTIFICATIONS(true, true, null),
5455
DOCUMENTS(true, false, null),
5556
OUTBREAKS(true, true, null);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public interface Captions {
6767
String actionSave = "actionSave";
6868
String actionSaveChanges = "actionSaveChanges";
6969
String actionSelectAll = "actionSelectAll";
70+
String actionSend = "actionSend";
7071
String actionSettings = "actionSettings";
7172
String actionShowLessFilters = "actionShowLessFilters";
7273
String actionShowMoreFilters = "actionShowMoreFilters";
@@ -1076,6 +1077,16 @@ public interface Captions {
10761077
String MaternalHistory_swollenLymphsMonth = "MaternalHistory.swollenLymphsMonth";
10771078
String MaternalHistory_swollenLymphsOnset = "MaternalHistory.swollenLymphsOnset";
10781079
String menu = "menu";
1080+
String messagesCharacters = "messagesCharacters";
1081+
String messagesEmail = "messagesEmail";
1082+
String messagesNoPhoneNumberForCasePerson = "messagesNoPhoneNumberForCasePerson";
1083+
String messagesNoSmsSentForCase = "messagesNoSmsSentForCase";
1084+
String messagesNumberOfMessages = "messagesNumberOfMessages";
1085+
String messagesNumberOfMissingPhoneNumbers = "messagesNumberOfMissingPhoneNumbers";
1086+
String messagesSendingSms = "messagesSendingSms";
1087+
String messagesSendSMS = "messagesSendSMS";
1088+
String messagesSentBy = "messagesSentBy";
1089+
String messagesSms = "messagesSms";
10791090
String moreActions = "moreActions";
10801091
String name = "name";
10811092
String nationalHealthId = "nationalHealthId";

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
@@ -629,6 +629,7 @@ public interface Strings {
629629
String messageDistrictsArchivingNotPossible = "messageDistrictsArchivingNotPossible";
630630
String messageDistrictsDearchived = "messageDistrictsDearchived";
631631
String messageDistrictsDearchivingNotPossible = "messageDistrictsDearchivingNotPossible";
632+
String messageEnterSms = "messageEnterSms";
632633
String messageEntryCreated = "messageEntryCreated";
633634
String messageEpiDataHint = "messageEpiDataHint";
634635
String messageEpidNumberWarning = "messageEpidNumberWarning";
@@ -769,6 +770,7 @@ public interface Strings {
769770
String notificationLabSampleShippedShort = "notificationLabSampleShippedShort";
770771
String notificationLabSampleShippedShortForContact = "notificationLabSampleShippedShortForContact";
771772
String notificationLabSampleShippedShortForEventParticipant = "notificationLabSampleShippedShortForEventParticipant";
773+
String notificationSmsSent = "notificationSmsSent";
772774
String notificationTaskDueGeneral = "notificationTaskDueGeneral";
773775
String notificationTaskDueSpecific = "notificationTaskDueSpecific";
774776
String notificationTaskStartGeneral = "notificationTaskStartGeneral";
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package de.symeda.sormas.api.messaging;
2+
3+
import java.io.Serializable;
4+
import java.util.Date;
5+
6+
import de.symeda.sormas.api.person.PersonReferenceDto;
7+
import de.symeda.sormas.api.user.UserReferenceDto;
8+
9+
public class ManualMessageLogDto implements Serializable {
10+
11+
private MessageType messageType;
12+
private Date sentDate;
13+
private UserReferenceDto sendingUser;
14+
private PersonReferenceDto recipientPerson;
15+
16+
public ManualMessageLogDto() {
17+
}
18+
19+
public ManualMessageLogDto(MessageType messageType, Date sentDate, UserReferenceDto sendingUser, PersonReferenceDto recipientPerson) {
20+
this.messageType = messageType;
21+
this.sentDate = sentDate;
22+
this.sendingUser = sendingUser;
23+
this.recipientPerson = recipientPerson;
24+
}
25+
26+
public MessageType getMessageType() {
27+
return messageType;
28+
}
29+
30+
public void setMessageType(MessageType messageType) {
31+
this.messageType = messageType;
32+
}
33+
34+
public Date getSentDate() {
35+
return sentDate;
36+
}
37+
38+
public void setSentDate(Date sentDate) {
39+
this.sentDate = sentDate;
40+
}
41+
42+
public UserReferenceDto getSendingUser() {
43+
return sendingUser;
44+
}
45+
46+
public void setSendingUser(UserReferenceDto sendingUser) {
47+
this.sendingUser = sendingUser;
48+
}
49+
50+
public PersonReferenceDto getRecipientPerson() {
51+
return recipientPerson;
52+
}
53+
54+
public void setRecipientPerson(PersonReferenceDto recipientPerson) {
55+
this.recipientPerson = recipientPerson;
56+
}
57+
}

sormas-backend/src/main/java/de/symeda/sormas/backend/common/MessageType.java renamed to sormas-api/src/main/java/de/symeda/sormas/api/messaging/MessageType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*******************************************************************************/
18-
package de.symeda.sormas.backend.common;
18+
package de.symeda.sormas.api.messaging;
1919

2020
public enum MessageType {
2121

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,32 @@
2121

2222
import de.symeda.sormas.api.ReferenceDto;
2323
import de.symeda.sormas.api.utils.DataHelper;
24+
import de.symeda.sormas.api.utils.PersonalData;
25+
import de.symeda.sormas.api.utils.SensitiveData;
2426

2527
public class UserReferenceDto extends ReferenceDto {
2628

2729
private static final long serialVersionUID = -8558187171374254398L;
2830

29-
public UserReferenceDto() {
31+
@PersonalData(mandatoryField = true)
32+
@SensitiveData(mandatoryField = true)
33+
private String firstName;
34+
@PersonalData(mandatoryField = true)
35+
@SensitiveData(mandatoryField = true)
36+
private String lastName;
3037

38+
public UserReferenceDto() {
3139
}
3240

3341
public UserReferenceDto(String uuid) {
3442
setUuid(uuid);
3543
}
3644

37-
public UserReferenceDto(String uuid, String caption) {
38-
setUuid(uuid);
39-
setCaption(caption);
40-
}
41-
4245
public UserReferenceDto(String uuid, String firstName, String lastName, Set<UserRole> userRoles) {
4346
setUuid(uuid);
4447
setCaption(buildCaption(firstName, lastName, userRoles));
48+
this.firstName = firstName;
49+
this.lastName = lastName;
4550
}
4651

4752
public static String buildCaption(String firstName, String lastName, Set<UserRole> userRoles) {
@@ -62,4 +67,12 @@ public static String buildCaption(String firstName, String lastName, Set<UserRol
6267
}
6368
return result.toString();
6469
}
70+
71+
public String getFirstName() {
72+
return firstName;
73+
}
74+
75+
public String getLastName() {
76+
return lastName;
77+
}
6578
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,10 @@ public enum UserRight {
784784
SURVEILLANCE_SUPERVISOR,
785785
ADMIN_SUPERVISOR
786786
),
787+
SEND_MANUAL_EXTERNAL_MESSAGES(
788+
ADMIN,
789+
NATIONAL_USER
790+
),
787791
STATISTICS_ACCESS(
788792
ADMIN,
789793
NATIONAL_USER,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Action.actionStatus=Action status
8787
actionApplyDateFilter=Apply date filter
8888
actionArchive=Archive
8989
actionAssignNewEpidNumber=Assign new epid number
90+
actionSend = Send
9091
actionCancel=Cancel
9192
actionClear=Clear
9293
actionClearAll=Clear all
@@ -1149,6 +1150,18 @@ LoginSidebar.diseasePrevention=Disease Prevention
11491150
LoginSidebar.outbreakResponse=Outbreak Response
11501151
LoginSidebar.poweredBy=Powered By
11511152

1153+
# Messaging
1154+
messagesSendSMS=Send SMS
1155+
messagesSentBy=Sent by
1156+
messagesNoSmsSentForCase=No SMS sent to case person
1157+
messagesNoPhoneNumberForCasePerson=Case person has no phone number
1158+
messagesSms = SMS
1159+
messagesEmail = Email
1160+
messagesSendingSms = Send new SMS
1161+
messagesNumberOfMissingPhoneNumbers = Number of selected cases without phone number: %s
1162+
messagesCharacters = Characters: %d / 160
1163+
messagesNumberOfMessages = Nr. of messages: %d
1164+
11521165
# Main Menu
11531166
mainMenuAbout=About
11541167
mainMenuCampaigns=Campaigns

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ messageSampleOpened = Opened sample found for search string
787787
messageSystemFollowUpCanceled = [System] Follow-up automatically canceled because contact was converted to a case
788788
messageSetContactRegionAndDistrict = Please choose a responsible region and responsible district and save the contact before removing the source case.
789789
messageAllCampaignFormsValid = All campaign forms have been successfully validated
790+
messageEnterSms = Please enter your SMS message here:
790791

791792
# Notifications
792793
notificationCaseClassificationChanged = The classification of case %s has changed to %s.
@@ -811,6 +812,7 @@ notificationTaskDueSpecific = Your %s task for %s is overdue.
811812
notificationTaskStartGeneral = Your %s task should be started today.
812813
notificationTaskStartSpecific = Your %s task for %s should be started today.
813814
notificationVisitCompleted = A follow-up visit for contact %s assigned to user %s has been completed.
815+
notificationSmsSent = Message sent
814816

815817
#Labels
816818
labelNumberOfUsers = No. of users
@@ -921,4 +923,4 @@ SurvnetGateway.notificationEntrySent = Entry has been sent
921923
SurvnetGateway.notificationEntryNotSent = Entry could not be sent
922924
SurvnetGateway.notificationErrorSending = Error when sending entry
923925

924-
warningDashboardMapTooManyMarkers = There are %d places to display and it is possible that your browser will freeze while displaying them.
926+
warningDashboardMapTooManyMarkers = There are %d places to display and it is possible that your browser will freeze while displaying them.

0 commit comments

Comments
 (0)