|
64 | 64 | import de.symeda.sormas.api.contact.ContactCriteria; |
65 | 65 | import de.symeda.sormas.api.contact.ContactDto; |
66 | 66 | import de.symeda.sormas.api.epidata.EpiDataDto; |
| 67 | +import de.symeda.sormas.api.facility.FacilityDto; |
67 | 68 | import de.symeda.sormas.api.facility.FacilityReferenceDto; |
68 | 69 | import de.symeda.sormas.api.facility.FacilityType; |
69 | 70 | import de.symeda.sormas.api.i18n.Captions; |
70 | 71 | import de.symeda.sormas.api.i18n.I18nProperties; |
71 | 72 | import de.symeda.sormas.api.i18n.Strings; |
72 | 73 | import de.symeda.sormas.api.i18n.Validations; |
| 74 | +import de.symeda.sormas.api.infrastructure.PointOfEntryDto; |
73 | 75 | import de.symeda.sormas.api.infrastructure.PointOfEntryReferenceDto; |
74 | 76 | import de.symeda.sormas.api.location.LocationDto; |
75 | 77 | import de.symeda.sormas.api.person.PersonDto; |
@@ -526,26 +528,39 @@ private InfrastructureData loadLocalInfrastructure( |
526 | 528 | } |
527 | 529 |
|
528 | 530 | if (facility != null) { |
529 | | - String facilityName = facility.getCaption(); |
530 | | - FacilityReferenceDto localFacility = |
531 | | - facilityFacade.getByNameAndType(facilityName, localDistrict, localCommunity, facilityType, false).stream().findFirst().orElse(null); |
532 | | - |
533 | | - if (localFacility == null) { |
534 | | - unmatchedFields.add(I18nProperties.getCaption(Captions.facility) + ": " + facilityName); |
| 531 | + String facilityUuid = facility.getUuid(); |
| 532 | + if (FacilityDto.CONSTANT_FACILITY_UUIDS.contains(facilityUuid)) { |
| 533 | + infrastructureData.facility = facilityFacade.getByUuid(facilityUuid).toReference(); |
535 | 534 | } else { |
536 | | - infrastructureData.facility = localFacility; |
| 535 | + String facilityName = facility.getCaption(); |
| 536 | + FacilityReferenceDto localFacility = facilityFacade.getByNameAndType(facilityName, localDistrict, localCommunity, facilityType, false) |
| 537 | + .stream() |
| 538 | + .findFirst() |
| 539 | + .orElse(null); |
| 540 | + |
| 541 | + if (localFacility == null) { |
| 542 | + unmatchedFields.add(I18nProperties.getCaption(Captions.facility) + ": " + facilityName); |
| 543 | + } else { |
| 544 | + infrastructureData.facility = localFacility; |
| 545 | + } |
537 | 546 | } |
538 | 547 | } |
539 | 548 |
|
540 | 549 | if (pointOfEntry != null) { |
541 | | - String pointOfEntryName = pointOfEntry.getCaption(); |
542 | | - PointOfEntryReferenceDto localPointOfEntry = |
543 | | - pointOfEntryFacade.getByName(pointOfEntryName, localDistrict, false).stream().findFirst().orElse(null); |
| 550 | + String pointOfEntryUuid = pointOfEntry.getUuid(); |
544 | 551 |
|
545 | | - if (localPointOfEntry == null) { |
546 | | - unmatchedFields.add(I18nProperties.getCaption(Captions.pointOfEntry) + ": " + pointOfEntryName); |
| 552 | + if (PointOfEntryDto.CONSTANT_POE_UUIDS.contains(pointOfEntryUuid)) { |
| 553 | + infrastructureData.pointOfEntry = pointOfEntryFacade.getByUuid(pointOfEntryUuid).toReference(); |
547 | 554 | } else { |
548 | | - infrastructureData.pointOfEntry = localPointOfEntry; |
| 555 | + String pointOfEntryName = pointOfEntry.getCaption(); |
| 556 | + PointOfEntryReferenceDto localPointOfEntry = |
| 557 | + pointOfEntryFacade.getByName(pointOfEntryName, localDistrict, false).stream().findFirst().orElse(null); |
| 558 | + |
| 559 | + if (localPointOfEntry == null) { |
| 560 | + unmatchedFields.add(I18nProperties.getCaption(Captions.pointOfEntry) + ": " + pointOfEntryName); |
| 561 | + } else { |
| 562 | + infrastructureData.pointOfEntry = localPointOfEntry; |
| 563 | + } |
549 | 564 | } |
550 | 565 | } |
551 | 566 |
|
|
0 commit comments