Skip to content

Commit

Permalink
Modify methods to support having in Siddhi app string
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuvindu committed Jun 7, 2023
1 parent fb74c5d commit ac7ede2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/SiddhiAppComposites/SiddhiApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import SiddhiAppComposites.Statement.From.IFromStatement;
import SiddhiAppComposites.Statement.GroupBy.GroupByStatement;
import SiddhiAppComposites.Statement.GroupBy.IGroupByStatement;
import SiddhiAppComposites.Statement.Having.HavingExpression;
import SiddhiAppComposites.Statement.Having.IHavingExpression;
import SiddhiAppComposites.Statement.Insert.IInsertStatement;
import SiddhiAppComposites.Statement.Insert.InsertStatement;
import SiddhiAppComposites.Statement.JoinStatement.IJoinStatement;
Expand Down Expand Up @@ -41,6 +43,7 @@ public class SiddhiApp {
private final IFromStatement joinStatement = new FromStatement(); // from statement

private final IFilterExpression filterExpression = new FilterExpression(); // filter statement
private final IHavingExpression havingExpression = new HavingExpression(); // filter statement
private final IInsertStatement insertStatement = new InsertStatement(); // insert into statement
private final App annotationApp; // Annotation @app
private final ISource annotationSource; // Annotation @source
Expand Down Expand Up @@ -102,6 +105,10 @@ public void addGroupByExpression(String column){
groupByStatement.addAttribute(column);
}

public void addHavingExpression(String symbol){
((HavingExpression) this.havingExpression).addSymbol(symbol);
}

public void setStreamNamePrefix(String inputOutputStreamNamePrefix) {
this.inputOutputStreamNamePrefix = inputOutputStreamNamePrefix;
}
Expand Down Expand Up @@ -225,6 +232,9 @@ public String getSiddhiAppStringRepresentation(){
groupByStatement.setColumnWithStreamMap(selectStatement.getAttributesListWithStreamName());
stringSiddhiApp.append(groupByStatement.getSiddhiAppCompositeAsString());
}
if (havingExpression.containsExpressions()) {
stringSiddhiApp.append(havingExpression.getSiddhiAppCompositeAsString());
}
stringSiddhiApp.append(insertStatement.getSiddhiAppCompositeAsString());
return stringSiddhiApp.toString();
}
Expand Down

0 comments on commit ac7ede2

Please sign in to comment.