/** * ChangeMessageBookingDetail Method. */ public int changeMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { String strDestination = null; // todo(don) Need to figure out where this message was sent to (what is my xyz [soap?] address?) // HACK: to make sure the local products were booked directly, otherwise I return a booking in progress to the remote client //x recBookingDetail.addListener(new SetDirectTransportHandler(null)); return productRequest.handleGetRawRecordData(recBookingDetail); // Add the booking detail } /**
/** * Init Method. */ public void init(MessageDataParent messageDataParent, String strKey) { if (strKey == null) strKey = RUN_REMOTE_PROCESS; super.init(messageDataParent, strKey); } /**
productRequest.put(ProductRequest.PRODUCT_MESSAGE, null); // Don't need to add this detail if (productRequest != null) TourMessageData tourMessageData = (TourMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); if (tourMessageData != null) if (objDetailDate != null) if (objDetailDate.equals(recTour.getField(TourModel.DEPARTURE_DATE).getData())) productRequest.put(ProductRequest.PRODUCT_MESSAGE, null); // Don't need to add this detail
/** * Add any message properties that are set in this record. */ public void addMessageProperties(String strPrefix, boolean bDeleteProperties, MessageHeader messageHeader, Message message, String strNewPrefix) { Map<String,Object> properties = ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).getProperties(); if (properties != null) { Iterator<String> iterator = properties.keySet().iterator(); while (iterator.hasNext()) { String strKey = iterator.next(); if (strKey.startsWith(strPrefix)) { String value = (String)properties.get(strKey); if (bDeleteProperties) ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).setProperty(strKey, null); // Remove from record strKey = strKey.substring(strPrefix.length()); if (strNewPrefix != null) strKey = strNewPrefix + strKey; if (messageHeader instanceof TrxMessageHeader) // Always ((TrxMessageHeader)messageHeader).put(strKey, value); if (message instanceof BaseMessage) // Always if (((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE) != null) ((MessageRecordDesc)((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE)).put(strKey, value); } } } } /**
/** * Process this product information request (override this). */ public Message processInfoRequestInMessage(Message messageIn, Message messageReply) { MessageRecordDesc productRequest = (ProductRequest)((BaseMessage)messageIn).getMessageDataDesc(null); MessageRecordDesc messageData = (ProductMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); BaseProductResponse responseMessage = null; if (messageReply == null) messageReply = (BaseMessage)this.getMessageProcessInfo().createReplyMessage((BaseMessage)messageData.getMessage()); responseMessage = (BaseProductResponse)((BaseMessage)messageReply).getMessageDataDesc(null); responseMessage.moveRequestInfoToReply(messageIn); int iProductStatus = InventoryStatus.VALID; //?String strErrorMessage = null; //?this.getField(Product.DISPLAY_INFO_STATUS_ID).setValue(iProductStatus); responseMessage.setMessageDataStatus(iProductStatus); //?if (strErrorMessage != null) //? responseMessage.setMessageDataError(strErrorMessage); return messageReply; } /**
/** * ChangeMessageBookingDetail Method. */ public int changeMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { if (this.getField(TourHeader.TOUR_SERIES).getState() == true) { ProductMessageData productMessage = (ProductMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); Date date = (Date)productMessage.get(BookingDetailModel.DETAIL_DATE); if (date != null) { // Departure date change. TourClass recTourClass = (TourClass)((ReferenceField)this.getField(TourHeader.TOUR_CLASS_ID)).getReferenceRecord(this.findRecordOwner()); BaseField fldTourCode = this.getField(TourHeader.CODE); DateField fldDepartureDate = (DateField)recTour.getField(TourModel.DEPARTURE_DATE); BaseField fldTourDesc = this.getField(TourHeader.DESCRIPTION); FieldListener fieldBehavior = null; fieldBehavior = new ChangeTourHeaderHandler(this, recTourClass, (TourModel)recTour, (BookingModel)recBooking, fldTourCode, fldDepartureDate, null); fldDepartureDate.addListener(fieldBehavior); fldDepartureDate.setDateTime(date, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // +message.addPassengersToBooking(recBooking); // +message.addContactToBooking(recBooking); } return DBConstants.NORMAL_RETURN; // For tour headers, the detail is the header, so no detail must be changed } return super.changeMessageBookingDetail(recBookingDetail, recBooking, recTour, strMessageTransportID, productRequest); } /**
if ((messageReply.getMessageDataDesc(null) != null) && (messageReplyIn.getMessageDataDesc(null) != null)) ((MessageRecordDesc)messageReply.getMessageDataDesc(null)).moveRequestInfoToReply(messageReplyIn);
/** * CreateMessageData Method. */ public BaseMessageRecordDesc createMessageData() { MessageRecordDesc messageData = null; String strMessageDataClassName = this.getField(MessageLog.kMessageDataClassName).toString(); return MessageRecordDesc.createMessageRecordDesc(strMessageDataClassName, null, null); } /**
productRequest.put(ProductRequest.PRODUCT_MESSAGE, null); // Don't need to add this detail if (productRequest != null) TourMessageData tourMessageData = (TourMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); if (tourMessageData != null) if (objDetailDate != null) if (objDetailDate.equals(recTour.getField(TourModel.DEPARTURE_DATE).getData())) productRequest.put(ProductRequest.PRODUCT_MESSAGE, null); // Don't need to add this detail
/** * Add any message properties that are set in this record. */ public void addMessageProperties(String strPrefix, boolean bDeleteProperties, MessageHeader messageHeader, Message message, String strNewPrefix) { Map<String,Object> properties = ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).getProperties(); if (properties != null) { Iterator<String> iterator = properties.keySet().iterator(); while (iterator.hasNext()) { String strKey = iterator.next(); if (strKey.startsWith(strPrefix)) { String value = (String)properties.get(strKey); if (bDeleteProperties) ((PropertiesField)this.getField(BookingDetail.PROPERTIES)).setProperty(strKey, null); // Remove from record strKey = strKey.substring(strPrefix.length()); if (strNewPrefix != null) strKey = strNewPrefix + strKey; if (messageHeader instanceof TrxMessageHeader) // Always ((TrxMessageHeader)messageHeader).put(strKey, value); if (message instanceof BaseMessage) // Always if (((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE) != null) ((MessageRecordDesc)((BaseMessage)message).getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE)).put(strKey, value); } } } } /**
/** * Process this product information request (override this). */ public Message processInfoRequestInMessage(Message messageIn, Message messageReply) { MessageRecordDesc productRequest = (ProductRequest)((BaseMessage)messageIn).getMessageDataDesc(null); MessageRecordDesc messageData = (ProductMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); BaseProductResponse responseMessage = null; if (messageReply == null) messageReply = (BaseMessage)this.getMessageProcessInfo().createReplyMessage((BaseMessage)messageData.getMessage()); responseMessage = (BaseProductResponse)((BaseMessage)messageReply).getMessageDataDesc(null); responseMessage.moveRequestInfoToReply(messageIn); int iProductStatus = InventoryStatus.VALID; //?String strErrorMessage = null; //?this.getField(Product.DISPLAY_INFO_STATUS_ID).setValue(iProductStatus); responseMessage.setMessageDataStatus(iProductStatus); //?if (strErrorMessage != null) //? responseMessage.setMessageDataError(strErrorMessage); return messageReply; } /**
/** * ChangeMessageBookingDetail Method. */ public int changeMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { if (this.getField(TourHeader.TOUR_SERIES).getState() == true) { ProductMessageData productMessage = (ProductMessageData)productRequest.getMessageDataDesc(ProductRequest.PRODUCT_MESSAGE); Date date = (Date)productMessage.get(BookingDetailModel.DETAIL_DATE); if (date != null) { // Departure date change. TourClass recTourClass = (TourClass)((ReferenceField)this.getField(TourHeader.TOUR_CLASS_ID)).getReferenceRecord(this.findRecordOwner()); BaseField fldTourCode = this.getField(TourHeader.CODE); DateField fldDepartureDate = (DateField)recTour.getField(TourModel.DEPARTURE_DATE); BaseField fldTourDesc = this.getField(TourHeader.DESCRIPTION); FieldListener fieldBehavior = null; fieldBehavior = new ChangeTourHeaderHandler(this, recTourClass, (TourModel)recTour, (BookingModel)recBooking, fldTourCode, fldDepartureDate, null); fldDepartureDate.addListener(fieldBehavior); fldDepartureDate.setDateTime(date, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // +message.addPassengersToBooking(recBooking); // +message.addContactToBooking(recBooking); } return DBConstants.NORMAL_RETURN; // For tour headers, the detail is the header, so no detail must be changed } return super.changeMessageBookingDetail(recBookingDetail, recBooking, recTour, strMessageTransportID, productRequest); } /**
if (messageOut != null) if (messageReplyIn.getMessageDataDesc(null) instanceof MessageRecordDesc) // Always ((MessageRecordDesc)messageReplyIn.getMessageDataDesc(null)).moveRequestInfoToReply(messageOut); if ((iErrorCode != DBConstants.NORMAL_RETURN) || (messageReplyIn.getExternalMessage() == null)
/** * AddMapProperty Method. */ public void addMapProperty(MessageRecordDesc map, String strKey, Record record, String iFieldSeq) { if (record.getField(iFieldSeq).getData() != null) map.put(strKey, record.getField(iFieldSeq).getData()); }
/** * ChangeMessageBookingDetail Method. */ public int changeMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { String strDestination = null; // todo(don) Need to figure out where this message was sent to (what is my xyz [soap?] address?) // HACK: to make sure the local products were booked directly, otherwise I return a booking in progress to the remote client //x recBookingDetail.addListener(new SetDirectTransportHandler(null)); return productRequest.handleGetRawRecordData(recBookingDetail); // Add the booking detail } /**
/** * Init Method. */ public void init(MessageDataParent messageDataParent, String strKey) { if (strKey == null) strKey = STANDARD_MESSAGE_RESPONSE; super.init(messageDataParent, strKey); } /**
/** * AddMapProperty Method. */ public void addMapProperty(MessageRecordDesc map, String strKey, Record record, String iFieldSeq) { if (record.getField(iFieldSeq).getData() != null) map.put(strKey, record.getField(iFieldSeq).getData()); }
/** * Add the booking detail that goes with the product in this message. */ public int addMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { //+ String strDestination = null; // todo(don) Need to figure out where this message was sent to (what is my xyz [soap?] address?) // HACK: I only did direct transport while I was testing since this would cause an endless message loop //x recBookingDetail.addListener(new SetDirectTransportHandler(null)); return productRequest.handleGetRawRecordData(recBookingDetail); } /**
/** * Create the message that this record describes * (in the classname field) * @returns The message or null if error. */ public MessageRecordDesc createNewMessage(BaseMessage message, String strKey) { MessageRecordDesc messageData = null; String strClassName = this.getField(MessageInfo.kMessageClass).toString(); messageData = (MessageRecordDesc)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName); if (messageData != null) messageData.init(message, strKey); return messageData; }
/** * Add the booking detail that goes with the product in this message. */ public int addMessageBookingDetail(BookingDetailModel recBookingDetail, BookingModel recBooking, TourModel recTour, String strMessageTransportID, MessageRecordDesc productRequest) throws DBException { //+ String strDestination = null; // todo(don) Need to figure out where this message was sent to (what is my xyz [soap?] address?) // HACK: I only did direct transport while I was testing since this would cause an endless message loop //x recBookingDetail.addListener(new SetDirectTransportHandler(null)); return productRequest.handleGetRawRecordData(recBookingDetail); } /**