Gets messages from the Messages[].

@param f The factor's index.
@param msgs The input messages.
@param isNew Whether to get messages in .newMessage or .message.
@param isIn Whether to get incoming or outgoing messages.
@return The output messages.
164977
private VarTensor[] getMsgs(int f, VarTensor[] msgs, boolean isIn) {
        int numNbs = bg.numNbsT2(f);
        VarTensor[] arr = new VarTensor[numNbs];
        for (int nb=0; nb<numNbs; nb++) {
            int edge = isIn ? bg.opposingT2(f, nb) : bg.edgeT2(f, nb);
            arr[nb] = msgs[edge];
        }
        return arr;
    }
1092813
public GetServiceStatusResult withMessages(Message... values) {
        List<Message> list = getMessages();
        for (Message value : values) {
            list.add(value);
        }
        return this;
    }
615831
@SuppressWarnings("unchecked")
    public static List<PendingMessage> parseRange(List<?> xpendingOutput) {

        LettuceAssert.notNull(xpendingOutput, "XPENDING output must not be null");

        List<PendingMessage> result = new ArrayList<>();

        for (Object element : xpendingOutput) {

            LettuceAssert.isTrue(element instanceof List, "Output elements must be a List");

            List<Object> message = (List) element;

            String messageId = (String) message.get(0);
            String consumer = (String) message.get(1);
            Long msSinceLastDelivery = (Long) message.get(2);
            Long deliveryCount = (Long) message.get(3);

            result.add(new PendingMessage(messageId, consumer, msSinceLastDelivery, deliveryCount));
        }

        return result;
    }
321762
public Collection<ValidationMessage<Origin>> getMessages(String messageKey) {

		Collection<ValidationMessage<Origin>> result = new ArrayList<ValidationMessage<Origin>>();

		for (ValidationMessage<Origin> message : messages) {
			if (messageKey.equals(message.getMessageKey())) {
				result.add(message);
			}
		}
		return result;
	}
1174340
public synchronized SIMessageHandle[] getSIMessageHandles()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIMessageHandles");

      int arrayCount = getInt();              // BIT32 ArrayCount
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "arrayCount", arrayCount);

      SIMessageHandle[] msgHandles = new SIMessageHandle[arrayCount];

      JsMessageHandleFactory jsMsgHandleFactory = JsMessageHandleFactory.getInstance();

      // Get arrayCount SIMessageHandles
      for (int msgHandleIndex = 0; msgHandleIndex < msgHandles.length; ++msgHandleIndex)
      {
         long msgHandleValue = getLong();
         byte[] msgHandleUuid = get(8);

         msgHandles[msgHandleIndex] =
            jsMsgHandleFactory.createJsMessageHandle(new SIBUuid8(msgHandleUuid),
                                                     msgHandleValue);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIMessageHandles", msgHandles);
      return msgHandles;
   }
1012260
public static List<FlatMessage> messageConverter(Message message) {
        try {
            if (message == null) {
                return null;
            }

            List<FlatMessage> flatMessages = new ArrayList<>();
            List<CanalEntry.Entry> entrys = null;
            if (message.isRaw()) {
                List<ByteString> rawEntries = message.getRawEntries();
                entrys = new ArrayList<CanalEntry.Entry>(rawEntries.size());
                for (ByteString byteString : rawEntries) {
                    CanalEntry.Entry entry = CanalEntry.Entry.parseFrom(byteString);
                    entrys.add(entry);
                }
            } else {
                entrys = message.getEntries();
            }

            for (CanalEntry.Entry entry : entrys) {
                if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
                    || entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
                    continue;
                }

                CanalEntry.RowChange rowChange;
                try {
                    rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue());
                } catch (Exception e) {
                    throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:"
                                               + entry.toString(), e);
                }

                CanalEntry.EventType eventType = rowChange.getEventType();

                FlatMessage flatMessage = new FlatMessage(message.getId());
                flatMessages.add(flatMessage);
                flatMessage.setDatabase(entry.getHeader().getSchemaName());
                flatMessage.setTable(entry.getHeader().getTableName());
                flatMessage.setIsDdl(rowChange.getIsDdl());
                flatMessage.setType(eventType.toString());
                flatMessage.setEs(entry.getHeader().getExecuteTime());
                flatMessage.setTs(System.currentTimeMillis());
                flatMessage.setSql(rowChange.getSql());

                if (!rowChange.getIsDdl()) {
                    Map<String, Integer> sqlType = new LinkedHashMap<>();
                    Map<String, String> mysqlType = new LinkedHashMap<>();
                    List<Map<String, String>> data = new ArrayList<>();
                    List<Map<String, String>> old = new ArrayList<>();

                    Set<String> updateSet = new HashSet<>();
                    boolean hasInitPkNames = false;
                    for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) {
                        if (eventType != CanalEntry.EventType.INSERT && eventType != CanalEntry.EventType.UPDATE
                            && eventType != CanalEntry.EventType.DELETE) {
                            continue;
                        }

                        Map<String, String> row = new LinkedHashMap<>();
                        List<CanalEntry.Column> columns;

                        if (eventType == CanalEntry.EventType.DELETE) {
                            columns = rowData.getBeforeColumnsList();
                        } else {
                            columns = rowData.getAfterColumnsList();
                        }

                        for (CanalEntry.Column column : columns) {
                            if (!hasInitPkNames && column.getIsKey()) {
                                flatMessage.addPkName(column.getName());
                            }
                            sqlType.put(column.getName(), column.getSqlType());
                            mysqlType.put(column.getName(), column.getMysqlType());
                            if (column.getIsNull()) {
                                row.put(column.getName(), null);
                            } else {
                                row.put(column.getName(), column.getValue());
                            }
                            // 获取update为true的字段
                            if (column.getUpdated()) {
                                updateSet.add(column.getName());
                            }
                        }

                        hasInitPkNames = true;
                        if (!row.isEmpty()) {
                            data.add(row);
                        }

                        if (eventType == CanalEntry.EventType.UPDATE) {
                            Map<String, String> rowOld = new LinkedHashMap<>();
                            for (CanalEntry.Column column : rowData.getBeforeColumnsList()) {
                                if (updateSet.contains(column.getName())) {
                                    if (column.getIsNull()) {
                                        rowOld.put(column.getName(), null);
                                    } else {
                                        rowOld.put(column.getName(), column.getValue());
                                    }
                                }
                            }
                            // update操作将记录修改前的值
                            if (!rowOld.isEmpty()) {
                                old.add(rowOld);
                            }
                        }
                    }
                    if (!sqlType.isEmpty()) {
                        flatMessage.setSqlType(sqlType);
                    }
                    if (!mysqlType.isEmpty()) {
                        flatMessage.setMysqlType(mysqlType);
                    }
                    if (!data.isEmpty()) {
                        flatMessage.setData(data);
                    }
                    if (!old.isEmpty()) {
                        flatMessage.setOld(old);
                    }
                }
            }
            return flatMessages;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
1136556
public Collection<Message> messages(MessageFilter filter) {
        return get(Message.class, (filter != null) ? filter : new MessageFilter());
    }
879619
public Message receiveMessage()
    {
        DualMessageQueue baseMessageQueue = (DualMessageQueue)this.getMessageQueue();
        if (baseMessageQueue == null)
            return null;    // In free
        return baseMessageQueue.getMessageStack().receiveMessage();
    }
139974
public Iterator<String> getMessages() {
		Iterator<SmtpMessage> it = server.getReceivedEmail();

		List<String> msgs = new ArrayList<>();
		while(it.hasNext()) {
			SmtpMessage msg = it.next();
			msgs.add(msg.toString());
		}

		return msgs.iterator();
	}
1320782
public SIMPIterator getTransmitMessagesIterator(int maxMsgs)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getTransmitMessagesIterator");
    
    // TODO : Method needs to throw SIMPRuntimInvalid to admin
    
    SIMPIterator returnIterator = null;
 
    Iterator<TickRange> messagesOnStream =
      _sourceStream.getAllMessageItemsOnStream(true).iterator();
    
     //now build a collection of TransmitMessageControllable
    Collection<SIMPTransmitMessageControllable> transmitMessages = 
      new LinkedList<SIMPTransmitMessageControllable>();
    
    boolean allMsgs = 
      (maxMsgs == SIMPConstants.SIMPCONTROL_RETURN_ALL_MESSAGES); 
    
    int index = 0;
    while((allMsgs || (index < maxMsgs)) && messagesOnStream.hasNext())
    {
      try
      {
        TickRange tr = messagesOnStream.next();
        if(tr.value == null)
          transmitMessages.add(new LinkTransmitMessageControl(tr.itemStreamIndex, _sourceStream, _downControl));  
        else
          transmitMessages.add(new LinkTransmitMessageControl(((SIMPMessage)tr.value), _sourceStream));  
         
        index++;
      }
      catch (SIResourceException e)
      {
        // No FFDC code needed  
        SibTr.exception(tc, e);      
      }
    }
    returnIterator = 
      new TransmitMessageControllableIterator(transmitMessages.iterator());
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getTransmitMessagesIterator", returnIterator);      
    return returnIterator;
  }
103608
public List<IType> getMessageOrBuilderList() {
    if (externalMessageOrBuilderList == null) {
      externalMessageOrBuilderList = new MessageOrBuilderExternalList<MType, BType, IType>(this);
    }
    return externalMessageOrBuilderList;
  }
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;
   }
856564
function getElementsMessages(elements) {
    return elements
        .map(function (element) {
        var msg = {};
        if (element.attributes) {
            element.attributes.properties.forEach(function (attr) {
                if (!ts.isJsxAttribute(attr) || !attr.initializer) {
                    // Either JsxSpreadAttribute, or JsxAttribute without initializer.
                    return;
                }
                var key = attr.name.text;
                var init = attr.initializer;
                var text;
                if (ts.isStringLiteral(init)) {
                    text = init.text;
                }
                else if (ts.isJsxExpression(init)) {
                    if (init.expression &&
                        (ts.isStringLiteral(init.expression) ||
                            ts.isNoSubstitutionTemplateLiteral(init.expression))) {
                        text = init.expression.text;
                    }
                    else {
                        // Either the JsxExpression has no expression (?)
                        // or a non-StringLiteral expression.
                        return;
                    }
                }
                else {
                    // Should be a StringLiteral or JsxExpression, but it's not!
                    return;
                }
                copyIfMessageKey(msg, key, text);
            });
        }
        return isValidMessage(msg) ? msg : null;
    })
        .filter(notNull);
}
852628
private IntuitMessage getFirst(List<IntuitMessage> intuitMessages) throws FMSException {
        if(intuitMessages.isEmpty()) {
            throw new FMSException("IntuitMessages list is empty. Nothing to upload.");
        }
        return intuitMessages.get(0);
    }
846977
public Observable<ComapiResult<List<Conversation>>> getConversations(final boolean isPublic) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueGetConversationsExt(isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
        }
    }
1325492
public List<String> getMessages() {
        if (mMessages == null || mMessages.size() == 0) {
            mMessages = Collections.singletonList(super.getMessage());
        }
        return mMessages;
    }
1084785
public List<Message> getFilteredList( EMessageType messageType, Long fromTsMillis, Long toTsMillis, long limit )
            throws Exception {
        String tableName = TABLE_MESSAGES;
        String sql = "select " + getQueryFieldsString() + " from " + tableName;

        List<String> wheresList = new ArrayList<>();
        if (messageType != null && messageType != EMessageType.ALL) {
            String where = type_NAME + "=" + messageType.getCode();
            wheresList.add(where);
        }
        if (fromTsMillis != null) {
            String where = TimeStamp_NAME + ">" + fromTsMillis;
            wheresList.add(where);
        }
        if (toTsMillis != null) {
            String where = TimeStamp_NAME + "<" + toTsMillis;
            wheresList.add(where);
        }

        if (wheresList.size() > 0) {
            sql += " WHERE ";
            for( int i = 0; i < wheresList.size(); i++ ) {
                if (i > 0) {
                    sql += " AND ";
                }
                sql += wheresList.get(i);
            }
        }

        sql += " order by " + ID_NAME + " desc";
        if (limit > 0) {
            sql += " limit " + limit;
        }

        String _sql = sql;
        List<Message> messages = new ArrayList<Message>();
        logDb.execOnConnection(connection -> {
            try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql);) {
                while( rs.next() ) {
                    Message event = resultSetToItem(rs);
                    messages.add(event);
                }
            }
            return null;
        });
        return messages;
    }