7 #if BOOST_VERSION >= 103400 9 #include <boost/foreach.hpp> 10 #endif // BOOST_VERSION >= 103400 41 if (BomManager::hasList<Inventory> (iBomRoot) ==
false) {
45 #if BOOST_VERSION >= 104100 53 BomManager::getList<Inventory> (iBomRoot);
54 for (InventoryList_T::const_iterator itInv = lInventoryList.begin();
55 itInv != lInventoryList.end(); ++itInv) {
57 assert (lInv_ptr != NULL);
63 if (iAirlineCode ==
"all" || iAirlineCode == lAirlineCode) {
71 if (BomManager::hasMap<FlightDate> (*lInv_ptr) ==
false) {
77 BomManager::getMap<FlightDate> (*lInv_ptr);
78 for (FlightDateMap_T::const_iterator itFD = lFlightDateList.begin();
79 itFD != lFlightDateList.end(); ++itFD) {
81 assert (lFD_ptr != NULL);
88 if (iFlightNumber == 0 || iFlightNumber == lFlightNumber) {
91 ptFD.put (
"airline_code", lAirlineCode);
93 ptFD.put (
"number", lFlightNumber);
95 ptFD.put (
"date", lFlightDateDate);
98 ptInventoryList.push_back(std::make_pair(
"", ptFD));
107 pt.add_child (
"inventories", ptInventoryList);
110 write_json (oStream, pt);
111 #endif // BOOST_VERSION >= 104100 115 void BomJSONExport::jsonExportFlightDate (
bpt::ptree& ioFDPropertyTree,
120 if (BomManager::hasMap<FlightDate> (iInventory) ==
false) {
124 #if BOOST_VERSION >= 104100 131 BomManager::getMap<FlightDate> (iInventory);
132 for (FlightDateMap_T::const_iterator itFD = lFlightDateList.begin();
133 itFD != lFlightDateList.end(); ++itFD) {
135 assert (lFD_ptr != NULL);
142 if (iFlightNumber == 0 || iFlightNumber == lFlightNumber) {
148 lCurrFDTree.put (
"number", lFlightNumber);
150 lCurrFDTree.put (
"date", lFlightDateDate);
153 ioFDPropertyTree.push_back(std::make_pair(
"", lCurrFDTree));
157 #endif // BOOST_VERSION >= 104100 166 #if BOOST_VERSION >= 104100 176 pt.put (
"flight_date.airline_code", lAirlineCode);
180 pt.put (
"flight_date.flight_number", lFlightNumber);
184 const std::string& lDepartureDateStr =
185 boost::gregorian::to_simple_string (lFlightDateDate);
186 pt.put (
"flight_date.departure_date", lDepartureDateStr);
195 jsonExportLegDate (ptLegs, iFlightDate);
198 pt.add_child (
"flight_date.legs", ptLegs);
207 jsonExportSegmentDate (ptSegments, iFlightDate);
210 pt.add_child (
"flight_date.segments", ptSegments);
213 write_json (oStream, pt);
215 #endif // BOOST_VERSION >= 104100 219 void BomJSONExport::jsonExportLegDate (
bpt::ptree& ioLegDateListTree,
223 if (BomManager::hasList<LegDate> (iFlightDate) ==
false) {
229 BomManager::getList<LegDate> (iFlightDate);
230 for (LegDateList_T::const_iterator itLD = lLegDateList.begin();
231 itLD != lLegDateList.end(); ++itLD) {
232 const LegDate* lLD_ptr = *itLD;
233 assert (lLD_ptr != NULL);
235 #if BOOST_VERSION >= 104100 242 lCurrLDTree.put (
"board_point", lBoardingPoint);
245 lCurrLDTree.put (
"off_point", lOffPoint);
248 lCurrLDTree.put (
"board_date", lBoardingDate);
251 lCurrLDTree.put (
"off_dDate", lOffDate);
254 lCurrLDTree.put (
"board_time", lBoardingTime);
257 lCurrLDTree.put (
"off_time", lOffTime);
260 lCurrLDTree.put (
"elapsed_time", lElapsedTime);
263 lCurrLDTree.put (
"date_offset", lDateOffset);
266 lCurrLDTree.put (
"time_offset", lTimeOffset);
269 lCurrLDTree.put (
"distance", lDistance);
272 lCurrLDTree.put (
"capacity", lCapacity);
279 jsonExportLegCabin (lLegCabinArray, *lLD_ptr);
282 lCurrLDTree.add_child (
"cabins", lLegCabinArray);
285 ioLegDateListTree.push_back(std::make_pair(
"", lCurrLDTree));
287 #endif // BOOST_VERSION >= 104100 292 void BomJSONExport::jsonExportLegCabin (
bpt::ptree& ioLegCabinListTree,
296 if (BomManager::hasList<LegCabin> (iLegDate) ==
false) {
302 BomManager::getList<LegCabin> (iLegDate);
303 for (LegCabinList_T::const_iterator itLC = lLegCabinList.begin();
304 itLC != lLegCabinList.end(); ++itLC) {
306 assert (lLC_ptr != NULL);
308 #if BOOST_VERSION >= 104100 316 lCurrLCTree.put (
"code", lCabinCode);
319 lCurrLCTree.put (
"offed_cap", lOfferedCapacity);
322 lCurrLCTree.put (
"phy_cap", lPhysicalCapacity);
325 lCurrLCTree.put (
"rgd_adj", lRegradeAdjustment);
328 lCurrLCTree.put (
"au", lAuthorizationLevel);
331 lCurrLCTree.put (
"upr", lUPR);
334 lCurrLCTree.put (
"ss", lNbOfSoldSeats);
337 lCurrLCTree.put (
"staff", lStaffNbOfSeats);
340 lCurrLCTree.put (
"wl", lWLNbOfSeats);
343 lCurrLCTree.put (
"group", lGroupNbOfSeats);
346 lCurrLCTree.put (
"comm_space", lCommittedSpace);
349 lCurrLCTree.put (
"av_pool", lAvailabilityPool);
352 lCurrLCTree.put (
"avl", lAvailability);
355 lCurrLCTree.put (
"nav", lNetAvailability);
358 lCurrLCTree.put (
"gav", lGrossAvailability);
362 lCurrLCTree.put (
"acp", lAvgCancellationPercentage);
365 lCurrLCTree.put (
"etb", lExpectedToBoard );
368 lCurrLCTree.put (
"bid_price", lCurrentBidPrice);
372 std::ostringstream ostr;
373 BidPriceVector_T::const_iterator itBP = lCurrentBidPriceVector.begin();
374 while (itBP != lCurrentBidPriceVector.end()) {
377 if (itBP != lCurrentBidPriceVector.end()) {
381 lCurrLCTree.put (
"BPV", ostr.str());
388 jsonExportBucket (lBucketTree, *lLC_ptr);
391 lCurrLCTree.add_child (
"buckets", lBucketTree);
394 ioLegCabinListTree.push_back(std::make_pair(
"", lCurrLCTree));
396 #endif // BOOST_VERSION >= 104100 401 void BomJSONExport::jsonExportBucket (
bpt::ptree& ioBucketListTree,
409 if (BomManager::hasList<Bucket> (iLegCabin) ==
false) {
414 const BucketList_T& lBucketList = BomManager::getList<Bucket> (iLegCabin);
415 for (BucketList_T::const_iterator itBuck = lBucketList.begin();
416 itBuck != lBucketList.end(); ++itBuck) {
417 const Bucket* lBucket_ptr = *itBuck;
418 assert (lBucket_ptr != NULL);
420 #if BOOST_VERSION >= 104100 426 const Yield_T& lYieldRangeUpperValue =
428 lCurrBucketTree.put (
"yield", lYieldRangeUpperValue);
431 lCurrBucketTree.put (
"si", lSeatIndex);
434 lCurrBucketTree.put (
"ss", lSoldSeats);
437 lCurrBucketTree.put (
"av", lAvailability);
440 ioBucketListTree.push_back(std::make_pair(
"", lCurrBucketTree));
442 #endif // BOOST_VERSION >= 104100 447 void BomJSONExport::jsonExportSegmentDate (
bpt::ptree& ioSegmentDateTree,
451 if (BomManager::hasList<SegmentDate> (iFlightDate) ==
false) {
457 BomManager::getList<SegmentDate> (iFlightDate);
458 for (SegmentDateList_T::const_iterator itSD = lSegmentDateList.begin();
459 itSD != lSegmentDateList.end(); ++itSD) {
461 assert (lSD_ptr != NULL);
463 #if BOOST_VERSION >= 104100 469 lCurrSDTree.put (
"segment", lSD_ptr->
toString());
476 jsonExportSegmentCabin (lSegmentCabinTree, *lSD_ptr);
479 lCurrSDTree.add_child (
"sub_classes", lSegmentCabinTree);
482 ioSegmentDateTree.push_back(std::make_pair(
"", lCurrSDTree));
484 #endif // BOOST_VERSION >= 104100 489 void BomJSONExport::jsonExportSegmentCabin (
bpt::ptree& ioPropertyTree,
493 if (BomManager::hasList<SegmentCabin> (iSegmentDate) ==
false) {
499 BomManager::getList<SegmentCabin> (iSegmentDate);
500 for (SegmentCabinList_T::const_iterator itSC = lSegmentCabinList.begin();
501 itSC != lSegmentCabinList.end(); ++itSC) {
503 assert (lSC_ptr != NULL);
505 #if BOOST_VERSION >= 104100 511 lSCArray.put (
"cabin_code",lSC_ptr->
toString());
514 jsonExportFareFamily (ioPropertyTree, lSCArray, *lSC_ptr);
516 #endif // BOOST_VERSION >= 104100 522 void BomJSONExport::jsonExportFareFamily (
bpt::ptree& ioPropertyTree,
527 if (BomManager::hasList<FareFamily> (iSegmentCabin) ==
true) {
531 BomManager::getList<FareFamily> (iSegmentCabin);
532 for (FareFamilyList_T::const_iterator itFF = lFareFamilyList.begin();
533 itFF != lFareFamilyList.end(); ++itFF) {
535 assert (lFF_ptr != NULL);
539 BomManager::getList<BookingClass> (*lFF_ptr);
540 for (BookingClassList_T::const_iterator itBC =
541 lBookingClassList.begin();
542 itBC != lBookingClassList.end(); ++itBC) {
544 assert (lBC_ptr != NULL);
546 #if BOOST_VERSION >= 104100 549 const FamilyCode_T& lFamilyCode = lFF_ptr->getFamilyCode();
550 ioSCTree.put (
"family_code", lFamilyCode);
553 jsonExportBookingClass (ioPropertyTree, ioSCTree, *lBC_ptr);
555 #endif // BOOST_VERSION >= 104100 567 BomManager::getList<BookingClass> (iSegmentCabin);
568 for (BookingClassList_T::const_iterator itBC =
569 lBookingClassList.begin();
570 itBC != lBookingClassList.end(); ++itBC) {
572 assert (lBC_ptr != NULL);
574 #if BOOST_VERSION >= 104100 577 ioSCTree.put (
"family_code", lDefaultFamilyCode);
580 jsonExportBookingClass (ioPropertyTree, ioSCTree, *lBC_ptr);
582 #endif // BOOST_VERSION >= 104100 588 void BomJSONExport::jsonExportBookingClass (
bpt::ptree& ioPropertyTree,
597 #if BOOST_VERSION >= 104100 600 ioSCTree.put (
"class_code", iBookingClass.
toString());
602 std::ostringstream oAUBlStr;
606 ioSCTree.put (
"au", oAUBlStr.str());
610 ioSCTree.put (
"nego", lNegotiatedSpace);
614 ioSCTree.put (
"ns%", lNoShowPercentage);
618 ioSCTree.put (
"ob%", lCancellationPercentage);
622 ioSCTree.put (
"bkgs", lNbOfBookings);
626 ioSCTree.put (
"grp_bks (pdg)", lNbOfGroupBookings);
630 ioSCTree.put (
"stf_bkgs", lNbOfStaffBookings);
634 ioSCTree.put (
"wl_bkgs", lNbOfWLBookings);
637 ioSCTree.put (
"etb", lETB);
641 ioSCTree.put (
"class_avl", lNetClassAvailability);
645 ioSCTree.put (
"seg_avl", lSegmentAvailability);
649 ioSCTree.put (
"rev_avl", lNetRevenueAvailability);
653 ioPropertyTree.push_back(std::make_pair(
"", ioSCTree));
655 #endif // BOOST_VERSION >= 104100 672 #if BOOST_VERSION >= 104100 680 ptBookingRequest.put (
"time_stamp", lRequestDateTime);
685 ptBookingRequest.put (
"org", lOrigin);
688 ptBookingRequest.put (
"des", lDestination);
691 ptBookingRequest.put (
"cab", lCabinCode);
694 ptBookingRequest.put (
"pax", lNbOfSeats);
697 ptBookingRequest.put (
"pos", lPOS);
701 ptBookingRequest.put (
"cha", lChannelLabel);
704 ptBookingRequest.put (
"wtp", lWTP);
706 const Date_T& lRequestDate =
707 lRequestDateTime.boost::posix_time::ptime::date();
708 ptBookingRequest.put (
"bkg_date", lRequestDate);
710 const Date_T& lPreferedDepartureDate =
712 ptBookingRequest.put (
"dep_date", lPreferedDepartureDate);
714 assert (lPreferedDepartureDate >= lRequestDate);
716 lPreferedDepartureDate - lRequestDate;
717 ptBookingRequest.put (
"adv_purchase", lAdvancePurchase);
721 ptBookingRequest.put (
"stay_duration", lStayDuration);
724 const Date_T& lReturnDate =
725 lPreferedDepartureDate + lDayDuration;
726 ptBookingRequest.put (
"return_date", lReturnDate);
729 ptBookingRequest.put (
"cancel_date",
"xxxx-xx-xx");
733 ptBookingRequest.put (
"dep_time", lPreferredDepartureTime);
736 ptBookingRequest.put (
"return_time",
"xxPM");
739 ptBookingRequest.put (
"pref_carriers",
"XX");
742 write_json (oStream, ptBookingRequest);
744 #endif // BOOST_VERSION >= 104100 761 #if BOOST_VERSION >= 104100 769 ptBreakPoint.put (
"time_stamp", lRequestDateTime);
774 write_json (oStream, ptBreakPoint);
777 #endif // BOOST_VERSION >= 104100 Handle on the StdAir library context.
const Date_T & getDepartureDate() const
const NbOfSeats_T & getSoldSeats() const
const AirlineCode_T & getAirlineCode() const
const NbOfBookings_T & getNbOfWLBookings() const
static const std::string & getLabel(const EN_EventType &)
Structure holding the elements of a booking request.
const AirlineCode_T & getAirlineCode() const
std::map< const MapKey_T, FlightDate * > FlightDateMap_T
std::string AirlineCode_T
boost::gregorian::date_duration DateOffset_T
std::list< SegmentCabin * > SegmentCabinList_T
const Availability_T & getAvailabilityPool() const
LocationCode_T AirportCode_T
static void jsonExportBreakPointObject(std::ostream &, const EventStruct &)
const CabinCode_T & getPreferredCabin() const
boost::gregorian::date Date_T
Class representing the actual attributes for an airline segment-date.
Class representing the actual attributes for an airline segment-cabin.
Class representing the actual attributes for the Bom root.
const CabinCapacity_T & getAvailability() const
Class representing the actual attributes for a family fare.
const Yield_T & getYieldRangeUpperValue() const
std::list< FareFamily * > FareFamilyList_T
NbOfRequests_T NbOfBookings_T
const CabinCapacity_T & getOfferedCapacity() const
const Availability_T & getNetClassAvailability() const
const DateTime_T & getRequestDateTime() const
const DateOffset_T getDateOffset() const
static void jsonExportFlightDateList(std::ostream &, const BomRoot &, const AirlineCode_T &iAirlineCode="all", const FlightNumber_T &iFlightNumber=0)
const AirportCode_T & getOffPoint() const
const ChannelLabel_T & getBookingChannel() const
const CabinCode_T & getCabinCode() const
const AirportCode_T & getDestination() const
const NbOfSeats_T & getETB() const
boost::posix_time::ptime DateTime_T
const CapacityAdjustment_T & getRegradeAdjustment() const
const NbOfBookings_T & getNbOfStaffBookings() const
std::list< Inventory * > InventoryList_T
const Duration_T & getPreferredDepartureTime() const
static void jsonExportBookingRequestObject(std::ostream &, const EventStruct &)
const AirportCode_T & getOrigin() const
unsigned short FlightNumber_T
const AuthorizationLevel_T & getAuthorizationLevel() const
std::string toString() const
boost::posix_time::time_duration Duration_T
Class representing the actual attributes for an airline booking class.
std::list< LegCabin * > LegCabinList_T
const AuthorizationLevel_T & getAuthorizationLevel() const
const BidPrice_T & getCurrentBidPrice() const
const EventType::EN_EventType & getEventType() const
std::list< BookingClass * > BookingClassList_T
const CabinCapacity_T & getPhysicalCapacity() const
std::list< SegmentDate * > SegmentDateList_T
std::string toString() const
static void jsonExportFlightDateObjects(std::ostream &, const FlightDate &)
const NbOfBookings_T & getETB() const
Class representing the actual attributes for an airline leg-cabin.
std::list< LegDate * > LegDateList_T
std::string ChannelLabel_T
const CityCode_T & getPOS() const
const DayDuration_T & getStayDuration() const
const CabinCapacity_T & getCapacity() const
const CommittedSpace_T & getCommittedSpace() const
Class representing the actual attributes for an airline inventory.
const SeatIndex_T & getSeatIndex() const
const Date_T & getBoardingDate() const
const Duration_T getTimeOffset() const
const BookingRequestStruct & getBookingRequest() const
const Duration_T & getElapsedTime() const
const NbOfBookings_T & getNbOfBookings() const
const Availability_T & getNetAvailability() const
const NbOfSeats_T & getGroupNbOfSeats() const
const Distance_T & getDistance() const
const BidPriceVector_T & getBidPriceVector() const
const Date_T & getPreferedDepartureDate() const
const Duration_T & getBoardingTime() const
const NbOfSeats_T & getWLNbOfSeats() const
const Availability_T & getNetRevenueAvailability() const
std::string toString() const
std::vector< BidPrice_T > BidPriceVector_T
const Date_T & getOffDate() const
const NbOfSeats_T & getNegotiatedSpace() const
const Duration_T & getOffTime() const
const NbOfBookings_T & getNbOfGroupBookings() const
const OverbookingRate_T & getAvgCancellationPercentage() const
const NbOfSeats_T & getPartySize() const
const AirportCode_T & getBoardingPoint() const
const BreakPointStruct & getBreakPoint() const
const NbOfSeats_T & getSoldSeat() const
const NbOfSeats_T & getStaffNbOfSeats() const
const UPR_T & getUPR() const
std::list< Bucket * > BucketList_T
const OverbookingRate_T & getNoShowPercentage() const
Class representing the actual attributes for an airline flight-date.
const FlightNumber_T & getFlightNumber() const
double CapacityAdjustment_T
const Availability_T & getAvailability() const
const Availability_T & getGrossAvailability() const
const Availability_T & getSegmentAvailability() const
const DateTime_T & getBreakPointTime() const
unsigned long int Distance_T
const WTP_T & getWTP() const
double AuthorizationLevel_T
const OverbookingRate_T & getCancellationPercentage() const