StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
CmdBomManager.cpp
Go to the documentation of this file.
00001 
00005 // //////////////////////////////////////////////////////////////////////
00006 // Import section
00007 // //////////////////////////////////////////////////////////////////////
00008 // STL
00009 #include <cassert>
00010 #include <sstream>
00011 // StdAir
00012 #include <stdair/basic/BasConst_General.hpp>
00013 #include <stdair/basic/BasConst_DefaultObject.hpp>
00014 #include <stdair/basic/BasConst_Request.hpp>
00015 #include <stdair/basic/BasConst_Inventory.hpp>
00016 #include <stdair/bom/BomRetriever.hpp>
00017 #include <stdair/bom/BomRoot.hpp>
00018 #include <stdair/bom/Inventory.hpp>
00019 #include <stdair/bom/FlightDate.hpp>
00020 #include <stdair/bom/LegDate.hpp>
00021 #include <stdair/bom/LegCabin.hpp>
00022 #include <stdair/bom/SegmentDate.hpp>
00023 #include <stdair/bom/SegmentCabin.hpp>
00024 #include <stdair/bom/FareFamily.hpp>
00025 #include <stdair/bom/BookingClass.hpp>
00026 #include <stdair/bom/AirportPair.hpp>
00027 #include <stdair/bom/PosChannel.hpp>
00028 #include <stdair/bom/DatePeriod.hpp>
00029 #include <stdair/bom/TimePeriod.hpp>
00030 #include <stdair/bom/FareFeatures.hpp>
00031 #include <stdair/bom/YieldFeatures.hpp>
00032 #include <stdair/bom/AirlineClassList.hpp>
00033 #include <stdair/bom/BomManager.hpp>
00034 #include <stdair/bom/TravelSolutionStruct.hpp>
00035 #include <stdair/bom/BookingRequestStruct.hpp>
00036 #include <stdair/factory/FacBomManager.hpp>
00037 #include <stdair/factory/FacBom.hpp>
00038 #include <stdair/command/CmdBomManager.hpp>
00039 #include <stdair/service/Logger.hpp>
00040 #include <stdair/bom/OnDDate.hpp>
00041 #include <stdair/bom/SegmentPeriod.hpp>
00042 #include <stdair/bom/FlightPeriod.hpp>
00043 
00044 namespace stdair {
00045 
00046   // //////////////////////////////////////////////////////////////////////
00047   void CmdBomManager::buildSampleBom (BomRoot& ioBomRoot) {
00048 
00049     // DEBUG
00050     STDAIR_LOG_DEBUG ("StdAir is building the BOM tree from built-in "
00051                       << "specifications.");
00052 
00053     // ////// Basic Bom Tree ///////
00054     // Build the inventory (flight-dates) and the schedule (flight period) parts.
00055     buildSampleInventorySchedule (ioBomRoot);
00056 
00057     // Build the pricing (fare rules) and revenue accounting (yields) parts.
00058     buildSamplePricing (ioBomRoot);
00059 
00060     // ////// Partnership Bom Tree ///////    
00061     // Build the inventory (flight-dates) and the schedule (flight period) parts.
00062     buildPartnershipsSampleInventoryAndRM (ioBomRoot);
00063 
00064     // Build the pricing (fare rules) and revenue accounting (yields) parts.
00065     buildPartnershipsSamplePricing (ioBomRoot);
00066 
00067     // Build a dummy inventory, needed by RMOL.
00068     buildCompleteDummyInventory (ioBomRoot);
00069   }
00070 
00071   // //////////////////////////////////////////////////////////////////////
00072   void CmdBomManager::buildSampleInventorySchedule (BomRoot& ioBomRoot) {
00073 
00074     // Inventory
00075     // Step 0.1: Inventory level
00076     // Create an Inventory for BA
00077     const InventoryKey lBAKey ("BA");
00078     Inventory& lBAInv = FacBom<Inventory>::instance().create (lBAKey);
00079     FacBomManager::addToListAndMap (ioBomRoot, lBAInv);
00080     FacBomManager::linkWithParent (ioBomRoot, lBAInv);
00081 
00082     // Create an Inventory for AF
00083     const InventoryKey lAFKey ("AF");
00084     Inventory& lAFInv = FacBom<Inventory>::instance().create (lAFKey);
00085     FacBomManager::addToListAndMap (ioBomRoot, lAFInv);
00086     FacBomManager::linkWithParent (ioBomRoot, lAFInv);
00087 
00088     // BA
00089     // Step 0.2: Flight-date level
00090     // Create a FlightDate (BA9/10-JUN-2011) for BA's Inventory
00091     FlightNumber_T lFlightNumber = 9;
00092     Date_T lDate (2011, 6, 10);
00093     FlightDateKey lFlightDateKey (lFlightNumber, lDate);
00094 
00095     FlightDate& lBA9_20110610_FD =
00096       FacBom<FlightDate>::instance().create (lFlightDateKey);
00097     FacBomManager::addToListAndMap (lBAInv, lBA9_20110610_FD);
00098     FacBomManager::linkWithParent (lBAInv, lBA9_20110610_FD);
00099     
00100     // Display the flight-date
00101     // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
00102     
00103     // Step 0.3: Segment-date level
00104     // Create a first SegmentDate (LHR-SYD) for BA's Inventory
00105     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=SYD&depDate=100611&SellingClass=O
00106     const AirportCode_T lLHR ("LHR");
00107     const AirportCode_T lSYD ("SYD");
00108     const DateOffset_T l1Day (1);
00109     const DateOffset_T l2Days (2);
00110     const Duration_T l2135 (21, 45, 0);
00111     const Duration_T l0610 (6, 10, 0);
00112     const Duration_T l2205 (22, 05, 0);
00113     SegmentDateKey lSegmentDateKey (lLHR, lSYD);
00114 
00115     SegmentDate& lLHRSYDSegment =
00116       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00117     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRSYDSegment);
00118     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRSYDSegment);
00119 
00120     // Fill the SegmentDate content
00121     lLHRSYDSegment.setBoardingDate (lDate);
00122     lLHRSYDSegment.setOffDate (lDate + l2Days);
00123     lLHRSYDSegment.setBoardingTime (l2135);
00124     lLHRSYDSegment.setOffTime (l0610);
00125     lLHRSYDSegment.setElapsedTime (l2135);
00126   
00127     // Display the segment-date
00128     // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRSYDSegment);
00129 
00130     // Create a second SegmentDate (LHR-BKK) for BA's Inventory
00131     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=LHR&to=BKK&depDate=100611&SellingClass=O
00132     const AirportCode_T lBKK ("BKK");
00133     const Duration_T l1540 (15, 40, 0);
00134     const Duration_T l1105 (11, 5, 0);
00135     lSegmentDateKey = SegmentDateKey (lLHR, lBKK);
00136 
00137     SegmentDate& lLHRBKKSegment =
00138       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00139     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRBKKSegment);
00140     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRBKKSegment);
00141 
00142     // Fill the SegmentDate content
00143     lLHRBKKSegment.setBoardingDate (lDate);
00144     lLHRBKKSegment.setOffDate (lDate + l1Day);
00145     lLHRBKKSegment.setBoardingTime (l2135);
00146     lLHRBKKSegment.setOffTime (l1540);
00147     lLHRBKKSegment.setElapsedTime (l1105);
00148   
00149     // Display the segment-date
00150     // STDAIR_LOG_DEBUG ("SegmentDate: " << lLHRBKKSegment);
00151 
00152     // Create a third SegmentDate (BKK-SYD) for BA's Inventory
00153     // See http://www.britishairways.com/travel/flightinformation/public/fr_fr?&Carrier=BA&FlightNumber=0009&from=BKK&to=SYD&depDate=110611&SellingClass=O
00154     const Duration_T l1705 (17, 5, 0);
00155     const Duration_T l0905 (9, 5, 0);
00156     lSegmentDateKey = SegmentDateKey (lBKK, lSYD);
00157 
00158     SegmentDate& lBKKSYDSegment =
00159       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00160     FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKSYDSegment);
00161     FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKSYDSegment);
00162 
00163     // Fill the SegmentDate content
00164     lBKKSYDSegment.setBoardingDate (lDate + l1Day);
00165     lBKKSYDSegment.setOffDate (lDate + l2Days);
00166     lBKKSYDSegment.setBoardingTime (l1705);
00167     lBKKSYDSegment.setOffTime (l1540);
00168     lBKKSYDSegment.setElapsedTime (l0905);
00169   
00170     // Display the segment-date
00171     // STDAIR_LOG_DEBUG ("SegmentDate: " << lBKKSYDSegment);
00172 
00173     // Step 0.4: Leg-date level
00174     // Create a first LegDate (LHR) for BA's Inventory
00175     LegDateKey lLegDateKey (lLHR);
00176 
00177     LegDate& lLHRLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00178     FacBomManager::addToListAndMap (lBA9_20110610_FD, lLHRLeg);
00179     FacBomManager::linkWithParent (lBA9_20110610_FD, lLHRLeg);
00180 
00181     // Fill the LegDate content
00182     lLHRLeg.setOffPoint (lBKK);
00183     lLHRLeg.setBoardingDate (lDate);
00184     lLHRLeg.setOffDate (lDate + l1Day);
00185     lLHRLeg.setBoardingTime (l2135);
00186     lLHRLeg.setOffTime (l1540);
00187     lLHRLeg.setElapsedTime (l1105);
00188 
00189     // Display the leg-date
00190     // STDAIR_LOG_DEBUG ("LegDate: " << lLHRLeg.toString());
00191     
00192     // Create a second LegDate (BKK)
00193     lLegDateKey = LegDateKey (lBKK);
00194 
00195     LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00196     FacBomManager::addToListAndMap (lBA9_20110610_FD, lBKKLeg);
00197     FacBomManager::linkWithParent (lBA9_20110610_FD, lBKKLeg);
00198 
00199     // Display the leg-date
00200     // STDAIR_LOG_DEBUG ("LegDate: " << lBKKLeg.toString());
00201 
00202     // Fill the LegDate content
00203     lBKKLeg.setOffPoint (lSYD);
00204     lBKKLeg.setBoardingDate (lDate + l1Day);
00205     lBKKLeg.setOffDate (lDate + l2Days);
00206     lBKKLeg.setBoardingTime (l1705);
00207     lBKKLeg.setOffTime (l1540);
00208     lBKKLeg.setElapsedTime (l0905);
00209 
00210     // Link the segment-dates with the leg-dates
00211     FacBomManager::addToListAndMap (lLHRLeg, lLHRSYDSegment);
00212     FacBomManager::addToListAndMap (lLHRLeg, lLHRBKKSegment);
00213     FacBomManager::addToListAndMap (lBKKLeg, lLHRSYDSegment);
00214     FacBomManager::addToListAndMap (lBKKLeg, lBKKSYDSegment);
00215     FacBomManager::addToListAndMap (lLHRSYDSegment, lLHRLeg);
00216     FacBomManager::addToListAndMap (lLHRBKKSegment, lLHRLeg);
00217     FacBomManager::addToListAndMap (lLHRSYDSegment, lBKKLeg);
00218     FacBomManager::addToListAndMap (lBKKSYDSegment, lBKKLeg);
00219 
00220 
00221     // Step 0.5: segment-cabin level
00222     // Create a SegmentCabin (Y) for the Segment LHR-BKK of BA's Inventory
00223     const CabinCode_T lY ("Y");
00224     SegmentCabinKey lYSegmentCabinKey (lY);
00225 
00226     SegmentCabin& lLHRBKKSegmentYCabin =
00227       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00228     FacBomManager::addToListAndMap (lLHRBKKSegment, lLHRBKKSegmentYCabin);
00229     FacBomManager::linkWithParent (lLHRBKKSegment, lLHRBKKSegmentYCabin);
00230 
00231     // Display the segment-cabin
00232     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRBKKSegmentYCabin.toString());
00233 
00234     // Create a SegmentCabin (Y) of the Segment BKK-SYD;
00235     SegmentCabin& lBKKSYDSegmentYCabin =
00236       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00237     FacBomManager::addToListAndMap (lBKKSYDSegment, lBKKSYDSegmentYCabin);
00238     FacBomManager::linkWithParent (lBKKSYDSegment, lBKKSYDSegmentYCabin);
00239 
00240      
00241     // Display the segment-cabin
00242     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lBKKSYDSegmentYCabin.toString());
00243 
00244     // Create a SegmentCabin (Y) of the Segment LHR-SYD;
00245     SegmentCabin& lLHRSYDSegmentYCabin =
00246       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00247     FacBomManager::addToListAndMap (lLHRSYDSegment, lLHRSYDSegmentYCabin);
00248     FacBomManager::linkWithParent (lLHRSYDSegment, lLHRSYDSegmentYCabin);
00249       
00250     // Display the segment-cabin
00251     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lLHRSYDSegmentYCabin.toString());
00252 
00253     // Step 0.6: leg-cabin level
00254     // Create a LegCabin (Y) for the Leg LHR-BKK on BA's Inventory
00255     LegCabinKey lYLegCabinKey (lY);
00256 
00257     LegCabin& lLHRLegYCabin =
00258       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00259     FacBomManager::addToListAndMap (lLHRLeg, lLHRLegYCabin);
00260     FacBomManager::linkWithParent (lLHRLeg, lLHRLegYCabin);
00261 
00262     // Display the leg-cabin
00263     // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
00264 
00265     // Create a LegCabin (Y) for the Leg BKK-SYD
00266     LegCabin& lBKKLegYCabin =
00267       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00268     FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
00269     FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
00270     // Display the leg-cabin
00271     // STDAIR_LOG_DEBUG ("LegCabin: " << lBKKLegYCabin.toString());
00272 
00283     FacBomManager::addToListAndMap (lLHRLegYCabin, lLHRSYDSegmentYCabin,
00284                                     lLHRSYDSegmentYCabin.getFullerKey());
00285     FacBomManager::addToListAndMap (lLHRLegYCabin, lLHRBKKSegmentYCabin,
00286                                     lLHRBKKSegmentYCabin.getFullerKey());
00287     FacBomManager::addToListAndMap (lBKKLegYCabin, lLHRSYDSegmentYCabin,
00288                                     lLHRSYDSegmentYCabin.getFullerKey());
00289     FacBomManager::addToListAndMap (lBKKLegYCabin, lBKKSYDSegmentYCabin,
00290     lBKKSYDSegmentYCabin.getFullerKey());
00291 
00302     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin, lLHRLegYCabin,
00303                                     lLHRLegYCabin.getFullerKey());
00304     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin, lLHRLegYCabin,
00305                                     lLHRLegYCabin.getFullerKey());
00306     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin, lBKKLegYCabin,
00307                                     lBKKLegYCabin.getFullerKey());
00308     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin, lBKKLegYCabin,
00309                                     lBKKLegYCabin.getFullerKey());
00310 
00311 
00312     // Step 0.7: fare family level
00313     // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
00314     const FamilyCode_T l1 ("EcoSaver");
00315     FareFamilyKey l1FareFamilyKey (l1);
00316 
00317     FareFamily& lLHRBKKSegmentYCabin1Family =
00318       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00319     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
00320                                     lLHRBKKSegmentYCabin1Family);
00321     FacBomManager::linkWithParent (lLHRBKKSegmentYCabin,
00322                                    lLHRBKKSegmentYCabin1Family);
00323 
00324     // Display the booking class
00325     // STDAIR_LOG_DEBUG ("FareFamily: "
00326     //                   << lLHRBKKSegmentYCabin1Family.toString());
00327 
00328     // Create a FareFamily (1)  for the Segment BKK-SYD, cabin Y on BA's Inv
00329     FareFamily& lBKKSYDSegmentYCabin1Family =
00330       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00331     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
00332                                     lBKKSYDSegmentYCabin1Family);
00333     FacBomManager::linkWithParent (lBKKSYDSegmentYCabin,
00334                                    lBKKSYDSegmentYCabin1Family);
00335     
00336     // Display the booking class
00337     // STDAIR_LOG_DEBUG ("FareFamily: "
00338     //                   << lLHRBKKSegmentYCabin1Family.toString());
00339 
00340     // Create a FareFamily (1)  for the Segment LHR-SYD, cabin Y on BA's Inv
00341     FareFamily& lLHRSYDSegmentYCabin1Family =
00342       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00343     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
00344                                     lLHRSYDSegmentYCabin1Family);
00345     FacBomManager::linkWithParent (lLHRSYDSegmentYCabin,
00346                                    lLHRSYDSegmentYCabin1Family);
00347 
00348     // Display the booking class
00349     // STDAIR_LOG_DEBUG ("FareFamily: "
00350     //                   << lLHRBKKSegmentYCabin1Family.toString());
00351 
00352 
00353     // Step 0.8: booking class level
00354     // Create a BookingClass (Q) for the Segment LHR-BKK, cabin Y,
00355     // fare family 1 on BA's Inv
00356     const ClassCode_T lQ ("Q");
00357     BookingClassKey lQBookingClassKey (lQ);
00358 
00359     BookingClass& lLHRBKKSegmentYCabin1FamilyQClass =
00360       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00361     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin1Family,
00362                                     lLHRBKKSegmentYCabin1FamilyQClass);
00363     FacBomManager::linkWithParent (lLHRBKKSegmentYCabin1Family,
00364                                    lLHRBKKSegmentYCabin1FamilyQClass);
00365 
00366     FacBomManager::addToListAndMap (lLHRBKKSegmentYCabin,
00367                                     lLHRBKKSegmentYCabin1FamilyQClass);
00368     FacBomManager::addToListAndMap (lLHRBKKSegment,
00369                                     lLHRBKKSegmentYCabin1FamilyQClass);
00370 
00371     // Display the booking class
00372     // STDAIR_LOG_DEBUG ("BookingClass: "
00373     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00374 
00375     // Create a BookingClass (Q) for the Segment BKK-SYD, cabin Y,
00376     // fare family 1 on BA's Inv
00377     BookingClass& lBKKSYDSegmentYCabin1FamilyQClass =
00378       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00379     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin1Family,
00380                                     lBKKSYDSegmentYCabin1FamilyQClass);
00381     FacBomManager::linkWithParent (lBKKSYDSegmentYCabin1Family,
00382                                    lBKKSYDSegmentYCabin1FamilyQClass);
00383     
00384     FacBomManager::addToListAndMap (lBKKSYDSegmentYCabin,
00385                                     lBKKSYDSegmentYCabin1FamilyQClass);
00386     FacBomManager::addToListAndMap (lBKKSYDSegment,
00387                                     lBKKSYDSegmentYCabin1FamilyQClass);
00388 
00389     // Display the booking class
00390     // STDAIR_LOG_DEBUG ("BookingClass: "
00391     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00392 
00393     // Create a BookingClass (Q) for the Segment LHR-SYD, cabin Y,
00394     // fare family 1 on BA's Inv
00395     BookingClass& lLHRSYDSegmentYCabin1FamilyQClass =
00396       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00397     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin1Family,
00398                                     lLHRSYDSegmentYCabin1FamilyQClass);
00399     FacBomManager::linkWithParent (lLHRSYDSegmentYCabin1Family,
00400                                    lLHRSYDSegmentYCabin1FamilyQClass);
00401 
00402     FacBomManager::addToListAndMap (lLHRSYDSegmentYCabin,
00403                                     lLHRSYDSegmentYCabin1FamilyQClass);
00404     FacBomManager::addToListAndMap (lLHRSYDSegment,
00405                                     lLHRSYDSegmentYCabin1FamilyQClass);
00406 
00407     // Display the booking class
00408     // STDAIR_LOG_DEBUG ("BookingClass: "
00409     //                   << lLHRBKKSegmentYCabin1FamilyQClass.toString());
00410 
00411     
00412     // ////// AF ///////    
00413     // Step 0.2: Flight-date level
00414     // Create a FlightDate (AF084/20-MAR-2011) for AF's Inventory
00415     lFlightNumber = 84;
00416     lDate = Date_T (2011, 3, 20);
00417     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
00418 
00419     FlightDate& lAF084_20110320_FD =
00420       FacBom<FlightDate>::instance().create (lFlightDateKey);
00421     FacBomManager::addToListAndMap (lAFInv, lAF084_20110320_FD);
00422     FacBomManager::linkWithParent (lAFInv, lAF084_20110320_FD);
00423     
00424     // Display the flight-date
00425     // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
00426 
00427     // Step 0.3: Segment-date level
00428     // Create a SegmentDate (CDG-SFO) for AF's Inventory
00429     const AirportCode_T lCDG ("CDG");
00430     const AirportCode_T lSFO ("SFO");
00431     const Duration_T l1040 (10, 40, 0);
00432     const Duration_T l1250 (12, 50, 0);
00433     const Duration_T l1110 (11, 10, 0);
00434     lSegmentDateKey = SegmentDateKey (lCDG, lSFO);
00435 
00436     SegmentDate& lCDGSFOSegment =
00437       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00438     FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGSFOSegment);
00439     FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGSFOSegment);
00440 
00441     // Display the segment-date
00442     // STDAIR_LOG_DEBUG ("SegmentDate: " << lCDGSFOSegment.toString());
00443 
00444     // Fill the SegmentDate content
00445     lCDGSFOSegment.setBoardingDate (lDate);
00446     lCDGSFOSegment.setOffDate (lDate);
00447     lCDGSFOSegment.setBoardingTime (l1040);
00448     lCDGSFOSegment.setOffTime (l1250);
00449     lCDGSFOSegment.setElapsedTime (l1110);
00450 
00451     // Step 0.4: Leg-date level
00452     // Create a LegDate (CDG) for AF's Inventory
00453     lLegDateKey = LegDateKey (lCDG);
00454 
00455     LegDate& lCDGLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00456     FacBomManager::addToListAndMap (lAF084_20110320_FD, lCDGLeg);
00457     FacBomManager::linkWithParent (lAF084_20110320_FD, lCDGLeg);
00458 
00459     // Fill the LegDate content
00460     lCDGLeg.setOffPoint (lSFO);
00461     lCDGLeg.setBoardingDate (lDate);
00462     lCDGLeg.setOffDate (lDate);
00463     lCDGLeg.setBoardingTime (l1040);
00464     lCDGLeg.setOffTime (l1250);
00465     lCDGLeg.setElapsedTime (l1110);
00466 
00467     // Display the leg-date
00468     // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
00469 
00470     // Link the segment-dates with the leg-dates
00471     FacBomManager::addToListAndMap (lCDGLeg, lCDGSFOSegment);
00472     FacBomManager::addToListAndMap (lCDGSFOSegment, lCDGLeg);
00473 
00474 
00475     // Step 0.5: segment-cabin level
00476     // Create a SegmentCabin (Y) for the Segment CDG-SFO of AF's Inventory
00477     SegmentCabin& lCDGSFOSegmentYCabin =
00478       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
00479     FacBomManager::addToListAndMap (lCDGSFOSegment, lCDGSFOSegmentYCabin);
00480     FacBomManager::linkWithParent (lCDGSFOSegment, lCDGSFOSegmentYCabin);
00481 
00482     // Display the segment-cabin
00483     // STDAIR_LOG_DEBUG ("SegmentCabin: " << lCDGSFOSegmentYCabin.toString());
00484 
00485     // Step 0.6: leg-cabin level
00486     // Create a LegCabin (Y) for the Leg CDG-SFO on AF's Inventory
00487     LegCabin& lCDGLegYCabin =
00488       FacBom<LegCabin>::instance().create (lYLegCabinKey);
00489     FacBomManager::addToListAndMap (lCDGLeg, lCDGLegYCabin);
00490     FacBomManager::linkWithParent (lCDGLeg, lCDGLegYCabin);
00491 
00492     // Display the leg-cabin
00493     // STDAIR_LOG_DEBUG ("LegCabin: " << lLHRLegYCabin.toString());
00494 
00495     // Link the segment-dates with the leg-dates
00496     FacBomManager::addToListAndMap (lCDGLegYCabin, lCDGSFOSegmentYCabin,
00497                                     lCDGSFOSegmentYCabin.getFullerKey());
00498     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin, lCDGLegYCabin,
00499                                     lCDGLegYCabin.getFullerKey());
00500 
00501 
00502     // Step 0.7: fare family level
00503     // Create a fareFamily (1) for the Segment CDG-SFO, cabin Y on AF's Inv
00504     FareFamily& lCDGSFOSegmentYCabin1Family =
00505       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00506     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
00507                                     lCDGSFOSegmentYCabin1Family);
00508     FacBomManager::linkWithParent (lCDGSFOSegmentYCabin,
00509                                    lCDGSFOSegmentYCabin1Family);
00510 
00511     // Display the fare family
00512     // STDAIR_LOG_DEBUG ("fareFamily: "
00513     //
00514     //                   << lCDGSFOSegmentYCabin1Family.toString());
00515 
00516     // Step 0.8: booking class level Create a BookingClass (Q) for the
00517     // Segment CDG-SFO, cabin Y, fare family 1 on AF's Inv
00518     BookingClass& lCDGSFOSegmentYCabin1FamilyQClass =
00519       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00520     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin1Family,
00521                                     lCDGSFOSegmentYCabin1FamilyQClass);
00522     FacBomManager::linkWithParent (lCDGSFOSegmentYCabin1Family,
00523                                    lCDGSFOSegmentYCabin1FamilyQClass);
00524 
00525     FacBomManager::addToListAndMap (lCDGSFOSegmentYCabin,
00526                                     lCDGSFOSegmentYCabin1FamilyQClass);
00527     FacBomManager::addToListAndMap (lCDGSFOSegment,
00528                                     lCDGSFOSegmentYCabin1FamilyQClass);
00529 
00530     // Display the booking class
00531     // STDAIR_LOG_DEBUG ("BookingClass: "
00532     //                   << lCDGSFOSegmentYCabin1FamilyQClass.toString());
00533 
00534     /*================================================================================
00535       ================================================================================
00536       ================================================================================*/
00537     // Schedule:
00538     // BA:
00539     // Step 1: flight period level
00540     // Create a flight period for BA9:
00541     const DoWStruct lDoWSrtuct ("1111111");
00542     const Date_T lBA9DateRangeStart (2010, boost::gregorian::Jun, 6);
00543     const Date_T lBA9DateRangeEnd (2010, boost::gregorian::Jun, 7);
00544     const DatePeriod_T lBA9DatePeriod (lBA9DateRangeStart, lBA9DateRangeEnd);
00545     const PeriodStruct lBA9PeriodStruct (lBA9DatePeriod, lDoWSrtuct);
00546 
00547     lFlightNumber = FlightNumber_T (9);
00548 
00549     FlightPeriodKey lBA9FlightPeriodKey (lFlightNumber, lBA9PeriodStruct);
00550 
00551     FlightPeriod& lBA9FlightPeriod =
00552       FacBom<FlightPeriod>::instance().create (lBA9FlightPeriodKey);
00553     FacBomManager::addToListAndMap (lBAInv, lBA9FlightPeriod);
00554     FacBomManager::linkWithParent (lBAInv, lBA9FlightPeriod);
00555 
00556     // Step 2: segment period level
00557     // Create a segment period for SIN-BKK:
00558 
00559     SegmentPeriodKey lLHRSYDSegmentPeriodKey (lLHR, lSYD);
00560 
00561     SegmentPeriod& lLHRSYDSegmentPeriod =
00562       FacBom<SegmentPeriod>::instance().create (lLHRSYDSegmentPeriodKey);
00563     FacBomManager::addToListAndMap (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
00564     FacBomManager::linkWithParent (lBA9FlightPeriod, lLHRSYDSegmentPeriod);
00565 
00566     lLHRSYDSegmentPeriod.setBoardingTime (l2135);
00567     lLHRSYDSegmentPeriod.setOffTime (l1540);
00568     lLHRSYDSegmentPeriod.setElapsedTime (l1105);
00569     ClassList_String_T lYM ("YM");
00570     lLHRSYDSegmentPeriod.addCabinBookingClassList (lY,lYM);
00571 
00572     // AF:
00573     // Step 1: flight period level
00574     // Create a flight period for AF84:
00575     const Date_T lAF84DateRangeStart (2011, boost::gregorian::Mar, 20);
00576     const Date_T lAF84DateRangeEnd (2011, boost::gregorian::Mar, 21);
00577     const DatePeriod_T lAF84DatePeriod (lAF84DateRangeStart, lAF84DateRangeEnd);
00578     const PeriodStruct lAF84PeriodStruct (lAF84DatePeriod, lDoWSrtuct);
00579 
00580     lFlightNumber = FlightNumber_T (84);
00581 
00582     FlightPeriodKey lAF84FlightPeriodKey (lFlightNumber, lAF84PeriodStruct);
00583 
00584     FlightPeriod& lAF84FlightPeriod =
00585       FacBom<FlightPeriod>::instance().create (lAF84FlightPeriodKey);
00586     FacBomManager::addToListAndMap (lAFInv, lAF84FlightPeriod);
00587     FacBomManager::linkWithParent (lAFInv, lAF84FlightPeriod);
00588 
00589     // Step 2: segment period level
00590     // Create a segment period for SIN-BKK:
00591 
00592     SegmentPeriodKey lCDGSFOSegmentPeriodKey (lCDG, lSFO);
00593 
00594     SegmentPeriod& lCDGSFOSegmentPeriod =
00595       FacBom<SegmentPeriod>::instance().create (lCDGSFOSegmentPeriodKey);
00596     FacBomManager::addToListAndMap (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
00597     FacBomManager::linkWithParent (lAF84FlightPeriod, lCDGSFOSegmentPeriod);
00598 
00599     lCDGSFOSegmentPeriod.setBoardingTime (l1040);
00600     lCDGSFOSegmentPeriod.setOffTime (l1250);
00601     lCDGSFOSegmentPeriod.setElapsedTime (l1110);
00602     lCDGSFOSegmentPeriod.addCabinBookingClassList (lY,lYM);
00603 
00604     /*================================================================================
00605       ================================================================================
00606       ================================================================================*/
00607     // O&D 
00608     // Create an O&D Date (BA;9,2010-Jun-06;LHR,SYD) for BA's Inventory
00609     OnDString_T  lBALHRSYDOnDStr = "BA;9,2010-Jun-06;LHR,SYD";
00610     OnDStringList_T lBAOnDStrList;
00611     lBAOnDStrList.push_back (lBALHRSYDOnDStr);
00612 
00613     OnDDateKey lBAOnDDateKey (lBAOnDStrList);
00614     OnDDate& lBA_LHRSYD_OnDDate =
00615       FacBom<OnDDate>::instance().create (lBAOnDDateKey);
00616     // Link to the inventory
00617     FacBomManager::addToListAndMap (lBAInv, lBA_LHRSYD_OnDDate);
00618     FacBomManager::linkWithParent (lBAInv, lBA_LHRSYD_OnDDate);
00619 
00620     // Add the segment
00621     FacBomManager::addToListAndMap (lBA_LHRSYD_OnDDate, lLHRSYDSegment);
00622 
00623     // Add total forecast info for cabin Y.
00624     const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
00625     const WTP_T lWTP750 = 750.0;
00626     const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
00627     lBA_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
00628 
00629     // Create an O&D Date (AF;84,2011-Mar-21;CDG,SFO) for AF's Inventory
00630     OnDString_T lAFLHRSYDOnDStr = "AF;9,2011-Mar-20;CDG,SFO";
00631     OnDStringList_T lAFOnDStrList;
00632     lAFOnDStrList.push_back (lAFLHRSYDOnDStr);
00633 
00634     OnDDateKey lAFOnDDateKey (lAFOnDStrList);
00635     OnDDate& lAF_LHRSYD_OnDDate =
00636       FacBom<OnDDate>::instance().create (lAFOnDDateKey);
00637     // Link to the inventory
00638     FacBomManager::addToListAndMap (lAFInv, lAF_LHRSYD_OnDDate);
00639     FacBomManager::linkWithParent (lAFInv, lAF_LHRSYD_OnDDate);
00640 
00641     // Add the segment
00642     FacBomManager::addToListAndMap (lAF_LHRSYD_OnDDate, lLHRSYDSegment);
00643 
00644     // Add total forecast info for cabin Y. 
00645     lAF_LHRSYD_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
00646     
00647   }
00648   // //////////////////////////////////////////////////////////////////////
00649   void CmdBomManager::buildCompleteDummyInventory  (BomRoot& ioBomRoot) {
00650 
00651     // Build a dummy inventory, containing a dummy flight-date with a
00652     // single segment-cabin and a single leg-cabin.
00653     const CabinCapacity_T lCapacity = DEFAULT_CABIN_CAPACITY;
00654     buildDummyInventory (ioBomRoot, lCapacity);
00655 
00656     // Retrieve the (sample) segment-cabin.
00657     SegmentCabin& lDummySegmentCabin =
00658       BomRetriever::retrieveDummySegmentCabin (ioBomRoot);
00659     
00660     // Retrieve the (sample) leg-cabin.
00661     LegCabin& lDummyLegCabin =
00662       BomRetriever::retrieveDummyLegCabin (ioBomRoot);
00663 
00664     // Add some booking classes to the dummy segment-cabin and some
00665     // virtual ones to the dummy leg-cabin.
00666     // First booking class yield and demand information.
00667     Yield_T lYield = 100;
00668     MeanValue_T lMean = 20;
00669     StdDevValue_T lStdDev= 9;
00670     BookingClassKey lBCKey (DEFAULT_CLASS_CODE);
00671 
00672     BookingClass& lDummyBookingClass =
00673       FacBom<BookingClass>::instance().create (lBCKey);
00674     lDummyBookingClass.setYield (lYield);
00675     lDummyBookingClass.setMean (lMean);
00676     lDummyBookingClass.setStdDev (lStdDev);
00677     // Add a booking class to the segment-cabin.
00678     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
00679 
00680     VirtualClassStruct lDummyVirtualClass (lDummyBookingClass);
00681     lDummyVirtualClass.setYield (lYield);
00682     lDummyVirtualClass.setMean (lMean);
00683     lDummyVirtualClass.setStdDev (lStdDev);
00684     // Add the corresponding virtual class to the leg-cabin.
00685     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
00686 
00687     // Second booking class yield and demand information.
00688     lYield = 70;
00689     lMean = 45;
00690     lStdDev= 12;
00691     lDummyBookingClass.setYield (lYield);
00692     lDummyBookingClass.setMean (lMean);
00693     lDummyBookingClass.setStdDev (lStdDev);
00694     // Add a booking class to the segment-cabin.
00695     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
00696 
00697     lDummyVirtualClass.setYield (lYield);
00698     lDummyVirtualClass.setMean (lMean);
00699     lDummyVirtualClass.setStdDev (lStdDev);
00700     // Add the corresponding virtual class to the leg-cabin.
00701     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
00702     
00703     // Third booking class yield and demand information.
00704     lYield = 42;
00705     lMean = 80;
00706     lStdDev= 16;
00707     lDummyBookingClass.setYield (lYield);
00708     lDummyBookingClass.setMean (lMean);
00709     lDummyBookingClass.setStdDev (lStdDev);
00710     // Add a booking class to the segment-cabin.
00711     FacBomManager::addToList (lDummySegmentCabin, lDummyBookingClass);
00712 
00713     lDummyVirtualClass.setYield (lYield);
00714     lDummyVirtualClass.setMean (lMean);
00715     lDummyVirtualClass.setStdDev (lStdDev);
00716     // Add the corresponding virtual class to the leg-cabin.
00717     lDummyLegCabin.addVirtualClass (lDummyVirtualClass);
00718     
00719   }
00720   
00721   // //////////////////////////////////////////////////////////////////////
00722   void CmdBomManager::buildDummyInventory (BomRoot& ioBomRoot,
00723                                            const CabinCapacity_T& iCapacity) {
00724     // Inventory
00725     const InventoryKey lInventoryKey (DEFAULT_AIRLINE_CODE);
00726     Inventory& lInv = FacBom<Inventory>::instance().create (lInventoryKey);
00727     FacBomManager::addToListAndMap (ioBomRoot, lInv);
00728     FacBomManager::linkWithParent (ioBomRoot, lInv);
00729 
00730     // Flight-date
00731     FlightDateKey lFlightDateKey(DEFAULT_FLIGHT_NUMBER, DEFAULT_DEPARTURE_DATE);
00732     FlightDate& lFlightDate =
00733       FacBom<FlightDate>::instance().create (lFlightDateKey);
00734     FacBomManager::addToListAndMap (lInv, lFlightDate);
00735     FacBomManager::linkWithParent (lInv, lFlightDate);
00736 
00737     // Leg-date
00738     LegDateKey lLegDateKey (DEFAULT_ORIGIN);
00739     LegDate& lLeg = FacBom<LegDate>::instance().create (lLegDateKey);
00740     FacBomManager::addToListAndMap (lFlightDate, lLeg);
00741     FacBomManager::linkWithParent (lFlightDate, lLeg);
00742 
00743     // Fill the LegDate content
00744     lLeg.setOffPoint (DEFAULT_DESTINATION);
00745     lLeg.setBoardingDate (DEFAULT_DEPARTURE_DATE);
00746     lLeg.setOffDate (DEFAULT_DEPARTURE_DATE);
00747     lLeg.setBoardingTime (Duration_T (14, 0, 0));
00748     lLeg.setOffTime (Duration_T (16, 0, 0));
00749     lLeg.setElapsedTime (Duration_T (8, 0, 0));
00750 
00751     // Leg-cabin
00752     LegCabinKey lLegCabinKey (DEFAULT_CABIN_CODE);
00753     LegCabin& lLegCabin = FacBom<LegCabin>::instance().create (lLegCabinKey);
00754     FacBomManager::addToListAndMap (lLeg, lLegCabin);
00755     FacBomManager::linkWithParent (lLeg, lLegCabin);
00756 
00757     lLegCabin.setCapacities (iCapacity);
00758     lLegCabin.setAvailabilityPool (iCapacity);
00759 
00760     // Segment-date
00761     SegmentDateKey lSegmentDateKey (DEFAULT_ORIGIN, DEFAULT_DESTINATION);
00762     SegmentDate& lSegment =
00763       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
00764     FacBomManager::addToListAndMap (lFlightDate, lSegment);
00765     FacBomManager::linkWithParent (lFlightDate, lSegment);
00766 
00767     // Links between the segment-date and the leg-date
00768     FacBomManager::addToListAndMap (lLeg, lSegment);
00769     FacBomManager::addToListAndMap (lSegment, lLeg);
00770 
00771     // Fill the SegmentDate content
00772     lSegment.setBoardingDate (DEFAULT_DEPARTURE_DATE);
00773     lSegment.setOffDate (DEFAULT_DEPARTURE_DATE);
00774     lSegment.setBoardingTime (Duration_T (14, 0, 0));
00775     lSegment.setOffTime (Duration_T (16, 0, 0));
00776     lSegment.setElapsedTime (Duration_T (8, 0, 0));
00777 
00778     // Segment-cabin
00779     SegmentCabinKey lSegmentCabinKey (DEFAULT_CABIN_CODE);
00780     SegmentCabin& lSegmentCabin =
00781       FacBom<SegmentCabin>::instance().create (lSegmentCabinKey);
00782     FacBomManager::addToListAndMap (lSegment, lSegmentCabin);
00783     FacBomManager::linkWithParent (lSegment, lSegmentCabin);
00784 
00785     // Links between the segment-cabin and the leg-cabin
00786     FacBomManager::addToListAndMap (lLegCabin, lSegmentCabin,
00787                                     lSegmentCabin.getFullerKey());
00788     FacBomManager::addToListAndMap (lSegmentCabin, lLegCabin,
00789                                     lLegCabin.getFullerKey());
00790 
00791     // Create a FareFamily (1) for the Segment LHR-BKK, cabin Y on BA's Inv
00792     const FamilyCode_T l1 ("EcoSaver");
00793     FareFamilyKey l1FareFamilyKey (l1);
00794 
00795     FareFamily& lSegmentYCabin1Family =
00796       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
00797     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1Family);
00798     FacBomManager::linkWithParent (lSegmentCabin, lSegmentYCabin1Family);
00799 
00800     // Create a booking-class
00801     const ClassCode_T lQ ("Q");
00802     BookingClassKey lQBookingClassKey (lQ);
00803 
00804     BookingClass& lSegmentYCabin1FamilyQClass =
00805       FacBom<BookingClass>::instance().create (lQBookingClassKey);
00806     FacBomManager::addToListAndMap (lSegmentYCabin1Family,
00807                                     lSegmentYCabin1FamilyQClass);
00808     FacBomManager::linkWithParent (lSegmentYCabin1Family,
00809                                    lSegmentYCabin1FamilyQClass);
00810     
00811     FacBomManager::addToListAndMap (lSegmentCabin, lSegmentYCabin1FamilyQClass);
00812     FacBomManager::addToListAndMap (lSegment, lSegmentYCabin1FamilyQClass);
00813 
00814   }
00815 
00816   // //////////////////////////////////////////////////////////////////////
00817   void CmdBomManager::buildSamplePricing (BomRoot& ioBomRoot) {
00818 
00819     // Set the airport-pair primary key.
00820     const AirportPairKey lAirportPairKey (AIRPORT_LHR, AIRPORT_SYD);
00821     
00822     // Create the AirportPairKey object and link it to the BOM tree root.
00823     AirportPair& lAirportPair =
00824       FacBom<AirportPair>::instance().create (lAirportPairKey);
00825     FacBomManager::addToListAndMap (ioBomRoot, lAirportPair);
00826     FacBomManager::linkWithParent (ioBomRoot, lAirportPair);
00827 
00828     // Set the fare date-period primary key.
00829     const Date_T lDateRangeStart (2011, boost::gregorian::Jan, 15);
00830     const Date_T lDateRangeEnd (2011, boost::gregorian::Dec, 31);
00831     const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
00832     const DatePeriodKey lDatePeriodKey (lDateRange);
00833 
00834     // Create the DatePeriodKey object and link it to the PosChannel object.
00835     DatePeriod& lDatePeriod =
00836       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
00837     FacBomManager::addToListAndMap (lAirportPair, lDatePeriod);
00838     FacBomManager::linkWithParent (lAirportPair, lDatePeriod);    
00839 
00840     // Set the point-of-sale-channel primary key.
00841     const PosChannelKey lPosChannelKey (POS_LHR, CHANNEL_DN);  
00842     
00843     // Create the PositionKey object and link it to the AirportPair object.
00844     PosChannel& lPosChannel =
00845       FacBom<PosChannel>::instance().create (lPosChannelKey);
00846     FacBomManager::addToListAndMap (lDatePeriod, lPosChannel);
00847     FacBomManager::linkWithParent (lDatePeriod, lPosChannel);
00848    
00849     // Set the fare time-period primary key.
00850     const Time_T lTimeRangeStart (0, 0, 0);
00851     const Time_T lTimeRangeEnd (23, 0, 0);
00852     const TimePeriodKey lTimePeriodKey (lTimeRangeStart, lTimeRangeEnd);
00853 
00854     // Create the TimePeriodKey and link it to the DatePeriod object.
00855     TimePeriod& lTimePeriod =
00856       FacBom<TimePeriod>::instance().create (lTimePeriodKey);
00857     FacBomManager::addToListAndMap (lPosChannel, lTimePeriod);
00858     FacBomManager::linkWithParent (lPosChannel, lTimePeriod);        
00859 
00860     // Pricing -- Generate the FareRule
00861     const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ROUND_TRIP,
00862                                             NO_ADVANCE_PURCHASE,
00863                                             SATURDAY_STAY,
00864                                             CHANGE_FEES,
00865                                             NON_REFUNDABLE,
00866                                             NO_STAY_DURATION);
00867 
00868     // Create the FareFeaturesKey and link it to the TimePeriod object.
00869     FareFeatures& lFareFeatures =
00870       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
00871     FacBomManager::addToListAndMap (lTimePeriod, lFareFeatures);
00872     FacBomManager::linkWithParent (lTimePeriod, lFareFeatures);        
00873 
00874     // Revenue Accounting -- Generate the YieldRule
00875     const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ROUND_TRIP,
00876                                               CABIN_Y);
00877     
00878     // Create the YieldFeaturesKey and link it to the TimePeriod object.
00879     YieldFeatures& lYieldFeatures =
00880       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
00881     FacBomManager::addToListAndMap (lTimePeriod, lYieldFeatures);
00882     FacBomManager::linkWithParent (lTimePeriod, lYieldFeatures);     
00883                                               
00884     // Generate Segment Features and link them to their respective
00885     // fare and yield rules.
00886     AirlineCodeList_T lAirlineCodeList;
00887     lAirlineCodeList.push_back (AIRLINE_CODE_BA);
00888     ClassList_StringList_T lClassCodeList;
00889     lClassCodeList.push_back (CLASS_CODE_Y);
00890     const AirlineClassListKey lAirlineClassListKey (lAirlineCodeList,
00891                                                     lClassCodeList);
00892 
00893     // Create the AirlineClassList
00894     AirlineClassList& lAirlineClassList =
00895       FacBom<AirlineClassList>::instance().create (lAirlineClassListKey);
00896     // Link the AirlineClassList to the FareFeatures object
00897     lAirlineClassList.setFare (900);
00898     FacBomManager::addToListAndMap (lFareFeatures, lAirlineClassList);
00899     FacBomManager::linkWithParent (lFareFeatures, lAirlineClassList);
00900 
00901     // Link the AirlineClassList to the YieldFeatures object
00902     lAirlineClassList.setYield (900);
00903     FacBomManager::addToListAndMap (lYieldFeatures, lAirlineClassList);
00904     // \todo (gsabatier): the following calls overrides the parent for
00905     //       lAirlineClassList. Check that it is what is actually wanted.
00906     FacBomManager::linkWithParent (lYieldFeatures, lAirlineClassList);
00907   }
00908 
00909   // //////////////////////////////////////////////////////////////////////
00910   void CmdBomManager::
00911   buildSampleTravelSolutionForPricing (TravelSolutionList_T& ioTravelSolutionList) {
00912 
00913     // Clean the list
00914     ioTravelSolutionList.clear();
00915 
00916     //
00917     const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
00918 
00919     // Add the segment date key to the travel solution
00920     TravelSolutionStruct lTS;
00921     lTS.addSegment (lBA9_SegmentDateKey);
00922 
00923     // Add the travel solution to the list
00924     ioTravelSolutionList.push_back (lTS);
00925   }
00926   
00927   // //////////////////////////////////////////////////////////////////////
00928   void CmdBomManager::
00929   buildSampleTravelSolutions (TravelSolutionList_T& ioTravelSolutionList) {
00930 
00931     // Clean the list
00932     ioTravelSolutionList.clear();
00933 
00934     //
00935     const std::string lBA9_SegmentDateKey ("BA, 9, 2011-06-10, LHR, SYD, 21:45");
00936 
00937     // Add the segment date key to the travel solution
00938     TravelSolutionStruct lTS;
00939     lTS.addSegment (lBA9_SegmentDateKey);
00940 
00941     // Fare option
00942     const ClassCode_T lClassPath (CLASS_CODE_Q);
00943     const Fare_T lFare (900);
00944     const ChangeFees_T lChangeFee (CHANGE_FEES);
00945     const NonRefundable_T isNonRefundable (NON_REFUNDABLE);
00946     const SaturdayStay_T lSaturdayStay (SATURDAY_STAY);
00947     const FareOptionStruct lFareOption (lClassPath, lFare, lChangeFee,
00948                                         isNonRefundable, lSaturdayStay);
00949 
00950     // Add (a copy of) the fare option
00951     lTS.addFareOption (lFareOption);
00952 
00953     // Map of class availabilities: set the availability for the Q
00954     // booking class (the one corresponding to the fare option) to 8.
00955     ClassAvailabilityMap_T lClassAvailabilityMap;
00956     const Availability_T lAvl (8);
00957     const bool hasInsertBeenSuccessful = lClassAvailabilityMap.
00958       insert (ClassAvailabilityMap_T::value_type (lClassPath, lAvl)).second;
00959     assert (hasInsertBeenSuccessful == true);
00960     // Add the map to the dedicated list held by the travel solution
00961     lTS.addClassAvailabilityMap (lClassAvailabilityMap);
00962 
00963     // Add the travel solution to the list
00964     ioTravelSolutionList.push_back (lTS);
00965   }
00966 
00967   // //////////////////////////////////////////////////////////////////////
00968   BookingRequestStruct CmdBomManager::buildSampleBookingRequest() {
00969     // Origin
00970     const AirportCode_T lOrigin (AIRPORT_LHR);
00971 
00972     // Destination
00973     const AirportCode_T lDestination (AIRPORT_SYD);
00974 
00975     // Point of Sale (POS)
00976     const CityCode_T lPOS (POS_LHR);
00977 
00978     // Preferred departure date (10-JUN-2011)
00979     const Date_T lPreferredDepartureDate (2011, boost::gregorian::Jun, 10);
00980 
00981     // Preferred departure time (08:00)
00982     const Duration_T lPreferredDepartureTime (8, 0, 0);
00983 
00984     // Date of the request (15-MAY-2011)
00985     const Date_T lRequestDate (2011, boost::gregorian::May, 15);
00986 
00987     // Time of the request (10:00)
00988     const Duration_T lRequestTime (10, 0, 0);
00989 
00990     // Date-time of the request (made of the date and time above)
00991     const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
00992 
00993     // Preferred cabin (also named class of service sometimes)
00994     const CabinCode_T lPreferredCabin (CABIN_ECO);
00995 
00996     // Number of persons in the party
00997     const PartySize_T lPartySize (3);
00998 
00999     // Channel (direct/indirect, on-line/off-line)
01000     const ChannelLabel_T lChannel (CHANNEL_DN);
01001 
01002     // Type of the trip (one-way, inbound/outbound of a return trip)
01003     const TripType_T lTripType (TRIP_TYPE_INBOUND);
01004 
01005     // Duration of the stay (expressed as a number of days)
01006     const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
01007 
01008     // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
01009     const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
01010 
01011     // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
01012     const WTP_T lWTP (DEFAULT_WTP);
01013 
01014     // Value of time, for the customer (expressed in monetary unit per
01015     // unit of time, e.g., EUR/hour)
01016     const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
01017 
01018     // Creation of the booking request structure
01019     BookingRequestStruct oBookingRequest (lOrigin, lDestination, lPOS,
01020                                           lPreferredDepartureDate,
01021                                           lRequestDateTime,
01022                                           lPreferredCabin,
01023                                           lPartySize, lChannel,
01024                                           lTripType, lStayDuration,
01025                                           lFrequentFlyerType,
01026                                           lPreferredDepartureTime,
01027                                           lWTP, lValueOfTime);
01028 
01029     return oBookingRequest;
01030   }
01031 
01032   // //////////////////////////////////////////////////////////////////////
01033   BookingRequestStruct CmdBomManager::buildSampleBookingRequestForCRS() {
01034     // Origin
01035     const AirportCode_T lOrigin (AIRPORT_SIN);
01036 
01037     // Destination
01038     const AirportCode_T lDestination (AIRPORT_BKK);
01039 
01040     // Point of Sale (POS)
01041     const CityCode_T lPOS (POS_SIN);
01042 
01043     // Preferred departure date (30-JAN-2010)
01044     const Date_T lPreferredDepartureDate (2010, boost::gregorian::Jan, 30);
01045 
01046     // Preferred departure time (10:00)
01047     const Duration_T lPreferredDepartureTime (10, 0, 0);
01048 
01049     // Date of the request (22-JAN-2010)
01050     const Date_T lRequestDate (2010, boost::gregorian::Jan, 22);
01051 
01052     // Time of the request (10:00)
01053     const Duration_T lRequestTime (10, 0, 0);
01054 
01055     // Date-time of the request (made of the date and time above)
01056     const DateTime_T lRequestDateTime (lRequestDate, lRequestTime);
01057 
01058     // Preferred cabin (also named class of service sometimes)
01059     const CabinCode_T lPreferredCabin (CABIN_ECO);
01060 
01061     // Number of persons in the party
01062     const PartySize_T lPartySize (3);
01063 
01064     // Channel (direct/indirect, on-line/off-line)
01065     const ChannelLabel_T lChannel (CHANNEL_IN);
01066 
01067     // Type of the trip (one-way, inbound/outbound of a return trip)
01068     const TripType_T lTripType (TRIP_TYPE_INBOUND);
01069 
01070     // Duration of the stay (expressed as a number of days)
01071     const DayDuration_T lStayDuration (DEFAULT_STAY_DURATION);
01072 
01073     // Frequent flyer tier (member, silver, gold, platinum, senator, etc)
01074     const FrequentFlyer_T lFrequentFlyerType (FREQUENT_FLYER_MEMBER);
01075 
01076     // Maximum willing-to-pay (WTP, expressed in monetary unit, e.g., EUR)
01077     const WTP_T lWTP (DEFAULT_WTP);
01078 
01079     // Value of time, for the customer (expressed in monetary unit per
01080     // unit of time, e.g., EUR/hour)
01081     const PriceValue_T lValueOfTime (DEFAULT_VALUE_OF_TIME);
01082 
01083     // Creation of the booking request structure
01084     BookingRequestStruct oBookingRequest (lOrigin,
01085                                           lDestination,
01086                                           lPOS,
01087                                           lPreferredDepartureDate,
01088                                           lRequestDateTime,
01089                                           lPreferredCabin,
01090                                           lPartySize, lChannel,
01091                                           lTripType, lStayDuration,
01092                                           lFrequentFlyerType,
01093                                           lPreferredDepartureTime,
01094                                           lWTP, lValueOfTime);
01095 
01096     return oBookingRequest;
01097   }
01098 
01099   // //////////////////////////////////////////////////////////////////////
01100   void CmdBomManager::buildPartnershipsSampleInventoryAndRM (BomRoot& ioBomRoot) {
01101 
01102     // Step 0.1: Inventory level
01103     // Create an Inventory for SQ
01104     const InventoryKey lSQKey ("SQ");
01105     Inventory& lSQInv = FacBom<Inventory>::instance().create (lSQKey);
01106     FacBomManager::addToListAndMap (ioBomRoot, lSQInv);
01107     FacBomManager::linkWithParent (ioBomRoot, lSQInv); 
01108     
01109     // Create an Inventory for CX
01110     const InventoryKey lCXKey ("CX");
01111     Inventory& lCXInv = FacBom<Inventory>::instance().create (lCXKey);
01112     FacBomManager::addToListAndMap (ioBomRoot, lCXInv);
01113     FacBomManager::linkWithParent (ioBomRoot, lCXInv);
01114 
01115     
01116     // ////// SQ ///////    
01117     // Step 0.2: Flight-date level
01118     // Create a FlightDate (SQ11/08-FEB-2010) for SQ's Inventory
01119     FlightNumber_T lFlightNumber = 11;
01120     Date_T lDate (2010, 2, 8);
01121     FlightDateKey lFlightDateKey (lFlightNumber, lDate);
01122 
01123     FlightDate& lSQ11_20100208_FD =
01124       FacBom<FlightDate>::instance().create (lFlightDateKey);
01125     FacBomManager::addToListAndMap (lSQInv, lSQ11_20100208_FD);
01126     FacBomManager::linkWithParent (lSQInv, lSQ11_20100208_FD);
01127 
01128     // Create a (mkt) FlightDate (SQ1200/08-FEB-2010) for SQ's Inventory
01129     FlightNumber_T lMktFlightNumber = 1200;
01130     //lDate = Date_T (2010, 2, 8);
01131     FlightDateKey lMktFlightDateKey (lMktFlightNumber, lDate);
01132 
01133     FlightDate& lSQ1200_20100208_FD =
01134       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
01135     FacBomManager::addToListAndMap (lSQInv, lSQ1200_20100208_FD);
01136     FacBomManager::linkWithParent (lSQInv, lSQ1200_20100208_FD);
01137     
01138     // Display the flight-date
01139     // STDAIR_LOG_DEBUG ("FlightDate: " << lBA9_20110610_FD.toString());
01140     
01141     // Step 0.3: Segment-date level
01142     // Create a first SegmentDate (SIN-BKK) for SQ's Inventory
01143     const AirportCode_T lSIN ("SIN");
01144     const AirportCode_T lBKK ("BKK");
01145     const DateOffset_T l1Day (1);
01146     const DateOffset_T l2Days (2);
01147     const Duration_T l0820 (8, 20, 0);
01148     const Duration_T l1100 (11, 0, 0);
01149     const Duration_T l0340 (3, 40, 0);
01150     SegmentDateKey lSegmentDateKey (lSIN, lBKK);
01151 
01152     SegmentDate& lSINBKKSegment =
01153       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01154     FacBomManager::addToListAndMap (lSQ11_20100208_FD, lSINBKKSegment);
01155     FacBomManager::linkWithParent (lSQ11_20100208_FD, lSINBKKSegment);
01156 
01157     // Fill the SegmentDate content
01158     lSINBKKSegment.setBoardingDate (lDate);
01159     lSINBKKSegment.setOffDate (lDate);
01160     lSINBKKSegment.setBoardingTime (l0820);
01161     lSINBKKSegment.setOffTime (l1100);
01162     lSINBKKSegment.setElapsedTime (l0340);
01163 
01164     // Create a second (mkt) SegmentDate (BKK-HKG) for SQ's Inventory
01165     const AirportCode_T lHKG ("HKG");
01166     const Duration_T l1200 (12, 0, 0);
01167     const Duration_T l1540 (15, 40, 0);
01168     const Duration_T l0240 (2, 40, 0);
01169     SegmentDateKey lMktSegmentDateKey (lBKK, lHKG);
01170 
01171     SegmentDate& lMktBKKHKGSegment =
01172       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
01173     FacBomManager::addToListAndMap (lSQ1200_20100208_FD, lMktBKKHKGSegment);
01174     FacBomManager::linkWithParent (lSQ1200_20100208_FD, lMktBKKHKGSegment);
01175 
01176     // Fill the (mkt) SegmentDate content
01177     lMktBKKHKGSegment.setBoardingDate (lDate);
01178     lMktBKKHKGSegment.setOffDate (lDate);
01179     lMktBKKHKGSegment.setBoardingTime (l1200);
01180     lMktBKKHKGSegment.setOffTime (l1540);
01181     lMktBKKHKGSegment.setElapsedTime (l0240);
01182 
01183     // Step 0.4: Leg-date level
01184     // Create a first LegDate (SIN) for SQ's Inventory
01185     LegDateKey lLegDateKey (lSIN);
01186 
01187     LegDate& lSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01188     FacBomManager::addToListAndMap (lSQ11_20100208_FD, lSINLeg);
01189     FacBomManager::linkWithParent (lSQ11_20100208_FD, lSINLeg);
01190 
01191     // Fill the LegDate content
01192     lSINLeg.setOffPoint (lBKK);
01193     lSINLeg.setBoardingDate (lDate);
01194     lSINLeg.setOffDate (lDate);
01195     lSINLeg.setBoardingTime (l0820);
01196     lSINLeg.setOffTime (l1100);
01197     lSINLeg.setElapsedTime (l0340);
01198 
01199     
01200     // Link the segment-dates with the leg-dates
01201     FacBomManager::addToListAndMap (lSINLeg, lSINBKKSegment);  
01202     FacBomManager::addToListAndMap (lSINBKKSegment, lSINLeg);
01203 
01204     // Step 0.5: segment-cabin level
01205     // Create a SegmentCabin (Y) for the Segment SIN-BKK of SQ's Inventory
01206     const CabinCode_T lY ("Y");
01207     SegmentCabinKey lYSegmentCabinKey (lY);
01208 
01209     SegmentCabin& lSINBKKSegmentYCabin =
01210       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01211     FacBomManager::addToListAndMap (lSINBKKSegment, lSINBKKSegmentYCabin);
01212     FacBomManager::linkWithParent (lSINBKKSegment, lSINBKKSegmentYCabin);
01213 
01214     // Create a SegmentCabin (Y) for the (mkt) Segment BKK-HKG of SQ's Inventory
01215     SegmentCabin& lMktBKKHKGSegmentYCabin =
01216       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01217     FacBomManager::addToListAndMap (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
01218     FacBomManager::linkWithParent (lMktBKKHKGSegment, lMktBKKHKGSegmentYCabin);
01219 
01220 
01221     // Step 0.6: leg-cabin level
01222     // Create a LegCabin (Y) for the Leg SIN-BKK on SQ's Inventory
01223     LegCabinKey lYLegCabinKey (lY);
01224 
01225     LegCabin& lSINLegYCabin =
01226       FacBom<LegCabin>::instance().create (lYLegCabinKey);
01227     FacBomManager::addToListAndMap (lSINLeg, lSINLegYCabin);
01228     FacBomManager::linkWithParent (lSINLeg, lSINLegYCabin);
01229 
01230     CabinCapacity_T lCapacity (100);
01231     lSINLegYCabin.setCapacities (lCapacity);
01232     lSINLegYCabin.setAvailabilityPool (lCapacity);
01233     
01245       FacBomManager::addToListAndMap (lSINLegYCabin, lSINBKKSegmentYCabin,
01246                                     lSINBKKSegmentYCabin.getFullerKey());
01247     
01258       FacBomManager::addToListAndMap (lSINBKKSegmentYCabin, lSINLegYCabin,
01259                                     lSINLegYCabin.getFullerKey());
01260 
01261 
01262     // Step 0.7: fare family level
01263     // Create a FareFamily (1) for the Segment SIN-BKK, cabin Y on SQ's Inv
01264     const FamilyCode_T l1 ("EcoSaver");
01265     FareFamilyKey l1FareFamilyKey (l1);
01266 
01267     FareFamily& lSINBKKSegmentYCabin1Family =
01268       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01269     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
01270                                     lSINBKKSegmentYCabin1Family);
01271     FacBomManager::linkWithParent (lSINBKKSegmentYCabin,
01272                                    lSINBKKSegmentYCabin1Family);
01273 
01274     // Create a FareFamily (1) for the (mkt) Segment BKK-HKG, cabin Y on SQ's Inv
01275     FareFamily& lMktBKKHKGSegmentYCabin1Family =
01276       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01277     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
01278                                     lMktBKKHKGSegmentYCabin1Family);
01279     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin,
01280                                     lMktBKKHKGSegmentYCabin1Family);
01281     
01282     // Step 0.8: booking class level
01283     // Create a BookingClass (Y) for the Segment SIN-BKK, cabin Y,
01284     // fare family 1 on SQ's Inv
01285     BookingClassKey lYBookingClassKey (lY);
01286 
01287     BookingClass& lSINBKKSegmentYCabin1FamilyYClass =
01288       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01289     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
01290                                     lSINBKKSegmentYCabin1FamilyYClass);
01291     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
01292                                    lSINBKKSegmentYCabin1FamilyYClass);
01293 
01294     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
01295                                     lSINBKKSegmentYCabin1FamilyYClass);
01296     FacBomManager::addToListAndMap (lSINBKKSegment,
01297                                     lSINBKKSegmentYCabin1FamilyYClass);
01298 
01299     lSINBKKSegmentYCabin1FamilyYClass.setYield(700);
01300 
01301     // Create a BookingClass (Y) for the (mkt) Segment BKK-HKG, cabin Y,
01302     // fare family 1 on SQ's Inv
01303     BookingClass& lMktBKKHKGSegmentYCabin1FamilyYClass =
01304       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01305     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
01306                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
01307     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
01308                                    lMktBKKHKGSegmentYCabin1FamilyYClass);
01309 
01310     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
01311                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
01312     FacBomManager::addToListAndMap (lMktBKKHKGSegment,
01313                                     lMktBKKHKGSegmentYCabin1FamilyYClass);
01314 
01315     lMktBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
01316 
01317    
01318     // Create a BookingClass (M) for the Segment SIN-BKK, cabin Y,
01319     // fare family 1 on SQ's Inv
01320     const ClassCode_T lM ("M");
01321     BookingClassKey lMBookingClassKey (lM);
01322 
01323     BookingClass& lSINBKKSegmentYCabin1FamilyMClass =
01324       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01325     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin1Family,
01326                                     lSINBKKSegmentYCabin1FamilyMClass);
01327     FacBomManager::linkWithParent (lSINBKKSegmentYCabin1Family,
01328                                    lSINBKKSegmentYCabin1FamilyMClass);
01329 
01330     FacBomManager::addToListAndMap (lSINBKKSegmentYCabin,
01331                                     lSINBKKSegmentYCabin1FamilyMClass);
01332     FacBomManager::addToListAndMap (lSINBKKSegment,
01333                                     lSINBKKSegmentYCabin1FamilyMClass);
01334 
01335     lSINBKKSegmentYCabin1FamilyMClass.setYield(500);
01336 
01337     // Create a BookingClass (M) for the (mkt) Segment BKK-HKG, cabin Y,
01338     // fare family 1 on SQ's Inv
01339     BookingClass& lMktBKKHKGSegmentYCabin1FamilyMClass =
01340       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01341     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin1Family,
01342                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
01343     FacBomManager::linkWithParent (lMktBKKHKGSegmentYCabin1Family,
01344                                    lMktBKKHKGSegmentYCabin1FamilyMClass);
01345 
01346     FacBomManager::addToListAndMap (lMktBKKHKGSegmentYCabin,
01347                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
01348     FacBomManager::addToListAndMap (lMktBKKHKGSegment,
01349                                     lMktBKKHKGSegmentYCabin1FamilyMClass);
01350 
01351     lMktBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
01352 
01353     /* =================================================================================== */
01354     // Step 0.9: Partner Inventory
01355     // Create a partner Inventory CX for SQ    
01356     const InventoryKey lPartnerCXKey ("CX");
01357     Inventory& lPartnerCXInv = FacBom<Inventory>::instance().create (lPartnerCXKey);
01358     FacBomManager::addToListAndMap (lSQInv, lPartnerCXInv);
01359     FacBomManager::linkWithParent (lSQInv, lPartnerCXInv);
01360 
01361     // Step 0.9.2 : Flight-date level
01362     lFlightNumber = 12;
01363     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01364 
01365     FlightDate& lPartnerCX12_20100208_FD =
01366       FacBom<FlightDate>::instance().create (lFlightDateKey);
01367     FacBomManager::addToListAndMap (lPartnerCXInv, lPartnerCX12_20100208_FD);
01368     FacBomManager::linkWithParent (lPartnerCXInv, lPartnerCX12_20100208_FD);
01369 
01370     lFlightNumber = 1100;
01371     lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01372 
01373     FlightDate& lPartnerCX1100_20100208_FD =
01374       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
01375     FacBomManager::addToListAndMap (lPartnerCXInv, lPartnerCX1100_20100208_FD);
01376     FacBomManager::linkWithParent (lPartnerCXInv, lPartnerCX1100_20100208_FD);
01377 
01378     // Step 0.9.3: Segment-date level
01379     lSegmentDateKey = SegmentDateKey (lBKK, lHKG);
01380 
01381     SegmentDate& lPartnerBKKHKGSegment =
01382       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01383     FacBomManager::addToListAndMap (lPartnerCX12_20100208_FD, lPartnerBKKHKGSegment);
01384     FacBomManager::linkWithParent (lPartnerCX12_20100208_FD, lPartnerBKKHKGSegment);
01385 
01386     lPartnerBKKHKGSegment.setBoardingDate (lDate);
01387     lPartnerBKKHKGSegment.setOffDate (lDate);
01388     lPartnerBKKHKGSegment.setBoardingTime (l1200);
01389     lPartnerBKKHKGSegment.setOffTime (l1540);
01390     lPartnerBKKHKGSegment.setElapsedTime (l0240);
01391 
01392     lMktSegmentDateKey = SegmentDateKey (lSIN, lBKK);
01393 
01394     SegmentDate& lPartnerMktSINBKKSegment =
01395       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
01396     FacBomManager::addToListAndMap (lPartnerCX1100_20100208_FD, lPartnerMktSINBKKSegment);
01397     FacBomManager::linkWithParent (lPartnerCX1100_20100208_FD, lPartnerMktSINBKKSegment);
01398 
01399     lPartnerMktSINBKKSegment.setBoardingDate (lDate);
01400     lPartnerMktSINBKKSegment.setOffDate (lDate);
01401     lPartnerMktSINBKKSegment.setBoardingTime (l0820);
01402     lPartnerMktSINBKKSegment.setOffTime (l1100);
01403     lPartnerMktSINBKKSegment.setElapsedTime (l0340);
01404 
01405     // Step 0.9.4: Leg-date level
01406     lLegDateKey = LegDateKey (lBKK);
01407 
01408     LegDate& lPartnerBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01409     FacBomManager::addToListAndMap (lPartnerCX12_20100208_FD, lPartnerBKKLeg);
01410     FacBomManager::linkWithParent (lPartnerCX12_20100208_FD, lPartnerBKKLeg);
01411 
01412     lPartnerBKKLeg.setOffPoint (lHKG);
01413     lPartnerBKKLeg.setBoardingDate (lDate);
01414     lPartnerBKKLeg.setOffDate (lDate);
01415     lPartnerBKKLeg.setBoardingTime (l1200);
01416     lPartnerBKKLeg.setOffTime (l1540);
01417     lPartnerBKKLeg.setElapsedTime (l0240);
01418 
01419     FacBomManager::addToListAndMap (lPartnerBKKLeg, lPartnerBKKHKGSegment);
01420     FacBomManager::addToListAndMap (lPartnerBKKHKGSegment, lPartnerBKKLeg);
01421 
01422     // Step 9.0.5: segment-cabin level
01423     
01424     SegmentCabin& lPartnerBKKHKGSegmentYCabin =
01425       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01426     FacBomManager::addToListAndMap (lPartnerBKKHKGSegment, lPartnerBKKHKGSegmentYCabin);
01427     FacBomManager::linkWithParent (lPartnerBKKHKGSegment, lPartnerBKKHKGSegmentYCabin);
01428 
01429     SegmentCabin& lPartnerMktSINBKKSegmentYCabin =
01430       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01431     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegment, lPartnerMktSINBKKSegmentYCabin);
01432     FacBomManager::linkWithParent (lPartnerMktSINBKKSegment, lPartnerMktSINBKKSegmentYCabin);
01433 
01434     // Step 9.0.6: leg-cabin level
01435     
01436     LegCabin& lPartnerBKKLegYCabin =
01437       FacBom<LegCabin>::instance().create (lYLegCabinKey);
01438     FacBomManager::addToListAndMap (lPartnerBKKLeg, lPartnerBKKLegYCabin);
01439     FacBomManager::linkWithParent (lPartnerBKKLeg, lPartnerBKKLegYCabin);
01440 
01441     lCapacity = CabinCapacity_T(999);
01442     lPartnerBKKLegYCabin.setCapacities (lCapacity);
01443     lPartnerBKKLegYCabin.setAvailabilityPool (lCapacity);
01444 
01445     FacBomManager::addToListAndMap (lPartnerBKKLegYCabin, lPartnerBKKHKGSegmentYCabin,
01446                                     lPartnerBKKHKGSegmentYCabin.getFullerKey());
01447     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin, lPartnerBKKLegYCabin,
01448                                     lPartnerBKKLegYCabin.getFullerKey());
01449 
01450     // Step 9.0.7: fare family level
01451     
01452     FareFamily& lPartnerBKKHKGSegmentYCabin1Family =
01453       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01454     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin,
01455                                     lPartnerBKKHKGSegmentYCabin1Family);
01456     FacBomManager::linkWithParent (lPartnerBKKHKGSegmentYCabin,
01457                                    lPartnerBKKHKGSegmentYCabin1Family);
01458 
01459     FareFamily& lPartnerMktSINBKKSegmentYCabin1Family =
01460       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01461     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegmentYCabin,
01462                                     lPartnerMktSINBKKSegmentYCabin1Family);
01463     FacBomManager::linkWithParent (lPartnerMktSINBKKSegmentYCabin,
01464                                    lPartnerMktSINBKKSegmentYCabin1Family);
01465 
01466     // Step 9.0.8: booking class level
01467 
01468     BookingClass& lPartnerBKKHKGSegmentYCabin1FamilyYClass =
01469       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01470     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin1Family,
01471                                     lPartnerBKKHKGSegmentYCabin1FamilyYClass);
01472     FacBomManager::linkWithParent (lPartnerBKKHKGSegmentYCabin1Family,
01473                                    lPartnerBKKHKGSegmentYCabin1FamilyYClass);
01474 
01475     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin,
01476                                     lPartnerBKKHKGSegmentYCabin1FamilyYClass);
01477     FacBomManager::addToListAndMap (lPartnerBKKHKGSegment,
01478                                     lPartnerBKKHKGSegmentYCabin1FamilyYClass);
01479 
01480     BookingClass& lPartnerMktSINBKKSegmentYCabin1FamilyYClass =
01481       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01482     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegmentYCabin1Family,
01483                                     lPartnerMktSINBKKSegmentYCabin1FamilyYClass);
01484     FacBomManager::linkWithParent (lPartnerMktSINBKKSegmentYCabin1Family,
01485                                    lPartnerMktSINBKKSegmentYCabin1FamilyYClass);
01486 
01487     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegmentYCabin,
01488                                     lPartnerMktSINBKKSegmentYCabin1FamilyYClass);
01489     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegment,
01490                                     lPartnerMktSINBKKSegmentYCabin1FamilyYClass);
01491     
01492     BookingClass& lPartnerBKKHKGSegmentYCabin1FamilyMClass =
01493       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01494     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin1Family,
01495                                     lPartnerBKKHKGSegmentYCabin1FamilyMClass);
01496     FacBomManager::linkWithParent (lPartnerBKKHKGSegmentYCabin1Family,
01497                                    lPartnerBKKHKGSegmentYCabin1FamilyMClass);
01498 
01499     FacBomManager::addToListAndMap (lPartnerBKKHKGSegmentYCabin,
01500                                     lPartnerBKKHKGSegmentYCabin1FamilyMClass);
01501     FacBomManager::addToListAndMap (lPartnerBKKHKGSegment,
01502                                     lPartnerBKKHKGSegmentYCabin1FamilyMClass);
01503 
01504     BookingClass& lPartnerMktSINBKKSegmentYCabin1FamilyMClass =
01505       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01506     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegmentYCabin1Family,
01507                                     lPartnerMktSINBKKSegmentYCabin1FamilyMClass);
01508     FacBomManager::linkWithParent (lPartnerMktSINBKKSegmentYCabin1Family,
01509                                    lPartnerMktSINBKKSegmentYCabin1FamilyMClass);
01510 
01511     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegmentYCabin,
01512                                     lPartnerMktSINBKKSegmentYCabin1FamilyMClass);
01513     FacBomManager::addToListAndMap (lPartnerMktSINBKKSegment,
01514                                     lPartnerMktSINBKKSegmentYCabin1FamilyMClass);    
01515 
01516     // Step 9.0.9: link SQ inventory objects to Partner CX inventory objects
01517 
01518     FacBomManager::addToList (lSINBKKSegment, lPartnerMktSINBKKSegment);
01519 
01520     lMktBKKHKGSegment.linkWithOperating (lPartnerBKKHKGSegment);
01521     
01522     /* =================================================================================== */
01523 
01524     // Step 1.0: O&D level
01525     // Create an O&D Date (SQ11/08-FEB-2010/SIN-BKK-SQ1200/08-FEB-2010/BKK-HKG) for SQ's Inventory
01526     OnDString_T lSQSINBKKOnDStr = "SQ;11,2010-Feb-08;SIN,BKK";
01527     OnDString_T lMktSQBKKHKGOnDStr = "SQ;1200,2010-Feb-08;BKK,HKG";
01528     OnDStringList_T lOnDStringList;
01529     lOnDStringList.push_back (lSQSINBKKOnDStr);
01530     lOnDStringList.push_back (lMktSQBKKHKGOnDStr);
01531 
01532     OnDDateKey lOnDDateKey (lOnDStringList);
01533     OnDDate& lSQ_SINHKG_OnDDate =
01534       FacBom<OnDDate>::instance().create (lOnDDateKey);
01535     // Link to the inventory
01536     FacBomManager::addToListAndMap (lSQInv, lSQ_SINHKG_OnDDate);
01537     FacBomManager::linkWithParent (lSQInv, lSQ_SINHKG_OnDDate);
01538 
01539     // Add the segments
01540     FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lSINBKKSegment);
01541     FacBomManager::addToListAndMap (lSQ_SINHKG_OnDDate, lMktBKKHKGSegment);
01542 
01543     // Add total forecast info for cabin Y.
01544     const MeanStdDevPair_T lMean60StdDev6 (60.0, 6.0);
01545     const WTP_T lWTP750 = 750.0;
01546     const WTPDemandPair_T lWTP750Mean60StdDev6 (lWTP750, lMean60StdDev6);
01547     lSQ_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
01548 
01549     // Add demand info (optional).
01550     // 2 legs here, so 2 CabinClassPair to add in the list.
01551     // Fist leg: cabin Y, class M.
01552     CabinClassPair_T lCC_YM1 (lY,lM);
01553     // Second leg: cabin Y, class M too.
01554     CabinClassPair_T lCC_YM2 (lY,lM);
01555     CabinClassPairList_T lCabinClassPairList;
01556     lCabinClassPairList.push_back(lCC_YM1);
01557     lCabinClassPairList.push_back(lCC_YM2);
01558     const MeanStdDevPair_T lMean20StdDev2 (20.0, 2.0);
01559     const Yield_T lYield850 = 850.0;
01560     const YieldDemandPair_T lYield850Mean20StdDev2 (lYield850, lMean20StdDev2);
01561     lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield850Mean20StdDev2);
01562     
01563     CabinClassPair_T lCC_YY1 (lY,lY);
01564     CabinClassPair_T lCC_YY2 (lY,lY);
01565     lCabinClassPairList.clear();
01566     lCabinClassPairList.push_back(lCC_YY1);
01567     lCabinClassPairList.push_back(lCC_YY2);
01568     const MeanStdDevPair_T lMean10StdDev1 (10.0, 1.0);
01569     const Yield_T lYield1200 = 1200.0;
01570     const YieldDemandPair_T lYield1200Mean10StdDev1 (lYield1200, lMean10StdDev1);
01571     lSQ_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield1200Mean10StdDev1);
01572 
01573     // Create an O&D Date (SQ11/08-FEB-2010/SIN-BKK) for SQ's Inventory
01574     lOnDStringList.clear();
01575     lOnDStringList.push_back (lSQSINBKKOnDStr);
01576 
01577     lOnDDateKey = OnDDateKey(lOnDStringList);
01578     OnDDate& lSQ_SINBKK_OnDDate =
01579       FacBom<OnDDate>::instance().create (lOnDDateKey);
01580     // Link to the inventory
01581     FacBomManager::addToListAndMap (lSQInv, lSQ_SINBKK_OnDDate);
01582     FacBomManager::linkWithParent (lSQInv, lSQ_SINBKK_OnDDate);
01583 
01584     // Add the segments
01585     FacBomManager::addToListAndMap (lSQ_SINBKK_OnDDate, lSINBKKSegment);
01586 
01587     // Add total forecast info for cabin Y.
01588     const WTP_T lWTP400 = 400.0;
01589     const WTPDemandPair_T lWTP400Mean60StdDev6 (lWTP400, lMean60StdDev6);
01590     lSQ_SINBKK_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
01591 
01592     // Add demand info (optional).
01593     lCabinClassPairList.clear();
01594     lCabinClassPairList.push_back(lCC_YM1);
01595     const MeanStdDevPair_T lMean20StdDev1 (20.0, 1.0);
01596     const Yield_T lYield500 = 500.0;
01597     const YieldDemandPair_T lYield500Mean20StdDev1 (lYield500, lMean20StdDev1);
01598     lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, lYield500Mean20StdDev1);
01599 
01600     lCabinClassPairList.clear();
01601     lCabinClassPairList.push_back(lCC_YY1);
01602     const Yield_T lYield700 = 700.0;
01603     const YieldDemandPair_T lYield700Mean20StdDev1 (lYield700, lMean10StdDev1 );
01604     lSQ_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, lYield700Mean20StdDev1);
01605 
01606     /*******************************************************************************
01607     // Create an O&D Date (SQ1200/08-FEB-2010/BKK-HKG) for SQ's Inventory
01608     lFullKeyList.clear();
01609     lFullKeyList.push_back (lMktSQBKKHKGFullKeyStr);
01610 
01611     lOnDDateKey = OnDDateKey(lFullKeyList);
01612     OnDDate& lMktSQ_BKKHKG_OnDDate =
01613       FacBom<OnDDate>::instance().create (lOnDDateKey);
01614     // Link to the inventory
01615     FacBomManager::addToListAndMap (lSQInv, lMktSQ_BKKHKG_OnDDate);
01616     FacBomManager::linkWithParent (lSQInv, lMktSQ_BKKHKG_OnDDate);
01617 
01618     // Add the segments
01619     FacBomManager::addToListAndMap (lMktSQ_BKKHKG_OnDDate, lMktBKKHKGSegment);
01620 
01621     // Demand info is not added for purely marketed O&Ds
01622     // Add demand info
01623     // lCabinClassPairList.clear();
01624     // lCabinClassPairList.push_back(lCC_YM2);
01625     // lMktSQ_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
01626     ***********************************************************************************/
01627     
01628             
01629     // ////// CX ///////    
01630     // Step 0.2: Flight-date level
01631     // Create a FlightDate (CX12/08-FEB-2010) for CX's Inventory
01632     lFlightNumber = 12;
01633     //lDate = Date_T (2010, 2, 8);
01634     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01635 
01636     FlightDate& lCX12_20100208_FD =
01637       FacBom<FlightDate>::instance().create (lFlightDateKey);
01638     FacBomManager::addToListAndMap (lCXInv, lCX12_20100208_FD);
01639     FacBomManager::linkWithParent (lCXInv, lCX12_20100208_FD);
01640 
01641     // Create a (mkt) FlightDate (CX1100/08-FEB-2010) for CX's Inventory
01642     lFlightNumber = 1100;
01643     //lDate = Date_T (2010, 2, 8);
01644     lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01645 
01646     FlightDate& lCX1100_20100208_FD =
01647       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
01648     FacBomManager::addToListAndMap (lCXInv, lCX1100_20100208_FD);
01649     FacBomManager::linkWithParent (lCXInv, lCX1100_20100208_FD);
01650     
01651     // Display the flight-date
01652     // STDAIR_LOG_DEBUG ("FlightDate: " << lAF084_20110320_FD.toString());
01653 
01654     // Step 0.3: Segment-date level
01655     // Create a SegmentDate BKK-HKG for CX's Inventory
01656     
01657     lSegmentDateKey = SegmentDateKey (lBKK, lHKG);
01658 
01659     SegmentDate& lBKKHKGSegment =
01660       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01661     FacBomManager::addToListAndMap (lCX12_20100208_FD, lBKKHKGSegment);
01662     FacBomManager::linkWithParent (lCX12_20100208_FD, lBKKHKGSegment);  
01663 
01664     // Fill the SegmentDate content
01665     lBKKHKGSegment.setBoardingDate (lDate);
01666     lBKKHKGSegment.setOffDate (lDate);
01667     lBKKHKGSegment.setBoardingTime (l1200);
01668     lBKKHKGSegment.setOffTime (l1540);
01669     lBKKHKGSegment.setElapsedTime (l0240);
01670 
01671     // Create a second (mkt) SegmentDate (SIN-BKK) for CX's Inventory
01672     lMktSegmentDateKey = SegmentDateKey (lSIN, lBKK);
01673 
01674     SegmentDate& lMktSINBKKSegment =
01675       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
01676     FacBomManager::addToListAndMap (lCX1100_20100208_FD, lMktSINBKKSegment);
01677     FacBomManager::linkWithParent (lCX1100_20100208_FD, lMktSINBKKSegment);
01678 
01679     // Fill the (mkt) SegmentDate content
01680     lMktSINBKKSegment.setBoardingDate (lDate);
01681     lMktSINBKKSegment.setOffDate (lDate);
01682     lMktSINBKKSegment.setBoardingTime (l0820);
01683     lMktSINBKKSegment.setOffTime (l1100);
01684     lMktSINBKKSegment.setElapsedTime (l0340);
01685 
01686     // Step 0.4: Leg-date level
01687     // Create a LegDate (BKK) for CX's Inventory
01688     lLegDateKey = LegDateKey (lBKK);
01689 
01690     LegDate& lBKKLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01691     FacBomManager::addToListAndMap (lCX12_20100208_FD, lBKKLeg);
01692     FacBomManager::linkWithParent (lCX12_20100208_FD, lBKKLeg);
01693 
01694     // Fill the LegDate content
01695     lBKKLeg.setOffPoint (lHKG);
01696     lBKKLeg.setBoardingDate (lDate);
01697     lBKKLeg.setOffDate (lDate);
01698     lBKKLeg.setBoardingTime (l1200);
01699     lBKKLeg.setOffTime (l1540);
01700     lBKKLeg.setElapsedTime (l0240);
01701 
01702     // Display the leg-date
01703     // STDAIR_LOG_DEBUG ("LegDate: " << lCDGLeg.toString());
01704 
01705     // Link the segment-dates with the leg-dates
01706     FacBomManager::addToListAndMap (lBKKLeg, lBKKHKGSegment);
01707     FacBomManager::addToListAndMap (lBKKHKGSegment, lBKKLeg);
01708 
01709     // Step 0.5: segment-cabin level
01710     // Create a SegmentCabin (Y) for the Segment BKK-HKG of CX's Inventory
01711     SegmentCabin& lBKKHKGSegmentYCabin =
01712       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01713     FacBomManager::addToListAndMap (lBKKHKGSegment, lBKKHKGSegmentYCabin);
01714     FacBomManager::linkWithParent (lBKKHKGSegment, lBKKHKGSegmentYCabin);
01715 
01716     // Create a SegmentCabin (Y) for the (mkt) Segment SIN-BKK of CX's Inventory
01717     SegmentCabin& lMktSINBKKSegmentYCabin =
01718       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01719     FacBomManager::addToListAndMap (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
01720     FacBomManager::linkWithParent (lMktSINBKKSegment, lMktSINBKKSegmentYCabin);
01721 
01722     // Step 0.6: leg-cabin level
01723     // Create a LegCabin (Y) for the Leg BKK-HKG on CX's Inventory
01724     LegCabin& lBKKLegYCabin =
01725       FacBom<LegCabin>::instance().create (lYLegCabinKey);
01726     FacBomManager::addToListAndMap (lBKKLeg, lBKKLegYCabin);
01727     FacBomManager::linkWithParent (lBKKLeg, lBKKLegYCabin);
01728 
01729     lCapacity = CabinCapacity_T(100);
01730     lBKKLegYCabin.setCapacities (lCapacity);
01731     lBKKLegYCabin.setAvailabilityPool (lCapacity);
01732 
01733     // Link the segment-dates with the leg-dates
01734     FacBomManager::addToListAndMap (lBKKLegYCabin, lBKKHKGSegmentYCabin,
01735                                     lBKKHKGSegmentYCabin.getFullerKey());
01736     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin, lBKKLegYCabin,
01737                                     lBKKLegYCabin.getFullerKey());
01738    
01739     // Step 0.7: fare family level
01740     // Create a fareFamily (1) for the Segment BKK-HKG, cabin Y on CX's Inv
01741     FareFamily& lBKKHKGSegmentYCabin1Family =
01742       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01743     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
01744                                     lBKKHKGSegmentYCabin1Family);
01745     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin,
01746                                    lBKKHKGSegmentYCabin1Family);
01747 
01748     // Create a FareFamily (1) for the (mkt) Segment SIN-BKK, cabin Y on CX's Inv
01749     FareFamily& lMktSINBKKSegmentYCabin1Family =
01750       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01751     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
01752                                     lMktSINBKKSegmentYCabin1Family);
01753     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin,
01754                                    lMktSINBKKSegmentYCabin1Family);
01755 
01756     
01757     // Step 0.8: booking class level
01758     // Create a BookingClass (Y) for the
01759     // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
01760     BookingClass& lBKKHKGSegmentYCabin1FamilyYClass =
01761       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01762     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
01763                                     lBKKHKGSegmentYCabin1FamilyYClass);
01764     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
01765                                    lBKKHKGSegmentYCabin1FamilyYClass);
01766 
01767     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
01768                                     lBKKHKGSegmentYCabin1FamilyYClass);
01769     FacBomManager::addToListAndMap (lBKKHKGSegment,
01770                                     lBKKHKGSegmentYCabin1FamilyYClass);
01771 
01772     lBKKHKGSegmentYCabin1FamilyYClass.setYield(700);
01773 
01774     // Create a BookingClass (Y) for the (mkt) Segment SIN-BKK, cabin Y,
01775     // fare family 1 on CX's Inv
01776     BookingClass& lMktSINBKKSegmentYCabin1FamilyYClass =
01777       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01778     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
01779                                     lMktSINBKKSegmentYCabin1FamilyYClass);
01780     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
01781                                    lMktSINBKKSegmentYCabin1FamilyYClass);
01782 
01783     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
01784                                     lMktSINBKKSegmentYCabin1FamilyYClass);
01785     FacBomManager::addToListAndMap (lMktSINBKKSegment,
01786                                     lMktSINBKKSegmentYCabin1FamilyYClass);
01787 
01788     lMktSINBKKSegmentYCabin1FamilyYClass.setYield(700);
01789     
01790     //Create a BookingClass (M) for the
01791     // Segment BKK-HKG, cabin Y, fare family 1 on CX's Inv
01792     BookingClass& lBKKHKGSegmentYCabin1FamilyMClass =
01793       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01794     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin1Family,
01795                                     lBKKHKGSegmentYCabin1FamilyMClass);
01796     FacBomManager::linkWithParent (lBKKHKGSegmentYCabin1Family,
01797                                    lBKKHKGSegmentYCabin1FamilyMClass);
01798 
01799     FacBomManager::addToListAndMap (lBKKHKGSegmentYCabin,
01800                                     lBKKHKGSegmentYCabin1FamilyMClass);
01801     FacBomManager::addToListAndMap (lBKKHKGSegment,
01802                                     lBKKHKGSegmentYCabin1FamilyMClass);
01803 
01804     lBKKHKGSegmentYCabin1FamilyMClass.setYield(500);
01805 
01806     // Create a BookingClass (M) for the (mkt) Segment SIN-BKK, cabin Y,
01807     // fare family 1 on CX's Inv
01808     BookingClass& lMktSINBKKSegmentYCabin1FamilyMClass =
01809       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01810     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin1Family,
01811                                     lMktSINBKKSegmentYCabin1FamilyMClass);
01812     FacBomManager::linkWithParent (lMktSINBKKSegmentYCabin1Family,
01813                                    lMktSINBKKSegmentYCabin1FamilyMClass);
01814 
01815     FacBomManager::addToListAndMap (lMktSINBKKSegmentYCabin,
01816                                     lMktSINBKKSegmentYCabin1FamilyMClass);
01817     FacBomManager::addToListAndMap (lMktSINBKKSegment,
01818                                     lMktSINBKKSegmentYCabin1FamilyMClass);
01819 
01820     lMktSINBKKSegmentYCabin1FamilyMClass.setYield(500);
01821 
01822     /* =================================================================================== */
01823     // Step 0.9: Partner Inventory
01824     // Create a partner Inventory SQ for CX   
01825     const InventoryKey lPartnerSQKey ("SQ");
01826     Inventory& lPartnerSQInv = FacBom<Inventory>::instance().create (lPartnerSQKey);
01827     FacBomManager::addToListAndMap (lCXInv, lPartnerSQInv);
01828     FacBomManager::linkWithParent (lCXInv, lPartnerSQInv);
01829 
01830     // Step 0.9.2 : Flight-date level
01831     lFlightNumber = 11;
01832     lFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01833 
01834     FlightDate& lPartnerSQ11_20100208_FD =
01835       FacBom<FlightDate>::instance().create (lFlightDateKey);
01836     FacBomManager::addToListAndMap (lPartnerSQInv, lPartnerSQ11_20100208_FD);
01837     FacBomManager::linkWithParent (lPartnerSQInv, lPartnerSQ11_20100208_FD);
01838 
01839     lFlightNumber = 1200;
01840     lMktFlightDateKey = FlightDateKey (lFlightNumber, lDate);
01841 
01842     FlightDate& lPartnerSQ1200_20100208_FD =
01843       FacBom<FlightDate>::instance().create (lMktFlightDateKey);
01844     FacBomManager::addToListAndMap (lPartnerSQInv, lPartnerSQ1200_20100208_FD);
01845     FacBomManager::linkWithParent (lPartnerSQInv, lPartnerSQ1200_20100208_FD);
01846 
01847     // Step 0.9.3: Segment-date level
01848     lSegmentDateKey = SegmentDateKey (lSIN, lBKK);
01849 
01850     SegmentDate& lPartnerSINBKKSegment =
01851       FacBom<SegmentDate>::instance().create (lSegmentDateKey);
01852     FacBomManager::addToListAndMap (lPartnerSQ11_20100208_FD, lPartnerSINBKKSegment);
01853     FacBomManager::linkWithParent (lPartnerSQ11_20100208_FD, lPartnerSINBKKSegment);
01854     
01855     lPartnerSINBKKSegment.setBoardingDate (lDate);
01856     lPartnerSINBKKSegment.setOffDate (lDate);
01857     lPartnerSINBKKSegment.setBoardingTime (l0820);
01858     lPartnerSINBKKSegment.setOffTime (l1100);
01859     lPartnerSINBKKSegment.setElapsedTime (l0340);
01860     
01861     lMktSegmentDateKey = SegmentDateKey (lBKK, lHKG);
01862 
01863     SegmentDate& lPartnerMktBKKHKGSegment =
01864       FacBom<SegmentDate>::instance().create (lMktSegmentDateKey);
01865     FacBomManager::addToListAndMap (lPartnerSQ1200_20100208_FD, lPartnerMktBKKHKGSegment);
01866     FacBomManager::linkWithParent (lPartnerSQ1200_20100208_FD, lPartnerMktBKKHKGSegment);
01867 
01868     lPartnerMktBKKHKGSegment.setBoardingDate (lDate);
01869     lPartnerMktBKKHKGSegment.setOffDate (lDate);
01870     lPartnerMktBKKHKGSegment.setBoardingTime (l1200);
01871     lPartnerMktBKKHKGSegment.setOffTime (l1540);
01872     lPartnerMktBKKHKGSegment.setElapsedTime (l0240);
01873   
01874     // Step 0.9.4: Leg-date level
01875     lLegDateKey = LegDateKey (lSIN);
01876 
01877     LegDate& lPartnerSINLeg = FacBom<LegDate>::instance().create (lLegDateKey);
01878     FacBomManager::addToListAndMap (lPartnerSQ11_20100208_FD, lPartnerSINLeg);
01879     FacBomManager::linkWithParent (lPartnerSQ11_20100208_FD, lPartnerSINLeg);
01880 
01881     lPartnerSINLeg.setOffPoint (lBKK);
01882     lPartnerSINLeg.setBoardingDate (lDate);
01883     lPartnerSINLeg.setOffDate (lDate);
01884     lPartnerSINLeg.setBoardingTime (l0820);
01885     lPartnerSINLeg.setOffTime (l1100);
01886     lPartnerSINLeg.setElapsedTime (l0340);
01887 
01888     FacBomManager::addToListAndMap (lPartnerSINLeg, lPartnerSINBKKSegment);
01889     FacBomManager::addToListAndMap (lPartnerSINBKKSegment, lPartnerSINLeg);
01890 
01891     // Step 9.0.5: segment-cabin level
01892 
01893     SegmentCabin& lPartnerSINBKKSegmentYCabin =
01894       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01895     FacBomManager::addToListAndMap (lPartnerSINBKKSegment, lPartnerSINBKKSegmentYCabin);
01896     FacBomManager::linkWithParent (lPartnerSINBKKSegment, lPartnerSINBKKSegmentYCabin);
01897     
01898     SegmentCabin& lPartnerMktBKKHKGSegmentYCabin =
01899       FacBom<SegmentCabin>::instance().create (lYSegmentCabinKey);
01900     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegment, lPartnerMktBKKHKGSegmentYCabin);
01901     FacBomManager::linkWithParent (lPartnerMktBKKHKGSegment, lPartnerMktBKKHKGSegmentYCabin);
01902     
01903     // Step 9.0.6: leg-cabin level
01904     
01905     LegCabin& lPartnerSINLegYCabin =
01906       FacBom<LegCabin>::instance().create (lYLegCabinKey);
01907     FacBomManager::addToListAndMap (lPartnerSINLeg, lPartnerSINLegYCabin);
01908     FacBomManager::linkWithParent (lPartnerSINLeg, lPartnerSINLegYCabin);
01909 
01910     lCapacity = CabinCapacity_T(999);
01911     lPartnerSINLegYCabin.setCapacities (lCapacity);
01912     lPartnerSINLegYCabin.setAvailabilityPool (lCapacity);
01913 
01914     FacBomManager::addToListAndMap (lPartnerSINLegYCabin, lPartnerSINBKKSegmentYCabin,
01915                                     lPartnerSINBKKSegmentYCabin.getFullerKey());
01916     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin, lPartnerSINLegYCabin,
01917                                     lPartnerSINLegYCabin.getFullerKey());
01918 
01919     // Step 9.0.7: fare family level
01920 
01921     FareFamily& lPartnerSINBKKSegmentYCabin1Family =
01922       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01923     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin,
01924                                     lPartnerSINBKKSegmentYCabin1Family);
01925     FacBomManager::linkWithParent (lPartnerSINBKKSegmentYCabin,
01926                                    lPartnerSINBKKSegmentYCabin1Family);
01927     
01928     FareFamily& lPartnerMktBKKHKGSegmentYCabin1Family =
01929       FacBom<FareFamily>::instance().create (l1FareFamilyKey);
01930     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegmentYCabin,
01931                                     lPartnerMktBKKHKGSegmentYCabin1Family);
01932     FacBomManager::linkWithParent (lPartnerMktBKKHKGSegmentYCabin,
01933                                    lPartnerMktBKKHKGSegmentYCabin1Family);
01934 
01935     
01936     // Step 9.0.8: booking class level
01937 
01938     BookingClass& lPartnerSINBKKSegmentYCabin1FamilyYClass =
01939       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01940     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin1Family,
01941                                     lPartnerSINBKKSegmentYCabin1FamilyYClass);
01942     FacBomManager::linkWithParent (lPartnerSINBKKSegmentYCabin1Family,
01943                                    lPartnerSINBKKSegmentYCabin1FamilyYClass);
01944 
01945     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin,
01946                                     lPartnerSINBKKSegmentYCabin1FamilyYClass);
01947     FacBomManager::addToListAndMap (lPartnerSINBKKSegment,
01948                                     lPartnerSINBKKSegmentYCabin1FamilyYClass);
01949 
01950     BookingClass& lPartnerMktBKKHKGSegmentYCabin1FamilyYClass =
01951       FacBom<BookingClass>::instance().create (lYBookingClassKey);
01952     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegmentYCabin1Family,
01953                                     lPartnerMktBKKHKGSegmentYCabin1FamilyYClass);
01954     FacBomManager::linkWithParent (lPartnerMktBKKHKGSegmentYCabin1Family,
01955                                    lPartnerMktBKKHKGSegmentYCabin1FamilyYClass);
01956 
01957     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegmentYCabin,
01958                                     lPartnerMktBKKHKGSegmentYCabin1FamilyYClass);
01959     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegment,
01960                                     lPartnerMktBKKHKGSegmentYCabin1FamilyYClass);    
01961     
01962     BookingClass& lPartnerSINBKKSegmentYCabin1FamilyMClass =
01963       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01964     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin1Family,
01965                                     lPartnerSINBKKSegmentYCabin1FamilyMClass);
01966     FacBomManager::linkWithParent (lPartnerSINBKKSegmentYCabin1Family,
01967                                    lPartnerSINBKKSegmentYCabin1FamilyMClass);
01968 
01969     FacBomManager::addToListAndMap (lPartnerSINBKKSegmentYCabin,
01970                                     lPartnerSINBKKSegmentYCabin1FamilyMClass);
01971     FacBomManager::addToListAndMap (lPartnerSINBKKSegment,
01972                                     lPartnerSINBKKSegmentYCabin1FamilyMClass);
01973 
01974     BookingClass& lPartnerMktBKKHKGSegmentYCabin1FamilyMClass =
01975       FacBom<BookingClass>::instance().create (lMBookingClassKey);
01976     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegmentYCabin1Family,
01977                                     lPartnerMktBKKHKGSegmentYCabin1FamilyMClass);
01978     FacBomManager::linkWithParent (lPartnerMktBKKHKGSegmentYCabin1Family,
01979                                    lPartnerMktBKKHKGSegmentYCabin1FamilyMClass);
01980 
01981     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegmentYCabin,
01982                                     lPartnerMktBKKHKGSegmentYCabin1FamilyMClass);
01983     FacBomManager::addToListAndMap (lPartnerMktBKKHKGSegment,
01984                                     lPartnerMktBKKHKGSegmentYCabin1FamilyMClass);
01985 
01986     // Step 9.0.9: link CX inventory objects to Partner SQ inventory objects
01987     FacBomManager::addToList (lBKKHKGSegment, lPartnerMktBKKHKGSegment);
01988 
01989     lMktSINBKKSegment.linkWithOperating (lPartnerSINBKKSegment);
01990 
01991     /* =================================================================================== */
01992 
01993     // Step 1.0: O&D level
01994     // Create an O&D Date (CX1100/08-FEB-2010/SIN-BKK-CX12/08-FEB-2010/BKK-HKG) for CX's Inventory
01995     OnDString_T lMktCXSINBKKOnDStr = "CX;1100,2010-Feb-08;SIN,BKK";
01996     OnDString_T lCXBKKHKGOnDStr = "CX;12,2010-Feb-08;BKK,HKG";
01997     lOnDStringList.clear();
01998     lOnDStringList.push_back (lMktCXSINBKKOnDStr);
01999     lOnDStringList.push_back (lCXBKKHKGOnDStr);
02000 
02001     lOnDDateKey = OnDDateKey(lOnDStringList);
02002     OnDDate& lCX_SINHKG_OnDDate =
02003       FacBom<OnDDate>::instance().create (lOnDDateKey);
02004     // Link to the inventory
02005     FacBomManager::addToListAndMap (lCXInv, lCX_SINHKG_OnDDate);
02006     FacBomManager::linkWithParent (lCXInv, lCX_SINHKG_OnDDate);
02007 
02008     // Add the segments
02009     FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lMktSINBKKSegment);
02010     FacBomManager::addToListAndMap (lCX_SINHKG_OnDDate, lBKKHKGSegment);
02011 
02012     // Add total forecast info for cabin Y.
02013     lCX_SINHKG_OnDDate.setTotalForecast (lY, lWTP750Mean60StdDev6);
02014     
02015     // Add demand info
02016     lCabinClassPairList.clear();
02017     lCabinClassPairList.push_back(lCC_YM1);
02018     lCabinClassPairList.push_back(lCC_YM2);
02019     lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield850Mean20StdDev2);
02020 
02021     lCabinClassPairList.clear();
02022     lCabinClassPairList.push_back(lCC_YY1);
02023     lCabinClassPairList.push_back(lCC_YY2);
02024     lCX_SINHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield1200Mean10StdDev1);
02025 
02026     /***********************************************************************************
02027     // Create an O&D Date (CX1100/08-FEB-2010/SIN-BKK) for CX's Inventory
02028     lFullKeyList.clear();
02029     lFullKeyList.push_back (lMktCXSINBKKFullKeyStr);
02030 
02031     lOnDDateKey = OnDDateKey(lFullKeyList);
02032     OnDDate& lMktCX_SINBKK_OnDDate =
02033       FacBom<OnDDate>::instance().create (lOnDDateKey);
02034     // Link to the inventory
02035     FacBomManager::addToListAndMap (lCXInv, lMktCX_SINBKK_OnDDate);
02036     FacBomManager::linkWithParent (lCXInv, lMktCX_SINBKK_OnDDate);
02037 
02038     // Add the segments
02039     FacBomManager::addToListAndMap (lMktCX_SINBKK_OnDDate, lMktSINBKKSegment);
02040 
02041     // Demand info is not added for purely marketed O&Ds
02042     // Add demand info
02043     // lCabinClassPairList.clear();
02044     // lCabinClassPairList.push_back(lCC_YM1);
02045     // lMktCX_SINBKK_OnDDate.setDemandInformation (lCabinClassPairList, 500.0, 20.0, 1.0);
02046     *************************************************************************************/
02047     
02048     // Create an O&D Date (CX12/08-FEB-2010/BKK-HKG) for CX's Inventory
02049     lOnDStringList.clear();
02050     lOnDStringList.push_back (lCXBKKHKGOnDStr);
02051 
02052     lOnDDateKey = OnDDateKey(lOnDStringList);
02053     OnDDate& lCX_BKKHKG_OnDDate =
02054       FacBom<OnDDate>::instance().create (lOnDDateKey);
02055     // Link to the inventory
02056     FacBomManager::addToListAndMap (lCXInv, lCX_BKKHKG_OnDDate);
02057     FacBomManager::linkWithParent (lCXInv, lCX_BKKHKG_OnDDate);
02058 
02059     // Add the segments
02060     FacBomManager::addToListAndMap (lCX_BKKHKG_OnDDate, lBKKHKGSegment);
02061 
02062     // Add total forecast info for cabin Y.
02063     lCX_BKKHKG_OnDDate.setTotalForecast (lY, lWTP400Mean60StdDev6);
02064 
02065     // Add demand info
02066     lCabinClassPairList.clear();
02067     lCabinClassPairList.push_back(lCC_YM2);
02068     lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield500Mean20StdDev1);
02069 
02070     lCabinClassPairList.clear();
02071     lCabinClassPairList.push_back(lCC_YY2);
02072     const YieldDemandPair_T lYield700Mean10StdDev1 (lYield700, lMean10StdDev1 );
02073     lCX_BKKHKG_OnDDate.setDemandInformation (lCabinClassPairList, lYield700Mean10StdDev1);
02074 
02075     /*================================================================================
02076       ================================================================================
02077       ================================================================================*/
02078     // Schedule:
02079     // SQ:
02080     // Step 1: flight period level
02081     // Create a flight period for SQ11:
02082     const DoWStruct lDoWSrtuct ("1111111");
02083     const Date_T lDateRangeStart (2010, boost::gregorian::Feb, 8);
02084     const Date_T lDateRangeEnd (2010, boost::gregorian::Feb, 9);
02085     const DatePeriod_T lDatePeriod (lDateRangeStart, lDateRangeEnd);
02086     const PeriodStruct lPeriodStruct (lDatePeriod,lDoWSrtuct);
02087 
02088     lFlightNumber = FlightNumber_T (11);
02089 
02090     FlightPeriodKey lFlightPeriodKey (lFlightNumber, lPeriodStruct);
02091 
02092     FlightPeriod& lSQ11FlightPeriod =
02093       FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
02094     FacBomManager::addToListAndMap (lSQInv, lSQ11FlightPeriod);
02095     FacBomManager::linkWithParent (lSQInv, lSQ11FlightPeriod);
02096 
02097     // Step 2: segment period level
02098     // Create a segment period for SIN-BKK:
02099 
02100     SegmentPeriodKey lSegmentPeriodKey (lSIN, lBKK);
02101 
02102     SegmentPeriod& lSINBKKSegmentPeriod =
02103       FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
02104     FacBomManager::addToListAndMap (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
02105     FacBomManager::linkWithParent (lSQ11FlightPeriod, lSINBKKSegmentPeriod);
02106 
02107     lSINBKKSegmentPeriod.setBoardingTime (l0820);
02108     lSINBKKSegmentPeriod.setOffTime (l1100);
02109     lSINBKKSegmentPeriod.setElapsedTime (l0340);
02110     ClassList_String_T lYM ("YM");
02111     lSINBKKSegmentPeriod.addCabinBookingClassList (lY,lYM);
02112 
02113     // CX:
02114     // Step 1: flight period level
02115     // Create a flight period for CX12:  
02116     lFlightNumber = FlightNumber_T (12);
02117 
02118     lFlightPeriodKey = FlightPeriodKey(lFlightNumber, lPeriodStruct);
02119 
02120     FlightPeriod& lCX12FlightPeriod =
02121       FacBom<FlightPeriod>::instance().create (lFlightPeriodKey);
02122     FacBomManager::addToListAndMap (lCXInv, lCX12FlightPeriod);
02123     FacBomManager::linkWithParent (lCXInv, lCX12FlightPeriod);
02124 
02125     // Step 2: segment period level
02126     // Create a segment period for BKK-HKG:
02127 
02128     lSegmentPeriodKey = SegmentPeriodKey (lBKK, lHKG);
02129 
02130     SegmentPeriod& lBKKHKGSegmentPeriod =
02131       FacBom<SegmentPeriod>::instance().create (lSegmentPeriodKey);
02132     FacBomManager::addToListAndMap (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
02133     FacBomManager::linkWithParent (lCX12FlightPeriod, lBKKHKGSegmentPeriod);
02134 
02135     lBKKHKGSegmentPeriod.setBoardingTime (l1200);
02136     lBKKHKGSegmentPeriod.setOffTime (l1540);
02137     lBKKHKGSegmentPeriod.setElapsedTime (l0240);
02138     lBKKHKGSegmentPeriod.addCabinBookingClassList (lY,lYM);
02139     
02140   }
02141 
02142   // //////////////////////////////////////////////////////////////////////
02143   void CmdBomManager::buildPartnershipsSamplePricing (BomRoot& ioBomRoot) {
02144 
02146 
02147     /*===================================================================================*/
02148     // First airport pair SIN-BKK.
02149     // Set the airport-pair primary key.
02150     AirportPairKey lAirportPairKey ("SIN", "BKK");
02151     
02152     // Create the AirportPairKey object and link it to the ioBomRoot object.
02153     AirportPair& lSINBKKAirportPair =
02154       FacBom<AirportPair>::instance().create (lAirportPairKey);
02155     FacBomManager::addToListAndMap (ioBomRoot, lSINBKKAirportPair);
02156     FacBomManager::linkWithParent (ioBomRoot, lSINBKKAirportPair);
02157 
02158     // Set the fare date-period primary key.
02159     const Date_T lDateRangeStart (2010, boost::gregorian::Jan, 15);
02160     const Date_T lDateRangeEnd (2010, boost::gregorian::Dec, 31);
02161     const DatePeriod_T lDateRange (lDateRangeStart, lDateRangeEnd);
02162     const DatePeriodKey lDatePeriodKey (lDateRange);
02163 
02164     // Create the DatePeriodKey object and link it to the PosChannel object.
02165     DatePeriod& lSINBKKDatePeriod =
02166       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02167     FacBomManager::addToListAndMap (lSINBKKAirportPair, lSINBKKDatePeriod);
02168     FacBomManager::linkWithParent (lSINBKKAirportPair, lSINBKKDatePeriod);    
02169 
02170     // Set the point-of-sale-channel primary key.
02171     PosChannelKey lPosChannelKey ("SIN","IN");  
02172     
02173     // Create the PositionKey object and link it to the AirportPair object.
02174     PosChannel& lSINPosChannel =
02175       FacBom<PosChannel>::instance().create (lPosChannelKey);
02176     FacBomManager::addToListAndMap (lSINBKKDatePeriod, lSINPosChannel);
02177     FacBomManager::linkWithParent (lSINBKKDatePeriod, lSINPosChannel);
02178    
02179     // Set the fare time-period primary key.
02180     const Time_T lTimeRangeStart (0, 0, 0);
02181     const Time_T lTimeRangeEnd (23, 0, 0);
02182     const TimePeriodKey lFareTimePeriodKey (lTimeRangeStart,
02183                                             lTimeRangeEnd);
02184 
02185     // Create the TimePeriodKey and link it to the DatePeriod object.
02186     TimePeriod& lSINBKKFareTimePeriod =
02187       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02188     FacBomManager::addToListAndMap (lSINPosChannel, lSINBKKFareTimePeriod);
02189     FacBomManager::linkWithParent (lSINPosChannel, lSINBKKFareTimePeriod);        
02190 
02191     // Generate the FareRule
02192     const FareFeaturesKey lFareFeaturesKey (TRIP_TYPE_ONE_WAY,
02193                                             NO_ADVANCE_PURCHASE,
02194                                             SATURDAY_STAY,
02195                                             CHANGE_FEES,
02196                                             NON_REFUNDABLE,
02197                                             NO_STAY_DURATION);
02198 
02199     // Create the FareFeaturesKey and link it to the TimePeriod object.
02200     FareFeatures& lSINBKKFareFeatures =
02201       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02202     FacBomManager::addToListAndMap (lSINBKKFareTimePeriod, lSINBKKFareFeatures);
02203     FacBomManager::linkWithParent (lSINBKKFareTimePeriod, lSINBKKFareFeatures);        
02204 
02205     // Generate Segment Features and link them to their FareRule.
02206     AirlineCodeList_T lSQAirlineCodeList;
02207     lSQAirlineCodeList.push_back ("SQ");
02208     
02209     ClassList_StringList_T lYClassCodeList;
02210     lYClassCodeList.push_back ("Y");    
02211     const AirlineClassListKey lSQAirlineYClassListKey (lSQAirlineCodeList,
02212                                                        lYClassCodeList);
02213 
02214     ClassList_StringList_T lMClassCodeList;
02215     lMClassCodeList.push_back ("M");
02216     const AirlineClassListKey lSQAirlineMClassListKey (lSQAirlineCodeList,
02217                                                        lMClassCodeList);
02218 
02219     // Create the AirlineClassListKey and link it to the FareFeatures object.
02220     AirlineClassList& lSQAirlineYClassList =
02221       FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
02222     lSQAirlineYClassList.setFare(700);
02223     FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineYClassList);
02224     FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineYClassList);
02225 
02226     AirlineClassList& lSQAirlineMClassList =
02227       FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
02228     lSQAirlineMClassList.setFare(500);
02229     FacBomManager::addToListAndMap (lSINBKKFareFeatures, lSQAirlineMClassList);
02230     FacBomManager::linkWithParent (lSINBKKFareFeatures, lSQAirlineMClassList);
02231 
02232     /*===================================================================================*/
02233     // Second airport pair BKK-HKG.
02234     // Set the airport-pair primary key.
02235     lAirportPairKey = AirportPairKey ("BKK", "HKG");
02236     
02237     // Create the AirportPairKey object and link it to the ioBomRoot object.
02238     AirportPair& lBKKHKGAirportPair =
02239       FacBom<AirportPair>::instance().create (lAirportPairKey);
02240     FacBomManager::addToListAndMap (ioBomRoot, lBKKHKGAirportPair);
02241     FacBomManager::linkWithParent (ioBomRoot, lBKKHKGAirportPair);
02242 
02243     // Set the fare date-period primary key.
02244     // Use the same as previously.
02245 
02246     // Create the DatePeriodKey object and link it to the PosChannel object.
02247     DatePeriod& lBKKHKGDatePeriod =
02248       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02249     FacBomManager::addToListAndMap (lBKKHKGAirportPair, lBKKHKGDatePeriod);
02250     FacBomManager::linkWithParent (lBKKHKGAirportPair, lBKKHKGDatePeriod);    
02251 
02252     // Set the point-of-sale-channel primary key.
02253     lPosChannelKey  = PosChannelKey("BKK","IN");  
02254     
02255     // Create the PositionKey object and link it to the AirportPair object.
02256     PosChannel& lBKKPosChannel =
02257       FacBom<PosChannel>::instance().create (lPosChannelKey);
02258     FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lBKKPosChannel);
02259     FacBomManager::linkWithParent (lBKKHKGDatePeriod, lBKKPosChannel);
02260    
02261     // Set the fare time-period primary key.
02262     // Use the same as previously.
02263 
02264     // Create the TimePeriodKey and link it to the DatePeriod object.
02265     TimePeriod& lBKKHKGFareTimePeriod =
02266       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02267     FacBomManager::addToListAndMap (lBKKPosChannel, lBKKHKGFareTimePeriod);
02268     FacBomManager::linkWithParent (lBKKPosChannel, lBKKHKGFareTimePeriod);        
02269 
02270     // Generate the FareRule
02271     // Use the same key as previously.
02272 
02273     // Create the FareFeaturesKey and link it to the TimePeriod object.
02274     FareFeatures& lBKKHKGFareFeatures =
02275       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02276     FacBomManager::addToListAndMap (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);
02277     FacBomManager::linkWithParent (lBKKHKGFareTimePeriod, lBKKHKGFareFeatures);        
02278 
02279     // Generate Segment Features and link them to their FareRule.
02280     AirlineCodeList_T lCXAirlineCodeList;
02281     lCXAirlineCodeList.push_back ("CX");
02282     
02283     const AirlineClassListKey lCXAirlineYClassListKey (lCXAirlineCodeList,
02284                                                        lYClassCodeList);
02285 
02286     const AirlineClassListKey lCXAirlineMClassListKey (lCXAirlineCodeList,
02287                                                        lMClassCodeList);
02288 
02289     // Create the AirlineClassListKey and link it to the FareFeatures object.
02290     AirlineClassList& lCXAirlineYClassList =
02291       FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
02292     lCXAirlineYClassList.setFare(700);
02293     FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineYClassList);
02294     FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineYClassList);
02295     
02296     AirlineClassList& lCXAirlineMClassList =
02297       FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
02298     lCXAirlineMClassList.setFare(500);
02299     FacBomManager::addToListAndMap (lBKKHKGFareFeatures, lCXAirlineMClassList);
02300     FacBomManager::linkWithParent (lBKKHKGFareFeatures, lCXAirlineMClassList);
02301 
02302     /*===================================================================================*/
02303     // Third airport pair SIN-HKG.
02304     // Set the airport-pair primary key.
02305     lAirportPairKey = AirportPairKey ("SIN", "HKG");
02306     
02307     // Create the AirportPairKey object and link it to the ioBomRoot object.
02308     AirportPair& lSINHKGAirportPair =
02309       FacBom<AirportPair>::instance().create (lAirportPairKey);
02310     FacBomManager::addToListAndMap (ioBomRoot, lSINHKGAirportPair);
02311     FacBomManager::linkWithParent (ioBomRoot, lSINHKGAirportPair);
02312 
02313     // Set the fare date-period primary key.
02314     // Use the same as previously.
02315 
02316     // Create the DatePeriodKey object and link it to the PosChannel object.
02317     DatePeriod& lSINHKGDatePeriod =
02318       FacBom<DatePeriod>::instance().create (lDatePeriodKey);
02319     FacBomManager::addToListAndMap (lSINHKGAirportPair, lSINHKGDatePeriod);
02320     FacBomManager::linkWithParent (lSINHKGAirportPair, lSINHKGDatePeriod);    
02321 
02322     // Set the point-of-sale-channel primary key.
02323     lPosChannelKey = PosChannelKey("SIN","IN");  
02324     
02325     // Create the PositionKey object and link it to the AirportPair object.
02326     PosChannel& lOnDSINPosChannel =
02327       FacBom<PosChannel>::instance().create (lPosChannelKey);
02328     FacBomManager::addToListAndMap (lSINHKGDatePeriod, lOnDSINPosChannel);
02329     FacBomManager::linkWithParent (lSINHKGDatePeriod, lOnDSINPosChannel);
02330    
02331     // Set the fare time-period primary key.
02332     // Use the same as previously.
02333 
02334     // Create the TimePeriodKey and link it to the DatePeriod object.
02335     TimePeriod& lSINHKGFareTimePeriod =
02336       FacBom<TimePeriod>::instance().create (lFareTimePeriodKey);
02337     FacBomManager::addToListAndMap (lOnDSINPosChannel, lSINHKGFareTimePeriod);
02338     FacBomManager::linkWithParent (lOnDSINPosChannel, lSINHKGFareTimePeriod);        
02339 
02340     // Generate the FareRule
02341     // Use the same key as previously.
02342 
02343     // Create the FareFeaturesKey and link it to the TimePeriod object.
02344     FareFeatures& lSINHKGFareFeatures =
02345       FacBom<FareFeatures>::instance().create (lFareFeaturesKey);
02346     FacBomManager::addToListAndMap (lSINHKGFareTimePeriod, lSINHKGFareFeatures);
02347     FacBomManager::linkWithParent (lSINHKGFareTimePeriod, lSINHKGFareFeatures);        
02348 
02349     // Generate Segment Features and link them to their FareRule.
02350     AirlineCodeList_T lSQ_CXAirlineCodeList;
02351     lSQ_CXAirlineCodeList.push_back ("SQ");
02352     lSQ_CXAirlineCodeList.push_back ("CX");
02353 
02354     ClassList_StringList_T lY_YClassCodeList;
02355     lY_YClassCodeList.push_back ("Y");
02356     lY_YClassCodeList.push_back ("Y");
02357     const AirlineClassListKey lSQ_CXAirlineYClassListKey (lSQ_CXAirlineCodeList,
02358                                                           lY_YClassCodeList);
02359 
02360     ClassList_StringList_T lM_MClassCodeList;
02361     lM_MClassCodeList.push_back ("M");
02362     lM_MClassCodeList.push_back ("M");
02363     const AirlineClassListKey lSQ_CXAirlineMClassListKey (lSQ_CXAirlineCodeList,
02364                                                           lM_MClassCodeList);
02365 
02366     // Create the AirlineClassListKey and link it to the FareFeatures object.
02367     AirlineClassList& lSQ_CXAirlineYClassList =
02368       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
02369     lSQ_CXAirlineYClassList.setFare(1200);
02370     FacBomManager::addToListAndMap (lSINHKGFareFeatures, lSQ_CXAirlineYClassList);
02371     FacBomManager::linkWithParent (lSINHKGFareFeatures, lSQ_CXAirlineYClassList);
02372     
02373     AirlineClassList& lSQ_CXAirlineMClassList =
02374       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
02375     lSQ_CXAirlineMClassList.setFare(850);
02376     FacBomManager::addToListAndMap (lSINHKGFareFeatures, lSQ_CXAirlineMClassList);
02377     FacBomManager::linkWithParent (lSINHKGFareFeatures, lSQ_CXAirlineMClassList);
02378 
02379 
02381 
02382     /*===================================================================================*/
02383 
02384     // Use the same airport pair, and date period for adding SQ SIN-BKK yields.
02385     
02386     // Set the point-of-sale-channel primary key.
02387     lPosChannelKey = PosChannelKey(DEFAULT_POS, DEFAULT_CHANNEL);  
02388     
02389     // Create the PositionKey object and link it to the AirportPair object.
02390     PosChannel& lRAC_SINBKKPosChannel =
02391       FacBom<PosChannel>::instance().create (lPosChannelKey);
02392     FacBomManager::addToListAndMap (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
02393     FacBomManager::linkWithParent (lSINBKKDatePeriod, lRAC_SINBKKPosChannel);
02394    
02395     // Set the yield time-period primary key.
02396     const TimePeriodKey lYieldTimePeriodKey (lTimeRangeStart,
02397                                             lTimeRangeEnd);
02398 
02399     // Create the TimePeriodKey and link it to the DatePeriod object.
02400     TimePeriod& lSINBKKYieldTimePeriod =
02401       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
02402     FacBomManager::addToListAndMap (lRAC_SINBKKPosChannel, lSINBKKYieldTimePeriod);
02403     FacBomManager::linkWithParent (lRAC_SINBKKPosChannel, lSINBKKYieldTimePeriod);        
02404 
02405     // Generate the YieldRule
02406     const YieldFeaturesKey lYieldFeaturesKey (TRIP_TYPE_ONE_WAY,
02407                                               CABIN_Y);
02408 
02409     // Create the YieldFeaturesKey and link it to the TimePeriod object.
02410     YieldFeatures& lSINBKKYieldFeatures =
02411       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
02412     FacBomManager::addToListAndMap (lSINBKKYieldTimePeriod, lSINBKKYieldFeatures);
02413     FacBomManager::linkWithParent (lSINBKKYieldTimePeriod, lSINBKKYieldFeatures);        
02414 
02415     // Generate Segment Features and link them to their YieldRule.
02416     // Use the same key as previously.
02417 
02418     // Create the AirlineClassListKey and link it to the YieldFeatures object.
02419     AirlineClassList& lRAC_SQAirlineYClassList =
02420       FacBom<AirlineClassList>::instance().create (lSQAirlineYClassListKey);
02421     lRAC_SQAirlineYClassList.setYield(700);
02422     FacBomManager::addToListAndMap (lSINBKKYieldFeatures, lRAC_SQAirlineYClassList);
02423     FacBomManager::linkWithParent (lSINBKKYieldFeatures, lRAC_SQAirlineYClassList);
02424 
02425     AirlineClassList& lRAC_SQAirlineMClassList =
02426       FacBom<AirlineClassList>::instance().create (lSQAirlineMClassListKey);
02427     lRAC_SQAirlineMClassList.setYield(500);
02428     FacBomManager::addToListAndMap (lSINBKKYieldFeatures, lRAC_SQAirlineMClassList);
02429     FacBomManager::linkWithParent (lSINBKKYieldFeatures, lRAC_SQAirlineMClassList);
02430 
02431     /*===================================================================================*/
02432 
02433     // Use the same airport pair, and date period for adding CX BKK-HKG yields. 
02434     
02435     // Set the point-of-sale-channel primary key.
02436     // Use the same as previously.
02437     
02438     // Create the PositionKey object and link it to the AirportPair object.
02439     PosChannel& lRAC_BKKHKGPosChannel =
02440       FacBom<PosChannel>::instance().create (lPosChannelKey);
02441     FacBomManager::addToListAndMap (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
02442     FacBomManager::linkWithParent (lBKKHKGDatePeriod, lRAC_BKKHKGPosChannel);
02443    
02444     // Set the yield time-period primary key.
02445     // Use the same as previously.
02446 
02447     // Create the TimePeriodKey and link it to the DatePeriod object.
02448     TimePeriod& lBKKHKGYieldTimePeriod =
02449       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
02450     FacBomManager::addToListAndMap (lRAC_BKKHKGPosChannel, lBKKHKGYieldTimePeriod);
02451     FacBomManager::linkWithParent (lRAC_BKKHKGPosChannel, lBKKHKGYieldTimePeriod);        
02452 
02453     // Generate the YieldRule
02454     // Use the same key as previously.
02455 
02456     // Create the YieldFeaturesKey and link it to the TimePeriod object.
02457     YieldFeatures& lBKKHKGYieldFeatures =
02458       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
02459     FacBomManager::addToListAndMap (lBKKHKGYieldTimePeriod, lBKKHKGYieldFeatures);
02460     FacBomManager::linkWithParent (lBKKHKGYieldTimePeriod, lBKKHKGYieldFeatures);        
02461 
02462     // Generate Segment Features and link them to their YieldRule.
02463     // Use the same key as previously.
02464 
02465     // Create the AirlineClassListKey and link it to the YieldFeatures object.
02466     AirlineClassList& lRAC_CXAirlineYClassList =
02467       FacBom<AirlineClassList>::instance().create (lCXAirlineYClassListKey);
02468     lRAC_CXAirlineYClassList.setYield(700);
02469     FacBomManager::addToListAndMap (lBKKHKGYieldFeatures, lRAC_CXAirlineYClassList);
02470     FacBomManager::linkWithParent (lBKKHKGYieldFeatures, lRAC_CXAirlineYClassList);
02471     
02472     AirlineClassList& lRAC_CXAirlineMClassList =
02473       FacBom<AirlineClassList>::instance().create (lCXAirlineMClassListKey);
02474     lRAC_CXAirlineMClassList.setYield(500);
02475     FacBomManager::addToListAndMap (lBKKHKGYieldFeatures, lRAC_CXAirlineMClassList);
02476     FacBomManager::linkWithParent (lBKKHKGYieldFeatures, lRAC_CXAirlineMClassList);
02477 
02478     /*===================================================================================*/
02479 
02480     // Use the same airport pair, and date period for SQ-CX SIN-HKG
02481 
02482     // Set the point-of-sale-channel primary key.
02483     // Use the same as previously.
02484     
02485     // Create the PositionKey object and link it to the AirportPair object.
02486     PosChannel& lRAC_SINHKGChannel =
02487       FacBom<PosChannel>::instance().create (lPosChannelKey);
02488     FacBomManager::addToListAndMap (lSINHKGDatePeriod, lRAC_SINHKGChannel);
02489     FacBomManager::linkWithParent (lSINHKGDatePeriod, lRAC_SINHKGChannel);
02490    
02491     // Set the yield time-period primary key.
02492     // Use the same as previously.
02493 
02494     // Create the TimePeriodKey and link it to the DatePeriod object.
02495     TimePeriod& lSINHKGYieldTimePeriod =
02496       FacBom<TimePeriod>::instance().create (lYieldTimePeriodKey);
02497     FacBomManager::addToListAndMap (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);
02498     FacBomManager::linkWithParent (lRAC_SINHKGChannel, lSINHKGYieldTimePeriod);        
02499 
02500     // Generate the YieldRule
02501     // Use the same key as previously.
02502 
02503     // Create the YieldFeaturesKey and link it to the TimePeriod object.
02504     YieldFeatures& lSINHKGYieldFeatures =
02505       FacBom<YieldFeatures>::instance().create (lYieldFeaturesKey);
02506     FacBomManager::addToListAndMap (lSINHKGYieldTimePeriod, lSINHKGYieldFeatures);
02507     FacBomManager::linkWithParent (lSINHKGYieldTimePeriod, lSINHKGYieldFeatures);        
02508 
02509     // Generate Segment Features and link them to their YieldRule.
02510     // Use the same key as previously
02511     
02512     // Create the AirlineClassListKey and link it to the YieldFeatures object.
02513     AirlineClassList& lRAC_SQ_CXAirlineYClassList =
02514       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineYClassListKey);
02515     lRAC_SQ_CXAirlineYClassList.setYield(1200);
02516     FacBomManager::addToListAndMap (lSINHKGYieldFeatures, lRAC_SQ_CXAirlineYClassList);
02517     FacBomManager::linkWithParent (lSINHKGYieldFeatures, lRAC_SQ_CXAirlineYClassList);
02518     
02519     AirlineClassList& lRAC_SQ_CXAirlineMClassList =
02520       FacBom<AirlineClassList>::instance().create (lSQ_CXAirlineMClassListKey);
02521     lRAC_SQ_CXAirlineMClassList.setYield(850);
02522     FacBomManager::addToListAndMap (lSINHKGYieldFeatures, lRAC_SQ_CXAirlineMClassList);
02523     FacBomManager::linkWithParent (lSINHKGYieldFeatures, lRAC_SQ_CXAirlineMClassList);
02524     
02525   }
02526 
02527 }
02528