private EPStatement createPatternStmt(
     String expression, String statementName, Object userObject, String statementId)
     throws EPException {
   StatementSpecRaw rawPattern =
       EPAdministratorHelper.compilePattern(
           expression, expression, true, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return services
       .getStatementLifecycleSvc()
       .createAndStart(
           rawPattern, expression, true, statementName, userObject, null, statementId, null);
 }
  public EPPreparedStatement preparePattern(String patternExpression) throws EPException {
    StatementSpecRaw rawPattern =
        EPAdministratorHelper.compilePattern(
            patternExpression,
            patternExpression,
            true,
            services,
            SelectClauseStreamSelectorEnum.ISTREAM_ONLY);

    // map to object model thus finding all substitution parameters and their indexes
    StatementSpecUnMapResult unmapped = StatementSpecMapper.unmap(rawPattern);

    // the prepared statement is the object model plus a list of substitution parameters
    // map to specification will refuse any substitution parameters that are unfilled
    return new EPPreparedStatementImpl(unmapped.getObjectModel(), unmapped.getIndexedParams());
  }
 public EPStatementObjectModel compilePatternToSODAModel(String expression) throws EPException {
   StatementSpecRaw rawPattern =
       EPAdministratorHelper.compilePattern(
           expression, expression, true, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return mapRawToSODA(rawPattern);
 }
 public EvalFactoryNode compilePatternToNode(String pattern) throws EPException {
   StatementSpecRaw raw =
       EPAdministratorHelper.compilePattern(
           pattern, pattern, false, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return ((PatternStreamSpecRaw) raw.getStreamSpecs().get(0)).getEvalFactoryNode();
 }