7 #if BOOST_VERSION >= 104100
9 #include <boost/property_tree/ptree.hpp>
10 #include <boost/property_tree/json_parser.hpp>
11 #endif // BOOST_VERSION >= 104100
32 #if BOOST_VERSION >= 104100
33 namespace bpt = boost::property_tree;
34 #else // BOOST_VERSION >= 104100
38 #endif // BOOST_VERSION >= 104100
54 : _stdairServiceContext (NULL) {
60 : _stdairServiceContext (NULL) {
75 : _stdairServiceContext (NULL) {
97 void STDAIR_Service::initServiceContext() {
103 _stdairServiceContext = &lSTDAIR_ServiceContext;
107 void STDAIR_Service::logInit (
const BasLogParams& iLogParams) {
108 Logger::init (iLogParams);
112 void STDAIR_Service::dbInit (
const BasDBParams& iDBParams) {
113 DBSessionManager::init (iDBParams);
116 assert (_stdairServiceContext != NULL);
117 STDAIR_ServiceContext& lSTDAIR_ServiceContext = *_stdairServiceContext;
118 lSTDAIR_ServiceContext.setDBParams (iDBParams);
122 void STDAIR_Service::init() {
128 assert (_stdairServiceContext != NULL);
130 return lSTDAIR_ServiceContext.getBomRoot();
136 assert (_stdairServiceContext != NULL);
138 return lSTDAIR_ServiceContext.getEventQueue();
149 assert (_stdairServiceContext != NULL);
151 return lSTDAIR_ServiceContext.getDBParams();
158 assert (_stdairServiceContext != NULL);
160 return lSTDAIR_ServiceContext.getServiceInitialisationType();
166 assert (_stdairServiceContext != NULL);
170 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
180 assert (_stdairServiceContext != NULL);
184 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
209 if (isForCRS ==
true) {
210 return CmdBomManager::buildSampleBookingRequestForCRS();
221 std::ostringstream oStr;
224 assert (_stdairServiceContext != NULL);
228 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
233 iFlightNumber, iDepartureDate);
236 if (lFlightDate_ptr != NULL) {
240 #if BOOST_VERSION >= 104100
246 std::ostringstream oNoFlightDateStream;
247 oNoFlightDateStream <<
"No flight-date found for the given key: '"
248 << iAirlineCode << iFlightNumber
249 <<
" - " << iDepartureDate <<
"'";
250 const std::string oNoFlightDateString (oNoFlightDateStream.str());
254 lPropertyTree.put (
"error", oNoFlightDateString.c_str());
257 write_json (oStr, lPropertyTree);
258 #endif // BOOST_VERSION >= 104100
267 std::ostringstream oStr;
270 assert (_stdairServiceContext != NULL);
274 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
284 std::ostringstream oStr;
287 assert (_stdairServiceContext != NULL);
291 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
303 std::ostringstream oStr;
306 assert (_stdairServiceContext != NULL);
310 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
318 return (lFlightDate_ptr != NULL);
325 std::ostringstream oStr;
328 assert (_stdairServiceContext != NULL);
332 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
341 return (lDatePeriodList.size() != 0);
346 std::ostringstream oStr;
349 assert (_stdairServiceContext != NULL);
353 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
366 std::ostringstream oStr;
369 assert (_stdairServiceContext != NULL);
373 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
378 iFlightNumber, iDepartureDate);
381 if (lFlightDate_ptr != NULL) {
385 oStr <<
" No flight-date found for the given key: '"
386 << iAirlineCode << iFlightNumber <<
" - " << iDepartureDate <<
"'";
397 std::ostringstream oStr;
408 std::ostringstream oStr;
411 assert (_stdairServiceContext != NULL);
415 BomRoot& lBomRoot = lSTDAIR_ServiceContext.getBomRoot();
420 iDestination, iDepartureDate,
424 if (lDatePeriodList.empty()) {
425 oStr <<
" No fare-rule found for the given key: '"
426 << iOrigin <<
"-" << iDestination <<
" - " << iDepartureDate <<
"'";
435 void STDAIR_Service::finalise() {
445 assert (_stdairServiceContext != NULL);
449 const EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
452 const Count_T& oExpectedTotalNumberOfEventsToBeGenerated =
456 return oExpectedTotalNumberOfEventsToBeGenerated;
464 assert (_stdairServiceContext != NULL);
468 const EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
471 const Count_T& oExpectedTotalNumberOfEventsToBeGenerated =
475 return oExpectedTotalNumberOfEventsToBeGenerated;
483 assert (_stdairServiceContext != NULL);
487 const EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
490 const Count_T& oActualTotalNumberOfEventsToBeGenerated =
494 return oActualTotalNumberOfEventsToBeGenerated;
502 assert (_stdairServiceContext != NULL);
506 const EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
509 const Count_T& oActualTotalNumberOfEventsToBeGenerated =
513 return oActualTotalNumberOfEventsToBeGenerated;
520 assert (_stdairServiceContext != NULL);
524 EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
527 return lQueue.
popEvent (ioEventStruct);
534 assert (_stdairServiceContext != NULL);
538 const EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();
551 assert (_stdairServiceContext != NULL);
555 EventQueue& lQueue = lSTDAIR_ServiceContext.getEventQueue();