Examples of FlightID


Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

                    // Keep looping until we get a FlightId that we haven't seen yet for this date
                    while (true) {
                        this.populate(date);
                       
                        // Generate a composite FlightId
                        this.flight_id = new FlightId(this.airline_id,
                                                      profile.getAirportId(this.depart_airport),
                                                      profile.getAirportId(this.arrive_airport),
                                                      this.start_date, this.depart_time);
                        if (this.todays_flights.contains(this.flight_id) == false) break;
                    } // WHILE
View Full Code Here

Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

                    value = ((CustomerId)this.current[0]).encode();
                    break;
                }
                // FLIGHT ID
                case (2): {
                    FlightId flight_id = (FlightId)this.current[1];
                    value = flight_id.encode();
                    if (profile.getReservationUpcomingOffset() == null &&
                        flight_id.isUpcoming(profile.getFlightStartDate(), profile.getFlightPastDays())) {
                        profile.setReservationUpcomingOffset(id);
                    }
                    break;
                }
                // SEAT
View Full Code Here

Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

    private final void loadCachedFlights(ResultSet vt) throws SQLException {
        int limit=1;
        while (vt.next() && limit++<SEATSConstants.CACHE_LIMIT_FLIGHT_IDS) {
            int col = 1;
            long f_id = vt.getLong(col++);
            FlightId flight_id = new FlightId(f_id);
            this.cached_flight_ids.add(flight_id);
        } // WHILE
        if (LOG.isDebugEnabled())
            LOG.debug(String.format("Loaded %d cached FlightIds", this.cached_flight_ids.size()));
    }
View Full Code Here

Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

    public FlightId getRandomFlightId() {
        assert(this.cached_flight_ids.isEmpty() == false);
        if (LOG.isTraceEnabled())
            LOG.trace("Attempting to get a random FlightId");
        int idx = rng.nextInt(this.cached_flight_ids.size());
        FlightId flight_id = this.cached_flight_ids.get(idx);
        if (LOG.isTraceEnabled())
            LOG.trace("Got random " + flight_id);
        return (flight_id);
    }
View Full Code Here

Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

            stop_date = new Timestamp(start_date.getTime() + (SEATSConstants.MILLISECONDS_PER_DAY * 2));
        }
       
        // Use an existing flight so that we guaranteed to get back results
        else {
            FlightId flight_id = this.profile.getRandomFlightId();
            depart_airport_id = flight_id.getDepartAirportId();
            arrive_airport_id = flight_id.getArriveAirportId();
           
            Timestamp flightDate = flight_id.getDepartDate(this.profile.getFlightStartDate());
            long range = Math.round(SEATSConstants.MILLISECONDS_PER_DAY * 0.5);
            start_date = new Timestamp(flightDate.getTime() - range);
            stop_date = new Timestamp(flightDate.getTime() + range);
           
            if (LOG.isDebugEnabled())
                LOG.debug(String.format("Using %s as look up in %s: %d / %s",
                                        flight_id, proc, flight_id.encode(), flightDate));
        }
       
        // If distance is greater than zero, then we will also get flights from nearby airports
        long distance = -1;
        if (rng.nextInt(100) < SEATSConstants.PROB_FIND_FLIGHTS_NEARBY_AIRPORT) {
            distance = SEATSConstants.DISTANCES[rng.nextInt(SEATSConstants.DISTANCES.length)];
        }
       
        if (LOG.isTraceEnabled()) LOG.trace("Calling " + proc);
        List<Object[]> results = proc.run(conn,
                                          depart_airport_id,
                                          arrive_airport_id,
                                          start_date,
                                          stop_date,
                                          distance);
        conn.commit();
       
        if (results.size() > 1) {
            // Convert the data into a FlightIds that other transactions can use
            int ctr = 0;
            for (Object row[] : results) {
                FlightId flight_id = new FlightId((Long)row[0]);
                assert(flight_id != null);
                boolean added = profile.addFlightId(flight_id);
                if (added) ctr++;
            } // WHILE
            if (LOG.isDebugEnabled()) LOG.debug(String.format("Added %d out of %d FlightIds to local cache",
View Full Code Here

Examples of com.oltpbenchmark.benchmarks.seats.util.FlightId

    /**
     * Execute the FindOpenSeat procedure
     * @throws SQLException
     */
    private boolean executeFindOpenSeats(FindOpenSeats proc) throws SQLException {
        final FlightId search_flight = this.profile.getRandomFlightId();
        assert(search_flight != null);
        Long airport_depart_id = search_flight.getDepartAirportId();
       
        if (LOG.isTraceEnabled()) LOG.trace("Calling " + proc);
        Object[][] results = proc.run(conn, search_flight.encode());
        conn.commit();
       
        int rowCount = results.length;
        assert (rowCount <= SEATSConstants.FLIGHTS_NUM_SEATS) :
            String.format("Unexpected %d open seats returned for %s", rowCount, search_flight);
   
        // there is some tiny probability of an empty flight .. maybe 1/(20**150)
        // if you hit this assert (with valid code), play the lottery!
        if (rowCount == 0) return (true);

        LinkedList<Reservation> cache = CACHE_RESERVATIONS.get(CacheType.PENDING_INSERTS);
        assert(cache != null) : "Unexpected " + CacheType.PENDING_INSERTS;
       
        // Store pending reservations in our queue for a later transaction           
        BitSet seats = getSeatsBitSet(search_flight);
        tmp_reservations.clear();
       
        for (Object row[] : results) {
            if (row == null) continue; //  || rng.nextInt(100) < 75) continue; // HACK
            Integer seatnum = (Integer)row[1];
         
            // We first try to get a CustomerId based at this departure airport
            if (LOG.isTraceEnabled())
                LOG.trace("Looking for a random customer to fly on " + search_flight);
            CustomerId customer_id = profile.getRandomCustomerId(airport_depart_id);
         
            // We will go for a random one if:
            //  (1) The Customer is already booked on this Flight
            //  (2) We already made a new Reservation just now for this Customer
            int tries = SEATSConstants.FLIGHTS_NUM_SEATS;
            while (tries-- > 0 && (customer_id == null)) { //  || isCustomerBookedOnFlight(customer_id, flight_id))) {
                customer_id = profile.getRandomCustomerId();
                if (LOG.isTraceEnabled())
                    LOG.trace("RANDOM CUSTOMER: " + customer_id);
            } // WHILE
            assert(customer_id != null) :
                String.format("Failed to find a unique Customer to reserve for seat #%d on %s", seatnum, search_flight);
   
            Reservation r = new Reservation(profile.getNextReservationId(getId()),
                                            search_flight,
                                            customer_id,
                                            seatnum.intValue());
            seats.set(seatnum);
            tmp_reservations.add(r);
            if (LOG.isTraceEnabled())
                LOG.trace("QUEUED INSERT: " + search_flight + " / " + search_flight.encode() + " -> " + customer_id);
        } // WHILE
     
        if (tmp_reservations.isEmpty() == false) {
            Collections.shuffle(tmp_reservations);
            cache.addAll(tmp_reservations);
View Full Code Here

Examples of ek.core.flightevent.FlightEvent.FlightId

    public void removeFlight(FlightId flightId) {
      if (_globalFlightEvent != null) {
        Iterator<FlightEvent> cacheIter = _globalFlightEvent.iterator();
        while (cacheIter.hasNext()) {
          FlightEvent event = cacheIter.next();
          FlightId id = event.getFlightId();
          if (id.getCxCd().equals(flightId.getCxCd())
              && id.getFltNum().equals(flightId.getFltNum())
              && id.getFltDate().getValue().equals(flightId.getFltDate().getValue())
              && id.getDepStn().equals(flightId.getDepStn())
              && id.getArrStn().equals(flightId.getArrStn())) {
            if (flightId.getFltSuffix() != null
                  && flightId.getFltSuffix().equals(id.getFltSuffix())) {
              cacheIter.remove();
            } else if (flightId.getFltSuffix() == id.getFltSuffix()) {
              cacheIter.remove();
            }
          }
        }
        // FlightEvent need to override the hashcode and equal method using flightId
View Full Code Here

Examples of ek.core.flightevent.FlightEvent.FlightId

      LOG.info("Loading EK flights into cahce from afttab...");
      List<EntDbAfttab> result = query.getResultList();
      if (result != null && result.size() > 0) {
        LOG.info("{} EK flight record found", result.size());
        FlightEvent flight = null;
        FlightId flightId = null;
        FltDate fltDate = null;
        HpUfisCalendar ufisCalendar = new HpUfisCalendar();
        ufisCalendar.setCustomFormat("yyyyMMdd");
        for (EntDbAfttab entity : result) {
          flight = new FlightEvent();
          flightId = new FlightId();
          fltDate = new FltDate();
          // carrier, boardpoint, destination, flight date, suffix
          flightId.setCxCd(entity.getAlc2() == null ? entity.getAlc3() : entity.getAlc2());
          flightId.setDepStn(entity.getOrg3());
          flightId.setArrStn(entity.getDes3());
          if (HpUfisUtils.isNotEmptyStr(entity.getFlda())) {
            ufisCalendar.setTime(entity.getFlda(), ufisCalendar.getCustomFormat());
            fltDate.setValue(HpUfisUtils.chgDateToXMLGregorianCalendar(ufisCalendar.getTime()));
            flightId.setFltDate(fltDate);
          }
          flightId.setFltNum(entity.getFltn());
          if (entity.getFlns() != null
              && !"".equals(String.valueOf(entity.getFlns()).trim())) {
            flightId.setFltSuffix(String.valueOf(entity.getFlns()));
          }
          flight.setFlightId(flightId);
          globalFlightEvent.add(flight);
        }
      }
View Full Code Here

Examples of ek.skychain.uldinfo.ULDInfo.FlightID

          // set urno of irmtab
          irmtabUrno = irmtabRef;
           
           ULDInfo inputUldInfo = (ULDInfo) _um.unmarshal(new StreamSource(new StringReader(message)));
          
           FlightID inputFlightID = inputUldInfo.getFlightID();
           Meta inputMeta = inputUldInfo.getMeta();
           ULDDetails inputUldDetails = inputUldInfo.getULDDetails();
          
           if(existsMandatory(inputFlightID, inputMeta, inputUldDetails)){
          LOG.error("Compulsory uld info are empty. Message dropped. ");
          addExptInfo(EMAND.name(), "");
          return false;
        }
          
           if(!inputFlightID.getCarrierCode().contains(EK)) {
             LOG.error("Processing performs only for EK flight. Message will be dropped.");
             addExptInfo(EWALC.name(), inputFlightID.getCarrierCode());
             return false;
           }
          
           if(!inputMeta.getType().equalsIgnoreCase(ULD_INFO)) {
             LOG.warn("Processing performs only for ULDInfo. Message will be dropped.");
             addExptInfo(EWVAL.name(), inputMeta.getType());
             return false;
           }
          
           if(!OP_TYPE.valueList().contains(inputMeta.getSubtype().trim().toUpperCase())) {
             LOG.warn("Processing performs only for INS, UPD, DEL sub type. Message will be dropped.");
             addExptInfo(EENUM.name(), inputMeta.getSubtype());
             return false;
           }
          
           if(!inputMeta.getSource().equalsIgnoreCase(SKY_CHAIN)) {
             LOG.error("Processing performs only for SkyChain. Message will be dropped.");
             addExptInfo(EWVAL.name(), inputMeta.getSource());
             return false;
           }
          
          
        String flightNumber = String
            .format("%s %s%s", inputFlightID.getCarrierCode(),
                formatCedaFltn(inputFlightID
                    .getFlightNumber()), isNullOrEmptyStr(inputFlightID
                    .getFlightSuffix()) ? "" : inputFlightID
                        .getFlightSuffix());
       
        String flightDate = formatFlightDate(inputFlightID.getFlightDate());
       
        if(isNullOrEmptyStr(flightDate)) {
          LOG.error("Flight Date provided format parsing error is encountered. Message will be dropped.");
          addExptInfo(EWVAL.name(), inputFlightID.getFlightDate());
             return false;
        }
       
        LOG.debug("Formed UFIS Flight Number, Flight Date - {}, {}", flightNumber, flightDate);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.