7 #include <stdair/bom/FareOptionStruct.hpp>
8 #include <stdair/bom/TravelSolutionStruct.hpp>
9 #include <stdair/bom/CancellationStruct.hpp>
10 #include <stdair/service/Logger.hpp>
12 #include <airinv/AIRINV_Master_Service.hpp>
19 void DistributionManager::
20 calculateAvailability (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
21 stdair::TravelSolutionList_T& ioTravelSolutionList) {
22 for (stdair::TravelSolutionList_T::iterator itTS =
23 ioTravelSolutionList.begin();
24 itTS != ioTravelSolutionList.end(); ++itTS) {
25 stdair::TravelSolutionStruct& lCurrentTravelSolution = *itTS;
28 ioAIRINV_Master_Service.calculateAvailability (lCurrentTravelSolution);
33 bool DistributionManager::
34 sell (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
35 const stdair::TravelSolutionStruct& iTravelSolution,
36 const stdair::NbOfSeats_T& iPartySize) {
37 bool hasSaleBeenSuccessful =
false;
39 const stdair::ClassObjectIDMapHolder_T& lClassObjectIDMapHolder =
40 iTravelSolution.getClassObjectIDMapHolder();
41 if (lClassObjectIDMapHolder.size() > 0) {
42 const stdair::FareOptionStruct& lChosenFareOption =
43 iTravelSolution.getChosenFareOption ();
44 const stdair::ClassList_StringList_T& lClassPath =
45 lChosenFareOption.getClassPath();
46 stdair::ClassList_StringList_T::const_iterator itClassKeyList =
48 for (stdair::ClassObjectIDMapHolder_T::const_iterator itClassObjectIDMap =
49 lClassObjectIDMapHolder.begin();
50 itClassObjectIDMap != lClassObjectIDMapHolder.end();
51 ++itClassObjectIDMap, ++itClassKeyList) {
52 const stdair::ClassObjectIDMap_T& lClassObjectIDMap =
56 std::ostringstream ostr;
57 const stdair::ClassList_String_T& lClassList = *itClassKeyList;
58 assert (lClassList.size() > 0);
59 ostr << lClassList.at(0);
60 const stdair::ClassCode_T lClassCode (ostr.str());
61 stdair::ClassObjectIDMap_T::const_iterator itClassID =
62 lClassObjectIDMap.find (lClassCode);
63 assert (itClassID != lClassObjectIDMap.end());
64 const stdair::BookingClassID_T& lClassID = itClassID->second;
66 hasSaleBeenSuccessful =
67 ioAIRINV_Master_Service.sell (lClassID, iPartySize);
70 const stdair::KeyList_T& lSegmentDateKeyList =
71 iTravelSolution.getSegmentPath();
72 const stdair::FareOptionStruct& lChosenFareOption =
73 iTravelSolution.getChosenFareOption ();
74 const stdair::ClassList_StringList_T& lClassPath =
75 lChosenFareOption.getClassPath();
76 stdair::ClassList_StringList_T::const_iterator itClassKeyList =
78 for (stdair::KeyList_T::const_iterator itKey= lSegmentDateKeyList.begin();
79 itKey != lSegmentDateKeyList.end(); ++itKey, ++itClassKeyList) {
80 const std::string& lSegmentDateKey = *itKey;
83 std::ostringstream ostr;
84 const stdair::ClassList_String_T& lClassList = *itClassKeyList;
85 assert (lClassList.size() > 0);
86 ostr << lClassList.at(0);
87 const stdair::ClassCode_T lClassCode (ostr.str());
89 hasSaleBeenSuccessful =
90 ioAIRINV_Master_Service.sell (lSegmentDateKey, lClassCode,
95 return hasSaleBeenSuccessful;
99 bool DistributionManager::
100 playCancellation (AIRINV::AIRINV_Master_Service& ioAIRINV_Master_Service,
101 const stdair::CancellationStruct& iCancellation) {
102 bool hasCancellationBeenSuccessful =
false;
104 const stdair::PartySize_T& lPartySize = iCancellation.getPartySize();
105 const stdair::BookingClassIDList_T& lClassIDList =
106 iCancellation.getClassIDList();
108 for (stdair::BookingClassIDList_T::const_iterator itClassID =
109 lClassIDList.begin(); itClassID != lClassIDList.end(); ++itClassID) {
110 const stdair::BookingClassID_T& lClassID = *itClassID;
112 hasCancellationBeenSuccessful =
113 ioAIRINV_Master_Service.cancel (lClassID, lPartySize);
115 return hasCancellationBeenSuccessful;