use of de.symeda.sormas.ui.epidata.EpiDataForm in project SORMAS-Project by hzi-braunschweig.
the class ContactController method getEpiDataComponent.
public CommitDiscardWrapperComponent<EpiDataForm> getEpiDataComponent(final String contactUuid) {
ContactDto contact = FacadeProvider.getContactFacade().getByUuid(contactUuid);
EpiDataForm epiDataForm = new EpiDataForm(contact.getDisease(), ContactDto.class, contact.getEpiData().isPseudonymized(), null);
epiDataForm.setValue(contact.getEpiData());
final CommitDiscardWrapperComponent<EpiDataForm> editView = new CommitDiscardWrapperComponent<EpiDataForm>(epiDataForm, UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EDIT), epiDataForm.getFieldGroup());
editView.addCommitListener(() -> {
ContactDto contactDto = FacadeProvider.getContactFacade().getByUuid(contactUuid);
contactDto.setEpiData(epiDataForm.getValue());
FacadeProvider.getContactFacade().save(contactDto);
Notification.show(I18nProperties.getString(Strings.messageContactSaved), Type.WARNING_MESSAGE);
SormasUI.refreshView();
});
return editView;
}
use of de.symeda.sormas.ui.epidata.EpiDataForm in project SORMAS-Project by hzi-braunschweig.
the class CaseController method getEpiDataComponent.
public CommitDiscardWrapperComponent<EpiDataForm> getEpiDataComponent(final String caseUuid, Consumer<Boolean> sourceContactsToggleCallback) {
CaseDataDto caze = findCase(caseUuid);
EpiDataForm epiDataForm = new EpiDataForm(caze.getDisease(), CaseDataDto.class, caze.isPseudonymized(), sourceContactsToggleCallback);
epiDataForm.setValue(caze.getEpiData());
final CommitDiscardWrapperComponent<EpiDataForm> editView = new CommitDiscardWrapperComponent<EpiDataForm>(epiDataForm, UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT), epiDataForm.getFieldGroup());
editView.addCommitListener(() -> {
CaseDataDto cazeDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
cazeDto.setEpiData(epiDataForm.getValue());
saveCase(cazeDto);
});
return editView;
}
Aggregations