public List<Facility> getAllForDeliveryZoneAndProgram(Long deliveryZoneId, Long programId) { List<Facility> facilities = facilityRepository.getAllInDeliveryZoneFor(deliveryZoneId, programId); for (Facility facility : facilities) { facility .getSupportedPrograms() .add( programSupportedService.getFilledByFacilityIdAndProgramId( facility.getId(), programId)); } return facilities; }
public Facility getById(Long id) { Facility facility = facilityRepository.getById(id); facility.setSupportedPrograms(programSupportedService.getAllByFacilityId(id)); return facility; }
@Transactional public void update(Facility facility) { save(facility); programSupportedService.updateSupportedPrograms(facility); }