@Override public StringBuilder visitPlan_annotation(@NotNull SiddhiQLParser.Plan_annotationContext ctx) { StringBuilder annotation = new StringBuilder(" { "); for (SiddhiQLParser.Annotation_elementContext elementContext : ctx.annotation_element()) { annotation.append(" \"plan_annoElement\":\"").append(elementContext.property_value().string_value().getText()).append("\" ,"); } annotation = new StringBuilder(annotation.substring(0, annotation.length() - 1)); annotation.append("}"); return annotation; }
@Override public StringBuilder visitDefinition_trigger(@NotNull SiddhiQLParser.Definition_triggerContext ctx) { StringBuilder triggerText = new StringBuilder(" { \"Trigger\": "); triggerText.append(" [{ \"triggerName\":\"").append(ctx.trigger_name().getText()).append("\","); if (ctx.time_value() != null) { triggerText.append(" \"triggerValue\":\"").append(ctx.time_value().getText()).append("\","); } else { triggerText.append(" \"triggerValue\":\"").append(ctx.string_value().getText()).append("\","); } String trigger_text = excapeCode(tokenStreamRewriter.getTokenStream().getText(ctx.getStart(), ctx.getStop())); triggerText.append(" \"triggerText\":\"").append(trigger_text).append("\","); triggerText = new StringBuilder(triggerText.substring(0, triggerText.length() - 1)); triggerText.append(" }]}"); return triggerText; }
@Override public StringBuilder visitPartition_with_stream(@NotNull SiddhiQLParser.Partition_with_streamContext ctx) { StringBuilder partitionWith = new StringBuilder(" \"PartitionWith\": [{ "); partitionWith.append(" \"Partition_Stream\":\"").append(ctx.stream_id().getText()).append("\", "); List<String> condition = new ArrayList<String>(); List<String> attribute = new ArrayList<String>(); if (ctx.condition_ranges() != null) { for (SiddhiQLParser.Condition_rangeContext context : ctx.condition_ranges().condition_range()) { condition.add("\"" + excapeCode(tokenStreamRewriter.getTokenStream().getText(context.expression().getStart(), context.expression().getStop())) + "\""); attribute.add("\"" + context.string_value().getText() + "\""); } partitionWith.append(" \"condition\":").append(condition).append(", "); partitionWith.append(" \"attribute\":").append(attribute).append(" "); } else if (ctx.attribute() != null) { condition.add("null"); attribute.add("\"" + ctx.attribute().getText() + "\""); partitionWith.append(" \"condition\":").append(condition).append(", "); partitionWith.append(" \"attribute\":").append(attribute).append(" "); } partitionWith = new StringBuilder(partitionWith.substring(0, partitionWith.length() - 1)); partitionWith.append(" }],"); return partitionWith; }