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());
}
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;
}
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());
}
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());
});
}
}
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()));
}
}
Aggregations