Package org.talend.services.reservation.types

Examples of org.talend.services.reservation.types.ConfirmationType


  public org.talend.services.reservation.types.ConfirmationType getConfirmationOfReservation(
      org.talend.services.reservation.types.ReservationType reservation) {
    //
    logData("getConfirmationOfReservation", "request", reservation);
    // Load customer data
    ConfirmationType status = getCarReservation(reservation);

    logData("getConfirmationOfReservation", "response", status);
    return status;
  }
View Full Code Here


    return carList;
  }

  private ConfirmationType getCarReservation(ReservationType reservation) {
    ConfirmationType status = resFactory.createConfirmationType();
    status.setCustomer(reservation.getCustomer());
    status.setFromDate(reservation.getFromDate());
    status.setToDate(reservation.getToDate());
   
    String clazz = reservation.getCar().getClazz();
    status.setCreditPoints(new BigInteger("0"));

    if (clazz.equalsIgnoreCase("BASIC")) {
      status.setCreditPoints(new BigInteger("120"));
    } else if (clazz.equalsIgnoreCase("STANDRAD")) {
      status.setCreditPoints(new BigInteger("180"));
    } else if (clazz.equalsIgnoreCase("SPORT")) {
      status.setCreditPoints(new BigInteger("210"));
    } else if (clazz.equalsIgnoreCase("SUV")) {
      status.setCreditPoints(new BigInteger("280"));
    } else if (clazz.equalsIgnoreCase("DELUX")) {
      status.setCreditPoints(new BigInteger("280"));
    }

    // status.setCode(RESStatucCodeType.OK);
    if (reservation.getReservationId() != null) {
      status.setReservationId(reservation.getReservationId());
    }
   
    status.setDescription("Your reservation is booked!");
    RESCarType car = reservation.getCar();
    status.setCar(car);
   
    if (car != null) {
      // check design model
      String model = car.getDesignModel();

      if ((model != null) && (model.equalsIgnoreCase("GOLF"))) {
        //
        // status.setCode(RESStatucCodeType.FAILED);
        status.setDescription("Your reservation failed! This car is booked by an other customer already.");
      }
    }

    return status;
  }
View Full Code Here

    if (searcher!=null && searcher.getCars()!= null && pos < searcher.getCars().size() && searcher.getCars().get(pos) != null) {
      RESStatusType resStatus = reserver.reserveCar(searcher.getCustomer()
                              , searcher.getCars().get(pos)
                              , pickupDate
                              , returnDate);
      ConfirmationType confirm = reserver.getConfirmation(resStatus
                              , searcher.getCustomer()
                              , searcher.getCars().get(pos)
                              , pickupDate
                              , returnDate);

      RESCarType car = confirm.getCar();
      CustomerDetailsType customer = confirm.getCustomer();
     
      System.out.println(MessageFormat.format(CONFIRMATION
          , confirm.getDescription()
          , confirm.getReservationId()
          , customer.getName()
          , customer.getEmail()
          , customer.getCity()
          , customer.getStatus()
          , car.getBrand()
          , car.getDesignModel()
          , confirm.getFromDate()
          , confirm.getToDate()
          , padl(car.getRateDay(), 10)
          , padl(car.getRateWeekend(), 10)
          , padl(confirm.getCreditPoints().toString(), 7)));
    } else {
      System.out.println("Invalid selection: " + (pos+1)); //$NON-NLS-1$
    }
  } 
View Full Code Here

        if (search != null) {
          RESStatusType resStatus = reserve.reserveCar(search.getCustomer()
              , search.getCars().get(pos)
              , tPickupDate.getText()
              , tReturnDate.getText());
          ConfirmationType confirm = reserve.getConfirmation(resStatus
              , search.getCustomer()
              , search.getCars().get(pos)
              , tPickupDate.getText()
              , tReturnDate.getText());

          RESCarType car = confirm.getCar();
          CustomerDetailsType customer = confirm.getCustomer();

          lStatus.setText(confirm.getDescription());
          tReservationId.setText(confirm.getReservationId());
          tName.setText(customer.getName());
          tEMail.setText(customer.getEmail());
          tCity.setText(customer.getCity());
          tStatus.setText(customer.getStatus().name());
          tBrand.setText(car.getBrand());
          tModel.setText(car.getDesignModel());
          tPickup.setText(confirm.getFromDate());
          tReturn.setText(confirm.getToDate());
          tDaily.setText(car.getRateDay());
          tWeekEnd.setText(car.getRateWeekend());
          tCredits.setText(confirm.getCreditPoints().toString());
        }
        cardlist.show(content, CONFIRM);
      }
     
    } else if (e.getSource().equals(cmdSelectBack)) {
View Full Code Here

        SearchRequestParameters requestParams = getSessionAttribute(
            session, SearchRequestParameters.class);

        RESStatusType resStatus = null;

        ConfirmationType confirm = null;

        try {
          resStatus = reserveModel.reserveCar(customerDetails,
              selectedCar, requestParams.getPickupDate(),
              requestParams.getReturnDate());

          confirm = reserveModel.getConfirmation(resStatus,
              customerDetails, selectedCar,
              requestParams.getPickupDate(),
              requestParams.getReturnDate());
        } catch (Exception e) {
          model.addAttribute("excptMessage", e);
          return "error";
        }

        setSessionAttribute(session, ConfirmationType.class, confirm);

        RESStatucCodeType code = confirm.getDescription().contains(
            "failed") ? RESStatucCodeType.FAILED
            : RESStatucCodeType.OK;
        setSessionAttribute(session, RESStatucCodeType.class, code);

        setSessionAttribute(session, Stages.class,
View Full Code Here

  public org.talend.services.reservation.types.ConfirmationType getConfirmationOfReservation(
      org.talend.services.reservation.types.ReservationType reservation) {
    //
    logData("getConfirmationOfReservation", "request", reservation);
    // Load customer data
    ConfirmationType status = getCarReservation(reservation);

    logData("getConfirmationOfReservation", "response", status);
    return status;
  }
View Full Code Here

    return carList;
  }

  private ConfirmationType getCarReservation(ReservationType reservation) {
    ConfirmationType status = resFactory.createConfirmationType();
    status.setCustomer(reservation.getCustomer());
    status.setFromDate(reservation.getFromDate());
    status.setToDate(reservation.getToDate());
   
    String clazz = reservation.getCar().getClazz();
    status.setCreditPoints(new BigInteger("0"));

    if (clazz.equalsIgnoreCase("BASIC")) {
      status.setCreditPoints(new BigInteger("120"));
    } else if (clazz.equalsIgnoreCase("STANDRAD")) {
      status.setCreditPoints(new BigInteger("180"));
    } else if (clazz.equalsIgnoreCase("SPORT")) {
      status.setCreditPoints(new BigInteger("210"));
    } else if (clazz.equalsIgnoreCase("SUV")) {
      status.setCreditPoints(new BigInteger("280"));
    } else if (clazz.equalsIgnoreCase("DELUX")) {
      status.setCreditPoints(new BigInteger("280"));
    }

    // status.setCode(RESStatucCodeType.OK);
    if (reservation.getReservationId() != null) {
      status.setReservationId(reservation.getReservationId());
    }
   
    status.setDescription("Your reservation is booked!");
    RESCarType car = reservation.getCar();
    status.setCar(car);
   
    if (car != null) {
      // check design model
      String model = car.getDesignModel();

      if ((model != null) && (model.equalsIgnoreCase("GOLF"))) {
        //
        // status.setCode(RESStatucCodeType.FAILED);
        status.setDescription("Your reservation failed! This car is booked by an other customer already.");
      }
    }

    return status;
  }
View Full Code Here

TOP

Related Classes of org.talend.services.reservation.types.ConfirmationType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.