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

Commit 6971b58

Browse files
Issue SORMAS-Foundation#3426 Adds importer for EventParticipant
1 parent 97c8ded commit 6971b58

13 files changed

Lines changed: 808 additions & 0 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantFacade.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ List<EventParticipantIndexDto> getIndexList(
5050
Integer max,
5151
List<SortProperty> sortProperties);
5252

53+
EventParticipantDto getByUuid(String uuid);
54+
5355
void validate(EventParticipantDto eventParticipant);
5456

5557
long count(EventParticipantCriteria eventParticipantCriteria);
@@ -62,6 +64,8 @@ List<EventParticipantIndexDto> getIndexList(
6264

6365
boolean isEventParticipantEditAllowed(String uuid);
6466

67+
EventParticipantDto getFirst(EventParticipantCriteria eventParticipantCriteria);
68+
6569
List<EventParticipantExportDto> getExportList(EventParticipantCriteria eventParticipantCriteria, int first, int max, Language userLanguage);
6670

6771
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ public interface Strings {
488488
String infoSelectOrCreatePersonForContact = "infoSelectOrCreatePersonForContact";
489489
String infoSelectOrCreatePersonForContactImport = "infoSelectOrCreatePersonForContactImport";
490490
String infoSelectOrCreatePersonForEventParticipant = "infoSelectOrCreatePersonForEventParticipant";
491+
String infoSelectOrCreatePersonForEventParticipantImport = "infoSelectOrCreatePersonForEventParticipantImport";
491492
String infoSpecificCaseSearch = "infoSpecificCaseSearch";
492493
String infoSpecificEventSearch = "infoSpecificEventSearch";
493494
String infoStatisticsDisclaimer = "infoStatisticsDisclaimer";

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ infoSelectOrCreateContactImport = The database already contains at least one con
541541
infoSelectOrCreatePersonForContact = The database already contains at least one person that seems to be very similar to the personal details of the created contact.<br/><br/>Please look through the list of persons. If you feel certain that one of those persons matches your contact person, select it and click on the <i>Save</i> button. Otherwise, click on <i>Create New Person</i> to create a new person for your contact.<br/><br/>If you are unsure, you can discard this window and cancel the contact creation process.
542542
infoSelectOrCreatePersonForContactImport = The database already contains at least one person that seems to be very similar to the personal details of the imported contact.<br/><br/>Please look through the list of persons. If you feel certain that one of those persons matches your contact person, select it and click on the <i>Save</i> button. Otherwise, click on <i>Create New Person</i> to create a new person for your contact.<br/><br/>If you are unsure, you can discard this window to remove the contact from the current import.
543543
infoSelectOrCreatePersonForEventParticipant = The database already contains at least one person that seems to be very similar to the personal details of the created event participant.<br/><br/>Please look through the list of persons. If you feel certain that one of those persons matches your event person, select it and click on the <i>Save</i> button. Otherwise, click on <i>Create New Person</i> to create a new event person for your event.<br/><br/>If you are unsure, you can discard this window and cancel the event participant creation process.
544+
infoSelectOrCreatePersonForEventParticipantImport = The database already contains at least one person that seems to be very similar to the personal details of the created event participant.<br/><br/>Please look through the list of persons. If you feel certain that one of those persons matches your event person, select it and click on the <i>Save</i> button. Otherwise, click on <i>Create New Person</i> to create a new event person for your event.<br/><br/>If you are unsure, you can discard this window to remove the event participant from the current import.
544545
pseudonymizedCasesSelectedWarning = For the bulked-edited cases you have only limited access to the sensitive data. For those cases the value you put into "Place Description" will be ignored.
545546
infoPickOrCreateEventForCase = The list below contains all existing events having the same disease as the current case. Please check whether the event this case belongs to is already on this list or create a new one if it isn't.
546547
infoSelectOrCreatePersonForCase = The database already contains at least one person that seems to be very similar to the personal details of the created case.<br/><br/>Please look through the list of persons. If you feel certain that one of those persons matches your case person, select them and click on the <i>Save</i> button. Otherwise, click on <i>Create New Person</i> to create a new person for your case.<br/><br/>If you are unsure, you can discard this window and cancel the case creation process.

sormas-api/src/main/resources/strings_fr-FR.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ infoSelectOrCreateContactImport = La base de données contient déjà au moins u
541541
infoSelectOrCreatePersonForContact = La base de données contient déjà au moins une personne qui semble être très similaire aux données personnelles du contact créé.<br/><br/>Veuillez consulter la liste des personnes. Si vous avez la certitude qu'une de ces personnes correspond à votre personne de contact, sélectionnez-la et cliquez sur le bouton <i>Enregistrer</i> . Sinon, cliquez sur <i>Créer une nouvelle personne</i> pour créer une nouvelle personne pour votre contact.<br/><br/>Si vous n'êtes pas sûr, vous pouvez supprimer cette fenêtre et annuler le processus de création de contact.
542542
infoSelectOrCreatePersonForContactImport = La base de données contient déjà au moins une personne qui semble être très similaire aux données personnelles du contact créé.<br/><br/>Veuillez consulter la liste des personnes. Si vous avez la certitude qu'une de ces personnes correspond à votre personne de contact, sélectionnez-la et cliquez sur le bouton <i>Enregistrer</i> . Sinon, cliquez sur <i>Créer une nouvelle personne</i> pour créer une nouvelle personne pour votre contact.<br/><br/>Si vous n'êtes pas sûr, vous pouvez supprimer cette fenêtre et annuler le processus de création de contact.
543543
infoSelectOrCreatePersonForEventParticipant = La base de données contient déjà au moins une personne qui semble être très similaire aux données personnelles du contact créé.<br/><br/>Veuillez consulter la liste des personnes. Si vous avez la certitude qu'une de ces personnes correspond à votre personne de contact, sélectionnez-la et cliquez sur le bouton <i>Enregistrer</i> . Sinon, cliquez sur <i>Créer une nouvelle personne</i> pour créer une nouvelle personne pour votre contact.<br/><br/>Si vous n'êtes pas sûr, vous pouvez supprimer cette fenêtre et annuler le processus de création de contact.
544+
infoSelectOrCreatePersonForEventParticipantImport = La base de données contient déjà au moins une personne qui semble être très similaire aux données personnelles du partcipant créé.<br/><br/>Veuillez consulter la liste des personnes. Si vous avez la certitude qu'une de ces personnes correspond à votre personne de participant, sélectionnez-la et cliquez sur le bouton <i>Enregistrer</i> . Sinon, cliquez sur <i>Créer une nouvelle personne</i> pour créer une nouvelle personne pour votre participant.<br/><br/>Si vous n'êtes pas sûr, vous pouvez fermer cette fenêtre pour supprimer le partcipant de l'importation courante.
544545
pseudonymizedCasesSelectedWarning = Pour les cas gérés en bloc, vous n'avez qu'un accès limité aux données sensibles. Dans ces cas, la valeur que vous mettez dans "Place Description" sera ignorée.
545546
infoPickOrCreateEventForCase = La liste ci-dessous contient tous les événements existants ayant la même maladie que le cas actuel. Veuillez vérifier si l'événement auquel appartient ce cas est déjà dans cette liste ou en créer un nouveau s'il ne l'est pas.
546547
infoSelectOrCreatePersonForCase = La base de données contient déjà au moins une personne qui semble être très similaire aux données personnelles du cas créé.<br/><br/>Veuillez consulter la liste des personnes. Si vous êtes certain qu'une de ces personnes correspond à la personne de votre cas, sélectionnez-les et cliquez sur le bouton <i>Sauvegarder</i>. Sinon, cliquez sur <i>Créer une nouvelle personne</i> pour créer une nouvelle personne pour votre cas.<br/><br/>Si vous n'êtes pas sûr, vous pouvez fermer cette fenêtre et annuler le processus de création du cas.

sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ public void deleteEventParticipant(EventParticipantReferenceDto eventParticipant
199199
eventParticipantService.delete(eventParticipant);
200200
}
201201

202+
@Override
203+
public EventParticipantDto getByUuid(String uuid) {
204+
return convertToDto(
205+
eventParticipantService.getByUuid(uuid),
206+
Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue)));
207+
}
208+
202209
@Override
203210
public List<EventParticipantIndexDto> getIndexList(
204211
EventParticipantCriteria eventParticipantCriteria,
@@ -453,6 +460,18 @@ public boolean isEventParticipantEditAllowed(String uuid) {
453460
return eventParticipantJurisdictionChecker.isInJurisdictionOrOwned(eventParticipant);
454461
}
455462

463+
@Override
464+
public EventParticipantDto getFirst(EventParticipantCriteria criteria) {
465+
466+
if (criteria.getEvent() == null) {
467+
return null;
468+
}
469+
470+
return eventParticipantService.getFirst(criteria)
471+
.map(e -> convertToDto(e, Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue))))
472+
.orElse(null);
473+
}
474+
456475
public EventParticipant fromDto(@NotNull EventParticipantDto source) {
457476

458477
EventParticipant target = eventParticipantService.getByUuid(source.getUuid());

sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantService.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919

2020
import java.util.Date;
2121
import java.util.List;
22+
import java.util.Optional;
2223

2324
import javax.ejb.EJB;
2425
import javax.ejb.LocalBean;
2526
import javax.ejb.Stateless;
27+
import javax.persistence.NoResultException;
2628
import javax.persistence.criteria.CriteriaBuilder;
2729
import javax.persistence.criteria.CriteriaQuery;
2830
import javax.persistence.criteria.From;
@@ -277,4 +279,22 @@ public List<String> getDeletedUuidsSince(Date since, User user) {
277279
public Predicate createDefaultFilter(CriteriaBuilder cb, Root<EventParticipant> root) {
278280
return cb.isFalse(root.get(EventParticipant.DELETED));
279281
}
282+
283+
public Optional<EventParticipant> getFirst(EventParticipantCriteria criteria) {
284+
285+
CriteriaBuilder cb = em.getCriteriaBuilder();
286+
CriteriaQuery<EventParticipant> cq = cb.createQuery(EventParticipant.class);
287+
Root<EventParticipant> eventParticipant = cq.from(EventParticipant.class);
288+
289+
Predicate filter = buildCriteriaFilter(criteria, cb, eventParticipant);
290+
cq.where(filter);
291+
cq.orderBy(cb.asc(eventParticipant.get(EventParticipant.UUID)));
292+
293+
try {
294+
return Optional.of(em.createQuery(cq).setFirstResult(0).setMaxResults(1).getSingleResult());
295+
} catch (NoResultException e) {
296+
return Optional.empty();
297+
}
298+
}
299+
280300
}

0 commit comments

Comments
 (0)