/* (non-Javadoc)
@see org.restcomm.connect.dao.SmsMessagesDao#getSmsMessageBySmppMessageId(java.lang.String)
507937
@Override
    public SmsMessage getSmsMessageBySmppMessageId(final String smppMessageId) {
        final SqlSession session = sessions.openSession();
        try {
            final Map<String, Object> result = session.selectOne(namespace + "getSmsMessageBySmppMessageId", smppMessageId);
            if (result != null) {
                return toSmsMessage(result);
            } else {
                return null;
            }
        } finally {
            session.close();
        }
    }
775273
public final MessageType getJsMessageType() {
        /* Get the int value and get the corresponding MessageType to return */
        Byte mType = (Byte) jmo.getField(JsHdrAccess.MESSAGETYPE);
        return MessageType.getMessageType(mType);
    }
1185483
public String getSystemMessageId() {
    //based on com.ibm.ws.sib.mfp.impl.JsHdrsImpl
    if (uuid != null) {
      StringBuilder buff = new StringBuilder(uuid.toString());
      buff.append(MfpConstants.MESSAGE_HANDLE_SEPARATOR);
      buff.append(value);
      return new String(buff);
    }
    else {
      return null;
    }
  }
34157
@Override
    public final byte[] getApiMessageIdAsBytes() {

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

        byte[] value = (byte[]) getApi().getField(JsApiAccess.MESSAGEID);
        if (value != null) {
            byte[] copy = new byte[value.length];
            System.arraycopy(value, 0, copy, 0, value.length);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getApiMessageIdAsBytes", copy);
            return copy;
        }
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getApiMessageIdAsBytes", null);
            return null;
        }
    }
423341
public StringBuffer getMessageKey(StringBuffer sb)
    {
        if (sb == null)
            sb = new StringBuffer();
        if (m_messageDataDescChildren != null)
        {
            for (String strKey : m_messageDataDescChildren.keySet())
            {
                MessageDataDesc messageDataDesc = m_messageDataDescChildren.get(strKey);
                messageDataDesc.getMessageKey(sb);
            }
        }
        return sb;
    }
770273
@Override
	protected AbstractMessage retrieveMessage(int handle) throws JMSException
    {
    	return (AbstractMessage)((InMemoryLinkedDataStore)dataStore).retrieve(handle);
    }
91078
public synchronized SIBusMessage getMessage(CommsConnection commsConnection)
      throws SIResourceException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessage");

      checkReleased();

      SIBusMessage mess = null;
      // Now build a JsMessage from the returned data. Note that a message length of -1 indicates
      // that no message has been returned and a null value should be returned to the caller.

      // Get length of JsMessage
      int messageLen = (int) getLong();
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message length", messageLen);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Remaining in buffer", receivedBuffer.remaining());

      if (messageLen > -1)
      {
         // Build Message from byte array. If the buffer is backed by an array we should simply
         // pass that into MFP rather than copying into a new byte[]
         try
         {
            if (receivedBuffer.hasArray())
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer has a backing array");

               mess = JsMessageFactory.getInstance().createInboundJsMessage(receivedBuffer.array(),
                                                                            receivedBuffer.position() + receivedBuffer.arrayOffset(),
                                                                            messageLen,
                                                                            commsConnection);

               // Move the position to the end of the message so that any data after the message
               // can be got
               receivedBuffer.position(receivedBuffer.position() + messageLen);
            }
            else
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Received buffer does NOT have a backing array");

               byte[] messageArray = get(messageLen);
               mess = JsMessageFactory.getInstance().createInboundJsMessage(messageArray,
                                                                            0,
                                                                            messageLen,
                                                                            commsConnection);
            }
         }
         catch (Exception e)
         {
            FFDCFilter.processException(e, CLASS_NAME + ".getMessage", CommsConstants.COMMSBYTEBUFFER_GETMESSAGE_01, this,
              new Object[] {"messageLen="+messageLen+", position="+receivedBuffer.position()+", limit="+receivedBuffer.limit() + " " +
                (receivedBuffer.hasArray()?"arrayOffset="+receivedBuffer.arrayOffset()+" array.length="+receivedBuffer.array().length:"no backing array")});

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            {
               SibTr.debug(this, tc, "Unable to create message", e);
               dump(this, tc, 100);
            }

            throw new SIResourceException(e);
         }
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessage", mess);
      return mess;
   }
904611
public AbstractMessage get( LocalSession localSession , 
				    			TransactionSet transactionSet , 
                                MessageSelector selector ) throws JMSException
    {
    	if (closed)
    		return null;
    	
    	this.lastActivity = System.currentTimeMillis();
    	
    	AbstractMessage msg = null;
    	
        // Search in volatile store first
        if (volatileStore != null)
        {
            msg = getFromStore(localSession, volatileStore, transactionSet, selector);
            
            // Then in persistent store
	        if (msg == null && persistentStore != null)
	        	msg = getFromStore(localSession, persistentStore, transactionSet, selector);
        }
        else
        if (persistentStore != null)
	        msg = getFromStore(localSession, persistentStore, transactionSet, selector);
        
        return msg;
    }
648035
public void setSQSMessageId(String sqsMessageID) throws JMSException {
        this.sqsMessageID = sqsMessageID;
        this.setJMSMessageID(String.format(SQSMessagingClientConstants.MESSAGE_ID_FORMAT, sqsMessageID));
    }
363299
final String getMESubUserId()
  {
	if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	{
	  SibTr.entry(tc, "getMESubUserId");
	  SibTr.exit(tc, "getMESubUserId", _meSubUserId);
	}

	return _meSubUserId;
  }
112021
public String getMessageAndLocation() {

        StringBuilder sbuffer = new StringBuilder();
        String       message = super.getMessage();

        if (null != message) {
            sbuffer.append(message);
        }

        if (null != locator) {
            String systemID = locator.getSystemId();
            int    line     = locator.getLineNumber();
            int    column   = locator.getColumnNumber();

            if (null != systemID) {
                sbuffer.append("; SystemID: ");
                sbuffer.append(systemID);
            }

            if (0 != line) {
                sbuffer.append("; Line#: ");
                sbuffer.append(line);
            }

            if (0 != column) {
                sbuffer.append("; Column#: ");
                sbuffer.append(column);
            }
        }

        return sbuffer.toString();
    }
521772
public SIMPMessage getMessageLocked() throws MessageStoreException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getMessageLocked");
    
    SIMPMessage msg = null;
    
    if(classifyingMessages)
    {
      // Take the classifications read lock
      consumerSet.takeClassificationReadLock();

      // Classifications may change dynamically, so check the pendingReset
      // flag under this lock. If classifications have changed then we'll
      // set up the filters again
      if(pendingFlowReset)
      {
        pendingFlowReset = false;
        resetFlowProperties();
      }
        
      // Determine which cursor to use. chooseGetCursorIndex() will 
      // randomly choose an index if XD has specified weightings.
      // The method can be called more than once. This supports the situation
      // where we've looked for but not found any messages of a particular 
      // classification. 
      // 
      // If chooseGetCursorIndex() returns 0, then either no classifications were 
      // specified or we've already tried all the classifications. An index
      // of 0 leads to the use of the default (unclassified) cursor.
      int classIndex = -1;
      while(classIndex != 0)
      {
        classIndex = chooseGetCursorIndex(classIndex);
     
        // Always use the cursor straight from the key
        msg = getMessageLocked(classIndex);

        if(msg != null)
          classIndex = 0;
      }

      // Free the classifications read lock
      consumerSet.freeClassificationReadLock();
    }
    else // Not classifying
    {
      // Use the zeroth index
      msg = getMessageLocked(0);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getMessageLocked", msg);

    return msg;
  }
11421
@Override
    public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
        return activity.getActivityContext().getMessageSource().getMessage(code, args, defaultMessage, locale);
    }
139015
public SIMPMQLinkTransmitMessageControllable getTransmitMessageByID( String id )
    throws SIMPInvalidRuntimeIDException,
           SIMPControllableNotFoundException,
           SIMPException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getTransmitMessageByID", id );
    SIMPMQLinkTransmitMessageControllable msgCon = (SIMPMQLinkTransmitMessageControllable)getQueuedMessageByID(id);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getTransmitMessageByID", msgCon);
    return msgCon;
  }
215416
public String getText() throws UnsupportedEncodingException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getText");
    String text = null;
    try {
      text = (String)getPayload().getField(JmsTextBodyAccess.BODY_DATA_VALUE);
    }
    catch (MFPUnsupportedEncodingRuntimeException e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsJmsTextMessageImpl.getText", "148");
      throw (UnsupportedEncodingException)e.getCause();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
      if ((text == null) || text.length() < 257) {
        SibTr.exit(this, tc, "getText", text);
      }
      else {
        SibTr.exit(this, tc, "getText", new Object[]{text.length(), text.substring(0,200)+"..."});
      }
    }
    return text;
  }
814557
@Override
    public String getMessage() {
        return new StringBuilder()
                .append("Request [").append(requestMethod.toString()).append("] ")
                .append("to URL: ").append(requestUri).append(" has failed with ")
                .append("Status code: ")
                .append(statusCode).append('\n')
                .append("Status message: ")
                .append(statusMessage).append('\n')
                .append("Content: '").append(content).append('\'')
                .toString();
    }
44860
protected String getSenderEmail(Message mailMessage) throws MessagingException
    {
        Address[] addresses=mailMessage.getFrom();
        String senderEmail=null;
        if((addresses!=null)&&(addresses.length>0))
        {
            //get sender mail address (only first from is used)
            Address address=addresses[0];
            
            //get as string
            senderEmail=address.toString();
        }

        return senderEmail;
    }