use of de.symeda.sormas.api.sormastosormas.sharerequest.SormasToSormasPersonPreview in project SORMAS-Project by hzi-braunschweig.
the class PreviewGridHelper method createPersonColumns.
public static <T> List<String> createPersonColumns(Grid<T> grid, Function<T, SormasToSormasPersonPreview> getPerson) {
((Grid.Column<PseudonymizableDto, ?>) grid.addComponentColumn(previewData -> {
SormasToSormasPersonPreview person = getPerson.apply(previewData);
if (person.isPseudonymized()) {
return new Label(I18nProperties.getCaption(Captions.inaccessibleValue));
}
return new Label(person.getFirstName() + " " + person.getLastName());
})).setId(PERSON_NAME).setStyleGenerator(item -> {
if (item.isPseudonymized()) {
return CssStyles.INACCESSIBLE_COLUMN;
}
return "";
});
grid.addComponentColumn(previewData -> new Label(DateFormatHelper.formatDate(getPerson.apply(previewData).getBirthdateDD(), getPerson.apply(previewData).getBirthdateMM(), getPerson.apply(previewData).getBirthdateYYYY()))).setId(BIRTH_DATE);
grid.addComponentColumn(previewData -> new Label(getPerson.apply(previewData).getSex().toString())).setId(SormasToSormasPersonPreview.SEX);
grid.addComponentColumn(previewData -> new Label(LocationHelper.buildLocationString(getPerson.apply(previewData).getAddress()))).setId(SormasToSormasPersonPreview.ADDRESS);
return Arrays.asList(PERSON_NAME, BIRTH_DATE, SormasToSormasPersonPreview.SEX, SormasToSormasPersonPreview.ADDRESS);
}
use of de.symeda.sormas.api.sormastosormas.sharerequest.SormasToSormasPersonPreview in project SORMAS-Project by hzi-braunschweig.
the class ShareDataBuilderHelper method getPersonPreview.
public SormasToSormasPersonPreview getPersonPreview(Person person) {
SormasToSormasPersonPreview personPreview = new SormasToSormasPersonPreview();
personPreview.setFirstName(person.getFirstName());
personPreview.setLastName(person.getLastName());
personPreview.setBirthdateDD(person.getBirthdateDD());
personPreview.setBirthdateMM(person.getBirthdateMM());
personPreview.setBirthdateYYYY(person.getBirthdateYYYY());
personPreview.setSex(person.getSex());
personPreview.setAddress(LocationFacadeEjb.toDto(person.getAddress()));
return personPreview;
}
Aggregations