本文整理汇总了Java中com.espertech.esper.client.soda.EPStatementObjectModel类的典型用法代码示例。如果您正苦于以下问题:Java EPStatementObjectModel类的具体用法?Java EPStatementObjectModel怎么用?Java EPStatementObjectModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EPStatementObjectModel类属于com.espertech.esper.client.soda包,在下文中一共展示了EPStatementObjectModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tryEnumeration
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void tryEnumeration(EPServiceProvider epService, String expression) {
String epl = expression + " select callIt().countOf(v => v<6) as val0 from SupportBean";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
assertEquals(Integer.class, stmt.getEventType().getPropertyType("val0"));
epService.getEPRuntime().sendEvent(new SupportBean());
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), "val0".split(","), new Object[]{2});
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
assertEquals(epl, model.toEPL());
EPStatement stmtTwo = epService.getEPAdministrator().create(model);
stmtTwo.addListener(listener);
assertEquals(epl, stmtTwo.getText());
epService.getEPRuntime().sendEvent(new SupportBean());
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), "val0".split(","), new Object[]{2});
stmtTwo.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecScriptExpression.java
示例2: run
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
String epl = "select " +
"theString, " +
"nth(intPrimitive,0) as int1, " + // current
"nth(intPrimitive,1) as int2 " + // one before
"from SupportBean#keepall group by theString output last every 3 events order by theString";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
runAssertion(epService, listener);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
assertEquals(epl, model.toEPL());
runAssertion(epService, listener);
tryInvalid(epService, "select nth() from SupportBean",
"Error starting statement: Failed to validate select-clause expression 'nth(*)': The nth aggregation function requires two parameters, an expression returning aggregation values and a numeric index constant [select nth() from SupportBean]");
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecAggregateNTh.java
示例3: runAssertionRateDataNonWindowed
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionRateDataNonWindowed(EPServiceProvider epService) {
sendTimer(epService, 0);
String epl = "select rate(10) as myrate from SupportBean";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
tryAssertion(epService, listener);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
assertEquals(epl, model.toEPL());
tryAssertion(epService, listener);
tryInvalid(epService, "select rate() from SupportBean",
"Error starting statement: Failed to validate select-clause expression 'rate(*)': The rate aggregation function minimally requires a numeric constant or expression as a parameter. [select rate() from SupportBean]");
tryInvalid(epService, "select rate(true) from SupportBean",
"Error starting statement: Failed to validate select-clause expression 'rate(true)': The rate aggregation function requires a numeric constant or time period as the first parameter in the constant-value notation [select rate(true) from SupportBean]");
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecAggregateRate.java
示例4: run
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
String epl = "select leaving() as val from SupportBean#length(3)";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
runAssertion(epService, listener);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
assertEquals(epl, model.toEPL());
runAssertion(epService, listener);
tryInvalid(epService, "select leaving(1) from SupportBean",
"Error starting statement: Failed to validate select-clause expression 'leaving(1)': The 'leaving' function expects no parameters");
}
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:ExecAggregateLeaving.java
示例5: validate
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void validate(EPServiceProvider epService, String selectClause, String groupByClause, String[] expectedCSV) {
String epl = PLAN_CALLBACK_HOOK + " select " + selectClause + ", count(*) from ABCProp group by " + groupByClause;
SupportGroupRollupPlanHook.reset();
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
comparePlan(expectedCSV);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
assertEquals(epl, model.toEPL());
SupportGroupRollupPlanHook.reset();
stmt = epService.getEPAdministrator().create(model);
comparePlan(expectedCSV);
assertEquals(epl, stmt.getText());
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:17,代码来源:ExecQuerytypeRollupPlanningAndSODA.java
示例6: runAssertionDocSampleCarEventAndGroupingFunc
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionDocSampleCarEventAndGroupingFunc(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType(CarEvent.class);
// try simple
String epl = "select name, place, sum(count), grouping(name), grouping(place), grouping_id(name,place) as gid " +
"from CarEvent group by grouping sets((name, place), name, place, ())";
SupportUpdateListener listener = new SupportUpdateListener();
epService.getEPAdministrator().createEPL(epl).addListener(listener);
tryAssertionDocSampleCarEvent(epService, listener);
epService.getEPAdministrator().destroyAllStatements();
// try audit
epService.getEPAdministrator().createEPL("@Audit " + epl).addListener(listener);
tryAssertionDocSampleCarEvent(epService, listener);
epService.getEPAdministrator().destroyAllStatements();
// try model
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
assertEquals(epl, model.toEPL());
EPStatement stmt = epService.getEPAdministrator().create(model);
assertEquals(epl, stmt.getText());
stmt.addListener(listener);
tryAssertionDocSampleCarEvent(epService, listener);
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:ExecQuerytypeRollupGroupingFuncs.java
示例7: tryAssertionTargetCurrentMatch
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void tryAssertionTargetCurrentMatch(EPServiceProvider epService, boolean testSoda, TargetEnum target) {
SupportUpdateListener listener = new SupportUpdateListener();
String[] fields = "a1.id,aarr[0].id,b.id".split(",");
String epl = "select * from pattern " + target.getText() + "[every a1=A -> [:10] aarr=A until b=B]";
if (testSoda) {
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
assertEquals(epl, model.toEPL());
epService.getEPAdministrator().create(model).addListener(listener);
} else {
epService.getEPAdministrator().createEPL(epl).addListener(listener);
}
sendAEvent(epService, "A1");
sendAEvent(epService, "A2");
sendBEvent(epService, "B1");
if (target == TargetEnum.SUPPRESS_ONLY || target == TargetEnum.DISCARD_AND_SUPPRESS) {
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A1", "A2", "B1"});
} else {
EPAssertionUtil.assertPropsPerRowAnyOrder(listener.getAndResetLastNewData(), fields,
new Object[][]{{"A1", "A2", "B1"}, {"A2", null, "B1"}});
}
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:ExecPatternConsumingPattern.java
示例8: runAssertionMixed
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionMixed(EPServiceProvider epService) {
SupportConditionHandlerFactory.SupportConditionHandler handler = SupportConditionHandlerFactory.getLastHandler();
String expression = "select a.id as a, b.id as b, c.id as c from pattern [" +
"every a=SupportBean_A -> b=SupportBean_B -[2]> c=SupportBean_C]";
EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
tryAssertionMixed(epService, stmt, handler);
// test SODA
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(expression);
assertEquals(expression, model.toEPL());
stmt = epService.getEPAdministrator().create(model);
assertEquals(stmt.getText(), model.toEPL());
tryAssertionMixed(epService, stmt, handler);
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:ExecPatternOperatorFollowedByMax.java
示例9: runAssertionSingleCategorySODAPrior
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionSingleCategorySODAPrior(EPServiceProvider epService) {
String ctx = "CategorizedContext";
String eplCtx = "@Name('context') create context " + ctx + " as " +
"group intPrimitive<10 as cat1 " +
"from SupportBean";
epService.getEPAdministrator().createEPL(eplCtx);
String eplStmt = "context CategorizedContext select context.name as c0, context.label as c1, prior(1,intPrimitive) as c2 from SupportBean";
EPStatementSPI statementOne = (EPStatementSPI) epService.getEPAdministrator().createEPL(eplStmt);
SupportUpdateListener listener = new SupportUpdateListener();
runAssertion(epService, listener, ctx, statementOne);
// test SODA
EPStatementObjectModel modelContext = epService.getEPAdministrator().compileEPL(eplCtx);
assertEquals(eplCtx, modelContext.toEPL());
EPStatement stmt = epService.getEPAdministrator().create(modelContext);
assertEquals(eplCtx, stmt.getText());
EPStatementObjectModel modelStmt = epService.getEPAdministrator().compileEPL(eplStmt);
assertEquals(eplStmt, modelStmt.toEPL());
EPStatementSPI statementTwo = (EPStatementSPI) epService.getEPAdministrator().create(modelStmt);
assertEquals(eplStmt, statementTwo.getText());
runAssertion(epService, listener, ctx, statementTwo);
}
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:ExecContextCategory.java
示例10: runEquivalent
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
protected static void runEquivalent(EPServiceProvider epService, String before, String after) throws Exception {
String epl = "select * from SupportBean#keepall " +
"match_recognize (" +
" measures A as a" +
" pattern (" + before + ")" +
" define" +
" A as A.theString like \"A%\"" +
")";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
EPStatementSPI spi = (EPStatementSPI) epService.getEPAdministrator().create(model);
StatementSpecCompiled spec = ((EPServiceProviderSPI) epService).getStatementLifecycleSvc().getStatementSpec(spi.getStatementId());
RowRegexExprNode expanded = RegexPatternExpandUtil.expand(spec.getMatchRecognizeSpec().getPattern());
StringWriter writer = new StringWriter();
expanded.toEPL(writer, RowRegexExprNodePrecedenceEnum.MINIMUM);
assertEquals(after, writer.toString());
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecRowRecogRepetition.java
示例11: runAssertionInherit
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionInherit(EPServiceProvider epService) throws Exception {
epService.getEPAdministrator().createEPL("create schema MyParentType as (col1 int, col2 string)");
EPStatement stmtChild = epService.getEPAdministrator().createEPL("create schema MyChildTypeOne (col3 int) inherits MyParentType");
assertEquals(Integer.class, stmtChild.getEventType().getPropertyType("col1"));
assertEquals(String.class, stmtChild.getEventType().getPropertyType("col2"));
assertEquals(Integer.class, stmtChild.getEventType().getPropertyType("col3"));
epService.getEPAdministrator().createEPL("create schema MyChildTypeTwo as (col4 boolean)");
String createText = "create schema MyChildChildType as (col5 short, col6 long) inherits MyChildTypeOne, MyChildTypeTwo";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(createText);
assertEquals(createText, model.toEPL());
EPStatement stmtChildChild = epService.getEPAdministrator().create(model);
assertEquals(Boolean.class, stmtChildChild.getEventType().getPropertyType("col4"));
assertEquals(Integer.class, stmtChildChild.getEventType().getPropertyType("col3"));
assertEquals(Short.class, stmtChildChild.getEventType().getPropertyType("col5"));
EPStatement stmtChildChildTwo = epService.getEPAdministrator().createEPL("create schema MyChildChildTypeTwo () inherits MyChildTypeOne, MyChildTypeTwo");
assertEquals(Boolean.class, stmtChildChildTwo.getEventType().getPropertyType("col4"));
assertEquals(Integer.class, stmtChildChildTwo.getEventType().getPropertyType("col3"));
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:ExecEPLSchema.java
示例12: parseRawStreams
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
public Collection<RawStream> parseRawStreams() throws Exception{
TreeMap<String,RawStream> rsMap=new TreeMap<String,RawStream>();
EPStatementObjectModel som=epService.getEPAdministrator().compileEPL(epl);
FromClause fc=som.getFromClause();
for(com.espertech.esper.client.soda.Stream s: fc.getStreams()){
if(s instanceof com.espertech.esper.client.soda.FilterStream){
com.espertech.esper.client.soda.FilterStream fs=(com.espertech.esper.client.soda.FilterStream)s;
String eventTypeName=fs.getFilter().getEventTypeName();
for(RawStream rs: rawStreamList){
if(rs.getEvent().getName().equals(eventTypeName)){
rsMap.put(eventTypeName, rs);
break;
}
}
}
else{
throw new RuntimeException("not implemented yet");
}
}
return rsMap.values();
}
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:22,代码来源:Instance.java
示例13: runAssertionColumnsUncorrelated
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionColumnsUncorrelated(EPServiceProvider epService) {
String stmtText = "select " +
"(select theString as v1, intPrimitive as v2 from SupportBean#lastevent) as subrow " +
"from S0 as s0";
EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
tryAssertion(epService, listener, stmt);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(stmtText);
assertEquals(stmtText, model.toEPL());
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
assertEquals(stmtText, stmt.getText());
tryAssertion(epService, listener, stmt);
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecSubselectMulticolumn.java
示例14: runAssertionSameProviderGroupedReturnSingleEvent
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionSameProviderGroupedReturnSingleEvent(EPServiceProvider epService) throws Exception {
String epl = "select se1() as c0, se2() as c1 from SupportBean#keepall group by theString";
// test regular
SupportAggMFFactory.reset();
SupportAggMFHandler.reset();
SupportAggMFFactorySingleEvent.reset();
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
tryAssertion(epService, stmt);
// test SODA
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
SupportAggMFFactory.reset();
SupportAggMFHandler.reset();
SupportAggMFFactorySingleEvent.reset();
assertEquals(epl, model.toEPL());
EPStatement stmtModel = epService.getEPAdministrator().create(model);
assertEquals(epl, stmtModel.getText());
tryAssertion(epService, stmtModel);
}
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecClientAggregationMultiFunctionPlugIn.java
示例15: runAssertionChainMethod
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionChainMethod(EPServiceProvider epService) throws Exception {
String text = "select chainTop().chainValue(12,intPrimitive) as val from SupportBean";
EPStatement stmt = epService.getEPAdministrator().createEPL(text);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
tryAssertionChainMethod(epService, listener);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(text);
assertEquals(text, model.toEPL());
stmt = epService.getEPAdministrator().create(model);
assertEquals(text, stmt.getText());
stmt.addListener(listener);
tryAssertionChainMethod(epService, listener);
}
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecClientSingleRowFunctionPlugIn.java
示例16: runAssertionSODA
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionSODA(EPServiceProvider epService) {
String soda = "@Name('create dataflow full')\n" +
"create dataflow DFFull\n" +
"create map schema ABC1 as (col1 int, col2 int),\n" +
"create map schema ABC2 as (col1 int, col2 int),\n" +
"MyOperatorOne(instream.one) -> outstream.one {}\n" +
"MyOperatorTwo(instream.two as IN1, input.three as IN2) -> outstream.one<Test>, outstream.two<EventBean<TestTwo>> {}\n" +
"MyOperatorThree((instream.two, input.three) as IN1) {}\n" +
"MyOperatorFour -> teststream {}\n" +
"MyOperatorFive {\n" +
"const_str: \"abc\",\n" +
"somevalue: def*2,\n" +
"select: (select * from ABC where 1=2),\n" +
"jsonarr: [\"a\",\"b\"],\n" +
"jsonobj: {a: \"a\",b: \"b\"}\n" +
"}\n";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(soda);
EPAssertionUtil.assertEqualsIgnoreNewline(soda, model.toEPL(new EPStatementFormatter(true)));
epService.getEPAdministrator().create(model);
}
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecDataflowDocSamples.java
示例17: runAssertionGlobalAliasAndSODA
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionGlobalAliasAndSODA(EPServiceProvider epService) {
String eplDeclare = "create expression myaliastwo alias for {2}";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(eplDeclare);
assertEquals(eplDeclare, model.toEPL());
EPStatement stmtDeclare = epService.getEPAdministrator().create(model);
assertEquals(eplDeclare, stmtDeclare.getText());
SupportUpdateListener listener = new SupportUpdateListener();
epService.getEPAdministrator().createEPL("create expression myalias alias for {1}");
epService.getEPAdministrator().createEPL("select myaliastwo from SupportBean(intPrimitive = myalias)").addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBean("E1", 0));
assertFalse(listener.isInvoked());
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
assertEquals(2, listener.assertOneGetNewAndReset().get("myaliastwo"));
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:20,代码来源:ExecExpressionDefAliasFor.java
示例18: runAssertionDynamicProps
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionDynamicProps(EPServiceProvider epService) {
epService.getEPAdministrator().createEPL(EventRepresentationChoice.MAP.getAnnotationText() + " create schema MyDynoPropSchema as (key string)");
String stmtText = "select typeof(prop?), typeof(key) from MyDynoPropSchema as s0";
EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
tryAssertionDynamicProps(epService, listener);
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(stmtText);
assertEquals(stmtText, model.toEPL());
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
tryAssertionDynamicProps(epService, listener);
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:ExecExprTypeOf.java
示例19: runAssertionChainedParameterized
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
private void runAssertionChainedParameterized(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType("SupportChainTop", SupportChainTop.class);
String subexpr = "top.getChildOne(\"abc\",10).getChildTwo(\"append\")";
String epl = "select " +
subexpr +
" from SupportChainTop as top";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
runAssertionChainedParam(epService, stmt, listener, subexpr);
listener.reset();
stmt.destroy();
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(epl);
assertEquals(epl, model.toEPL());
stmt = epService.getEPAdministrator().create(model);
stmt.addListener(listener);
runAssertionChainedParam(epService, stmt, listener, subexpr);
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecExprDotExpression.java
示例20: execute
import com.espertech.esper.client.soda.EPStatementObjectModel; //导入依赖的package包/类
/**
* Executes the query and returns the result. This only works for on-demand
* queries. Live queries will return null
*
* @return
*/
public String execute() {
final StreamProcessingAdapter esper = StreamProcessingAdapter.getInstance();
if (this.isLiveQuery()) {
return null;
}
EPOnDemandQueryResult result = null;
// TODO evaluate semantic query part (if existent) for all events
// only query those events, that passed the semantic test
final EPStatementObjectModel statement = esper.getEsperAdministrator().compileEPL(this.esperQuery);
result = esper.getEsperRuntime().executeQuery(statement);
// print results
final StringBuffer buffer = new StringBuffer();
buffer.append("Number of events found: " + result.getArray().length);
final Iterator<EventBean> i = result.iterator();
while (i.hasNext()) {
buffer.append(System.getProperty("line.separator"));
final EventBean next = i.next();
if (next.getUnderlying() instanceof ElementImpl) {
final ElementImpl event = (ElementImpl) next.getUnderlying();
buffer.append("{");
for (int k = 0; k < event.getChildNodes().getLength(); k++) {
final Node node = event.getChildNodes().item(k);
buffer.append(node.getNodeName() + "=" + node.getFirstChild().getNodeValue());
if (k + 1 < event.getChildNodes().getLength()) {
buffer.append(", ");
}
}
buffer.append("}");
} else {
buffer.append(next.getUnderlying());
}
}
return buffer.toString();
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:42,代码来源:QueryWrapper.java
注:本文中的com.espertech.esper.client.soda.EPStatementObjectModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论