7 #include <boost/make_shared.hpp>
9 #include <stdair/basic/BasChronometer.hpp>
10 #include <stdair/basic/BasFileMgr.hpp>
11 #include <stdair/bom/BomManager.hpp>
12 #include <stdair/bom/BookingRequestStruct.hpp>
13 #include <stdair/factory/FacBomManager.hpp>
14 #include <stdair/service/Logger.hpp>
15 #include <stdair/STDAIR_Service.hpp>
25 TRAVELCCM_Service::TRAVELCCM_Service() : _travelccmServiceContext (NULL) {
30 TRAVELCCM_Service::TRAVELCCM_Service (
const TRAVELCCM_Service& iService)
31 : _travelccmServiceContext (NULL) {
36 TRAVELCCM_Service::TRAVELCCM_Service (
const stdair::BasLogParams& iLogParams,
37 const stdair::BasDBParams& iDBParams)
38 : _travelccmServiceContext (NULL) {
41 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
42 initStdAirService (iLogParams, iDBParams);
49 const bool ownStdairService =
true;
50 addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
53 initTravelCCMService();
57 TRAVELCCM_Service::TRAVELCCM_Service (
const stdair::BasLogParams& iLogParams)
58 : _travelccmServiceContext (NULL) {
61 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
62 initStdAirService (iLogParams);
69 const bool ownStdairService =
true;
70 addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
73 initTravelCCMService();
78 TRAVELCCM_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr)
79 : _travelccmServiceContext (NULL) {
86 const bool doesNotOwnStdairService =
false;
87 addStdAirService (ioSTDAIR_Service_ptr, doesNotOwnStdairService);
90 initTravelCCMService();
100 void TRAVELCCM_Service::finalise() {
101 assert (_travelccmServiceContext != NULL);
103 _travelccmServiceContext->reset();
107 void TRAVELCCM_Service::initServiceContext() {
109 TRAVELCCM_ServiceContext& lTRAVELCCM_ServiceContext =
111 _travelccmServiceContext = &lTRAVELCCM_ServiceContext;
115 void TRAVELCCM_Service::
116 addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr,
117 const bool iOwnStdairService) {
119 assert (_travelccmServiceContext != NULL);
120 TRAVELCCM_ServiceContext& lTRAVELCCM_ServiceContext =
121 *_travelccmServiceContext;
124 lTRAVELCCM_ServiceContext.setSTDAIR_Service (ioSTDAIR_Service_ptr,
129 stdair::STDAIR_ServicePtr_T TRAVELCCM_Service::
130 initStdAirService (
const stdair::BasLogParams& iLogParams,
131 const stdair::BasDBParams& iDBParams) {
139 stdair::STDAIR_ServicePtr_T oSTDAIR_Service_ptr =
140 boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams);
141 assert (oSTDAIR_Service_ptr != NULL);
143 return oSTDAIR_Service_ptr;
147 stdair::STDAIR_ServicePtr_T TRAVELCCM_Service::
148 initStdAirService (
const stdair::BasLogParams& iLogParams) {
156 stdair::STDAIR_ServicePtr_T oSTDAIR_Service_ptr =
157 boost::make_shared<stdair::STDAIR_Service> (iLogParams);
158 assert (oSTDAIR_Service_ptr != NULL);
160 return oSTDAIR_Service_ptr;
164 void TRAVELCCM_Service::initTravelCCMService() {
173 if (_travelccmServiceContext == NULL) {
174 throw stdair::NonInitialisedServiceException (
"The TravelCCM service has "
175 "not been initialised");
177 assert (_travelccmServiceContext != NULL);
182 *_travelccmServiceContext;
183 const bool doesOwnStdairService =
184 lTRAVELCCM_ServiceContext.getOwnStdairServiceFlag();
187 stdair::STDAIR_Service& lSTDAIR_Service =
188 lTRAVELCCM_ServiceContext.getSTDAIR_Service();
194 if (doesOwnStdairService ==
true) {
196 lSTDAIR_Service.buildSampleBom();
220 if (_travelccmServiceContext == NULL) {
221 throw stdair::NonInitialisedServiceException (
"The Travelccm service has "
222 "not been initialised");
224 assert (_travelccmServiceContext != NULL);
227 *_travelccmServiceContext;
230 stdair::STDAIR_Service& lSTDAIR_Service =
231 lTRAVELCCM_ServiceContext.getSTDAIR_Service();
234 lSTDAIR_Service.buildSampleTravelSolutions (ioTSList);
242 if (_travelccmServiceContext == NULL) {
243 throw stdair::NonInitialisedServiceException (
"The Travelccm service has "
244 "not been initialised");
246 assert (_travelccmServiceContext != NULL);
249 *_travelccmServiceContext;
252 stdair::STDAIR_Service& lSTDAIR_Service =
253 lTRAVELCCM_ServiceContext.getSTDAIR_Service();
256 return lSTDAIR_Service.buildSampleBookingRequest (isForCRS);
263 if (_travelccmServiceContext == NULL) {
264 throw stdair::NonInitialisedServiceException (
"The TravelccmMaster service"
265 " has not been initialised");
267 assert (_travelccmServiceContext != NULL);
270 *_travelccmServiceContext;
273 stdair::STDAIR_Service& lSTDAIR_Service =
274 lTRAVELCCM_ServiceContext.getSTDAIR_Service();
277 return lSTDAIR_Service.csvDisplay();
282 csvDisplay (
const stdair::TravelSolutionList_T& iTravelSolutionList)
const {
284 if (_travelccmServiceContext == NULL) {
285 throw stdair::NonInitialisedServiceException (
"The TravelccmMaster service"
286 " has not been initialised");
288 assert (_travelccmServiceContext != NULL);
291 *_travelccmServiceContext;
294 stdair::STDAIR_Service& lSTDAIR_Service =
295 lTRAVELCCM_ServiceContext.getSTDAIR_Service();
298 return lSTDAIR_Service.csvDisplay (iTravelSolutionList);
304 const stdair::BookingRequestStruct& iBookingRequest) {
306 const stdair::TravelSolutionStruct* oTravelSolution_ptr =
309 return oTravelSolution_ptr;