public class EPStatementObjectModel extends Object implements Serializable
Applications can create an object model by instantiating this class and then setting the various clauses.
When done, use EPAdministrator
to create a statement from the model.
Alternativly, a given textual EPL can be compiled into an object model representation via the compile method on
EPAdministrator
.
Use the toEPL method to generate a textual EPL from an object model.
Minimally, and EPL statement consists of the select-clause and the where-clause. These are represented by SelectClause
and FromClause
respectively.
Here is a short example that create a simple EPL statement such as "select page, responseTime from PageLoad" :
EPStatementObjectModel model = new EPStatementObjectModel(); model.setSelectClause(SelectClause.create("page", "responseTime")); model.setPropertyEvalSpec(FromClause.create(FilterStream.create("PageLoad")));
The select-clause and from-clause must be set for the statement object model to be useable by the administrative API. All other clauses a optional.
Please see the documentation set for further examples.
Constructor and Description |
---|
EPStatementObjectModel()
Ctor.
|
Modifier and Type | Method and Description |
---|---|
EPStatementObjectModel |
fromClause(FromClause fromClause)
Specify a from-clause.
|
List<AnnotationPart> |
getAnnotations()
Returns annotations.
|
String |
getContextName()
Returns the context name if context dimensions apply to statement.
|
CreateContextClause |
getCreateContext()
Returns the create-context clause.
|
CreateDataFlowClause |
getCreateDataFlow()
Returns the "create dataflow" part, if present.
|
CreateExpressionClause |
getCreateExpression()
Returns the create-expression clause, if any
|
CreateIndexClause |
getCreateIndex()
Returns create-index clause.
|
CreateSchemaClause |
getCreateSchema()
Returns the create-schema clause.
|
CreateTableClause |
getCreateTable()
Returns the create-table clause if present or null if not present
|
CreateVariableClause |
getCreateVariable()
Returns the create-variable clause if this is a statement creating a variable, or null if not.
|
CreateWindowClause |
getCreateWindow()
Returns the create-window clause for creating named windows, or null if this statement does not
create a named window.
|
List<ExpressionDeclaration> |
getExpressionDeclarations()
Returns the expression declarations, if any.
|
FireAndForgetClause |
getFireAndForgetClause()
Returns fire-and-forget (on-demand) query information for FAF select, insert, update and delete.
|
ForClause |
getForClause()
Returns the for-clause.
|
FromClause |
getFromClause()
Return the from-clause.
|
GroupByClause |
getGroupByClause()
Return the group-by-clause, or null to indicate that the clause is absent.
|
Expression |
getHavingClause()
Return the having-clause, or null to indicate that the clause is absent.
|
InsertIntoClause |
getInsertInto()
Return the insert-into-clause, or null to indicate that the clause is absent.
|
IntoTableClause |
getIntoTableClause()
Returns the into-table clause, or null if none found.
|
MatchRecognizeClause |
getMatchRecognizeClause()
Match-recognize clause.
|
OnClause |
getOnExpr()
Returns the on-delete clause for deleting from named windows, or null if this statement
does not delete from a named window
|
OrderByClause |
getOrderByClause()
Return the order-by-clause, or null to indicate that the clause is absent.
|
OutputLimitClause |
getOutputLimitClause()
Return the output-rate-limiting-clause, or null to indicate that the clause is absent.
|
RowLimitClause |
getRowLimitClause()
Returns the row limit specification, or null if none supplied.
|
List<ScriptExpression> |
getScriptExpressions()
Returns the scripts defined.
|
SelectClause |
getSelectClause()
Return the select-clause.
|
String |
getTreeObjectName()
Returns the internal expression id assigned for tools to identify the expression.
|
UpdateClause |
getUpdateClause()
Returns the update specification.
|
Expression |
getWhereClause()
Return the where-clause, or null to indicate that the clause is absent.
|
EPStatementObjectModel |
groupByClause(GroupByClause groupByClause)
Specify a group-by-clause.
|
EPStatementObjectModel |
havingClause(Expression havingClause)
Specify a having-clause.
|
EPStatementObjectModel |
insertInto(InsertIntoClause insertInto)
Specify an insert-into-clause.
|
EPStatementObjectModel |
orderByClause(OrderByClause orderByClause)
Specify an order-by-clause.
|
EPStatementObjectModel |
outputLimitClause(OutputLimitClause outputLimitClause)
Specify an output-rate-limiting-clause.
|
EPStatementObjectModel |
selectClause(SelectClause selectClause)
Specify a select-clause.
|
void |
setAnnotations(List<AnnotationPart> annotations)
Sets annotations.
|
void |
setContextName(String contextName)
Sets the context name if context dimensions apply to statement.
|
void |
setCreateContext(CreateContextClause createContext)
Sets the create-context clause.
|
void |
setCreateDataFlow(CreateDataFlowClause createDataFlow)
Sets the "create dataflow" part,.
|
void |
setCreateExpression(CreateExpressionClause createExpression)
Sets the create-expression clause, if any
|
void |
setCreateIndex(CreateIndexClause createIndex)
Sets create-index clause.
|
void |
setCreateSchema(CreateSchemaClause createSchema)
Sets the create-schema clause.
|
void |
setCreateTable(CreateTableClause createTable)
Sets the create-table clause if present or null if not present
|
void |
setCreateVariable(CreateVariableClause createVariable)
Sets the create-variable clause if this is a statement creating a variable, or null if not.
|
void |
setCreateWindow(CreateWindowClause createWindow)
Sets the create-window clause for creating named windows, or null if this statement does not
create a named window.
|
void |
setExpressionDeclarations(List<ExpressionDeclaration> expressionDeclarations)
Sets the expression declarations, if any.
|
void |
setFireAndForgetClause(FireAndForgetClause fireAndForgetClause)
Sets fire-and-forget (on-demand) query information for FAF select, insert, update and delete.
|
void |
setForClause(ForClause forClause)
Sets the for-clause.
|
void |
setFromClause(FromClause fromClause)
Specify a from-clause.
|
void |
setGroupByClause(GroupByClause groupByClause)
Specify a group-by-clause.
|
void |
setHavingClause(Expression havingClause)
Specify a having-clause.
|
void |
setInsertInto(InsertIntoClause insertInto)
Specify an insert-into-clause.
|
void |
setIntoTableClause(IntoTableClause intoTableClause)
Sets the into-table clause, or null if none found.
|
void |
setMatchRecognizeClause(MatchRecognizeClause clause)
Sets match-recognize clause.
|
void |
setOnExpr(OnClause onExpr)
Sets the on-delete or on-select clause for selecting or deleting from named windows, or null if this statement
does not on-select or on-delete from a named window
|
void |
setOrderByClause(OrderByClause orderByClause)
Specify an order-by-clause.
|
void |
setOutputLimitClause(OutputLimitClause outputLimitClause)
Specify an output-rate-limiting-clause.
|
void |
setRowLimitClause(RowLimitClause rowLimitClause)
Sets the row limit specification, or null if none applicable.
|
void |
setScriptExpressions(List<ScriptExpression> scriptExpressions)
Sets the scripts.
|
void |
setSelectClause(SelectClause selectClause)
Specify a select-clause.
|
void |
setTreeObjectName(String treeObjectName)
Sets an internal expression id assigned for tools to identify the expression.
|
void |
setUpdateClause(UpdateClause updateClause)
Sets the update specification.
|
void |
setWhereClause(Expression whereClause)
Specify a where-clause.
|
String |
toEPL()
Renders the object model in it's EPL syntax textual representation.
|
String |
toEPL(EPStatementFormatter formatter)
Rendering using the provided formatter.
|
void |
toEPL(EPStatementFormatter formatter,
StringWriter writer)
Renders the object model in it's EPL syntax textual representation, using a whitespace-formatter as provided.
|
void |
toEPL(StringWriter writer)
Rendering using the provided writer.
|
EPStatementObjectModel |
whereClause(Expression whereClause)
Specify a where-clause.
|
public void setInsertInto(InsertIntoClause insertInto)
insertInto
- specifies the insert-into-clause, or null to indicate that the clause is absentpublic EPStatementObjectModel insertInto(InsertIntoClause insertInto)
insertInto
- specifies the insert-into-clause, or null to indicate that the clause is absentpublic InsertIntoClause getInsertInto()
public void setSelectClause(SelectClause selectClause)
selectClause
- specifies the select-clause, the select-clause cannot be null and must be setpublic EPStatementObjectModel selectClause(SelectClause selectClause)
selectClause
- specifies the select-clause, the select-clause cannot be null and must be setpublic SelectClause getSelectClause()
public void setFromClause(FromClause fromClause)
fromClause
- specifies the from-clause, the from-clause cannot be null and must be setpublic EPStatementObjectModel fromClause(FromClause fromClause)
fromClause
- specifies the from-clause, the from-clause cannot be null and must be setpublic Expression getWhereClause()
public void setWhereClause(Expression whereClause)
whereClause
- specifies the where-clause, which is optional and can be nullpublic EPStatementObjectModel whereClause(Expression whereClause)
whereClause
- specifies the where-clause, which is optional and can be nullpublic FromClause getFromClause()
public GroupByClause getGroupByClause()
public void setGroupByClause(GroupByClause groupByClause)
groupByClause
- specifies the group-by-clause, which is optional and can be nullpublic EPStatementObjectModel groupByClause(GroupByClause groupByClause)
groupByClause
- specifies the group-by-clause, which is optional and can be nullpublic Expression getHavingClause()
public void setHavingClause(Expression havingClause)
havingClause
- specifies the having-clause, which is optional and can be nullpublic EPStatementObjectModel havingClause(Expression havingClause)
havingClause
- specifies the having-clause, which is optional and can be nullpublic OrderByClause getOrderByClause()
public void setOrderByClause(OrderByClause orderByClause)
orderByClause
- specifies the order-by-clause, which is optional and can be nullpublic EPStatementObjectModel orderByClause(OrderByClause orderByClause)
orderByClause
- specifies the order-by-clause, which is optional and can be nullpublic OutputLimitClause getOutputLimitClause()
public void setOutputLimitClause(OutputLimitClause outputLimitClause)
outputLimitClause
- specifies the output-rate-limiting-clause, which is optional and can be nullpublic EPStatementObjectModel outputLimitClause(OutputLimitClause outputLimitClause)
outputLimitClause
- specifies the output-rate-limiting-clause, which is optional and can be nullpublic String toEPL()
IllegalStateException
- if required clauses do not existpublic void toEPL(StringWriter writer)
writer
- to usepublic String toEPL(EPStatementFormatter formatter)
formatter
- to usepublic void toEPL(EPStatementFormatter formatter, StringWriter writer)
formatter
- the formatter to usewriter
- writer to useIllegalStateException
- if required clauses do not existpublic CreateWindowClause getCreateWindow()
public void setCreateWindow(CreateWindowClause createWindow)
createWindow
- is the named window creation clausepublic OnClause getOnExpr()
public void setOnExpr(OnClause onExpr)
onExpr
- is the on-expression (on-select and on-delete) clause to setpublic CreateVariableClause getCreateVariable()
public void setCreateVariable(CreateVariableClause createVariable)
createVariable
- create-variable clausepublic RowLimitClause getRowLimitClause()
public void setRowLimitClause(RowLimitClause rowLimitClause)
rowLimitClause
- row limit spec if anypublic UpdateClause getUpdateClause()
public void setUpdateClause(UpdateClause updateClause)
updateClause
- update spec if definedpublic List<AnnotationPart> getAnnotations()
public void setAnnotations(List<AnnotationPart> annotations)
annotations
- to setpublic MatchRecognizeClause getMatchRecognizeClause()
public void setMatchRecognizeClause(MatchRecognizeClause clause)
clause
- to setpublic CreateIndexClause getCreateIndex()
public void setCreateIndex(CreateIndexClause createIndex)
createIndex
- to setpublic CreateSchemaClause getCreateSchema()
public void setCreateSchema(CreateSchemaClause createSchema)
createSchema
- clause to setpublic CreateContextClause getCreateContext()
public void setCreateContext(CreateContextClause createContext)
createContext
- clause to setpublic ForClause getForClause()
public void setForClause(ForClause forClause)
forClause
- for-clausepublic List<ExpressionDeclaration> getExpressionDeclarations()
public void setExpressionDeclarations(List<ExpressionDeclaration> expressionDeclarations)
expressionDeclarations
- expression declarations to setpublic String getContextName()
public void setContextName(String contextName)
contextName
- context namepublic List<ScriptExpression> getScriptExpressions()
public void setScriptExpressions(List<ScriptExpression> scriptExpressions)
scriptExpressions
- to setpublic CreateDataFlowClause getCreateDataFlow()
public void setCreateDataFlow(CreateDataFlowClause createDataFlow)
createDataFlow
- create dataflow clausepublic String getTreeObjectName()
public void setTreeObjectName(String treeObjectName)
treeObjectName
- object namepublic CreateExpressionClause getCreateExpression()
public void setCreateExpression(CreateExpressionClause createExpression)
createExpression
- clausepublic FireAndForgetClause getFireAndForgetClause()
public void setFireAndForgetClause(FireAndForgetClause fireAndForgetClause)
fireAndForgetClause
- fire and forget query informationpublic IntoTableClause getIntoTableClause()
public void setIntoTableClause(IntoTableClause intoTableClause)
intoTableClause
- into-table clausepublic CreateTableClause getCreateTable()
public void setCreateTable(CreateTableClause createTable)
createTable
- create-table clause