use of de.symeda.sormas.api.immunization.ImmunizationSimilarityCriteria in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationController method selectOrCreateImmunization.
private void selectOrCreateImmunization(ImmunizationDto immunizationDto, Consumer<String> selectedImmunizationUuidConsumer) {
ImmunizationSimilarityCriteria criteria = new ImmunizationSimilarityCriteria.Builder().withDisease(immunizationDto.getDisease()).withStartDate(immunizationDto.getStartDate()).withEndDate(immunizationDto.getEndDate()).withPerson(immunizationDto.getPerson().getUuid()).withMeansOfImmunization(immunizationDto.getMeansOfImmunization()).build();
List<ImmunizationDto> similarImmunizations = FacadeProvider.getImmunizationFacade().getSimilarImmunizations(criteria);
if (!similarImmunizations.isEmpty()) {
ImmunizationPickOrCreateField pickOrCreateField = new ImmunizationPickOrCreateField(immunizationDto, similarImmunizations);
pickOrCreateField.setWidth(1280, Sizeable.Unit.PIXELS);
final CommitDiscardWrapperComponent<ImmunizationPickOrCreateField> component = new CommitDiscardWrapperComponent<>(pickOrCreateField);
component.getCommitButton().setCaption(I18nProperties.getCaption(Captions.actionConfirm));
component.getCommitButton().setEnabled(false);
component.addCommitListener(() -> selectedImmunizationUuidConsumer.accept(pickOrCreateField.getValue()));
pickOrCreateField.setSelectionChangeCallback((commitAllowed) -> component.getCommitButton().setEnabled(commitAllowed));
VaadinUiUtil.showModalPopupWindow(component, I18nProperties.getString(Strings.headingPickOrCreateImmunization));
} else {
selectedImmunizationUuidConsumer.accept(immunizationDto.getUuid());
}
}
use of de.symeda.sormas.api.immunization.ImmunizationSimilarityCriteria in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationFacadeEjbTest method assertSimilarImmunizationsSize.
private void assertSimilarImmunizationsSize(int size, PersonDto person, Date startDate, Date endDate) {
final ImmunizationSimilarityCriteria criteria = new ImmunizationSimilarityCriteria.Builder().withDisease(Disease.ANTHRAX).withMeansOfImmunization(MeansOfImmunization.VACCINATION).withPerson(person.getUuid()).withStartDate(startDate).withEndDate(endDate).build();
final List<ImmunizationDto> similarImmunizations = getImmunizationFacade().getSimilarImmunizations(criteria);
assertEquals(size, similarImmunizations.size());
}
Aggregations