Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
  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;
  }