Search in sources :

Example 1 with ContactIndexDto

use of de.symeda.sormas.api.contact.ContactIndexDto in project SORMAS-Project by hzi-braunschweig.

the class ContactFacadeEjb method getIndexList.

@Override
public List<ContactIndexDto> getIndexList(ContactCriteria contactCriteria, Integer first, Integer max, List<SortProperty> sortProperties) {
    CriteriaQuery<ContactIndexDto> query = listCriteriaBuilder.buildIndexCriteria(contactCriteria, sortProperties);
    List<ContactIndexDto> dtos = QueryHelper.getResultList(em, query, first, max);
    Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
    pseudonymizer.pseudonymizeDtoCollection(ContactIndexDto.class, dtos, ContactIndexDto::getInJurisdiction, (c, isInJurisdiction) -> {
        if (c.getCaze() != null) {
            pseudonymizer.pseudonymizeDto(CaseReferenceDto.class, c.getCaze(), c.getCaseInJurisdiction(), null);
        }
    });
    return dtos;
}
Also used : Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) MergeContactIndexDto(de.symeda.sormas.api.contact.MergeContactIndexDto) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto)

Example 2 with ContactIndexDto

use of de.symeda.sormas.api.contact.ContactIndexDto in project SORMAS-Project by hzi-braunschweig.

the class ContactController method showBulkContactDataEditComponent.

public void showBulkContactDataEditComponent(Collection<? extends ContactIndexDto> selectedContacts, String caseUuid) {
    if (selectedContacts.size() == 0) {
        new Notification(I18nProperties.getString(Strings.headingNoContactsSelected), I18nProperties.getString(Strings.messageNoContactsSelected), Type.WARNING_MESSAGE, false).show(Page.getCurrent());
        return;
    }
    // Check if cases with multiple districts have been selected
    String districtUuid = null;
    for (ContactIndexDto selectedContact : selectedContacts) {
        String selectedDistrictUuid = selectedContact.getDistrictUuid();
        if (districtUuid == null) {
            districtUuid = selectedDistrictUuid;
        } else if (!districtUuid.equals(selectedDistrictUuid)) {
            districtUuid = null;
            break;
        }
    }
    DistrictReferenceDto district = districtUuid != null ? FacadeProvider.getDistrictFacade().getReferenceByUuid(districtUuid) : null;
    // Create a temporary contact in order to use the CommitDiscardWrapperComponent
    ContactBulkEditData bulkEditData = new ContactBulkEditData();
    BulkContactDataForm form = new BulkContactDataForm(district, selectedContacts);
    form.setValue(bulkEditData);
    final CommitDiscardWrapperComponent<BulkContactDataForm> editView = new CommitDiscardWrapperComponent<BulkContactDataForm>(form, form.getFieldGroup());
    Window popupWindow = VaadinUiUtil.showModalPopupWindow(editView, I18nProperties.getString(Strings.headingEditContacts));
    editView.addCommitListener(() -> {
        ContactBulkEditData updatedBulkEditData = form.getValue();
        ContactFacade contactFacade = FacadeProvider.getContactFacade();
        boolean classificationChange = form.getClassificationCheckBox().getValue();
        boolean contactOfficerChange = district != null ? form.getContactOfficerCheckBox().getValue() : false;
        int changedContacts = bulkEdit(selectedContacts, updatedBulkEditData, contactFacade, classificationChange, contactOfficerChange);
        popupWindow.close();
        if (caseUuid == null) {
            overview();
        } else {
            caseContactsOverview(caseUuid);
        }
        if (changedContacts == selectedContacts.size()) {
            Notification.show(I18nProperties.getString(Strings.messageContactsEdited), Type.HUMANIZED_MESSAGE);
        } else {
            NotificationHelper.showNotification(String.format(I18nProperties.getString(Strings.messageContactsEditedExceptArchived), changedContacts), Type.HUMANIZED_MESSAGE, -1);
        }
    });
    editView.addDiscardListener(() -> popupWindow.close());
}
Also used : Window(com.vaadin.ui.Window) ContactFacade(de.symeda.sormas.api.contact.ContactFacade) ContactBulkEditData(de.symeda.sormas.api.contact.ContactBulkEditData) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) Notification(com.vaadin.ui.Notification) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto)

Example 3 with ContactIndexDto

use of de.symeda.sormas.api.contact.ContactIndexDto in project SORMAS-Project by hzi-braunschweig.

the class AbstractContactGrid method initColumns.

@SuppressWarnings("unchecked")
protected void initColumns() {
    Column<IndexDto, String> diseaseShortColumn = addColumn(entry -> DiseaseHelper.toString(entry.getDisease(), entry.getDiseaseDetails()));
    diseaseShortColumn.setId(DISEASE_SHORT);
    diseaseShortColumn.setSortProperty(ContactIndexDto.DISEASE);
    Column<IndexDto, String> visitsColumn = addColumn(entry -> {
        if (FacadeProvider.getDiseaseConfigurationFacade().hasFollowUp(entry.getDisease())) {
            int numberOfVisits = entry.getVisitCount();
            int numberOfRequiredVisits = FollowUpLogic.getNumberOfRequiredVisitsSoFar(entry.getReportDateTime(), entry.getFollowUpUntil());
            int numberOfMissedVisits = numberOfRequiredVisits - numberOfVisits;
            // Set number of missed visits to 0 when more visits than expected have been done
            if (numberOfMissedVisits < 0) {
                numberOfMissedVisits = 0;
            }
            return String.format(I18nProperties.getCaption(Captions.formatNumberOfVisitsFormat), numberOfVisits, numberOfMissedVisits);
        } else {
            return "-";
        }
    });
    visitsColumn.setId(NUMBER_OF_VISITS);
    visitsColumn.setSortable(false);
    addComponentColumn(indexDto -> {
        Label label = new Label(indexDto.getCompleteness() != null ? new DecimalFormat("#").format(indexDto.getCompleteness() * 100) + " %" : "-");
        if (indexDto.getCompleteness() != null) {
            if (indexDto.getCompleteness() < 0.25f) {
                CssStyles.style(label, CssStyles.LABEL_CRITICAL);
            } else if (indexDto.getCompleteness() < 0.5f) {
                CssStyles.style(label, CssStyles.LABEL_IMPORTANT);
            } else if (indexDto.getCompleteness() < 0.75f) {
                CssStyles.style(label, CssStyles.LABEL_RELEVANT);
            } else {
                CssStyles.style(label, CssStyles.LABEL_POSITIVE);
            }
        }
        return label;
    }).setId(COLUMN_COMPLETENESS);
    getColumn(COLUMN_COMPLETENESS).setCaption(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.COMPLETENESS));
    getColumn(COLUMN_COMPLETENESS).setSortable(false);
    boolean tasksFeatureEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TASK_MANAGEMENT);
    if (tasksFeatureEnabled) {
        Column<IndexDto, String> pendingTasksColumn = addColumn(entry -> String.format(I18nProperties.getCaption(Captions.formatSimpleNumberFormat), FacadeProvider.getTaskFacade().getPendingTaskCountByContact(entry.toReference())));
        pendingTasksColumn.setId(NUMBER_OF_PENDING_TASKS);
        pendingTasksColumn.setSortable(false);
    }
    setColumns(getColumnList().toArray(String[]::new));
    if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY)) {
        getColumn(ContactIndexDto.CONTACT_CATEGORY).setHidden(true);
    }
    if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY) && !FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_SWITZERLAND)) {
        getColumn(CaseIndexDto.EXTERNAL_ID).setHidden(true);
        getColumn(CaseIndexDto.EXTERNAL_TOKEN).setHidden(true);
    }
    getColumn(ContactIndexDto.CONTACT_PROXIMITY).setWidth(200);
    ((Column<ContactIndexDto, String>) getColumn(ContactIndexDto.UUID)).setRenderer(new UuidRenderer());
    ((Column<ContactIndexDto, String>) getColumn(ContactIndexDto.PERSON_UUID)).setRenderer(new UuidRenderer());
    ((Column<ContactIndexDto, Date>) getColumn(ContactIndexDto.FOLLOW_UP_UNTIL)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
    if (!FacadeProvider.getConfigFacade().isExternalJournalActive()) {
        getColumn(ContactIndexDto.SYMPTOM_JOURNAL_STATUS).setHidden(true);
    }
    for (Column<IndexDto, ?> column : getColumns()) {
        column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), ContactIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX, LocationDto.I18N_PREFIX));
        column.setStyleGenerator(FieldAccessColumnStyleGenerator.getDefault(getBeanType(), column.getId()));
    }
}
Also used : FollowUpStatus(de.symeda.sormas.api.contact.FollowUpStatus) FeatureType(de.symeda.sormas.api.feature.FeatureType) ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) DataProviderListener(com.vaadin.data.provider.DataProviderListener) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) Date(java.util.Date) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DateFormatHelper(de.symeda.sormas.ui.utils.DateFormatHelper) SortDirection(com.vaadin.shared.data.sort.SortDirection) PersonDto(de.symeda.sormas.api.person.PersonDto) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) FieldAccessColumnStyleGenerator(de.symeda.sormas.ui.utils.FieldAccessColumnStyleGenerator) Label(com.vaadin.ui.Label) CountryHelper(de.symeda.sormas.api.CountryHelper) DataProvider(com.vaadin.data.provider.DataProvider) UserProvider(de.symeda.sormas.ui.UserProvider) DateRenderer(com.vaadin.ui.renderers.DateRenderer) LocationDto(de.symeda.sormas.api.location.LocationDto) ListDataProvider(com.vaadin.data.provider.ListDataProvider) FilteredGrid(de.symeda.sormas.ui.utils.FilteredGrid) DiseaseHelper(de.symeda.sormas.api.DiseaseHelper) DecimalFormat(java.text.DecimalFormat) SortProperty(de.symeda.sormas.api.utils.SortProperty) Collectors(java.util.stream.Collectors) Captions(de.symeda.sormas.api.i18n.Captions) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) UserRight(de.symeda.sormas.api.user.UserRight) ShowDetailsListener(de.symeda.sormas.ui.utils.ShowDetailsListener) List(java.util.List) Stream(java.util.stream.Stream) FollowUpLogic(de.symeda.sormas.api.followup.FollowUpLogic) View(com.vaadin.navigator.View) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) DecimalFormat(java.text.DecimalFormat) Label(com.vaadin.ui.Label) DateRenderer(com.vaadin.ui.renderers.DateRenderer)

Example 4 with ContactIndexDto

use of de.symeda.sormas.api.contact.ContactIndexDto in project SORMAS-Project by hzi-braunschweig.

the class ContactsView method createStatusFilterBar.

public HorizontalLayout createStatusFilterBar() {
    HorizontalLayout statusFilterLayout = new HorizontalLayout();
    statusFilterLayout.setMargin(false);
    statusFilterLayout.setSpacing(true);
    statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
    statusFilterLayout.addStyleName(CssStyles.VSPACE_3);
    statusButtons = new HashMap<>();
    Button statusAll = ButtonHelper.createButton(I18nProperties.getCaption(Captions.all), e -> {
        criteria.contactStatus(null);
        navigateTo(criteria);
    }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
    statusAll.setCaptionAsHtml(true);
    if (ContactsViewType.FOLLOW_UP_VISITS_OVERVIEW.equals(viewConfiguration.getViewType())) {
        CssStyles.style(statusAll, CssStyles.FORCE_CAPTION);
    }
    statusFilterLayout.addComponent(statusAll);
    statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
    activeStatusButton = statusAll;
    for (ContactStatus status : ContactStatus.values()) {
        Button statusButton = ButtonHelper.createButton("status-" + status.toString(), status.toString(), e -> {
            criteria.contactStatus(status);
            navigateTo(criteria);
        }, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT);
        statusButton.setCaptionAsHtml(true);
        statusButton.setData(status);
        if (ContactsViewType.FOLLOW_UP_VISITS_OVERVIEW.equals(viewConfiguration.getViewType())) {
            CssStyles.style(statusButton, CssStyles.FORCE_CAPTION);
        }
        statusFilterLayout.addComponent(statusButton);
        statusButtons.put(statusButton, status.toString());
    }
    HorizontalLayout actionButtonsLayout = new HorizontalLayout();
    actionButtonsLayout.setSpacing(true);
    {
        // Show active/archived/all dropdown
        if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) {
            if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AUTOMATIC_ARCHIVING, CoreEntityType.CONTACT)) {
                int daysAfterContactGetsArchived = FacadeProvider.getFeatureConfigurationFacade().getProperty(FeatureType.AUTOMATIC_ARCHIVING, CoreEntityType.CONTACT, FeatureTypeProperty.THRESHOLD_IN_DAYS, Integer.class);
                if (daysAfterContactGetsArchived > 0) {
                    relevanceStatusInfoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + String.format(I18nProperties.getString(Strings.infoArchivedContacts), daysAfterContactGetsArchived), ContentMode.HTML);
                    relevanceStatusInfoLabel.setVisible(false);
                    relevanceStatusInfoLabel.addStyleName(CssStyles.LABEL_VERTICAL_ALIGN_SUPER);
                    actionButtonsLayout.addComponent(relevanceStatusInfoLabel);
                    actionButtonsLayout.setComponentAlignment(relevanceStatusInfoLabel, Alignment.MIDDLE_RIGHT);
                }
            }
            relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
            relevanceStatusFilter.setId("relevanceStatus");
            relevanceStatusFilter.setWidth(140, Unit.PERCENTAGE);
            relevanceStatusFilter.setNullSelectionAllowed(false);
            relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.contactActiveContacts));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.contactArchivedContacts));
            relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.contactAllContacts));
            relevanceStatusFilter.addValueChangeListener(e -> {
                if (relevanceStatusInfoLabel != null) {
                    relevanceStatusInfoLabel.setVisible(EntityRelevanceStatus.ARCHIVED.equals(e.getProperty().getValue()));
                }
                criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
                navigateTo(criteria);
            });
            actionButtonsLayout.addComponent(relevanceStatusFilter);
        }
        // Bulk operation dropdown
        if (isBulkEditAllowed()) {
            statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
            boolean hasBulkOperationsRight = UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS);
            List<MenuBarHelper.MenuBarItem> bulkActions = new ArrayList<>(Arrays.asList(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, mi -> grid.bulkActionHandler(items -> ControllerProvider.getContactController().showBulkContactDataEditComponent(items, null)), hasBulkOperationsRight), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE, mi -> grid.bulkActionHandler(items -> ControllerProvider.getContactController().cancelFollowUpOfAllSelectedItems(items, () -> navigateTo(criteria))), hasBulkOperationsRight), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK, mi -> grid.bulkActionHandler(items -> ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(items, () -> navigateTo(criteria))), hasBulkOperationsRight), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, mi -> grid.bulkActionHandler(items -> ControllerProvider.getContactController().deleteAllSelectedItems(items, () -> navigateTo(criteria)), true), hasBulkOperationsRight), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.sormasToSormasShare), VaadinIcons.SHARE, mi -> grid.bulkActionHandler(items -> ControllerProvider.getSormasToSormasController().shareSelectedContacts(items, () -> navigateTo(criteria))), FacadeProvider.getSormasToSormasFacade().isSharingCasesContactsAndSamplesEnabledForUser())));
            if (isDocGenerationAllowed() && grid instanceof AbstractContactGrid) {
                bulkActions.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkActionCreatDocuments), VaadinIcons.FILE_TEXT, mi -> grid.bulkActionHandler(items -> {
                    List<ReferenceDto> references = ((AbstractContactGrid<?>) grid).asMultiSelect().getSelectedItems().stream().map(ContactIndexDto::toReference).collect(Collectors.toList());
                    if (references.size() == 0) {
                        new Notification(I18nProperties.getString(Strings.headingNoContactsSelected), I18nProperties.getString(Strings.messageNoContactsSelected), Notification.Type.WARNING_MESSAGE, false).show(Page.getCurrent());
                        return;
                    }
                    ControllerProvider.getDocGenerationController().showBulkQuarantineOrderDocumentDialog(references, DocumentWorkflow.QUARANTINE_ORDER_CONTACT);
                })));
            }
            if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)) {
                bulkActions.add(new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkLinkToEvent), VaadinIcons.PHONE, mi -> grid.bulkActionHandler(items -> {
                    List<ContactIndexDto> selectedContacts = grid.asMultiSelect().getSelectedItems().stream().map(item -> (ContactIndexDto) item).collect(Collectors.toList());
                    if (selectedContacts.isEmpty()) {
                        new Notification(I18nProperties.getString(Strings.headingNoContactsSelected), I18nProperties.getString(Strings.messageNoContactsSelected), Notification.Type.WARNING_MESSAGE, false).show(Page.getCurrent());
                        return;
                    }
                    if (!selectedContacts.stream().allMatch(contact -> contact.getDisease().equals(selectedContacts.stream().findAny().get().getDisease()))) {
                        new Notification(I18nProperties.getString(Strings.messageBulkContactsWithDifferentDiseasesSelected), Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                        return;
                    }
                    ControllerProvider.getEventController().selectOrCreateEventForContactList(selectedContacts.stream().map(ContactIndexDto::toReference).collect(Collectors.toList()));
                })));
            }
            bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, bulkActions);
            bulkOperationsDropdown.setVisible(viewConfiguration.isInEagerMode());
            actionButtonsLayout.addComponent(bulkOperationsDropdown);
        }
    }
    statusFilterLayout.addComponent(actionButtonsLayout);
    statusFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
    statusFilterLayout.setExpandRatio(actionButtonsLayout, 1);
    return statusFilterLayout;
}
Also used : FeatureType(de.symeda.sormas.api.feature.FeatureType) ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) Arrays(java.util.Arrays) CaseController(de.symeda.sormas.ui.caze.CaseController) Date(java.util.Date) DocumentWorkflow(de.symeda.sormas.api.docgeneneration.DocumentWorkflow) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Alignment(com.vaadin.ui.Alignment) ReferenceDto(de.symeda.sormas.api.ReferenceDto) Window(com.vaadin.ui.Window) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ExportEntityName(de.symeda.sormas.ui.utils.ExportEntityName) ContactDownloadUtil(de.symeda.sormas.ui.utils.ContactDownloadUtil) ViewModelProviders(de.symeda.sormas.ui.ViewModelProviders) CssStyles(de.symeda.sormas.ui.utils.CssStyles) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) Page(com.vaadin.server.Page) ViewChangeEvent(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) VaadinIcons(com.vaadin.icons.VaadinIcons) ComboBoxHelper(de.symeda.sormas.ui.utils.ComboBoxHelper) UserProvider(de.symeda.sormas.ui.UserProvider) ValoTheme(com.vaadin.ui.themes.ValoTheme) DownloadUtil(de.symeda.sormas.ui.utils.DownloadUtil) FilteredGrid(de.symeda.sormas.ui.utils.FilteredGrid) DateField(com.vaadin.ui.DateField) MenuBar(com.vaadin.ui.MenuBar) ComboBox(com.vaadin.v7.ui.ComboBox) Set(java.util.Set) Collectors(java.util.stream.Collectors) List(java.util.List) LocalDate(java.time.LocalDate) CoreEntityType(de.symeda.sormas.api.common.CoreEntityType) DateHelper8(de.symeda.sormas.ui.utils.DateHelper8) ContactsImportLayout(de.symeda.sormas.ui.contact.importer.ContactsImportLayout) Descriptions(de.symeda.sormas.api.i18n.Descriptions) FollowUpUtils.createFollowUpLegend(de.symeda.sormas.ui.utils.FollowUpUtils.createFollowUpLegend) StreamResource(com.vaadin.server.StreamResource) VaadinUiUtil(de.symeda.sormas.ui.utils.VaadinUiUtil) FacadeProvider(de.symeda.sormas.api.FacadeProvider) VerticalLayout(com.vaadin.ui.VerticalLayout) DateHelper(de.symeda.sormas.api.utils.DateHelper) GridExportStreamResource(de.symeda.sormas.ui.utils.GridExportStreamResource) HashMap(java.util.HashMap) PopupButton(org.vaadin.hene.popupbutton.PopupButton) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) PopupMenu(de.symeda.sormas.ui.utils.components.popupmenu.PopupMenu) ArrayList(java.util.ArrayList) BAGExportContactDto(de.symeda.sormas.api.bagexport.BAGExportContactDto) OptionGroup(com.vaadin.v7.ui.OptionGroup) Notification(com.vaadin.ui.Notification) SormasUI(de.symeda.sormas.ui.SormasUI) Label(com.vaadin.ui.Label) CountryHelper(de.symeda.sormas.api.CountryHelper) AbstractView(de.symeda.sormas.ui.utils.AbstractView) ButtonHelper(de.symeda.sormas.ui.utils.ButtonHelper) ContentMode(com.vaadin.shared.ui.ContentMode) Validations(de.symeda.sormas.api.i18n.Validations) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) Captions(de.symeda.sormas.api.i18n.Captions) UserRight(de.symeda.sormas.api.user.UserRight) Button(com.vaadin.ui.Button) LayoutUtil(de.symeda.sormas.ui.utils.LayoutUtil) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FeatureTypeProperty(de.symeda.sormas.api.feature.FeatureTypeProperty) Strings(de.symeda.sormas.api.i18n.Strings) DocGenerationHelper.isDocGenerationAllowed(de.symeda.sormas.ui.docgeneration.DocGenerationHelper.isDocGenerationAllowed) Collections(java.util.Collections) Label(com.vaadin.ui.Label) EntityRelevanceStatus(de.symeda.sormas.api.EntityRelevanceStatus) Notification(com.vaadin.ui.Notification) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) MenuBarHelper(de.symeda.sormas.ui.utils.MenuBarHelper) ExpandableButton(de.symeda.sormas.ui.utils.components.expandablebutton.ExpandableButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) ContactStatus(de.symeda.sormas.api.contact.ContactStatus) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with ContactIndexDto

use of de.symeda.sormas.api.contact.ContactIndexDto in project SORMAS-Project by hzi-braunschweig.

the class SourceContactList method drawDisplayedEntries.

@Override
protected void drawDisplayedEntries() {
    List<ContactIndexDto> displayedEntries = getDisplayedEntries();
    for (int i = 0, displayedEntriesSize = displayedEntries.size(); i < displayedEntriesSize; i++) {
        ContactIndexDto contact = displayedEntries.get(i);
        SourceContactListEntry listEntry = new SourceContactListEntry(contact);
        if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EDIT)) {
            listEntry.addEditListener(i, (ClickListener) e -> ControllerProvider.getContactController().navigateToData(listEntry.getContact().getUuid()));
        }
        listLayout.addComponent(listEntry);
    }
}
Also used : PaginationList(de.symeda.sormas.ui.utils.PaginationList) ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) ClickListener(com.vaadin.ui.Button.ClickListener) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) Collectors(java.util.stream.Collectors) Captions(de.symeda.sormas.api.i18n.Captions) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto) UserRight(de.symeda.sormas.api.user.UserRight) List(java.util.List) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) Label(com.vaadin.ui.Label) ContactReferenceDto(de.symeda.sormas.api.contact.ContactReferenceDto) UserProvider(de.symeda.sormas.ui.UserProvider) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto)

Aggregations

ContactIndexDto (de.symeda.sormas.api.contact.ContactIndexDto)16 Label (com.vaadin.ui.Label)8 ContactCriteria (de.symeda.sormas.api.contact.ContactCriteria)8 ContactDto (de.symeda.sormas.api.contact.ContactDto)6 SimilarContactDto (de.symeda.sormas.api.contact.SimilarContactDto)6 Notification (com.vaadin.ui.Notification)5 Test (org.junit.Test)5 FacadeProvider (de.symeda.sormas.api.FacadeProvider)4 Captions (de.symeda.sormas.api.i18n.Captions)4 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)4 UserRight (de.symeda.sormas.api.user.UserRight)4 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)4 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)4 UserProvider (de.symeda.sormas.ui.UserProvider)4 Date (java.util.Date)4 List (java.util.List)4 MapContactDto (de.symeda.sormas.api.contact.MapContactDto)3 Collectors (java.util.stream.Collectors)3 ClickListener (com.vaadin.ui.Button.ClickListener)2 Window (com.vaadin.ui.Window)2