コード例 #1
0
  private boolean executeFreeProfessionalsJson(Date date) {
    // requisicao de banco para recuperar lista de profissionais livres, anexado com sua lista de
    // serviços, para mostrar na lista
    // selectedDateFreeFullProfList = FreeTimeCalculator.getFreeProfessionalsFromDate(date,
    // professionalDTOList);
    // selectedDateFreeProfessionalDTOSet = new ArrayList<>();

    // if (selectedDateFreeFullProfList == null) {
    //    Log.i("doInBackground", "Não conseguiu executar TaskRetrieveFreeDays, erro ao recuperar
    // selectedDateFreeFullProfList");
    //    selectedDateFreeProfessionalDTOSet = new ArrayList<>();
    //    return false;
    // }

    // gera lista de profissionais disponiveis
    // for (ProfessionalForSchedule professionalForSchedule : selectedDateFreeFullProfList) {
    // selectedDateFreeProfessionalDTOSet.add(professionalForSchedule.getProfessionalDTO());

    // }
    ProfessionalService professionalService = new ProfessionalService(mParentActivity);
    Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
    calendar.setTime(date);
    try {
      System.out.println(
          "===================================CUST6.EXECUTEFREEPROFESSIONALSJSON=================================");
      System.out.println("Recuperando profissionais livres do calendar: " + calendar);
      System.out.println("Lista de Profs enviados: ");
      for (ProfessionalDTO professionalDTO : professionalDTOList) {
        System.out.println(professionalDTO.getName());
      }

      selectedDateFreeProfessionalDTOSet =
          professionalService.findAvailableProfessionalsInSpecificDate(
              calendar, professionalDTOList);
      System.out.println("Profissionais recebidos em findProfessionalAvailableToScheduling: ");
      for (ProfessionalDTO professionalDTO : selectedDateFreeProfessionalDTOSet) {
        System.out.println(professionalDTO.getName() + " disponível");
      }
    } catch (ServiceException ex) {
      Log.i(
          "doInBackground",
          "Não conseguiu executar TaskRetrieveFreeDays, erro ao recuperar selectedDateFreeProfessionalDTOSet");
      selectedDateFreeProfessionalDTOSet = new LinkedHashSet<>();
      return false;
    }

    if (selectedDateFreeProfessionalDTOSet == null) {
      Log.i(
          "doInBackground",
          "Não conseguiu executar TaskRetrieveFreeDays, selectedDateFreeProfessionalDTOSet está vazia");
      selectedDateFreeProfessionalDTOSet = new LinkedHashSet<>();
      return false;
    }
    return true;
  }
コード例 #2
0
    @Override
    protected Boolean doInBackground(Integer... integers) {
      try {
        ProfessionalService professionalService = new ProfessionalService(getActivity());
        professionalDTOList =
            professionalService.findProfessionalAndPhoneContactsByCustomerId(customerDTO.getId());
        unavailableProfessionalsSet =
            professionalService.findUnavailableProfessionalsInUpcomingDates(professionalDTOList);
        if (unavailableProfessionalsSet == null) {
          unavailableProfessionalsSet = new HashSet<>();
        }

      } catch (Exception e) {
        e.printStackTrace();
        return false;
      }
      return true;
    }