public void save(Facility newFacility) { newFacility.validate(); Facility storedFacility = facilityRepository.getById(newFacility.getId()); facilityRepository.save(newFacility); if (!newFacility.equals(storedFacility)) { notify(asList(newFacility)); if (canUpdateVirtualFacilities(newFacility, storedFacility)) { updateAndNotifyForVirtualFacilities(newFacility); } } }
@Transactional public void updateEnabledAndActiveFor(Facility facility) { facility = facilityRepository.updateEnabledAndActiveFor(facility); notify(asList(facility)); }
public void updateAndNotifyForVirtualFacilities(Facility parentFacility) { facilityRepository.updateVirtualFacilities(parentFacility); notify(getChildFacilities(parentFacility)); }