Search in sources :

Example 1 with SimilarEventParticipantDto

use of de.symeda.sormas.api.event.SimilarEventParticipantDto in project SORMAS-Project by hzi-braunschweig.

the class CaseController method convertSamePersonContactsAndEventparticipants.

private void convertSamePersonContactsAndEventparticipants(CaseDataDto caze, Date relevantDate) {
    ContactSimilarityCriteria contactCriteria = new ContactSimilarityCriteria().withPerson(caze.getPerson()).withDisease(caze.getDisease()).withContactClassification(ContactClassification.CONFIRMED).withExcludePseudonymized(true).withNoResultingCase(true);
    List<SimilarContactDto> matchingContacts = FacadeProvider.getContactFacade().getMatchingContacts(contactCriteria);
    EventParticipantCriteria eventParticipantCriteria = new EventParticipantCriteria().withPerson(caze.getPerson()).withDisease(caze.getDisease()).withExcludePseudonymized(true).withNoResultingCase(true);
    List<SimilarEventParticipantDto> matchingEventParticipants = FacadeProvider.getEventParticipantFacade().getMatchingEventParticipants(eventParticipantCriteria);
    if (matchingContacts.size() > 0 || matchingEventParticipants.size() > 0) {
        String infoText = matchingEventParticipants.isEmpty() ? String.format(I18nProperties.getString(Strings.infoConvertToCaseContacts), matchingContacts.size(), caze.getDisease()) : (matchingContacts.isEmpty() ? String.format(I18nProperties.getString(Strings.infoConvertToCaseEventParticipants), matchingEventParticipants.size(), caze.getDisease()) : String.format(I18nProperties.getString(Strings.infoConvertToCaseContactsAndEventParticipants), matchingContacts.size(), caze.getDisease(), matchingEventParticipants.size(), caze.getDisease()));
        HorizontalLayout infoComponent = VaadinUiUtil.createInfoComponent(infoText);
        infoComponent.setWidth(600, Sizeable.Unit.PIXELS);
        CommitDiscardWrapperComponent<HorizontalLayout> convertToCaseConfirmComponent = new CommitDiscardWrapperComponent<>(infoComponent);
        convertToCaseConfirmComponent.getCommitButton().setCaption(I18nProperties.getCaption(Captions.actionYesForAll));
        convertToCaseConfirmComponent.getDiscardButton().setCaption(I18nProperties.getCaption(Captions.actionNo));
        convertToCaseConfirmComponent.addCommitListener(() -> {
            CaseDataDto refreshedCaze = FacadeProvider.getCaseFacade().getCaseDataByUuid(caze.getUuid());
            refreshedCaze.getEpiData().setContactWithSourceCaseKnown(YesNoUnknown.YES);
            saveCase(refreshedCaze);
            setResultingCase(refreshedCaze, matchingContacts, matchingEventParticipants);
            SormasUI.refreshView();
        });
        Button convertSomeButton = ButtonHelper.createButton("convertSome", I18nProperties.getCaption(Captions.actionYesForSome), (Button.ClickListener) event -> {
            convertToCaseConfirmComponent.discard();
            showConvertToCaseSelection(caze, matchingContacts, matchingEventParticipants);
        }, ValoTheme.BUTTON_PRIMARY);
        HorizontalLayout buttonsPanel = convertToCaseConfirmComponent.getButtonsPanel();
        buttonsPanel.addComponent(convertSomeButton, convertToCaseConfirmComponent.getComponentCount() - 1);
        buttonsPanel.setComponentAlignment(convertSomeButton, Alignment.BOTTOM_RIGHT);
        buttonsPanel.setExpandRatio(convertSomeButton, 0);
        VaadinUiUtil.showModalPopupWindow(convertToCaseConfirmComponent, I18nProperties.getString(Strings.headingCaseConversion));
    }
}
Also used : Alignment(com.vaadin.ui.Alignment) CaseSimilarityCriteria(de.symeda.sormas.api.caze.CaseSimilarityCriteria) StringUtils(org.apache.commons.lang3.StringUtils) PersonDto(de.symeda.sormas.api.person.PersonDto) ClinicalCourseForm(de.symeda.sormas.ui.clinicalcourse.ClinicalCourseForm) YesNoUnknown(de.symeda.sormas.api.utils.YesNoUnknown) MaternalHistoryView(de.symeda.sormas.ui.caze.maternalhistory.MaternalHistoryView) CssStyles(de.symeda.sormas.ui.utils.CssStyles) Page(com.vaadin.server.Page) PortHealthInfoView(de.symeda.sormas.ui.caze.porthealthinfo.PortHealthInfoView) TextArea(com.vaadin.ui.TextArea) ValoTheme(com.vaadin.ui.themes.ValoTheme) DiseaseHelper(de.symeda.sormas.api.DiseaseHelper) Link(com.vaadin.ui.Link) HtmlHelper(de.symeda.sormas.api.utils.HtmlHelper) EpiDataForm(de.symeda.sormas.ui.epidata.EpiDataForm) Type(com.vaadin.ui.Notification.Type) CaseLogic(de.symeda.sormas.api.caze.CaseLogic) DateHelper8(de.symeda.sormas.ui.utils.DateHelper8) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) MaternalHistoryForm(de.symeda.sormas.ui.caze.maternalhistory.MaternalHistoryForm) CloseEvent(com.vaadin.ui.Window.CloseEvent) ExternalSurveillanceToolException(de.symeda.sormas.api.externalsurveillancetool.ExternalSurveillanceToolException) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) VerticalLayout(com.vaadin.ui.VerticalLayout) EventParticipantCriteria(de.symeda.sormas.api.event.EventParticipantCriteria) PersonReferenceDto(de.symeda.sormas.api.person.PersonReferenceDto) SymptomsContext(de.symeda.sormas.api.symptoms.SymptomsContext) ArrayList(java.util.ArrayList) ClassificationHtmlRenderer(de.symeda.sormas.api.caze.classification.ClassificationHtmlRenderer) ExternalSurveillanceServiceGateway(de.symeda.sormas.ui.externalsurveillanceservice.ExternalSurveillanceServiceGateway) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent) CountryHelper(de.symeda.sormas.api.CountryHelper) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto) TitleLayout(de.symeda.sormas.ui.utils.components.page.title.TitleLayout) ContactSimilarityCriteria(de.symeda.sormas.api.contact.ContactSimilarityCriteria) ContentMode(com.vaadin.shared.ui.ContentMode) MessageType(de.symeda.sormas.api.messaging.MessageType) DataHelper(de.symeda.sormas.api.utils.DataHelper) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) CaseFacade(de.symeda.sormas.api.caze.CaseFacade) ContactLogic(de.symeda.sormas.api.contact.ContactLogic) CaseOrigin(de.symeda.sormas.api.caze.CaseOrigin) SymptomsHelper(de.symeda.sormas.api.symptoms.SymptomsHelper) Captions(de.symeda.sormas.api.i18n.Captions) LineListingLayout(de.symeda.sormas.ui.caze.components.linelisting.LineListingLayout) AutomaticDeletionInfoDto(de.symeda.sormas.api.deletionconfiguration.AutomaticDeletionInfoDto) Button(com.vaadin.ui.Button) CaseBulkEditData(de.symeda.sormas.api.caze.CaseBulkEditData) Disease(de.symeda.sormas.api.Disease) VisitDto(de.symeda.sormas.api.visit.VisitDto) HorizontalLayout(com.vaadin.ui.HorizontalLayout) DiseaseClassificationCriteriaDto(de.symeda.sormas.api.caze.classification.DiseaseClassificationCriteriaDto) FeatureType(de.symeda.sormas.api.feature.FeatureType) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto) AutomaticDeletionLabel(de.symeda.sormas.ui.utils.components.automaticdeletion.AutomaticDeletionLabel) Date(java.util.Date) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) UI(com.vaadin.ui.UI) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) Window(com.vaadin.ui.Window) SymptomsForm(de.symeda.sormas.ui.symptoms.SymptomsForm) DetailSubComponentWrapper(de.symeda.sormas.ui.utils.DetailSubComponentWrapper) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) SmsComponent(de.symeda.sormas.ui.caze.messaging.SmsComponent) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CaseEpiDataView(de.symeda.sormas.ui.epidata.CaseEpiDataView) UserRole(de.symeda.sormas.api.user.UserRole) UserProvider(de.symeda.sormas.ui.UserProvider) PointOfEntryDto(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryDto) CloseListener(com.vaadin.ui.Window.CloseListener) ViewMode(de.symeda.sormas.ui.utils.ViewMode) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) FacilityType(de.symeda.sormas.api.infrastructure.facility.FacilityType) Collection(java.util.Collection) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) EventDto(de.symeda.sormas.api.event.EventDto) Collectors(java.util.stream.Collectors) ContactClassification(de.symeda.sormas.api.contact.ContactClassification) CommunityReferenceDto(de.symeda.sormas.api.infrastructure.community.CommunityReferenceDto) Objects(java.util.Objects) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) List(java.util.List) ExternalResource(com.vaadin.server.ExternalResource) TherapyView(de.symeda.sormas.ui.therapy.TherapyView) ContactDto(de.symeda.sormas.api.contact.ContactDto) Optional(java.util.Optional) UiFieldAccessCheckers(de.symeda.sormas.api.utils.fieldaccess.UiFieldAccessCheckers) ValidationRuntimeException(de.symeda.sormas.api.utils.ValidationRuntimeException) FacilityDto(de.symeda.sormas.api.infrastructure.facility.FacilityDto) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) DateHelper(de.symeda.sormas.api.utils.DateHelper) CollectionUtils(org.apache.commons.collections.CollectionUtils) Notification(com.vaadin.ui.Notification) SormasUI(de.symeda.sormas.ui.SormasUI) Label(com.vaadin.ui.Label) TitleLayoutHelper(de.symeda.sormas.ui.utils.components.page.title.TitleLayoutHelper) HospitalizationForm(de.symeda.sormas.ui.hospitalization.HospitalizationForm) SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) NullableOptionGroup(de.symeda.sormas.ui.utils.NullableOptionGroup) AbstractView(de.symeda.sormas.ui.utils.AbstractView) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) PortHealthInfoForm(de.symeda.sormas.ui.caze.porthealthinfo.PortHealthInfoForm) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) UserDto(de.symeda.sormas.api.user.UserDto) HospitalizationView(de.symeda.sormas.ui.hospitalization.HospitalizationView) Sizeable(com.vaadin.server.Sizeable) FacilityReferenceDto(de.symeda.sormas.api.infrastructure.facility.FacilityReferenceDto) Consumer(java.util.function.Consumer) Navigator(com.vaadin.navigator.Navigator) UserReferenceDto(de.symeda.sormas.api.user.UserReferenceDto) UserRight(de.symeda.sormas.api.user.UserRight) TravelEntryDto(de.symeda.sormas.api.travelentry.TravelEntryDto) PointOfEntryReferenceDto(de.symeda.sormas.api.infrastructure.pointofentry.PointOfEntryReferenceDto) ClinicalCourseView(de.symeda.sormas.ui.clinicalcourse.ClinicalCourseView) HospitalizationDto(de.symeda.sormas.api.hospitalization.HospitalizationDto) Unit(com.vaadin.server.Sizeable.Unit) Strings(de.symeda.sormas.api.i18n.Strings) Component(com.vaadin.ui.Component) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Button(com.vaadin.ui.Button) EventParticipantCriteria(de.symeda.sormas.api.event.EventParticipantCriteria) ContactSimilarityCriteria(de.symeda.sormas.api.contact.ContactSimilarityCriteria) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto)

Example 2 with SimilarEventParticipantDto

use of de.symeda.sormas.api.event.SimilarEventParticipantDto in project SORMAS-Project by hzi-braunschweig.

the class CaseController method setResultingCase.

private void setResultingCase(CaseDataDto caze, List<SimilarContactDto> matchingContacts, List<SimilarEventParticipantDto> matchingEventParticipants) {
    if (matchingContacts != null && !matchingContacts.isEmpty()) {
        List<String> contactUuids = matchingContacts.stream().map(SimilarContactDto::getUuid).collect(Collectors.toList());
        List<ContactDto> contacts = FacadeProvider.getContactFacade().getByUuids(contactUuids);
        for (ContactDto contact : contacts) {
            contact.setContactStatus(ContactStatus.CONVERTED);
            contact.setResultingCase(caze.toReference());
            contact.setResultingCaseUser(UserProvider.getCurrent().getUserReference());
            FacadeProvider.getContactFacade().save(contact);
        }
    }
    if (matchingEventParticipants != null && !matchingEventParticipants.isEmpty()) {
        List<String> eventParticipantUuids = matchingEventParticipants.stream().map(SimilarEventParticipantDto::getUuid).collect(Collectors.toList());
        List<EventParticipantDto> eventParticipants = FacadeProvider.getEventParticipantFacade().getByUuids(eventParticipantUuids);
        for (EventParticipantDto eventParticipant : eventParticipants) {
            eventParticipant.setResultingCase(caze.toReference());
            FacadeProvider.getEventParticipantFacade().save(eventParticipant);
        }
    }
}
Also used : SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) ContactDto(de.symeda.sormas.api.contact.ContactDto) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto)

Example 3 with SimilarEventParticipantDto

use of de.symeda.sormas.api.event.SimilarEventParticipantDto in project SORMAS-Project by hzi-braunschweig.

the class EventParticipantFacadeEjb method getMatchingEventParticipants.

@Override
public List<SimilarEventParticipantDto> getMatchingEventParticipants(EventParticipantCriteria criteria) {
    final CriteriaBuilder cb = em.getCriteriaBuilder();
    final CriteriaQuery<SimilarEventParticipantDto> cq = cb.createQuery(SimilarEventParticipantDto.class);
    final Root<EventParticipant> eventParticipantRoot = cq.from(EventParticipant.class);
    cq.distinct(true);
    Join<Object, Object> personJoin = eventParticipantRoot.join(EventParticipant.PERSON, JoinType.LEFT);
    Join<Object, Object> eventJoin = eventParticipantRoot.join(EventParticipant.EVENT, JoinType.LEFT);
    EventParticipantQueryContext eventParticipantQueryContext = new EventParticipantQueryContext(cb, cq, eventParticipantRoot);
    Expression<Object> jurisdictionSelector = JurisdictionHelper.booleanSelector(cb, service.inJurisdictionOrOwned(new EventParticipantQueryContext(cb, cq, eventParticipantRoot)));
    cq.multiselect(eventParticipantRoot.get(EventParticipant.UUID), personJoin.get(Person.FIRST_NAME), personJoin.get(Person.LAST_NAME), eventParticipantRoot.get(EventParticipant.INVOLVEMENT_DESCRIPTION), eventJoin.get(Event.UUID), eventJoin.get(Event.EVENT_STATUS), eventJoin.get(Event.EVENT_TITLE), eventJoin.get(Event.START_DATE), jurisdictionSelector);
    cq.groupBy(eventParticipantRoot.get(EventParticipant.UUID), personJoin.get(Person.FIRST_NAME), personJoin.get(Person.LAST_NAME), eventParticipantRoot.get(EventParticipant.INVOLVEMENT_DESCRIPTION), eventJoin.get(Event.UUID), eventJoin.get(Event.EVENT_STATUS), eventJoin.get(Event.EVENT_TITLE), eventJoin.get(Event.START_DATE), jurisdictionSelector);
    final Predicate defaultFilter = service.createDefaultFilter(cb, eventParticipantRoot);
    final Predicate userFilter = service.createUserFilter(eventParticipantQueryContext);
    final PersonReferenceDto person = criteria.getPerson();
    final Predicate samePersonFilter = person != null ? cb.equal(personJoin.get(Person.UUID), person.getUuid()) : null;
    final Disease disease = criteria.getDisease();
    final Predicate diseaseFilter = disease != null ? cb.equal(eventJoin.get(Event.DISEASE), disease) : null;
    final Date relevantDate = criteria.getRelevantDate();
    final Predicate relevantDateFilter = CriteriaBuilderHelper.or(cb, contactService.recentDateFilter(cb, relevantDate, eventJoin.get(Event.START_DATE), 30), contactService.recentDateFilter(cb, relevantDate, eventJoin.get(Event.END_DATE), 30), contactService.recentDateFilter(cb, relevantDate, eventJoin.get(Event.REPORT_DATE_TIME), 30));
    final Predicate noResulingCaseFilter = Boolean.TRUE.equals(criteria.getNoResultingCase()) ? cb.isNull(eventParticipantRoot.get(EventParticipant.RESULTING_CASE)) : null;
    cq.where(CriteriaBuilderHelper.and(cb, defaultFilter, userFilter, samePersonFilter, diseaseFilter, relevantDateFilter, noResulingCaseFilter));
    List<SimilarEventParticipantDto> participants = em.createQuery(cq).getResultList();
    Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight);
    pseudonymizer.pseudonymizeDtoCollection(SimilarEventParticipantDto.class, participants, p -> p.getInJurisdiction(), null);
    if (Boolean.TRUE.equals(criteria.getExcludePseudonymized())) {
        participants = participants.stream().filter(e -> !e.isPseudonymized()).collect(Collectors.toList());
    }
    return participants;
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) Disease(de.symeda.sormas.api.Disease) PersonReferenceDto(de.symeda.sormas.api.person.PersonReferenceDto) Date(java.util.Date) LocalDate(java.time.LocalDate) Predicate(javax.persistence.criteria.Predicate) AbstractDomainObject(de.symeda.sormas.backend.common.AbstractDomainObject) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto)

Example 4 with SimilarEventParticipantDto

use of de.symeda.sormas.api.event.SimilarEventParticipantDto in project SORMAS-Project by hzi-braunschweig.

the class EventParticipantSelectionGrid method buildGrid.

private void buildGrid() {
    setSizeFull();
    setSelectionMode(SelectionMode.SINGLE);
    setHeightMode(HeightMode.ROW);
    BeanItemContainer<SimilarEventParticipantDto> container = new BeanItemContainer(SimilarEventParticipantDto.class);
    GeneratedPropertyContainer generatedContainer = new GeneratedPropertyContainer(container);
    setContainerDataSource(generatedContainer);
    setColumns();
}
Also used : GeneratedPropertyContainer(com.vaadin.v7.data.util.GeneratedPropertyContainer) BeanItemContainer(com.vaadin.v7.data.util.BeanItemContainer) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto)

Example 5 with SimilarEventParticipantDto

use of de.symeda.sormas.api.event.SimilarEventParticipantDto in project SORMAS-Project by hzi-braunschweig.

the class AbstractLabMessageProcessingFlowTest method init.

@Override
@SuppressWarnings("unchecked")
public void init() {
    super.init();
    missingDiseaseHandler = Mockito.mock(Supplier.class);
    when(missingDiseaseHandler.get()).thenReturn(CompletableFuture.completedFuture(true));
    relatedForwardedMessagesHandler = Mockito.mock(Supplier.class);
    when(relatedForwardedMessagesHandler.get()).thenReturn(CompletableFuture.completedFuture(true));
    relatedLabMessageHandler = Mockito.mock(AbstractRelatedLabMessageHandler.class);
    when(relatedLabMessageHandler.handle(any())).thenReturn(CompletableFuture.completedFuture(new HandlerResult(HandlerResultStatus.NOT_HANDLED, null)));
    handlePickOrCreatePerson = Mockito.mock(BiFunction.class);
    doAnswer(answerPickOrCreatePerson(null)).when(handlePickOrCreatePerson).apply(any(), any());
    handlePickOrCreateEntry = Mockito.mock(PickOrCreateEntryHandler.class);
    PickOrCreateEntryResult pickOrCreateEntryResult = new PickOrCreateEntryResult();
    pickOrCreateEntryResult.setNewCase(true);
    doAnswer(answerPickOrCreateEntry(pickOrCreateEntryResult)).when(handlePickOrCreateEntry).handle(any(), any(), any(), any());
    handleCreateCase = Mockito.mock(EntityCreationHandler.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(invocation.getArgument(0));
        return null;
    }).when(handleCreateCase).handle(any(), any(), any());
    handleCreateSampleAndPathogenTests = Mockito.mock(CreateSampleAndPathogenTestHandler.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(new SampleAndPathogenTests(invocation.getArgument(0), invocation.getArgument(1)));
        return null;
    }).when(handleCreateSampleAndPathogenTests).handle(any(), any(), any(), any());
    handleCreateContact = Mockito.mock(EntityCreationHandler.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(invocation.getArgument(0));
        return null;
    }).when(handleCreateContact).handle(any(), any(), any());
    handlePickOrCreateEvent = Mockito.mock(Consumer.class);
    PickOrCreateEventResult pickOrCreateEventResult = new PickOrCreateEventResult();
    pickOrCreateEventResult.setNewEvent(true);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(pickOrCreateEventResult);
        return null;
    }).when(handlePickOrCreateEvent).accept(any());
    handleCreateEvent = Mockito.mock(BiConsumer.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(invocation.getArgument(0));
        return null;
    }).when(handleCreateEvent).accept(any(), any());
    handleCreateEventParticipant = Mockito.mock(BiConsumer.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(invocation.getArgument(0));
        return null;
    }).when(handleCreateEventParticipant).accept(any(), any());
    confirmPickExistingEventParticipant = Mockito.mock(Supplier.class);
    when(confirmPickExistingEventParticipant.get()).thenReturn(CompletableFuture.completedFuture(true));
    handlePickOrCreateSample = Mockito.mock(BiConsumer.class);
    PickOrCreateSampleResult pickOrCreateSampleResult = new PickOrCreateSampleResult();
    pickOrCreateSampleResult.setNewSample(true);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(pickOrCreateSampleResult);
        return null;
    }).when(handlePickOrCreateSample).accept(any(), any());
    handleEditSample = Mockito.mock(EditSampleHandler.class);
    doAnswer((invocation) -> {
        getCallbackParam(invocation).done(new SampleAndPathogenTests(invocation.getArgument(0), invocation.getArgument(1)));
        return null;
    }).when(handleEditSample).handle(any(), any(), any());
    rdcf = creator.createRDCF();
    user = creator.createUser(rdcf, UserRole.NATIONAL_USER);
    country = new CountryReferenceDto(DataHelper.createUuid(), "de-DE");
    flow = new AbstractLabMessageProcessingFlow(user, country) {

        @Override
        protected CompletionStage<Boolean> handleMissingDisease() {
            return missingDiseaseHandler.get();
        }

        @Override
        protected CompletionStage<Boolean> handleRelatedForwardedMessages() {
            return relatedForwardedMessagesHandler.get();
        }

        @Override
        protected void handlePickOrCreatePerson(PersonDto person, HandlerCallback<PersonDto> callback) {
            handlePickOrCreatePerson.apply(person, callback);
        }

        @Override
        protected void handlePickOrCreateEntry(List<CaseSelectionDto> similarCases, List<SimilarContactDto> similarContacts, List<SimilarEventParticipantDto> similarEventParticipants, LabMessageDto labMessageDto, HandlerCallback<PickOrCreateEntryResult> callback) {
            handlePickOrCreateEntry.handle(similarCases, similarContacts, similarEventParticipants, callback);
        }

        @Override
        protected void handleCreateCase(CaseDataDto caze, PersonDto person, LabMessageDto labMessage, HandlerCallback<CaseDataDto> callback) {
            handleCreateCase.handle(caze, person, callback);
        }

        @Override
        protected void handleCreateSampleAndPathogenTests(SampleDto sample, List<PathogenTestDto> pathogenTests, Disease disease, LabMessageDto labMessage, boolean entityCreated, HandlerCallback<SampleAndPathogenTests> callback) {
            handleCreateSampleAndPathogenTests.handle(sample, pathogenTests, entityCreated, callback);
        }

        @Override
        protected void handleCreateContact(ContactDto contact, PersonDto person, LabMessageDto labMessage, HandlerCallback<ContactDto> callback) {
            handleCreateContact.handle(contact, person, callback);
        }

        @Override
        protected void handlePickOrCreateEvent(LabMessageDto labMessage, HandlerCallback<PickOrCreateEventResult> callback) {
            handlePickOrCreateEvent.accept(callback);
        }

        @Override
        protected void handleCreateEvent(EventDto event, HandlerCallback<EventDto> callback) {
            handleCreateEvent.accept(event, callback);
        }

        @Override
        protected void handleCreateEventParticipant(EventParticipantDto eventParticipant, EventDto event, LabMessageDto labMessage, HandlerCallback<EventParticipantDto> callback) {
            handleCreateEventParticipant.accept(eventParticipant, callback);
        }

        @Override
        protected CompletionStage<Boolean> confirmPickExistingEventParticipant() {
            return confirmPickExistingEventParticipant.get();
        }

        @Override
        protected void handlePickOrCreateSample(List<SampleDto> samples, LabMessageDto labMessageDto, HandlerCallback<PickOrCreateSampleResult> callback) {
            handlePickOrCreateSample.accept(samples, callback);
        }

        @Override
        protected void handleEditSample(SampleDto sample, List<PathogenTestDto> newPathogenTests, LabMessageDto labMessage, HandlerCallback<SampleAndPathogenTests> callback) {
            handleEditSample.handle(sample, newPathogenTests, callback);
        }
    };
}
Also used : Disease(de.symeda.sormas.api.Disease) PickOrCreateEntryResult(de.symeda.sormas.ui.labmessage.processing.PickOrCreateEntryResult) PathogenTestDto(de.symeda.sormas.api.sample.PathogenTestDto) BiConsumer(java.util.function.BiConsumer) Consumer(java.util.function.Consumer) AbstractRelatedLabMessageHandler(de.symeda.sormas.ui.labmessage.processing.AbstractRelatedLabMessageHandler) AbstractLabMessageProcessingFlow(de.symeda.sormas.ui.labmessage.processing.AbstractLabMessageProcessingFlow) ContactDto(de.symeda.sormas.api.contact.ContactDto) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) Supplier(java.util.function.Supplier) PickOrCreateSampleResult(de.symeda.sormas.ui.labmessage.processing.PickOrCreateSampleResult) CompletionStage(java.util.concurrent.CompletionStage) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) PersonDto(de.symeda.sormas.api.person.PersonDto) LabMessageDto(de.symeda.sormas.api.labmessage.LabMessageDto) EventDto(de.symeda.sormas.api.event.EventDto) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto) HandlerResult(de.symeda.sormas.ui.labmessage.processing.AbstractRelatedLabMessageHandler.HandlerResult) SimilarContactDto(de.symeda.sormas.api.contact.SimilarContactDto) SampleAndPathogenTests(de.symeda.sormas.ui.labmessage.processing.SampleAndPathogenTests) BiFunction(java.util.function.BiFunction) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto) CountryReferenceDto(de.symeda.sormas.api.infrastructure.country.CountryReferenceDto) PickOrCreateEventResult(de.symeda.sormas.ui.labmessage.processing.PickOrCreateEventResult) SimilarEventParticipantDto(de.symeda.sormas.api.event.SimilarEventParticipantDto) SampleDto(de.symeda.sormas.api.sample.SampleDto) BiConsumer(java.util.function.BiConsumer)

Aggregations

SimilarEventParticipantDto (de.symeda.sormas.api.event.SimilarEventParticipantDto)13 SimilarContactDto (de.symeda.sormas.api.contact.SimilarContactDto)8 EventParticipantDto (de.symeda.sormas.api.event.EventParticipantDto)8 EventDto (de.symeda.sormas.api.event.EventDto)7 CaseSelectionDto (de.symeda.sormas.api.caze.CaseSelectionDto)6 ContactDto (de.symeda.sormas.api.contact.ContactDto)6 PersonDto (de.symeda.sormas.api.person.PersonDto)6 Disease (de.symeda.sormas.api.Disease)5 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)5 Date (java.util.Date)5 PersonReferenceDto (de.symeda.sormas.api.person.PersonReferenceDto)4 Consumer (java.util.function.Consumer)4 FacadeProvider (de.symeda.sormas.api.FacadeProvider)3 SampleDto (de.symeda.sormas.api.sample.SampleDto)3 List (java.util.List)3 Navigator (com.vaadin.navigator.Navigator)2 ExternalResource (com.vaadin.server.ExternalResource)2 Page (com.vaadin.server.Page)2 Sizeable (com.vaadin.server.Sizeable)2 Unit (com.vaadin.server.Sizeable.Unit)2