Search in sources :

Example 1 with TravelEntryIndexDto

use of de.symeda.sormas.api.travelentry.TravelEntryIndexDto in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryFacadeEjbTest method testGetIndexList.

@Test
public void testGetIndexList() {
    loginWith(nationalUser);
    PersonDto person1 = creator.createPerson("Peter", "Kruder");
    PersonDto person2 = creator.createPerson("Richard", "Dorfmeister");
    TravelEntryDto travelEntry1 = creator.createTravelEntry(person1.toReference(), nationalUser.toReference(), Disease.CORONAVIRUS, rdcf1.region, rdcf1.district, rdcf1.pointOfEntry);
    TravelEntryDto travelEntry2 = creator.createTravelEntry(person2.toReference(), nationalUser.toReference(), Disease.YELLOW_FEVER, rdcf1.region, rdcf1.district, rdcf1.pointOfEntry);
    List<TravelEntryIndexDto> indexList = getTravelEntryFacade().getIndexList(new TravelEntryCriteria().person(person1.toReference()), 0, 5, null);
    assertEquals(1, indexList.size());
    TravelEntryIndexDto indexDto = indexList.get(0);
    assertEquals(travelEntry1.getUuid(), indexDto.getUuid());
    assertEquals("Point of entry 1", indexDto.getPointOfEntryName());
}
Also used : TravelEntryCriteria(de.symeda.sormas.api.travelentry.TravelEntryCriteria) PersonDto(de.symeda.sormas.api.person.PersonDto) TravelEntryDto(de.symeda.sormas.api.travelentry.TravelEntryDto) TravelEntryIndexDto(de.symeda.sormas.api.travelentry.TravelEntryIndexDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 2 with TravelEntryIndexDto

use of de.symeda.sormas.api.travelentry.TravelEntryIndexDto in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryFacadeEjb method getIndexList.

@Override
public List<TravelEntryIndexDto> getIndexList(TravelEntryCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties) {
    List<TravelEntryIndexDto> resultList = service.getIndexList(criteria, first, max, sortProperties);
    Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
    pseudonymizer.pseudonymizeDtoCollection(TravelEntryIndexDto.class, resultList, TravelEntryIndexDto::isInJurisdiction, null);
    return resultList;
}
Also used : Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) TravelEntryIndexDto(de.symeda.sormas.api.travelentry.TravelEntryIndexDto)

Example 3 with TravelEntryIndexDto

use of de.symeda.sormas.api.travelentry.TravelEntryIndexDto in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryFacadeEjbTest method testFilterByFreeTextFilter.

@Test
public void testFilterByFreeTextFilter() {
    loginWith(nationalUser);
    PersonDto person = creator.createPerson("John", "Doe");
    TravelEntryDto travelEntry = creator.createTravelEntry(person.toReference(), nationalUser.toReference(), Disease.CORONAVIRUS, rdcf1.region, rdcf1.district, rdcf1.pointOfEntry);
    PersonDto person2 = creator.createPerson("Sam", "Johnson");
    TravelEntryDto travelEntry2 = creator.createTravelEntry(person2.toReference(), nationalUser.toReference(), Disease.CORONAVIRUS, rdcf1.region, rdcf1.district, rdcf1.pointOfEntry);
    TravelEntryCriteria criteria = new TravelEntryCriteria();
    criteria.setNameUuidExternalIDLike("Doe");
    List<TravelEntryIndexDto> indexList = getTravelEntryFacade().getIndexList(criteria, null, null, new ArrayList<>());
    assertTrue(!indexList.isEmpty());
    assertEquals(1, indexList.size());
    assertEquals(person.getFirstName(), indexList.get(0).getPersonFirstName());
    assertEquals(person.getLastName(), indexList.get(0).getPersonLastName());
}
Also used : TravelEntryCriteria(de.symeda.sormas.api.travelentry.TravelEntryCriteria) PersonDto(de.symeda.sormas.api.person.PersonDto) TravelEntryDto(de.symeda.sormas.api.travelentry.TravelEntryDto) TravelEntryIndexDto(de.symeda.sormas.api.travelentry.TravelEntryIndexDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 4 with TravelEntryIndexDto

use of de.symeda.sormas.api.travelentry.TravelEntryIndexDto in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryController method deleteAllSelectedItems.

public void deleteAllSelectedItems(Collection<TravelEntryIndexDto> selectedRows, Runnable callback) {
    if (selectedRows.size() == 0) {
        new Notification(I18nProperties.getString(Strings.headingNoTravelEntriesSelected), I18nProperties.getString(Strings.messageNoTravelEntriesSelected), Notification.Type.WARNING_MESSAGE, false).show(Page.getCurrent());
    } else {
        DeletableUtils.showDeleteWithReasonPopup(String.format(I18nProperties.getString(Strings.confirmationDeleteTravelEntries), selectedRows.size()), (deleteDetails) -> {
            for (TravelEntryIndexDto selectedRow : selectedRows) {
                FacadeProvider.getTravelEntryFacade().delete(selectedRow.getUuid(), deleteDetails);
            }
            callback.run();
            new Notification(I18nProperties.getString(Strings.headingTravelEntriesDeleted), I18nProperties.getString(Strings.messageTravelEntriesDeleted), Notification.Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent());
        });
    }
}
Also used : TravelEntryIndexDto(de.symeda.sormas.api.travelentry.TravelEntryIndexDto) Notification(com.vaadin.ui.Notification)

Example 5 with TravelEntryIndexDto

use of de.symeda.sormas.api.travelentry.TravelEntryIndexDto in project SORMAS-Project by hzi-braunschweig.

the class TravelEntryGrid method initColumns.

private void initColumns() {
    setColumns(TravelEntryIndexDto.UUID, TravelEntryIndexDto.EXTERNAL_ID, TravelEntryIndexDto.PERSON_FIRST_NAME, TravelEntryIndexDto.PERSON_LAST_NAME, TravelEntryIndexDto.HOME_DISTRICT_NAME, TravelEntryIndexDto.POINT_OF_ENTRY_NAME, TravelEntryIndexDto.RECOVERED, TravelEntryIndexDto.VACCINATED, TravelEntryIndexDto.TESTED_NEGATIVE, TravelEntryIndexDto.QUARANTINE_TO);
    ((Column<TravelEntryIndexDto, String>) getColumn(TravelEntryIndexDto.UUID)).setRenderer(new UuidRenderer());
    ((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.RECOVERED)).setRenderer(new BooleanRenderer());
    ((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.VACCINATED)).setRenderer(new BooleanRenderer());
    ((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.TESTED_NEGATIVE)).setRenderer(new BooleanRenderer());
    ((Column<TravelEntryIndexDto, Date>) getColumn(TravelEntryIndexDto.QUARANTINE_TO)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
    for (Column<TravelEntryIndexDto, ?> column : getColumns()) {
        column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), TravelEntryIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX));
        column.setStyleGenerator(FieldAccessColumnStyleGenerator.getDefault(getBeanType(), column.getId()));
    }
}
Also used : BooleanRenderer(de.symeda.sormas.ui.utils.BooleanRenderer) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) TravelEntryIndexDto(de.symeda.sormas.api.travelentry.TravelEntryIndexDto) DateRenderer(com.vaadin.ui.renderers.DateRenderer)

Aggregations

TravelEntryIndexDto (de.symeda.sormas.api.travelentry.TravelEntryIndexDto)6 TravelEntryCriteria (de.symeda.sormas.api.travelentry.TravelEntryCriteria)3 PersonDto (de.symeda.sormas.api.person.PersonDto)2 TravelEntryDto (de.symeda.sormas.api.travelentry.TravelEntryDto)2 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)2 Test (org.junit.Test)2 Notification (com.vaadin.ui.Notification)1 DateRenderer (com.vaadin.ui.renderers.DateRenderer)1 SortProperty (de.symeda.sormas.api.utils.SortProperty)1 Pseudonymizer (de.symeda.sormas.backend.util.Pseudonymizer)1 BooleanRenderer (de.symeda.sormas.ui.utils.BooleanRenderer)1 UuidRenderer (de.symeda.sormas.ui.utils.UuidRenderer)1