コード例 #1
0
 @RequestMapping(
     value = {"/passenger/add"},
     method = RequestMethod.POST)
 public String add(
     @CookieValue(
             value = AbstractAeroportalController.AEROPORTAL_COOKIE_TRACK__NAME,
             required = false)
         String userTrackCookie,
     final HttpServletRequest request,
     final HttpServletResponse response) {
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".add() - Begin :::::: ");
   String view = "req03.passageiro.list_passenger";
   try {
     if (!CommonFunction.isNullOrEmpty(userTrackCookie)) {
       Usuario usuarioAutenticado = usuarioService.restore(new Integer(userTrackCookie));
       request.setAttribute("usuarioAutenticado", usuarioAutenticado);
       List<Aeroporto> aeroportos =
           (usuarioAutenticado.getAeroportoIdIATA() == null)
               ? aeroportoService.list()
               : aeroportoService.listByAeroportoIdIATA(usuarioAutenticado.getAeroportoIdIATA());
       request.setAttribute("aeroportos", aeroportos);
       VooOrigem vooOrigem = vooService.restore(Integer.parseInt(request.getParameter("voo_id")));
       request.setAttribute("vooOrigem", vooOrigem);
       gerenciaPassageiroService.addPassageiro(
           parseRequestParametersForPassageiro(request), vooOrigem);
       request.setAttribute("passageiros", vooService.listPassageiros(vooOrigem));
       HTMLPage htmlPage =
           new HTMLPage.Builder()
               .title("::: Assistencia Material - Gerencia de Passageiros")
               .module("Assistencia Material")
               .feature("assistencia.gerencia_passageiros")
               .errorCode(ErrorEnum.PASSENGER_ADD.getCode())
               .errorMessage(ErrorEnum.PASSENGER_ADD.getMessage())
               .build();
       request.setAttribute("htmlPage", htmlPage);
     } else {
       view = "redirect:/login";
     }
   } catch (Exception e) {
     LOGGER.error(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".add() - Exception :::::: ",
         e);
   }
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".add() - End :::::: ");
   return view;
 }
コード例 #2
0
 @RequestMapping(
     value = {"/gerencia/voo/list/", "/gerencia/voo/", "/gerencia/voo/page/"},
     method = RequestMethod.GET)
 public String page(
     @CookieValue(
             value = AbstractAeroportalController.AEROPORTAL_COOKIE_TRACK__NAME,
             required = false)
         String userTrackCookie,
     final HttpServletRequest request,
     final HttpServletResponse response) {
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".page() - Begin :::::: ");
   String view = "req03.passageiro.list";
   try {
     if (!CommonFunction.isNullOrEmpty(userTrackCookie)) {
       Usuario usuarioAutenticado =
           usuarioAutenticadoService.restore(new Integer(userTrackCookie));
       request.setAttribute("usuarioAutenticado", usuarioAutenticado);
       List<Aeroporto> aeroportos =
           (usuarioAutenticado.getAeroportoIdIATA() == null)
               ? aeroportoService.list()
               : aeroportoService.listByAeroportoIdIATA(usuarioAutenticado.getAeroportoIdIATA());
       request.setAttribute("aeroportos", aeroportos);
       List<VooOrigem> vooOrigemList =
           (usuarioAutenticado.getAeroportoIdIATA() == null)
               ? vooService.list()
               : vooService.listByAeroportoOrigemIdIATA(usuarioAutenticado.getAeroportoIdIATA());
       List<Integer> pagesIndex = new ArrayList<Integer>();
       int page = 0;
       if (vooOrigemList.size() > 0) {
         pagesIndex = parsePage(vooOrigemList);
         request.setAttribute("voosOrigem", vooService.listByPage(pagesIndex.get(0)));
         request.setAttribute("pagesIndex", pagesIndex);
         request.setAttribute("page", page);
         if (vooOrigemList.size() == 101) {
           request.setAttribute("next_fimId", vooOrigemList.get(100).getId());
           request.setAttribute("previous_fimId", vooOrigemList.get(0).getId() + 100);
         } else {
           request.setAttribute("next_fimId", null);
           request.setAttribute("previous_fimId", vooOrigemList.get(0).getId());
         }
       }
       HTMLPage htmlPage =
           new HTMLPage.Builder()
               .title("::: Assistencia Material - Gerencia de Passageiros")
               .module("Assistencia Material")
               .feature("assistencia.gerencia_passageiros")
               .build();
       request.setAttribute("htmlPage", htmlPage);
     } else {
       view = "redirect:/login";
     }
   } catch (Exception e) {
     LOGGER.error(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".page() - Exception :::::: ",
         e);
   }
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".page() - End :::::: ");
   return view;
 }
コード例 #3
0
 @RequestMapping(
     value = {"/gerencia/voo/filter"},
     method = RequestMethod.POST)
 public String filter(
     @CookieValue(
             value = AbstractAeroportalController.AEROPORTAL_COOKIE_TRACK__NAME,
             required = false)
         String userTrackCookie,
     final HttpServletRequest request,
     final HttpServletResponse response) {
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".filter() - Begin :::::: ");
   String view = "req03.passageiro.list";
   try {
     if (!CommonFunction.isNullOrEmpty(userTrackCookie)) {
       Usuario usuarioAutenticado =
           usuarioAutenticadoService.restore(new Integer(userTrackCookie));
       request.setAttribute("usuarioAutenticado", usuarioAutenticado);
       request.setAttribute(
           "aeroportos",
           (usuarioAutenticado.getAeroportoIdIATA() == null)
               ? aeroportoService.list()
               : aeroportoService.listByAeroportoIdIATA(usuarioAutenticado.getAeroportoIdIATA()));
       List<VooOrigem> voosOrigem =
           vooService.filter(
               ((!CommonFunction.isNullOrEmpty(request.getParameter("voo")))
                   ? request.getParameter("voo")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("data_inicio")))
                   ? request.getParameter("data_inicio")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("data_final")))
                   ? request.getParameter("data_final")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("origem")))
                   ? request.getParameter("origem")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("destino")))
                   ? request.getParameter("destino")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("status")))
                   ? request.getParameter("status")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("data_liberacao")))
                   ? request.getParameter("data_liberacao")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("pnr")))
                   ? request.getParameter("pnr")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("bilhete")))
                   ? request.getParameter("bilhete")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("nome")))
                   ? request.getParameter("nome")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("sobrenome")))
                   ? request.getParameter("sobrenome")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("data_inicial_voucher")))
                   ? request.getParameter("data_inicial_voucher")
                   : null),
               ((!CommonFunction.isNullOrEmpty(request.getParameter("data_final_voucher")))
                   ? request.getParameter("data_final_voucher")
                   : null));
       request.setAttribute("voosOrigem", voosOrigem);
       HTMLPage htmlPage =
           new HTMLPage.Builder()
               .title("::: Assistencia Material - Gerencia de Passageiros")
               .module("Assistencia Material")
               .feature("assistencia.gerencia_passageiros")
               .build();
       request.setAttribute("htmlPage", htmlPage);
     } else {
       view = "redirect:/login";
     }
   } catch (Exception e) {
     LOGGER.error(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".filter() - Exception :::::: ",
         e);
   }
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".filter() - End :::::: ");
   return view;
 }
コード例 #4
0
  @RequestMapping(
      value = {"/gerencia/voo/page/prev/{startVooOrigemId}"},
      method = RequestMethod.GET)
  public String pagePrevious(
      @CookieValue(
              value = AbstractAeroportalController.AEROPORTAL_COOKIE_TRACK__NAME,
              required = false)
          String userTrackCookie,
      final HttpServletRequest request,
      final HttpServletResponse response,
      @PathVariable("startVooOrigemId") Integer startVooOrigemId,
      @RequestParam(value = "page", required = false, defaultValue = "0") final Integer page) {
    LOGGER.debug(
        "::: "
            + this.getClass().getPackage().getName()
            + "."
            + this.getClass().getName()
            + ".page() - Begin :::::: ");
    String view = "req03.passageiro.page";
    try {
      if (!CommonFunction.isNullOrEmpty(userTrackCookie)) {
        Usuario usuarioAutenticado =
            usuarioAutenticadoService.restore(new Integer(userTrackCookie));
        request.setAttribute("usuarioAutenticado", usuarioAutenticado);
        List<VooOrigem> vooOrigemList = vooService.listByPagePrevious(startVooOrigemId);
        Collections.reverse(vooOrigemList);
        if ((vooOrigemList != null) && (!vooOrigemList.isEmpty())) {
          List<Integer> pagesIndex = new ArrayList<Integer>();
          pagesIndex = parsePage(vooOrigemList);

          request.setAttribute("pagesIndex", pagesIndex);
          request.setAttribute("pagePrevId", page);
          List<Aeroporto> aeroportos =
              (usuarioAutenticado.getAeroportoIdIATA() == null)
                  ? aeroportoService.list()
                  : aeroportoService.listByAeroportoIdIATA(usuarioAutenticado.getAeroportoIdIATA());
          request.setAttribute("aeroportos", aeroportos);
          request.setAttribute("aeroportosDestino", aeroportos);
          if (vooOrigemList.size() == 101) {
            request.setAttribute("next_fimId", vooOrigemList.get(0).getId() - 100);
            request.setAttribute("previous_fimId", vooOrigemList.get(0).getId());
          } else {
            request.setAttribute("next_fimId", null);
            request.setAttribute("previous_fimId", null);
          }
          HTMLPage htmlPage =
              new HTMLPage.Builder()
                  .title("::: Assistencia Material - Gerencia de Passageiros")
                  .module("Assistencia Material")
                  .feature("assistencia.gerencia_passageiros")
                  .build();
          request.setAttribute("htmlPage", htmlPage);
        } else {
          view = "redirect:/am/liberar-voo/new";
        }
      } else {
        view = "redirect:/login";
      }
    } catch (Exception e) {
      LOGGER.error(
          "::: "
              + this.getClass().getPackage().getName()
              + "."
              + this.getClass().getName()
              + ".page() - Exception :::::: ",
          e);
    }
    LOGGER.debug(
        "::: "
            + this.getClass().getPackage().getName()
            + "."
            + this.getClass().getName()
            + ".page() - End :::::: ");
    return view;
  }