Package de.marcusschiesser.dbpendler.common.vo

Examples of de.marcusschiesser.dbpendler.common.vo.StationVO


      Matcher matcher = pattern.matcher(response);
      if(matcher.find()) {
        String filter = matcher.group();
        ObjectMapper m = new ObjectMapper();
        try {
          StationVO stations[] = m.readValue(filter, StationVO[].class);
          return Arrays.asList(stations);
        } catch (Exception e) {
          StationServerResource.log.severe("could not parse object to stationvo: " + e.toString());
        }
      } else {
View Full Code Here


    List<StationVO> destinations = StationStorage.getInstance().getStations(d);
    // this does not work (see ConnectionServerResource)
//    if(starts.size()!=1 || destinations.size()!=1) {
//      ExceptionUtils.throwError("Either start or destination is not unique. Use StationService to get a unique station id.");
//    }
    StationVO start = starts.get(0);
    StationVO destination = destinations.get(0);
    // do transaction
    try {
      HTTPSession session = Login.getInstance().login(login, pin);
      Date bookDate = DateUtils.getDateFormat().parse(date);
      Date bookTime = DateUtils.getTimeFormat().parse(time);
View Full Code Here

  @Produces("application/json; charset=UTF-8")
  public ConnectionVO[] listDay(@QueryParam("start") String s, @QueryParam("destination") String d, @QueryParam("date") String date ) {
    ExceptionUtils.checkRequiredParamters("start",s,"destination",d,"date",date);
    try {
      Date queryDate = DateUtils.getDateFormat().parse(date);
      StationVO start = StationStorage.getInstance().getStations(s).get(0);
      StationVO destination = StationStorage.getInstance().getStations(d).get(0);
      List<ConnectionVO> result = ConnectionStorage.getInstance().getConnection(start, destination, queryDate);
      return result.toArray(new ConnectionVO[result.size()]);
    } catch (ParseException e) {
      log.warning("Can not parse input date: '" + date + "'");
      ExceptionUtils.throwError(e);
View Full Code Here

      List<StationVO> destinations = StationStorage.getInstance().getStations(d);
      // TODO: this unique check does not work - idea: try to check the weight of the first station instead?
//      if(starts.size()!=1 || destinations.size()!=1) {
//        ExceptionUtils.throwError("Either start or destination is not unique. Use StationService to get a unique station id.");
//      }
      StationVO start = starts.get(0);
      StationVO destination = destinations.get(0);
      // get all connections for this week (7 days)
      Date date = DateUtils.getThisMonday();
      Set<ConnectionVO> result = new LinkedHashSet<ConnectionVO>();
      for (int i = 0; i < 7; i++) {
        Collection<ConnectionVO> connections = ConnectionStorage.getInstance().getConnection(start, destination, date);
View Full Code Here

    for (ReservationType reservationType : ReservationType.values()) {
      for (PaymentType paymentType : PaymentType.values()) {
        HTTPSession session = Login.getInstance().login(LoginTest.TEST_USER_LOGIN, LoginTest.TEST_USER_PIN);
        Date date = DateUtils.getDateFormat().parse("25.07.2011");
        Date queryTime = DateUtils.getTimeFormat().parse("08:00");
        handler = Booking.getInstance().doPreBooking(session, new StationVO("Karlsruhe Hbf"), new StationVO("Frankfurt(Main)Hbf"),
            date, queryTime, bookingType, reservationType, paymentType);
        Assert.assertTrue("precommit price must not be undefined for payment:" + paymentType.name() + " and reservation: " + reservationType.name(), handler.getPrice()!=null);
      }
    }
    return handler.getPrice();
View Full Code Here

      break;
    case connection:
      switch(insideSpan) {
      case none:
        String stations[] = s.split("-");
        this.start = new StationVO(stations[0].trim());
        destination = new StationVO(stations[1].trim());
        break;
      case date:
        // am 26.05.2011, ICE   78, ab 08:51
        Matcher dateMatcher = datePattern.matcher(s);
        if(dateMatcher.find()) {
View Full Code Here

TOP

Related Classes of de.marcusschiesser.dbpendler.common.vo.StationVO

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.