3131import java .util .Collections ;
3232import java .util .Comparator ;
3333import java .util .Date ;
34- import java .util .EnumSet ;
3534import java .util .HashMap ;
3635import java .util .List ;
3736import java .util .Map ;
@@ -1495,7 +1494,7 @@ public void saveBulkCase(
14951494 Case caze = caseService .getByUuid (caseUuid );
14961495 CaseDataDto existingCaseDto = toDto (caze );
14971496
1498- changeCaseDto (
1497+ updateCaseWithBulkData (
14991498 updatedCaseBulkEditData ,
15001499 caze ,
15011500 diseaseChange ,
@@ -1529,7 +1528,7 @@ public void saveBulkEditWithFacilities(
15291528 Case caze = caseService .getByUuid (caseUuid );
15301529 CaseDataDto existingCaseDto = toDto (caze );
15311530
1532- changeCaseDto (
1531+ updateCaseWithBulkData (
15331532 updatedCaseBulkEditData ,
15341533 caze ,
15351534 diseaseChange ,
@@ -1548,7 +1547,7 @@ public void saveBulkEditWithFacilities(
15481547 }
15491548 }
15501549
1551- private void changeCaseDto (
1550+ private void updateCaseWithBulkData (
15521551 CaseBulkEditData updatedCaseBulkEditData ,
15531552 Case existingCase ,
15541553 boolean diseaseChange ,
@@ -1931,33 +1930,36 @@ public void onCaseChanged(CaseDataDto existingCase, Case newCase) {
19311930 // If the case is a newly created case or if it was not in a CONFIRMED status
19321931 // and now the case is in a CONFIRMED status, notify related surveillance officers
19331932 Set <CaseClassification > confirmedClassifications = CaseClassification .getConfirmedClassifications ();
1934- if ((existingCase == null || !confirmedClassifications .contains (existingCase .getCaseClassification ())) && confirmedClassifications .contains (newCase .getCaseClassification ())) {
1933+ if ((existingCase == null || !confirmedClassifications .contains (existingCase .getCaseClassification ()))
1934+ && confirmedClassifications .contains (newCase .getCaseClassification ())) {
19351935 sendConfirmedCaseNotificationsForEvents (newCase );
19361936 }
19371937 }
19381938
19391939 private void sendConfirmedCaseNotificationsForEvents (Case caze ) {
19401940 Date fromDate = Date .from (Instant .now ().minus (Duration .ofDays (30 )));
1941- Map <String , User > surveillanceOfficerByEventByEventUuid = eventService .getAllEventUuidWithSurveillanceOfficerByCaseAfterDateForNotification (caze , fromDate );
1941+ Map <String , User > surveillanceOfficerByEventByEventUuid =
1942+ eventService .getAllEventUuidWithSurveillanceOfficerByCaseAfterDateForNotification (caze , fromDate );
19421943 for (Map .Entry <String , User > entry : surveillanceOfficerByEventByEventUuid .entrySet ()) {
19431944 try {
19441945 messagingService .sendMessage (
1945- entry .getValue (),
1946- MessageSubject .EVENT_PARTICIPANT_CASE_CLASSIFICATION_CONFIRMED ,
1947- new Object [] { caze .getDisease ().getName () },
1948- String .format (
1949- I18nProperties .getString (MessagingService .CONTENT_EVENT_PARTICIPANT_CASE_CLASSIFICATION_CONFIRMED ),
1950- DataHelper .getShortUuid (entry .getKey ()),
1951- caze .getDisease ().getName (),
1952- DataHelper .getShortUuid (caze .getUuid ())),
1953- MessageType .EMAIL ,
1954- MessageType .SMS );
1946+ entry .getValue (),
1947+ MessageSubject .EVENT_PARTICIPANT_CASE_CLASSIFICATION_CONFIRMED ,
1948+ new Object [] {
1949+ caze .getDisease ().getName () },
1950+ String .format (
1951+ I18nProperties .getString (MessagingService .CONTENT_EVENT_PARTICIPANT_CASE_CLASSIFICATION_CONFIRMED ),
1952+ DataHelper .getShortUuid (entry .getKey ()),
1953+ caze .getDisease ().getName (),
1954+ DataHelper .getShortUuid (caze .getUuid ())),
1955+ MessageType .EMAIL ,
1956+ MessageType .SMS );
19551957 } catch (NotificationDeliveryFailedException e ) {
19561958 logger .error (
1957- String .format (
1958- "NotificationDeliveryFailedException when trying to notify event surveillance officer about a newly confirmed case. "
1959- + "Failed to send " + e .getMessageType () + " to user with UUID %s." ,
1960- entry .getValue ().getUuid ()));
1959+ String .format (
1960+ "NotificationDeliveryFailedException when trying to notify event surveillance officer about a newly confirmed case. "
1961+ + "Failed to send " + e .getMessageType () + " to user with UUID %s." ,
1962+ entry .getValue ().getUuid ()));
19611963 }
19621964 }
19631965 }
0 commit comments