public List<StratioStreamingMessage> list() {
    List<StratioStreamingMessage> result = new ArrayList<>();
    for (StreamDefinition streamDefinition : siddhiManager.getStreamDefinitions()) {
      if (suitableToList(streamDefinition.getStreamId())) {
        StratioStreamingMessage message = new StratioStreamingMessage();
        for (Attribute attribute : streamDefinition.getAttributeList()) {
          message.addColumn(
              new ColumnNameTypeValue(
                  attribute.getName(), this.getStreamingType(attribute.getType()), null));
        }
        StreamStatusDTO streamStatus = streamStatusDao.get(streamDefinition.getStreamId());

        if (streamStatus != null) {
          Map<String, QueryDTO> attachedQueries = streamStatus.getAddedQueries();

          for (Map.Entry<String, QueryDTO> entry : attachedQueries.entrySet()) {
            message.addQuery(new StreamQuery(entry.getKey(), entry.getValue().getQueryRaw()));
          }
          message.setUserDefined(streamStatus.getUserDefined());
          message.setActiveActions(
              streamStatusDao.getEnabledActions(streamDefinition.getStreamId()));
        }

        message.setStreamName(streamDefinition.getStreamId());

        result.add(message);
      }
    }

    return result;
  }
 private List<ColumnNameTypeValue> castToColumnNameTypeValue(List<Attribute> attributeList) {
   List<ColumnNameTypeValue> result = new ArrayList<>();
   for (Attribute attribute : attributeList) {
     result.add(
         new ColumnNameTypeValue(
             attribute.getName(), getStreamingType(attribute.getType()), null));
   }
   return result;
 }
 private static void populateAttributes(
     org.wso2.siddhi.query.api.definition.StreamDefinition streamDefinition,
     List<Attribute> attributes,
     String prefix) {
   if (attributes != null) {
     for (Attribute attribute : attributes) {
       org.wso2.siddhi.query.api.definition.Attribute siddhiAttribute =
           EventProcessorUtil.convertToSiddhiAttribute(attribute, prefix);
       streamDefinition.attribute(siddhiAttribute.getName(), siddhiAttribute.getType());
     }
   }
 }
  @Override
  public void declareOutputFields(OutputFieldsDeclarer declarer) {
    if (siddhiManager == null) {
      init();
    }

    // Declaring output fileds for each exported stream ID
    for (String streamId : exportedStreamIds) {
      StreamDefinition streamDefinition = siddhiManager.getStreamDefinition(streamId);

      if (streamDefinition == null) {
        throw new RuntimeException("Cannot find exported stream - " + streamId);
      }
      List<String> list = new ArrayList<String>();

      for (Attribute attribute : streamDefinition.getAttributeList()) {
        list.add(attribute.getName());
      }
      Fields fields = new Fields(list);
      declarer.declareStream(streamId, fields);
      log.info("Declaring output field for stream -" + streamId);
    }
  }