private void checkPollingMessageType(
      Exchange exchange, List<Message> messageList, TelemetryObject incomingMessage) {

    if (exchange.getIn().getHeader(JMSConstants.HEADER_POLLING) != null) {
      if (exchange
          .getIn()
          .getHeader(JMSConstants.HEADER_POLLING)
          .equals(JMSConstants.POLL_SET_COMMAND)) {

        if (incomingMessage
            .getParameter(JMSConstants.GS_DEVICE_END_MESSAGE)
            .getValue()
            .equals("0")) {
          createPollingMessage(exchange, messageList, incomingMessage);
        } else {
          PollStoreSetValues.getRequiredParameterValueDataStore().remove(incomingMessage.getName());
        }
      }
      if (exchange
          .getIn()
          .getHeader(JMSConstants.HEADER_POLLING)
          .equals(JMSConstants.POLL_GET_COMMAND)) {
        if (incomingMessage
            .getParameter(JMSConstants.GS_DEVICE_END_MESSAGE)
            .getValue()
            .equals("0")) {
          checkStatusUpdate(exchange, messageList, incomingMessage);
        } else {
          PollStoreSetValues.getRequiredParameterValueDataStore()
              .remove(commandsBidiMap.getKey(incomingMessage.getName()));
        }
      }
    }
  }
  private void checkStatusUpdate(
      Exchange exchange, List<Message> messageList, TelemetryObject incomingMessage) {
    // No reason to check polling, if nothing to poll
    if (PollStoreSetValues.getRequiredParameterValueDataStore().size() == 0) return;

    String dataStoreKey;
    if (commandsBidiMap.getKey(incomingMessage.getName()) == null) return;

    dataStoreKey = (String) commandsBidiMap.getKey(incomingMessage.getName());
    boolean statusUpdateParametersCorrect = true;
    /*
     * Int starts from 1 because first parameter is always name and doesnt
     * contain value.
     */
    for (int i = 1; i < incomingMessage.getParams().size() - 1; i++) {

      try {
        if (commandsThatReturnIntegrer.contains(incomingMessage.getName())) {
          statusUpdateParametersCorrect =
              checkIntegerParameterValue(
                  exchange,
                  messageList,
                  incomingMessage,
                  dataStoreKey,
                  statusUpdateParametersCorrect,
                  i);
        } else {
          statusUpdateParametersCorrect =
              checkBigDecimalParameterValue(
                  exchange,
                  messageList,
                  incomingMessage,
                  dataStoreKey,
                  statusUpdateParametersCorrect,
                  i);
        }
      } catch (NumberFormatException e) {
        statusUpdateParametersCorrect =
            checkStringParameterValue(
                exchange,
                messageList,
                incomingMessage,
                dataStoreKey,
                statusUpdateParametersCorrect,
                i);
      }
      if (statusUpdateParametersCorrect == false) {
        break;
      }
    }
    if (statusUpdateParametersCorrect == true) {
      PollStoreSetValues.getRequiredParameterValueDataStore().remove(dataStoreKey);
    }
  }
 private boolean checkStringParameterValue(
     Exchange exchange,
     List<Message> messageList,
     TelemetryObject incomingMessage,
     String dataStoreKey,
     boolean statusUpdateParametersCorrect,
     int i) {
   String currentParameterValue = incomingMessage.getParams().get(i).getValue().toString();
   String requiredParameterValue =
       PollStoreSetValues.getRequiredParameterValueDataStore()
           .get(dataStoreKey)
           .getParameter(incomingMessage.getParams().get(i).getName())
           .toString();
   if (!currentParameterValue.equals(requiredParameterValue)) {
     createPollingMessage(exchange, messageList, incomingMessage);
     statusUpdateParametersCorrect = false;
   }
   return statusUpdateParametersCorrect;
 }
 private boolean checkIntegerParameterValue(
     Exchange exchange,
     List<Message> messageList,
     TelemetryObject incomingMessage,
     String dataStoreKey,
     boolean statusUpdateParametersCorrect,
     int i) {
   int currentParameterValue =
       Integer.parseInt(incomingMessage.getParams().get(i).getValue().toString());
   double requiredParameterValue =
       Double.parseDouble(
           PollStoreSetValues.getRequiredParameterValueDataStore()
               .get(dataStoreKey)
               .getParameter(incomingMessage.getParams().get(i).getName())
               .toString());
   if (currentParameterValue != (int) requiredParameterValue) {
     createPollingMessage(exchange, messageList, incomingMessage);
     statusUpdateParametersCorrect = false;
   }
   return statusUpdateParametersCorrect;
 }
  private boolean checkBigDecimalParameterValue(
      Exchange exchange,
      List<Message> messageList,
      TelemetryObject incomingMessage,
      String dataStoreKey,
      boolean statusUpdateParametersCorrect,
      int i) {

    BigDecimal currentParameterValue =
        NumberUtils.createBigDecimal(incomingMessage.getParams().get(i).getValue().toString())
            .setScale(pollRoundScale, RoundingMode.HALF_UP);
    BigDecimal requiredParameterValue =
        NumberUtils.createBigDecimal(
                PollStoreSetValues.getRequiredParameterValueDataStore()
                    .get(dataStoreKey)
                    .getParameter(incomingMessage.getParams().get(i).getName())
                    .toString())
            .setScale(pollRoundScale, RoundingMode.HALF_UP);
    if ((currentParameterValue.compareTo(requiredParameterValue)) != 0) {
      createPollingMessage(exchange, messageList, incomingMessage);
      statusUpdateParametersCorrect = false;
    }
    return statusUpdateParametersCorrect;
  }