use of de.symeda.sormas.api.caze.CaseFacade in project SORMAS-Project by hzi-braunschweig.
the class CaseController method showBulkCaseDataEditComponent.
public void showBulkCaseDataEditComponent(Collection<? extends CaseIndexDto> selectedCases) {
if (selectedCases.size() == 0) {
new Notification(I18nProperties.getString(Strings.headingNoCasesSelected), I18nProperties.getString(Strings.messageNoCasesSelected), Type.WARNING_MESSAGE, false).show(Page.getCurrent());
return;
}
// Check if cases with multiple regions and districts have been selected
String regionUuid = null, districtUuid = null;
boolean first = true;
for (CaseIndexDto selectedCase : selectedCases) {
String currentRegionUuid = selectedCase.getResponsibleRegionUuid() == null ? selectedCase.getRegionUuid() : selectedCase.getResponsibleRegionUuid();
String currentDistrictUuid = selectedCase.getResponsibleDistrictUuid() == null ? selectedCase.getDistrictUuid() : selectedCase.getResponsibleDistrictUuid();
if (first) {
regionUuid = currentRegionUuid;
districtUuid = currentDistrictUuid;
first = false;
} else {
if (!DataHelper.equal(regionUuid, currentDistrictUuid)) {
regionUuid = null;
}
if (!DataHelper.equal(districtUuid, currentDistrictUuid)) {
districtUuid = null;
}
}
if (regionUuid == null && districtUuid == null)
break;
}
RegionReferenceDto region = regionUuid != null ? FacadeProvider.getRegionFacade().getReferenceByUuid(regionUuid) : null;
DistrictReferenceDto district = districtUuid != null ? FacadeProvider.getDistrictFacade().getReferenceByUuid(districtUuid) : null;
// Create a temporary case in order to use the CommitDiscardWrapperComponent
CaseBulkEditData bulkEditData = new CaseBulkEditData();
bulkEditData.setRegion(region);
bulkEditData.setDistrict(district);
BulkCaseDataForm form = new BulkCaseDataForm(district, selectedCases);
form.setValue(bulkEditData);
final CommitDiscardWrapperComponent<BulkCaseDataForm> editView = new CommitDiscardWrapperComponent<BulkCaseDataForm>(form, form.getFieldGroup());
Window popupWindow = VaadinUiUtil.showModalPopupWindow(editView, I18nProperties.getString(Strings.headingEditCases));
editView.addCommitListener(() -> {
CaseBulkEditData updatedBulkEditData = form.getValue();
boolean diseaseChange = form.getDiseaseCheckBox().getValue();
boolean classificationChange = form.getClassificationCheckBox().getValue();
boolean investigationStatusChange = form.getInvestigationStatusCheckBox().getValue();
boolean outcomeChange = form.getOutcomeCheckBox().getValue();
boolean surveillanceOfficerChange = district != null && form.getSurveillanceOfficerCheckBox().getValue();
boolean facilityChange = form.getHealthFacilityCheckbox().getValue();
CaseFacade caseFacade = FacadeProvider.getCaseFacade();
if (facilityChange) {
VaadinUiUtil.showChooseOptionPopup(I18nProperties.getCaption(Captions.caseInfrastructureDataChanged), new Label(I18nProperties.getString(Strings.messageFacilityMulitChanged)), I18nProperties.getCaption(Captions.caseTransferCases), I18nProperties.getCaption(Captions.caseEditData), 500, e -> {
bulkEditWithFacilities(selectedCases, updatedBulkEditData, diseaseChange, classificationChange, investigationStatusChange, outcomeChange, surveillanceOfficerChange, e.booleanValue(), caseFacade);
popupWindow.close();
navigateToIndex();
Notification.show(I18nProperties.getString(Strings.messageCasesEdited), Type.HUMANIZED_MESSAGE);
});
} else {
bulkEdit(selectedCases, updatedBulkEditData, diseaseChange, classificationChange, investigationStatusChange, outcomeChange, surveillanceOfficerChange, caseFacade);
popupWindow.close();
navigateToIndex();
Notification.show(I18nProperties.getString(Strings.messageCasesEdited), Type.HUMANIZED_MESSAGE);
}
});
editView.addDiscardListener(() -> popupWindow.close());
}
use of de.symeda.sormas.api.caze.CaseFacade in project SORMAS-Project by hzi-braunschweig.
the class DashboardMapComponent method getCasesForFacility.
public List<CaseDataDto> getCasesForFacility(FacilityReferenceDto facility) {
List<CaseDataDto> casesForFacility = new ArrayList<>();
CaseFacade caseFacade = FacadeProvider.getCaseFacade();
for (MapCaseDto mapCaseDto : casesByFacility.get(facility)) {
casesForFacility.add(caseFacade.getCaseDataByUuid(mapCaseDto.getUuid()));
}
return casesForFacility;
}
Aggregations