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
34 #if BOOST_VERSION >= 104100
35 namespace bpt = boost::property_tree;
36 #else // BOOST_VERSION >= 104100
40 #endif // BOOST_VERSION >= 104100
56 : _stdairServiceContext (NULL) {
62 : _stdairServiceContext (NULL) {
77 : _stdairServiceContext (NULL) {
99 void STDAIR_Service::initServiceContext() {
105 _stdairServiceContext = &lSTDAIR_ServiceContext;
109 void STDAIR_Service::logInit (
const BasLogParams& iLogParams) {
110 Logger::init (iLogParams);
114 void STDAIR_Service::dbInit (
const BasDBParams& iDBParams) {
115 DBSessionManager::init (iDBParams);
118 assert (_stdairServiceContext != NULL);
119 STDAIR_ServiceContext& lSTDAIR_ServiceContext = *_stdairServiceContext;
120 lSTDAIR_ServiceContext.setDBParams (iDBParams);
124 void STDAIR_Service::init() {
130 assert (_stdairServiceContext != NULL);
132 *_stdairServiceContext;
134 return lSTDAIR_ServiceContext.getCloneBomRoot();
140 assert (_stdairServiceContext != NULL);
142 *_stdairServiceContext;
144 return lSTDAIR_ServiceContext.getPersistentBomRoot();
155 assert (_stdairServiceContext != NULL);
157 *_stdairServiceContext;
158 return lSTDAIR_ServiceContext.getDBParams();
165 assert (_stdairServiceContext != NULL);
167 *_stdairServiceContext;
168 return lSTDAIR_ServiceContext.getServiceInitialisationType();
174 assert (_stdairServiceContext != NULL);
176 *_stdairServiceContext;
179 BomRoot& lPersistentBomRoot = lSTDAIR_ServiceContext.getPersistentBomRoot();
189 assert (_stdairServiceContext != NULL);
191 *_stdairServiceContext;
194 BomRoot& lPersistentBomRoot = lSTDAIR_ServiceContext.getPersistentBomRoot();
198 CmdBomManager::buildCompleteDummyInventoryForFareFamilies (lPersistentBomRoot);
206 assert (_stdairServiceContext != NULL);
232 if (isForCRS ==
true) {
233 return CmdBomManager::buildSampleBookingRequestForCRS();
244 std::ostringstream oStr;
247 assert (_stdairServiceContext != NULL);
249 *_stdairServiceContext;
252 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
255 iAirlineCode, iFlightNumber);
265 std::ostringstream oStr;
268 assert (_stdairServiceContext != NULL);
270 *_stdairServiceContext;
273 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
282 if (lFlightDate_ptr != NULL) {
286 #if BOOST_VERSION >= 104100
292 std::ostringstream oNoFlightDateStream;
293 oNoFlightDateStream <<
"No flight-date found for the given key: '"
294 << iAirlineCode << iFlightNumber
295 <<
" - " << iDepartureDate <<
"'";
296 const std::string oNoFlightDateString (oNoFlightDateStream.str());
300 lPropertyTree.put (
"error", oNoFlightDateString.c_str());
303 write_json (oStr, lPropertyTree);
304 #endif // BOOST_VERSION >= 104100
314 std::ostringstream oStr;
319 switch (lEventType) {
345 assert (_stdairServiceContext != NULL);
347 *_stdairServiceContext;
351 lSTDAIR_ServiceContext.getConfigHolder();
362 assert (_stdairServiceContext != NULL);
364 *_stdairServiceContext;
368 lSTDAIR_ServiceContext.getConfigHolder();
378 assert (_stdairServiceContext != NULL);
380 *_stdairServiceContext;
384 lSTDAIR_ServiceContext.getConfigHolder();
392 const std::string& iPath) {
395 assert (_stdairServiceContext != NULL);
397 *_stdairServiceContext;
401 lSTDAIR_ServiceContext.getConfigHolder();
404 lConfigHolder.
addValue (iValue, iPath);
411 assert (_stdairServiceContext != NULL);
413 *_stdairServiceContext;
417 lSTDAIR_ServiceContext.getConfigHolder();
421 lSTDAIR_ServiceContext.getPersistentBomRoot();
430 std::ostringstream oStr;
433 assert (_stdairServiceContext != NULL);
437 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
447 std::ostringstream oStr;
450 assert (_stdairServiceContext != NULL);
454 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
466 std::ostringstream oStr;
469 assert (_stdairServiceContext != NULL);
473 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
481 return (lFlightDate_ptr != NULL);
488 std::ostringstream oStr;
491 assert (_stdairServiceContext != NULL);
495 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
504 return (lDatePeriodList.size() != 0);
511 assert (_stdairServiceContext != NULL);
513 *_stdairServiceContext;
517 lSTDAIR_ServiceContext.getConfigHolder();
528 assert (_stdairServiceContext != NULL);
530 *_stdairServiceContext;
533 const BomRoot& lPersistentBomRoot =
534 lSTDAIR_ServiceContext.getPersistentBomRoot();
542 std::ostringstream oStr;
545 assert (_stdairServiceContext != NULL);
558 std::ostringstream oStr;
561 assert (_stdairServiceContext != NULL);
565 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
574 if (lFlightDate_ptr != NULL) {
578 oStr <<
" No flight-date found for the given key: '"
579 << iAirlineCode << iFlightNumber <<
" - " << iDepartureDate <<
"'";
590 std::ostringstream oStr;
601 std::ostringstream oStr;
604 assert (_stdairServiceContext != NULL);
608 const BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
618 if (lDatePeriodList.empty()) {
619 oStr <<
" No fare-rule found for the given key: '"
620 << iOrigin <<
"-" << iDestination <<
" - " << iDepartureDate <<
"'";
629 void STDAIR_Service::finalise() {
638 assert (_stdairServiceContext != NULL);
645 lSTDAIR_ServiceContext.initCloneBomRoot();
648 const BomRoot& lPersistentBomRoot =
649 lSTDAIR_ServiceContext.getPersistentBomRoot();
650 BomRoot& lCloneBomRoot = lSTDAIR_ServiceContext.getCloneBomRoot();
653 CmdCloneBomManager::cloneBomRoot (lPersistentBomRoot, lCloneBomRoot);