public Facility getFacilityByCode(String facilityCode) { Facility facility; if ((facility = facilityRepository.getByCode(facilityCode)) == null) { throw new DataException(ERROR_FACILITY_CODE_INVALID); } facility.setSupportedPrograms( (List<ProgramSupported>) select( facility.getSupportedPrograms(), new Predicate() { @Override public boolean evaluate(Object o) { return ((ProgramSupported) o).getActive(); } })); return facility; }
public Facility getById(Long id) { Facility facility = facilityRepository.getById(id); facility.setSupportedPrograms(programSupportedService.getAllByFacilityId(id)); return facility; }