예제 #1
0
 public static void CheckAlreadyDeclaredVariable(String variableName, VariableService variableService)
 {
     if (variableService.GetVariableMetaData(variableName) != null)
     {
         throw new ExprValidationException(GetAlreadyDeclaredEx(variableName));
     }
 }
예제 #2
0
        public ExprValidationContext(StreamTypeService streamTypeService, EngineImportService engineImportService, StatementExtensionSvcContext statementExtensionSvcContext, ViewResourceDelegateUnverified viewResourceDelegate, TimeProvider timeProvider, VariableService variableService, TableService tableService, ExprEvaluatorContext exprEvaluatorContext, EventAdapterService eventAdapterService, string statementName, int statementId, Attribute[] annotations, ContextDescriptor contextDescriptor, ScriptingService scriptingService, bool disablePropertyExpressionEventCollCache, bool allowRollupFunctions, bool allowBindingConsumption, bool isUnidirectionalJoin, string intoTableName, bool isFilterExpression)
        {
            StreamTypeService            = streamTypeService;
            EngineImportService          = engineImportService;
            StatementExtensionSvcContext = statementExtensionSvcContext;
            ViewResourceDelegate         = viewResourceDelegate;
            TimeProvider         = timeProvider;
            VariableService      = variableService;
            TableService         = tableService;
            ExprEvaluatorContext = exprEvaluatorContext;
            EventAdapterService  = eventAdapterService;
            StatementName        = statementName;
            StatementId          = statementId;
            Annotations          = annotations;
            ContextDescriptor    = contextDescriptor;
            ScriptingService     = scriptingService;
            IsDisablePropertyExpressionEventCollCache = disablePropertyExpressionEventCollCache;
            IsAllowRollupFunctions    = allowRollupFunctions;
            IsAllowBindingConsumption = allowBindingConsumption;
            IsResettingAggregations   = isUnidirectionalJoin;
            IntoTableName             = intoTableName;
            IsFilterExpression        = isFilterExpression;

            IsExpressionAudit       = AuditEnum.EXPRESSION.GetAudit(annotations) != null;
            IsExpressionNestedAudit = AuditEnum.EXPRESSION_NESTED.GetAudit(annotations) != null;
        }
 /// <summary>
 /// Adds configured variables to the variable service.
 /// </summary>
 /// <param name="variableService">service to add to</param>
 /// <param name="variables">configured variables</param>
 /// <param name="engineImportService">engine imports</param>
 internal static void InitVariables(
     VariableService variableService,
     IDictionary <string, ConfigurationVariable> variables,
     EngineImportService engineImportService)
 {
     foreach (var entry in variables)
     {
         try
         {
             var arrayType = TypeHelper.IsGetArrayType(entry.Value.VariableType);
             variableService.CreateNewVariable(
                 null, entry.Key, arrayType.First, entry.Value.IsConstant, arrayType.Second, false,
                 entry.Value.InitializationValue, engineImportService);
             variableService.AllocateVariableState(
                 entry.Key, EPStatementStartMethodConst.DEFAULT_AGENT_INSTANCE_ID, null, false);
         }
         catch (VariableExistsException e)
         {
             throw new ConfigurationException("Error configuring variables: " + e.Message, e);
         }
         catch (VariableTypeException e)
         {
             throw new ConfigurationException("Error configuring variables: " + e.Message, e);
         }
     }
 }
예제 #4
0
        public void TestRollover()
        {
            _service = new VariableServiceImpl(
                VariableServiceImpl.ROLLOVER_READER_BOUNDARY - 100,
                10000,
                new SchedulingServiceImpl(new TimeSourceServiceImpl()),
                SupportEventAdapterService.Service,
                null);

            String[] variables = "a,b,c,d".Split(',');

            var readers = new VariableReader[variables.Length];

            for (int i = 0; i < variables.Length; i++)
            {
                _service.CreateNewVariable <long>(null, variables[i], false, 100L, null);
                _service.AllocateVariableState(variables[i], EPStatementStartMethodConst.DEFAULT_AGENT_INSTANCE_ID, null, false);
                readers[i] = _service.GetReader(variables[i], EPStatementStartMethodConst.DEFAULT_AGENT_INSTANCE_ID);
            }

            for (int i = 0; i < 1000; i++)
            {
                for (int j = 0; j < variables.Length; j++)
                {
                    _service.Write(readers[j].VariableMetaData.VariableNumber, EPStatementStartMethodConst.DEFAULT_AGENT_INSTANCE_ID, 100L + i);
                    _service.Commit();
                }
                ReadCompare(variables, 100L + i);
            }
        }
예제 #5
0
        public static StatementSpecRaw CompileEPL(
            string eplStatement,
            string eplStatementForErrorMsg,
            bool addPleaseCheck,
            string statementName,
            SelectClauseStreamSelectorEnum defaultStreamSelector,
            EngineImportService engineImportService,
            VariableService variableService,
            SchedulingService schedulingService,
            string engineURI,
            ConfigurationInformation configSnapshot,
            PatternNodeFactory patternNodeFactory,
            ContextManagementService contextManagementService,
            ExprDeclaredService exprDeclaredService,
            TableService tableService)
        {
            if (Log.IsDebugEnabled)
            {
                Log.Debug(".createEPLStmt statementName=" + statementName + " eplStatement=" + eplStatement);
            }

            ParseResult parseResult = ParseHelper.Parse(
                eplStatement, eplStatementForErrorMsg, addPleaseCheck, EPLParseRule, true);
            ITree ast = parseResult.Tree;

            var walker = new EPLTreeWalkerListener(
                parseResult.TokenStream, engineImportService, variableService, schedulingService, defaultStreamSelector,
                engineURI, configSnapshot, patternNodeFactory, contextManagementService, parseResult.Scripts,
                exprDeclaredService, tableService);

            try
            {
                ParseHelper.Walk(ast, walker, eplStatement, eplStatementForErrorMsg);
            }
            catch (ASTWalkException ex)
            {
                Log.Error(".createEPL Error validating expression", ex);
                throw new EPStatementException(ex.Message, ex, eplStatementForErrorMsg);
            }
            catch (EPStatementSyntaxException ex)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Error in expression";
                Log.Debug(message, ex);
                throw new EPStatementException(GetNullableErrortext(message, ex.Message), ex, eplStatementForErrorMsg);
            }

            if (Log.IsDebugEnabled)
            {
                ASTUtil.DumpAST(ast);
            }

            StatementSpecRaw raw = walker.StatementSpec;

            raw.ExpressionNoAnnotations = parseResult.ExpressionWithoutAnnotations;
            return(raw);
        }
        public object PostLoadConditionForm(PostLoadConditionFormDTO model)
        {
            Guid?            dynamicFormId = model.DynamicFormId.ToGuidObjNull();
            DCConditionModel designCode;

            if (!string.IsNullOrWhiteSpace(model.Data))
            {
                designCode = DesignCodeUtility.GetObjectOfDesignCode <DCConditionModel>(model.Data.ToStringObj().FromBase64());

                designCode.IsOutputYes = model.IsOutputYes.ToBoolObjNull();
                if (string.IsNullOrWhiteSpace(designCode.FuncName))
                {
                    designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID);
                }
            }
            else
            {
                designCode = new DCConditionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(),
                                                  model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                  model.IsOutputYes.ToBoolObjNull(), new List <DCRowConditionModel>(), model.IsFirst.ToBoolObj(), null);
            }

            using (VariableService variableService = new VariableService())
                using (DynamicFormService dynamicFormService = new DynamicFormService())
                    return new
                           {
                               ProcessControls = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                 dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                               ListOperationTypes = EnumObjHelper.GetEnumList <DCRowConditionModel.e_OperationType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                               Model = designCode
                           };
        }
예제 #7
0
 public FilterSpecCompilerArgs(
     IDictionary<string, Pair<EventType, string>> taggedEventTypes,
     IDictionary<string, Pair<EventType, string>> arrayEventTypes,
     ExprEvaluatorContext exprEvaluatorContext,
     string statementName,
     string statementId,
     StreamTypeService streamTypeService,
     MethodResolutionService methodResolutionService,
     TimeProvider timeProvider,
     VariableService variableService,
     TableService tableService,
     EventAdapterService eventAdapterService,
     ScriptingService scriptingService,
     Attribute[] annotations,
     ContextDescriptor contextDescriptor,
     ConfigurationInformation configurationInformation)
 {
     TaggedEventTypes = taggedEventTypes;
     ArrayEventTypes = arrayEventTypes;
     ExprEvaluatorContext = exprEvaluatorContext;
     StatementName = statementName;
     StatementId = statementId;
     StreamTypeService = streamTypeService;
     MethodResolutionService = methodResolutionService;
     TimeProvider = timeProvider;
     VariableService = variableService;
     TableService = tableService;
     EventAdapterService = eventAdapterService;
     ScriptingService = scriptingService;
     Annotations = annotations;
     ContextDescriptor = contextDescriptor;
     ConfigurationInformation = configurationInformation;
 }
예제 #8
0
        /// <summary>
        /// Delete Variable
        /// </summary>
        /// <param name="id"></param>
        /// <param name="Model"></param>
        public void Delete(Guid id)
        {
            var      languageID = TSMContext.CurrentLanguageID;
            Variable variable   = VariableService.GetVariable(id, languageID);

            if (variable != null)
            {
                List <Choice> choicelist = new List <Choice>();
                choicelist       = variable.Choices;
                variable.Choices = new List <Choice>();

                variable.LastModifiedBy   = TSM.Model.TSMContext.CurrentUser.ID;
                variable.LastModifiedDate = DateTime.UtcNow;
                variable.IsActive         = false;
                variable.IsDeleted        = true;
                variable.DisplayOrder     = null;

                string Name        = variable.Variable_Languages[0].Name;
                string DisplayName = variable.Variable_Languages[0].DisplayName;
                string Description = variable.Variable_Languages[0].Description;

                variable.Variable_Languages = new List <Variable_Language>();
                variable.Variable_Languages.Add(new Variable_Language
                {
                    ID          = variable.ID,
                    LanguageID  = TSMContext.CurrentLanguageID,
                    Name        = Name,
                    DisplayName = DisplayName,
                    Description = Description
                });
                variable.Choices = choicelist;
                VariableService.Save(variable, TSM.Model.TSMContext.CurrentSiteLanguageID);
                DeleteFromXML(id);
            }
        }
예제 #9
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="container">The container.</param>
 /// <param name="engineImportService">engine imports</param>
 /// <param name="variableService">variable names</param>
 /// <param name="configuration">the configuration</param>
 /// <param name="schedulingService">The scheduling service.</param>
 /// <param name="engineURI">The engine URI.</param>
 /// <param name="patternNodeFactory">The pattern node factory.</param>
 /// <param name="namedWindowMgmtService">The named window service.</param>
 /// <param name="contextManagementService">The context management service.</param>
 /// <param name="exprDeclaredService">The expr declared service.</param>
 /// <param name="contextDescriptor">optional context description</param>
 /// <param name="tableService">The table service.</param>
 public StatementSpecMapContext(
     IContainer container,
     EngineImportService engineImportService,
     VariableService variableService,
     ConfigurationInformation configuration,
     SchedulingService schedulingService,
     string engineURI,
     PatternNodeFactory patternNodeFactory,
     NamedWindowMgmtService namedWindowMgmtService,
     ContextManagementService contextManagementService,
     ExprDeclaredService exprDeclaredService,
     ContextDescriptor contextDescriptor,
     TableService tableService)
 {
     Container                = container;
     PlugInAggregations       = new LazyAllocatedMap <ConfigurationPlugInAggregationMultiFunction, PlugInAggregationMultiFunctionFactory>();
     TableExpressions         = new HashSet <ExprTableAccessNode>();
     EngineImportService      = engineImportService;
     VariableService          = variableService;
     Configuration            = configuration;
     VariableNames            = new HashSet <string>();
     SchedulingService        = schedulingService;
     EngineURI                = engineURI;
     PatternNodeFactory       = patternNodeFactory;
     NamedWindowMgmtService   = namedWindowMgmtService;
     ContextManagementService = contextManagementService;
     ExprDeclaredService      = exprDeclaredService;
     ContextDescriptor        = contextDescriptor;
     TableService             = tableService;
 }
예제 #10
0
 public object GetAddEditFormDesign(Guid?ID = null)
 {
     using (DynamicFormService dynamicFormService = new DynamicFormService())
     {
         DynamicFormDTO dynamicFormDTO = new DynamicFormDTO(ID.HasValue ? dynamicFormService.GetInfo(ID.Value) :
                                                            dynamicFormService.GetInfoByPageID(base.ApplicationPageId.Value));
         if (dynamicFormDTO != null)
         {
             using (VariableService variableService = new VariableService())
                 return(Json(new
                 {
                     //it is used in dataGrid seting for binging form to openForm Column Item Type.
                     ProcessForms = dynamicFormService.GetList(dynamicFormDTO.ProcessId, null, base.ApplicationPageId.HasValue, string.Empty, null, null).Select(c => new { value = c.ID, text = c.Name }).ToList(),
                     //it is used for binding variable of entity type to fileupload controls.
                     EntityVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.Object, "", null, true).Select(c => new { text = c.Name, value = c.ID }).ToList(),
                     //it is used for binding variable of list type to list controls like dropdownlist or checkboxlist and uploader.
                     ListVariables = variableService.GetList(dynamicFormDTO.ProcessId, base.ApplicationPageId, (int)sysBpmsVariable.e_VarTypeLU.List, "", null, true).Select(c => new { text = c.Name, value = c.Name }).ToList(),
                     Model = dynamicFormDTO
                 }));
         }
         else
         {
             return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error));
         }
     }
 }
예제 #11
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="lookupable">is the lookup-able</param>
        /// <param name="filterOperator">is expected to be the BOOLEAN_EXPR operator</param>
        /// <param name="exprNode">represents the boolean expression</param>
        /// <param name="taggedEventTypes">is null if the expression doesn't need other streams, or is filled with a ordered list of stream names and types</param>
        /// <param name="arrayEventTypes">is a map of name tags and event type per tag for repeat-expressions that generate an array of events</param>
        /// <param name="variableService">provides access to variables</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="eventAdapterService">for creating event types and event beans</param>
        /// <param name="configurationInformation">The configuration information.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="hasSubquery">if set to <c>true</c> [has subquery].</param>
        /// <param name="hasTableAccess">if set to <c>true</c> [has table access].</param>
        /// <exception cref="System.ArgumentException">Invalid filter operator for filter expression node</exception>
        /// <throws>IllegalArgumentException for illegal args</throws>
        public FilterSpecParamExprNode(
            FilterSpecLookupable lookupable,
            FilterOperator filterOperator,
            ExprNode exprNode,
            IDictionary <string, Pair <EventType, string> > taggedEventTypes,
            IDictionary <string, Pair <EventType, string> > arrayEventTypes,
            VariableService variableService,
            TableService tableService,
            EventAdapterService eventAdapterService,
            ConfigurationInformation configurationInformation,
            string statementName,
            bool hasSubquery,
            bool hasTableAccess)
            : base(lookupable, filterOperator)
        {
            if (filterOperator != FilterOperator.BOOLEAN_EXPRESSION)
            {
                throw new ArgumentException("Invalid filter operator for filter expression node");
            }
            _exprNode                 = exprNode;
            _taggedEventTypes         = taggedEventTypes;
            _arrayEventTypes          = arrayEventTypes;
            _variableService          = variableService;
            _tableService             = tableService;
            _eventAdapterService      = eventAdapterService;
            _useLargeThreadingProfile = configurationInformation.EngineDefaults.ExecutionConfig.ThreadingProfile == ConfigurationEngineDefaults.ThreadingProfile.LARGE;
            _hasFilterStreamSubquery  = hasSubquery;
            _hasTableAccess           = hasTableAccess;

            var visitor = new ExprNodeVariableVisitor();

            exprNode.Accept(visitor);
            _hasVariable = visitor.HasVariables;
        }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="eventAdapterService">is the event wrapper and type service</param>
 /// <param name="eventTypeIdGenerator">The event type id generator.</param>
 /// <param name="engineImportService">for imported aggregation functions and static functions</param>
 /// <param name="variableService">provides access to variable values</param>
 /// <param name="engineSettingsService">some engine settings are writable</param>
 /// <param name="valueAddEventService">Update event handling</param>
 /// <param name="metricReportingService">for metric reporting</param>
 /// <param name="statementEventTypeRef">statement to event type reference holding</param>
 /// <param name="statementVariableRef">statement to variable reference holding</param>
 /// <param name="plugInViews">The plug in views.</param>
 /// <param name="filterService">The filter service.</param>
 /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
 /// <param name="tableService">The table service.</param>
 public ConfigurationOperationsImpl(
     EventAdapterService eventAdapterService,
     EventTypeIdGenerator eventTypeIdGenerator,
     EngineImportService engineImportService,
     VariableService variableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     MetricReportingService metricReportingService,
     StatementEventTypeRef statementEventTypeRef,
     StatementVariableRef statementVariableRef,
     PluggableObjectCollection plugInViews,
     FilterService filterService,
     PatternSubexpressionPoolEngineSvc patternSubexpressionPoolSvc,
     MatchRecognizeStatePoolEngineSvc matchRecognizeStatePoolEngineSvc,
     TableService tableService)
 {
     _eventAdapterService              = eventAdapterService;
     _eventTypeIdGenerator             = eventTypeIdGenerator;
     _engineImportService              = engineImportService;
     _variableService                  = variableService;
     _engineSettingsService            = engineSettingsService;
     _valueAddEventService             = valueAddEventService;
     _metricReportingService           = metricReportingService;
     _statementEventTypeRef            = statementEventTypeRef;
     _statementVariableRef             = statementVariableRef;
     _plugInViews                      = plugInViews;
     _filterService                    = filterService;
     _patternSubexpressionPoolSvc      = patternSubexpressionPoolSvc;
     _matchRecognizeStatePoolEngineSvc = matchRecognizeStatePoolEngineSvc;
     _tableService                     = tableService;
 }
예제 #13
0
        /// <summary>
        /// Populate
        /// </summary>
        /// <param name="id"></param>
        /// <param name="languageID"></param>
        public void Populate(Guid languageID)
        {
            try
            {
                //Populate Countries, Regions, Sectors
                this.Country_Languages = CountryService.GetCountries(languageID);
                this.Region_Languages = RegionService.GetRegions(languageID);

                // this.Sector_Languages = SectorService.GetSectors(languageID);
                // this.Sector_Languages = null;

                //Populate Variables
                this.Variable_Languages = VariableService.GetVariables(languageID);

                this.LanguageID = languageID;

                //Populate Record Variables
                PopulateRecordVariables();
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog("ManageRecordModel", "Populate", ex, string.Empty);
            }

        }
예제 #14
0
        /// <summary>
        /// Returns processor for order-by clauses.
        /// </summary>
        /// <param name="selectionList">is a list of select expressions</param>
        /// <param name="groupByNodes">is a list of group-by expressions</param>
        /// <param name="orderByList">is a list of order-by expressions</param>
        /// <param name="rowLimitSpec">specification for row limit, or null if no row limit is defined</param>
        /// <param name="variableService">for retrieving variable state for use with row limiting</param>
        /// <param name="isSortUsingCollator">for string value sorting using compare or Collator</param>
        /// <param name="optionalContextName">Name of the optional context.</param>
        /// <returns>ordering processor instance</returns>
        /// <throws><seealso cref="ExprValidationException" /> when validation of expressions fails</throws>
        public static OrderByProcessorFactory GetProcessor(
            IList <SelectClauseExprCompiledSpec> selectionList,
            ExprNode[] groupByNodes,
            IList <OrderByItem> orderByList,
            RowLimitSpec rowLimitSpec,
            VariableService variableService,
            bool isSortUsingCollator,
            String optionalContextName)
        {
            // Get the order by expression nodes
            IList <ExprNode> orderByNodes = orderByList.Select(element => element.ExprNode).ToList();

            // No order-by clause
            if (orderByList.IsEmpty())
            {
                Log.Debug(".getProcessor Using no _orderByProcessor");
                if (rowLimitSpec != null)
                {
                    var rowLimitProcessorFactory = new RowLimitProcessorFactory(rowLimitSpec, variableService, optionalContextName);
                    return(new OrderByProcessorRowLimitOnlyFactory(rowLimitProcessorFactory));
                }
                return(null);
            }

            // Determine aggregate functions used in select, if any
            IList <ExprAggregateNode> selectAggNodes = new List <ExprAggregateNode>();

            foreach (var element in selectionList)
            {
                ExprAggregateNodeUtil.GetAggregatesBottomUp(element.SelectExpression, selectAggNodes);
            }

            // Get all the aggregate functions occuring in the order-by clause
            IList <ExprAggregateNode> orderAggNodes = new List <ExprAggregateNode>();

            foreach (var orderByNode in orderByNodes)
            {
                ExprAggregateNodeUtil.GetAggregatesBottomUp(orderByNode, orderAggNodes);
            }

            ValidateOrderByAggregates(selectAggNodes, orderAggNodes);

            // Tell the order-by processor whether to compute group-by
            // keys if they are not present
            var needsGroupByKeys = !selectionList.IsEmpty() && !orderAggNodes.IsEmpty();

            Log.Debug(".getProcessor Using OrderByProcessorImpl");
            var orderByProcessorFactory = new OrderByProcessorFactoryImpl(orderByList, groupByNodes, needsGroupByKeys, isSortUsingCollator);

            if (rowLimitSpec == null)
            {
                return(orderByProcessorFactory);
            }
            else
            {
                var rowLimitProcessorFactory = new RowLimitProcessorFactory(rowLimitSpec, variableService, optionalContextName);
                return(new OrderByProcessorOrderedLimitFactory(orderByProcessorFactory, rowLimitProcessorFactory));
            }
        }
예제 #15
0
 public StatementContextEngineServices(
     IContainer container,
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowMgmtService namedWindowMgmtService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory,
     ContextManagementService contextManagementService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     EventTableIndexService eventTableIndexService,
     PatternNodeFactory patternNodeFactory,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     TimeSourceService timeSourceService,
     EngineImportService engineImportService,
     AggregationFactoryFactory aggregationFactoryFactory,
     SchedulingService schedulingService,
     ExprDeclaredService exprDeclaredService)
 {
     Container                           = container;
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowMgmtService              = namedWindowMgmtService;
     VariableService                     = variableService;
     TableService                        = tableService;
     EngineSettingsService               = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
     ContextManagementService            = contextManagementService;
     ViewServicePreviousFactory          = viewServicePreviousFactory;
     EventTableIndexService              = eventTableIndexService;
     PatternNodeFactory                  = patternNodeFactory;
     FilterBooleanExpressionFactory      = filterBooleanExpressionFactory;
     TimeSourceService                   = timeSourceService;
     EngineImportService                 = engineImportService;
     AggregationFactoryFactory           = aggregationFactoryFactory;
     SchedulingService                   = schedulingService;
     ExprDeclaredService                 = exprDeclaredService;
 }
예제 #16
0
 public void SetUp()
 {
     _variableService = new VariableServiceImpl(100, null, null, null);
     _variableService.CreateNewVariable(null, "var1", "string", true, false, false, null, null);
     _variableService.CreateNewVariable(null, "dummy", "string", true, false, false, null, null);
     _variableService.CreateNewVariable(null, "IntPrimitive", "int", true, false, false, null, null);
     _varNode = new ExprVariableNodeImpl(_variableService.GetVariableMetaData("var1"), null);
 }
예제 #17
0
        public void GetVariable()
        {
            var sut = new VariableService();

            var actual = sut.GetVariableByName("WalletEndpointAddress");

            Assert.Equal("WalletEndpointAddress", actual.Name);
        }
예제 #18
0
        public Form1()
        {
            InitializeComponent();
            _variableService = new VariableService();
            GetProjectNames();
            string name = comboBox1.Text;

            GetScopes(name);
        }
예제 #19
0
        public string IsVariableOpGetName(VariableService variableService)
        {
            VariableMetaData metaData = null;

            if (_chainSpec.Count > 0 && _chainSpec[0].IsProperty)
            {
                metaData = variableService.GetVariableMetaData(_chainSpec[0].Name);
            }
            return(metaData == null ? null : metaData.VariableName);
        }
예제 #20
0
 public override bool Evaluate(EventBean theEvent)
 {
     if (VariableService != null)
     {
         VariableService.SetLocalVersion();
     }
     EventBean[] eventsPerStream = _arrayPerThread.GetOrCreate();
     eventsPerStream[0] = theEvent;
     return(EvaluatePerStream(eventsPerStream));
 }
예제 #21
0
 /// <summary>
 /// Populate Variable With Order
 /// </summary>
 public void PopulateWithOrder()
 {
     try
     {
         this.Variables = VariableService.GetVariableWithOrder(TSMContext.CurrentLanguageID);
     }
     catch (Exception ex)
     {
         ErrorLog.WriteLog("ManageVariableModel", "PopulateWithOrder", ex, "");
     }
 }
 public ExprNodeAdapterMultiStreamStmtLock(
     int filterSpecId,
     int filterSpecParamPathNum,
     ExprNode exprNode,
     ExprEvaluatorContext evaluatorContext,
     VariableService variableService,
     EventBean[] prototype,
     IThreadLocalManager threadLocalManager)
     : base(filterSpecId, filterSpecParamPathNum, exprNode, evaluatorContext, variableService, prototype, threadLocalManager)
 {
 }
 protected ExprNodeAdapterBase GetLockableMultiStream(
     int filterSpecId,
     int filterSpecParamPathNum,
     ExprNode exprNode,
     ExprEvaluatorContext exprEvaluatorContext,
     VariableService variableServiceToUse,
     EventBean[] events)
 {
     return new ExprNodeAdapterMultiStreamStmtLock(
         filterSpecId, filterSpecParamPathNum, exprNode, exprEvaluatorContext, variableServiceToUse, events);
 }
예제 #24
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="statementId">The statement identifier.</param>
        /// <param name="desc">specification for the on-set statement</param>
        /// <param name="eventAdapterService">for creating statements</param>
        /// <param name="variableService">for setting variables</param>
        /// <param name="statementResultService">for coordinating on whether insert and remove stream events should be posted</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <throws>com.espertech.esper.epl.expression.core.ExprValidationException if the assignment expressions are invalid</throws>
        public OnSetVariableViewFactory(string statementId, OnTriggerSetDesc desc, EventAdapterService eventAdapterService, VariableService variableService, StatementResultService statementResultService, ExprEvaluatorContext exprEvaluatorContext)
        {
            EventAdapterService    = eventAdapterService;
            VariableService        = variableService;
            StatementResultService = statementResultService;

            VariableReadWritePackage = new VariableReadWritePackage(desc.Assignments, variableService, eventAdapterService);
            var outputEventTypeName = statementId + "_outsetvar";

            EventType = eventAdapterService.CreateAnonymousMapType(outputEventTypeName, VariableReadWritePackage.VariableTypes);
        }
예제 #25
0
 public MethodPollingExecStrategyEventBeans(
     EventAdapterService eventAdapterService,
     FastMethod method,
     EventType eventType,
     Object invocationTarget,
     MethodPollingExecStrategyEnum strategy,
     VariableReader variableReader,
     string variableName,
     VariableService variableService)
     : base(eventAdapterService, method, eventType, invocationTarget, strategy, variableReader, variableName, variableService)
 {
 }
예제 #26
0
        /// <summary>
        /// Validate the view.
        /// </summary>
        /// <param name="engineImportService">The engine import service.</param>
        /// <param name="streamTypeService">supplies the types of streams against which to validate</param>
        /// <param name="methodResolutionService">for resolving imports and classes and methods</param>
        /// <param name="timeProvider">for providing current time</param>
        /// <param name="variableService">for access to variables</param>
        /// <param name="tableService"></param>
        /// <param name="scriptingService">The scripting service.</param>
        /// <param name="exprEvaluatorContext">The expression evaluator context.</param>
        /// <param name="configSnapshot">The config snapshot.</param>
        /// <param name="schedulingService">The scheduling service.</param>
        /// <param name="engineURI">The engine URI.</param>
        /// <param name="sqlParameters">The SQL parameters.</param>
        /// <param name="eventAdapterService">The event adapter service.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementId">The statement id.</param>
        /// <param name="annotations">The annotations.</param>
        /// <throws>  ExprValidationException is thrown to indicate an exception in validating the view </throws>
        public void Validate(
            EngineImportService engineImportService,
            StreamTypeService streamTypeService,
            MethodResolutionService methodResolutionService,
            TimeProvider timeProvider,
            VariableService variableService,
            TableService tableService,
            ScriptingService scriptingService,
            ExprEvaluatorContext exprEvaluatorContext,
            ConfigurationInformation configSnapshot,
            SchedulingService schedulingService,
            string engineURI,
            IDictionary <int, IList <ExprNode> > sqlParameters,
            EventAdapterService eventAdapterService,
            string statementName,
            string statementId,
            Attribute[] annotations)
        {
            _evaluators           = new ExprEvaluator[_inputParameters.Count];
            _subordinateStreams   = new SortedSet <int>();
            _exprEvaluatorContext = exprEvaluatorContext;

            int count             = 0;
            var validationContext = new ExprValidationContext(
                streamTypeService, methodResolutionService, null, timeProvider, variableService, tableService,
                exprEvaluatorContext, eventAdapterService, statementName, statementId, annotations, null, scriptingService,
                false, false, true, false, null, false);

            foreach (string inputParam in _inputParameters)
            {
                ExprNode raw = FindSQLExpressionNode(_myStreamNumber, count, sqlParameters);
                if (raw == null)
                {
                    throw new ExprValidationException(
                              "Internal error find expression for historical stream parameter " + count + " stream " +
                              _myStreamNumber);
                }
                ExprNode evaluator = ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.DATABASEPOLL, raw, validationContext);
                _evaluators[count++] = evaluator.ExprEvaluator;

                ExprNodeIdentifierCollectVisitor visitor = new ExprNodeIdentifierCollectVisitor();
                visitor.Visit(evaluator);
                foreach (ExprIdentNode identNode in visitor.ExprProperties)
                {
                    if (identNode.StreamId == _myStreamNumber)
                    {
                        throw new ExprValidationException("Invalid expression '" + inputParam +
                                                          "' resolves to the historical data itself");
                    }
                    _subordinateStreams.Add(identNode.StreamId);
                }
            }
        }
 protected ExprNodeAdapterBase GetLockableSingle(
     int filterSpecId,
     int filterSpecParamPathNum,
     ExprNode exprNode,
     ExprEvaluatorContext exprEvaluatorContext,
     VariableService variableService,
     StatementContext statementContext,
     int agentInstanceId)
 {
     return new ExprNodeAdapterBaseStmtLock(
         filterSpecId, filterSpecParamPathNum, exprNode, exprEvaluatorContext, variableService);
 }
예제 #28
0
 public void SetUp()
 {
     _container = SupportContainer.Reset();
     _service   = new VariableServiceImpl(
         _container, 10000,
         new SchedulingServiceImpl(
             new TimeSourceServiceImpl(),
             _container.Resolve <ILockManager>()),
         _container.Resolve <EventAdapterService>(), null);
     _engineImportService = SupportEngineImportServiceFactory.Make(
         _container.Resolve <ClassLoaderProvider>());
 }
예제 #29
0
        public override bool Evaluate(EventBean theEvent)
        {
            if (VariableService != null)
            {
                VariableService.SetLocalVersion();
            }

            var eventsPerStream = new EventBean[PrototypeArray.Length];

            Array.Copy(PrototypeArray, 0, eventsPerStream, 0, PrototypeArray.Length);
            eventsPerStream[0] = theEvent;
            return(base.EvaluatePerStream(eventsPerStream));
        }
        public object PostLoadExpressionCodeForm(PostLoadExpressionCodeFormDTO model)
        {
            DCExpressionModel designCode;
            Guid?dynamicFormId = model.DynamicFormId.ToGuidObjNull();

            if (!string.IsNullOrWhiteSpace(model.Data))
            {
                designCode             = DesignCodeUtility.GetObjectOfDesignCode <DCExpressionModel>(model.Data.FromBase64());
                designCode.IsOutputYes = model.IsOutputYes;
                if (string.IsNullOrWhiteSpace(designCode.FuncName))
                {
                    designCode.FuncName = DesignCodeUtility.GetFunctionName(designCode.ShapeID);
                }
            }
            else
            {
                designCode = new DCExpressionModel(Guid.NewGuid().ToString(), model.Name.ToStringObj(),
                                                   model.ShapeId.ToStringObj(), model.ParentShapeId.ToStringObj(),
                                                   "", model.IsOutputYes, model.IsFirst.ToBoolObj(), null);
            }
            designCode.Assemblies     = string.Join(",", designCode.Assemblies.ToStringObj().Split(',').Select(c => c.Trim()).ToList());
            designCode.ExpressionCode = designCode.ExpressionCode.ToStringObj().Replace("\\", "\\\\");
            using (DocumentFolderService documentFolderService = new DocumentFolderService())
                using (DepartmentService departmentService = new DepartmentService())
                    using (LURowService luRowService = new LURowService())
                        using (VariableService variableService = new VariableService())
                            using (DynamicFormService dynamicFormService = new DynamicFormService())
                                return new
                                       {
                                           GetAllSysMethods    = DesignCodeUtility.GetAllSysMethods().Select(c => new { Key = c }).ToList(),
                                           GetVariableMethods  = DesignCodeUtility.GetVariableMethods().Select(c => new { Key = c }).ToList(),
                                           GetMessageMethods   = DesignCodeUtility.GetMessageMethods().Select(c => new { Key = c }).ToList(),
                                           GetAccessMethods    = DesignCodeUtility.GetAccessMethods().Select(c => new { Key = c }).ToList(),
                                           GetHelperMethods    = DesignCodeUtility.GetHelperMethods().Select(c => new { Key = c }).ToList(),
                                           GetDocumentMethods  = DesignCodeUtility.GetDocumentMethods().Select(c => new { Key = c }).ToList(),
                                           GetAllSysProperties = DesignCodeUtility.GetAllSysProperties().Select(c => new { Key = c }).ToList(),

                                           AssembliesJson   = (Directory.Exists(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot) ? new DirectoryInfo(BPMSResources.FilesRoot + BPMSResources.AssemblyRoot).GetFiles("*.dll").Select(c => new AssemblyDTO(c)).Select(c => new ComboTreeModel()
                                    {
                                        id = c.FileName, title = c.FileName
                                    }).ToList() : new List <ComboTreeModel>()),
                                           ApplicationPages = dynamicFormService.GetList(null, null, true, string.Empty, null, null).Select(c => new QueryModel(c.ApplicationPageID.ToString(), c.Name)).ToList(),
                                           DepartmentRoles  = luRowService.GetList("DepartmentRoleLU").Select(c => new LURowDTO(c)).ToList(),
                                           DepartmentList   = departmentService.GetList(true, "", null).Select(c => new { ID = $"new Guid(\"{ c.ID }\")", c.Name }),
                                           DocumentFolders  = documentFolderService.GetList(null, "", "", true).Select(c => new QueryModel(c.ID.ToString(), c.DisplayName)).ToList(),
                                           ProcessVariables = variableService.GetVariableAsComboTree(base.ProcessId, base.ApplicationPageId, null, "{0}"),
                                           ProcessControls  = dynamicFormId != Guid.Empty && dynamicFormId.HasValue ?
                                                              dynamicFormService.GetControls(dynamicFormService.GetInfo(dynamicFormId.Value)).Select(c => new QueryModel(c.Key, c.Value)).ToList() : new List <QueryModel>(),
                                           Model = designCode
                                       };
        }