Do any of the conversion that has to be done for all message types.
Typically overidden to return correctly converted data.
@param trxMessage The raw internal trx message.
@return The new Internal message with additional/refined data.
333830
public Object get(String strKey)
    {
        if (this.getMessageFieldDesc(strKey) != null)
            return this.getMessageFieldDesc(strKey).get();
        return this.getNative(strKey);
    }
1333102
public TrxMessageHeader createReplyHeader()
    {
        Map<String,Object> mapInHeader = this.getMessageHeaderMap();
        Map<String,Object> mapInInfo = this.getMessageInfoMap();
        Map<String,Object> mapReplyHeader = new HashMap<String,Object>();
        Map<String,Object> mapReplyInfo = new HashMap<String,Object>();
        this.moveMapInfo(mapReplyHeader, mapInHeader, TrxMessageHeader.DESTINATION_PARAM, TrxMessageHeader.SOURCE_PARAM);
        this.moveMapInfo(mapReplyHeader, mapInHeader, TrxMessageHeader.SOURCE_PARAM, TrxMessageHeader.DESTINATION_PARAM);

        this.moveMapInfo(mapReplyHeader, mapInHeader, TrxMessageHeader.ORIG_LOG_TRX_ID, TrxMessageHeader.LOG_TRX_ID);
        
        this.moveMapInfo(mapReplyHeader, mapInHeader, TrxMessageHeader.REGISTRY_ID, TrxMessageHeader.REGISTRY_ID);

        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.MESSAGE_CODE, TrxMessageHeader.MESSAGE_RESPONSE_ID);
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.MESSAGE_CODE, TrxMessageHeader.MESSAGE_RESPONSE_CODE);
        this.moveMapInfo(mapReplyInfo, mapInHeader, TrxMessageHeader.MESSAGE_CODE, TrxMessageHeader.MESSAGE_RESPONSE_CODE);
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.EXTERNAL_MESSAGE_CLASS, TrxMessageHeader.MESSAGE_RESPONSE_CLASS);
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.MESSAGE_MARSHALLER_CLASS, TrxMessageHeader.MESSAGE_RESPONSE_MARSHALLER_CLASS);
        
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.MESSAGE_VERSION, TrxMessageHeader.MESSAGE_VERSION);
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.MESSAGE_VERSION_ID, TrxMessageHeader.MESSAGE_VERSION_ID);
        this.moveMapInfo(mapReplyInfo, mapInInfo, TrxMessageHeader.SCHEMA_LOCATION, TrxMessageHeader.SCHEMA_LOCATION);

        TrxMessageHeader trxMessageHeader = new TrxMessageHeader(null, mapReplyHeader);
        trxMessageHeader.setMessageInfoMap(mapReplyInfo);
        return trxMessageHeader;
    }
989205
public void doWithMessage(WebServiceMessage requestMessage) throws IOException, TransformerException {
        endpointConfiguration.getMessageConverter().convertOutbound(requestMessage, message, endpointConfiguration, context);
    }
601487
public BaseMessage convertToThinMessage()
    {
        int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType();
        // See if this record is currently displayed or buffered, if so, refresh and display.

        Object data = this.getData();
        BaseMessage messageTableUpdate = null;
        // NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession
//        if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)
        {
            BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this);
            messageTableUpdate = new MapMessage(messageHeader, data);
            messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType));
        }
        return messageTableUpdate;
    }
1198513
public List<ConversionMessage> getMessages( ConversionMessageType messageType ) {
        List<ConversionMessage> messages = new ArrayList<ConversionMessage>();
        for ( ConversionMessage message : this.messages ) {
            if ( message.getMessageType() == messageType ) {
                messages.add( message );
            }
        }
        return messages;
    }
502772
public BaseMessage getMessage()
    {
        String strTrxID = this.getProperty(TrxMessageHeader.LOG_TRX_ID);
        if (m_strTrxID != null)
            if (m_strTrxID.equalsIgnoreCase(strTrxID))
                return m_message;   // Cached message is what you are looking for.
        m_strTrxID = null;
        m_message = null;
        if (strTrxID != null)
        {   // Good, they are referencing a transaction (access the transaction properties).
            MessageLogModel recMessageLog = (MessageLogModel)this.getRecord(MessageLogModel.MESSAGE_LOG_FILE);
            if (recMessageLog == null)
                recMessageLog = (MessageLogModel)Record.makeRecordFromClassName(MessageLogModel.THICK_CLASS, this);
            if (recMessageLog != null)
                m_message = (BaseMessage)recMessageLog.createMessage(strTrxID);
        }
        return m_message;
    }
1052781
public JsJmsTextMessage createJmsTextMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsTextMessage");
    JsJmsTextMessage msg = null;
    try {
      msg = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsTextMessage");
    return msg;
  }
488842
public final SubscriptionMessage makeInboundSubscriptionMessage() throws IncorrectMessageTypeException {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "makeInboundSubscriptionMessage");

    SubscriptionMessage subMessage = null;

    /* If the message has never been flattened/encoded, it will already be  */
    /* a SubscriptionMessage so we can just proceed with this recast.       */
    /* Otherwise we will need to convert it into a SubscriptionMessage.     */
    if (this instanceof SubscriptionMessageImpl) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Incoming message is already a SubscriptionMessage");
      subMessage = (SubscriptionMessageImpl)this;
    }
    /* The incoming message should be a SUBSCRIPTION message.                 */
    else if (getJsMessageType() == MessageType.SUBSCRIPTION) {
      // Ensure pending changes are flushed to JMF before passing the JMO around
      updateDataFields(MfpConstants.UDF_MAKE_INBOUND_OTHER);
      subMessage = new SubscriptionMessageImpl(jmo);
    }
    /* If the incoming message is some other sort of message it is an error.  */
    else {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Not a SUBSCRIPTION Message");
      String exString = nls.getFormattedMessage("UNEXPECTED_MESSAGE_TYPE_CWSIF0102"
                                               ,new Object[] {getJsMessageType(), MessageType.SUBSCRIPTION}
                                               ,"The Message is not a SUBSCRIPTION Message");
      throw new IncorrectMessageTypeException(exString);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "makeInboundSubscriptionMessage");
    return subMessage;
  }
919252
public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader, MessageDetailTarget recMessageDetailTarget, MessageProcessInfo recMessageProcessInfo, MessageTransport recMessageTransport)
    {
        try {
            if (trxMessageHeader == null)
                trxMessageHeader = new TrxMessageHeader(null, null);
            ContactType recContactType = (ContactType)((ReferenceField)this.getField(MessageDetail.CONTACT_TYPE_ID)).getReferenceRecord(null);
            recContactType = (ContactType)recContactType.getContactType((Record)recMessageDetailTarget);
            if (recContactType == null)
                return trxMessageHeader;    // Just being careful
        
            this.setKeyArea(MessageDetail.CONTACT_TYPE_ID_KEY);
            this.getField(MessageDetail.CONTACT_TYPE_ID).moveFieldToThis((BaseField)recContactType.getCounterField());
            this.getField(MessageDetail.PERSON_ID).moveFieldToThis((BaseField)((Record)recMessageDetailTarget).getCounterField());
            this.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField());
            this.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField());
            if (this.seek(null))
            {
                Map<String,Object> propHeader = ((PropertiesField)this.getField(MessageDetail.PROPERTIES)).loadProperties();
                if (propHeader == null)
                    propHeader = new HashMap<String,Object>(); // Never return null.
                Map<String,Object> map = trxMessageHeader.getMessageHeaderMap();
                if (map != null)
                    map.putAll(propHeader);
                else
                    map = propHeader;
                trxMessageHeader.setMessageHeaderMap(map);
                if ((recMessageTransport != null)
                    && ((recMessageTransport.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageTransport.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
                {
                    trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
                }
            }
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        // No need to free the two files as they are linked to the fields in this record
        
        return trxMessageHeader;
    }
1047264
private StringBuilder appendMessage(StringBuilder toAppendTo) {
        if (isValid()) {
            return toAppendTo.append("[valid]");
        }
        return toAppendTo.append(messages);
    }
150324
public String logMessage(String strTrxID, BaseMessage trxMessage, String strMessageInfoType, String strMessageProcessType, String strMessageStatus, String strContactType, String strPerson, String strMessageDescription, int iUserID, int iMessageReferenceID, Message message, String strDest)
    {
        Utility.getLogger().info("Sending message to URL: " + strDest);
        String strMessageFrom = null;
        String strMessageTo = null;
        String strContentType = null;
        String strContent = null;
        if (message != null)
        {
            try {
                Object objContent = message.getContent();
                strContentType = message.getContentType();
                Address[] rgstrMessageFrom = message.getFrom();
                if (rgstrMessageFrom != null) if (rgstrMessageFrom.length > 0)
                    strMessageFrom = rgstrMessageFrom[0].toString();
                Address[] rgstrMessageTo = message.getAllRecipients();
                if (rgstrMessageTo != null) if (rgstrMessageTo.length > 0)
                    strMessageTo = rgstrMessageTo[0].toString();
                if ((strMessageDescription == null) || (strMessageDescription.length() == 0))
                    strMessageDescription = message.getSubject();
                strContent = objContent.toString();
            } catch (IOException ex)    {
                ex.printStackTrace();
            } catch (MessagingException ex)    {
                ex.printStackTrace();
            }
        }
        // Be sure to call super!
        return super.logMessage(strTrxID, trxMessage, strMessageInfoType, strMessageProcessType, strMessageStatus, strMessageDescription, strContentType);
    }
440906
public BaseMessage processMessage(BaseMessage internalMessage)
    {
        if (internalMessage.getMessageDataDesc(null) == null)
            internalMessage.addMessageDataDesc(new RunRemoteProcessMessageData(null, null));
        
        RunRemoteProcessMessageData runRemoteProcessMessageData = (RunRemoteProcessMessageData)internalMessage.getMessageDataDesc(null);
        String processClassName = (String)runRemoteProcessMessageData.get(RunRemoteProcessMessageData.PROCESS_CLASS_NAME);
        if (processClassName == null)
        	return null;
        
        BaseProcess process = null;
        Task task = this.getTask();
        Map<String,Object> properties = new HashMap<String,Object>();
        MapMessage.convertDOMtoMap(internalMessage.getDOM(), properties, true);
        process = (BaseProcess)ClassServiceUtility.getClassService().makeObjectFromClassName(processClassName);
        if (process == null)
        	return null;
        process.init(task, null, properties);
        
        BaseMessage messageReply = null;
        if (process instanceof BaseMessageProcess)
        	messageReply = ((BaseMessageProcess)process).processMessage(internalMessage);
        else
        	process.run();
      
        return messageReply;
    }
793514
public String getMessageVersion(BaseMessage externalTrxMessage)
    {
        if (externalTrxMessage.getMessageHeader() == null)
            return null;
        return (String)externalTrxMessage.getMessageHeader().get(MessageVersionModel.VERSION);
    }
316364
@Override
	protected int replaceMessage(int handle, AbstractMessage message) throws JMSException
    {
    	return ((InMemoryLinkedDataStore)dataStore).replace(handle,message);
    }
8495
@Override
	public String getFormattedMessage() {
		String result = localizedMessage==null ? rawMessage : localizedMessage;
		if (parameters != null) {
			try {
				return MessageFormat.format(result, parameters);
			} catch (IllegalArgumentException iae) {
				// In case of problem with positional parameters fall through and
				// return unformatted string.
			}
		}
		return result;
	}
73285
public static StringMessage decode(ByteArray encodedMessage) {
		if(encodedMessage.size == 0) return EMPTY_STRING_MESSAGE;

		return new StringMessage(new String(encodedMessage.array, 0, encodedMessage.size, CHARSET));
	}
284106
public BaseMessage getOriginalMessage(BaseMessage messageResponseIn)
    {
        BaseMessage messageOrig = null;
        TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageResponseIn.getMessageHeader();
        String strOrigTrxID = (String)trxMessageHeader.get(TrxMessageHeader.ORIG_LOG_TRX_ID);
        MessageLogModel recMessageLog = this.getMessageLog(strOrigTrxID);
        if ((recMessageLog != null)
            && ((recMessageLog.getEditMode() == DBConstants.EDIT_CURRENT)
                || (recMessageLog.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
        {
            messageOrig = (BaseMessage)recMessageLog.createMessage(strOrigTrxID);
        }
        return messageOrig;
    }