public ISearchResponse <T> SearchResponse(IQueryContainer query = null, FilterContainer filter = null, Func <AggregationDescriptor <T>, AggregationDescriptor <T> > aggregation = null) { int skip = _pageSize * (_pageNumber - 1); skip = Math.Max(0, skip); Func <SearchDescriptor <T>, SearchDescriptor <T> > descriptor = i => i.Index(_indexName) .Type(_typeName) .Skip(skip) .Size(_pageSize); if (_excludedFields != null) { descriptor += i => i.Source(s => s.Exclude(_excludedFields)); } if (query != null) { descriptor += i => i.Query(query); } if (filter != null) { descriptor += i => i.Filter(filter); } if (aggregation != null) { descriptor += i => i.Aggregations(aggregation); } var response = Client.Search <T>(descriptor); return(response); }
public IActionResult WorkFlowProcess(WorkFlowProcessModel model) { if (!model.IsSortBySeted) { model.SortBy = "steporder"; model.SortDirection = 0; } FilterContainer <WorkFlowProcess> filter = FilterContainerBuilder.Build <WorkFlowProcess>(); filter.And(n => n.WorkFlowInstanceId == model.WorkFlowInstanceId); if (model.GetAll) { List <WorkFlowProcess> result = _workFlowProcessFinder.Query(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { PagedList <WorkFlowProcess> result = _workFlowProcessFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(DynamicResult(model)); }
//[HttpPost] public IActionResult Dialog(WebResourceModel model, DialogModel dm) { FilterContainer <WebResource.Domain.WebResource> container = FilterContainerBuilder.Build <WebResource.Domain.WebResource>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.SolutionId.HasValue && !model.SolutionId.Value.Equals(Guid.Empty)) { container.And(n => n.SolutionId == model.SolutionId.Value); } if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.WebResourceType.HasValue) { container.And(n => n.WebResourceType == model.WebResourceType.Value); } var result = _webResourceFinder.QueryPaged(x => x .Select(s => new { s.WebResourceId, s.WebResourceType, s.Name, s.Description, s.CreatedOn }) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; ViewData["DialogModel"] = dm; return(View(model)); }
public override void BuildFilter <T>(object query, object options, ref FilterContainer container) { var searchQuery = query as ISearchQuery; if (searchQuery == null) { return; } if (!String.IsNullOrEmpty(searchQuery.SystemFilter)) { container &= new QueryFilter { Query = QueryContainer.From(new QueryStringQuery { Query = searchQuery.SystemFilter, DefaultOperator = Operator.And }) }; } if (!String.IsNullOrEmpty(searchQuery.Filter)) { container &= new QueryFilter { Query = QueryContainer.From(new QueryStringQuery { Query = searchQuery.Filter, DefaultOperator = Operator.And }) }; } }
public IActionResult Get(FilterRulesModel model) { FilterContainer <FilterRule> filter = FilterContainerBuilder.Build <FilterRule>(); //filter.And(n => n.SolutionId == this.solutionId.Value); if (!model.EntityId.Equals(Guid.Empty)) { filter.And(n => n.EntityId == model.EntityId); } if (model.GetAll) { model.Page = 1; model.PageSize = 25000; } else if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <FilterRule> result = _filterRuleFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))); model.Items = result.Items; model.TotalItems = result.TotalItems; return(JOk(model)); }
public override void InitFilter(FilterContainer container, Configuration conf) { IDictionary <string, string> filterConfig = CreateFilterConfig(conf); container.AddFilter("RMAuthenticationFilter", typeof(RMAuthenticationFilter).FullName , filterConfig); }
private void DeletePB_Click(object sender, RoutedEventArgs e) { DataRecord record = (DataRecord)filterXamDataGrid.ActiveRecord; if (record == null) { return; } if (record != null) { FilterContainer filter = (FilterContainer)record.DataItem; string MsgStr = "Are you sure that you want to DELETE Filter: " + ((FilterChangerEnum)filter.FilterChanger).ToString() + ":" + ((FilterPositionEnum)filter.PositionNumber).ToString() + " " + filter.Description + "?"; MessageBoxResult result = MessageBox.Show(MsgStr, "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { WaveguideDB wgDB = new WaveguideDB(); bool success = wgDB.DeleteFilter(filter.FilterID); if (success) { FilterVM.Refresh(); } } } }
/// <summary>Initializes hadoop-auth AuthenticationFilter.</summary> /// <remarks> /// Initializes hadoop-auth AuthenticationFilter. /// <p/> /// Propagates to hadoop-auth AuthenticationFilter configuration all Hadoop /// configuration properties prefixed with "hadoop.http.authentication." /// </remarks> /// <param name="container">The filter container</param> /// <param name="conf">Configuration for run-time parameters</param> public override void InitFilter(FilterContainer container, Configuration conf) { IDictionary <string, string> filterConfig = GetFilterConfigMap(conf, Prefix); container.AddFilter("authentication", typeof(AuthenticationFilter).FullName, filterConfig ); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <Flow.Domain.WorkFlow> filter = FilterContainerBuilder.Build <Flow.Domain.WorkFlow>(); filter.And(x => x.StateCode == RecordState.Enabled); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled.Value); } var data = _workFlowFinder.Query(x => x.Select(s => new { s.WorkFlowId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(f => f.StateCode == Core.RecordState.Enabled)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll(); foreach (var item in entities) { var attributes = data.Where(x => x.EntityId == item.EntityId); if (!attributes.Any()) { continue; } var group1 = new PrivilegeResourceItem(); group1.Label = item.LocalizedName; group1.Children = attributes.Select(x => (new PrivilegeResourceItem { Id = x.WorkFlowId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList(); result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult GetButtons(Guid id) { var queryView = _queryViewFinder.FindById(id); if (queryView == null) { return(NotFound()); } FilterContainer <RibbonButton.Domain.RibbonButton> buttonFilter = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>() .And(w => w.StateCode == RecordState.Enabled && w.EntityId == queryView.EntityId && (w.ShowArea == RibbonButtonArea.ListHead || w.ShowArea == RibbonButtonArea.ListRow)); var buttons = _ribbonbuttonFinder.Find(queryView.EntityId, null); if (queryView.IsCustomButton && queryView.CustomButtons.IsNotEmpty()) { List <Guid> buttonid = new List <Guid>(); buttonid = buttonid.DeserializeFromJson(queryView.CustomButtons); buttons.RemoveAll(x => !buttonid.Contains(x.RibbonButtonId)); } if (buttons.NotEmpty()) { buttons = buttons.OrderBy(x => x.DisplayOrder).ToList(); } return(JOk(buttons)); }
public IndicatorItem(int indID, int methID, string desc, ref ObservableCollection <SignalTypeContainer> signalTypeList, ref ObservableCollection <FilterContainer> exFiltList, ref ObservableCollection <FilterContainer> emFiltList) { _indicatorID = indID; _methodID = methID; _description = desc; _excitationFilterList = exFiltList; _emissionsFilterList = emFiltList; _signalTypeList = signalTypeList; if (_excitationFilterList.Count() > 0) { FilterContainer filter = _excitationFilterList.ElementAt(0); _excitationFilterPosition = filter.PositionNumber; } if (_emissionsFilterList.Count() > 0) { FilterContainer filter = _emissionsFilterList.ElementAt(0); _emissionsFilterPosition = filter.PositionNumber; } if (_signalTypeList.Count() > 0) { SignalTypeContainer st = _signalTypeList.ElementAt(0); _signalType = st.Value; } }
public IActionResult Index(AttributeModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <Schema.Domain.Attribute> container = FilterContainerBuilder.Build <Schema.Domain.Attribute>(); container.And(n => n.EntityId == model.EntityId); if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.AttributeTypeName != null && model.AttributeTypeName.Length > 0) { container.And(n => n.AttributeTypeName.In(model.AttributeTypeName)); } if (model.FilterSysAttribute) { container.And(n => n.Name.NotIn(AttributeDefaults.SystemAttributes)); container.And(n => n.AttributeTypeName != AttributeTypeIds.PRIMARYKEY); } if (!model.IsSortBySeted) { model.SortBy = "name"; model.SortDirection = (int)SortDirection.Asc; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Schema.Domain.Attribute> result = _attributeFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <QueryView.Domain.QueryView> filter = FilterContainerBuilder.Build <QueryView.Domain.QueryView>(); filter.And(x => x.StateCode == RecordState.Enabled && x.IsDefault == false && x.IsPrivate == false); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _queryViewFinder.Query(x => x.Select(s => new { s.QueryViewId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(filter)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll()?.OrderBy(x => x.LocalizedName).ToList(); foreach (var item in entities) { var views = data.Where(x => x.EntityId == item.EntityId); if (!views.Any()) { continue; } var group1 = new PrivilegeResourceItem { Label = item.LocalizedName, Children = views.Select(x => (new PrivilegeResourceItem { Id = x.QueryViewId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList() }; result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult WorkFlowInstances(WorkFlowInstanceModel model) { if (model.WorkFlowId.Equals(Guid.Empty)) { return(NotFound()); } model.FlowInfo = _workFlowFinder.FindById(model.WorkFlowId); FilterContainer <WorkFlowInstance> filter = FilterContainerBuilder.Build <WorkFlowInstance>(); filter.And(n => n.WorkFlowId == model.WorkFlowId); if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <WorkFlowInstance> result = _workFlowInstanceService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; return(DynamicResult(model)); }
public static FilterContainer AndValueWithin <T>(this FilterContainer queryDescriptor, Expression <Func <T, Object> > fieldGetter, IEnumerable <Object> list) where T : class { var filterDescriptor = new FilterDescriptor <T>(); var termsFilter = filterDescriptor.Terms(fieldGetter, list); return(filterDescriptor.And(termsFilter, queryDescriptor)); }
// // Container Dropped event handler // private void ContainerDropped(object sender, EventArgs e) { FilterContainer fc = (FilterContainer)sender; // Close the dragging form _dragForm.ContainerDragging -= _containerDraggingHandler; _dragForm.End(); _dragForm.Dispose(); // Re-add the filter container to the panel int index = pnl_container.Controls.GetChildIndex(_containerReplacePanel); int scroll = pnl_container.VerticalScroll.Value; pnl_container.SuspendLayout(); pnl_container.Controls.Add(fc); pnl_container.Controls.SetChildIndex(fc, index); pnl_container.Controls.Remove(_containerReplacePanel); pnl_container.VerticalScroll.Value = scroll; pnl_container.ResumeLayout(true); // Re-sort the filter's index _filterContainers.Remove(fc); _filterContainers.Insert(index, fc); UpdateVisualization(); Focus(); BringToFront(); }
public IActionResult Index(LocalizationLabelsModel model) { return(ToBePerfected()); if (!model.IsSortBySeted) { model.SortBy = "ObjectColumnName"; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; FilterContainer <LocalizedLabel> filter = FilterContainerBuilder.Build <LocalizedLabel>(); if (model.TypeCode.HasValue) { filter.And(n => n.LabelTypeCode == model.TypeCode.Value); } var result = _localizedLabelService.QueryPaged(n => n.Page(model.Page, model.PageSize) .Where(filter) .Sort(s => s.OnFile(model.SortBy).ByDirection(model.SortDirection))); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Get([FromQuery] GetAttributesModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } FilterContainer <Schema.Domain.Attribute> container = FilterContainerBuilder.Build <Schema.Domain.Attribute>(); container.And(n => n.EntityId == model.EntityId); if (model.AttributeTypeName != null && model.AttributeTypeName.Length > 0) { container.And(n => n.AttributeTypeName.In(model.AttributeTypeName)); } List <Schema.Domain.Attribute> result = _attributeFinder.Query(x => x .Where(container) .Sort(n => n.OnFile("name").ByDirection(SortDirection.Asc)) ); if (model.FilterSysAttribute) { result.RemoveAll(n => n.IsSystemControl()); } return(JOk(result)); }
public IActionResult Index(SolutionModel model) { FilterContainer <Solution.Domain.Solution> container = FilterContainerBuilder.Build <Solution.Domain.Solution>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.Name.IsNotEmpty()) { container.And(n => n.Name == model.Name); } if (!model.IsSortBySeted) { model.SortBy = "Name"; model.SortDirection = (int)SortDirection.Asc; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Solution.Domain.Solution> result = _solutionService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; return(DynamicResult(model)); }
// // Container Dragged event handler // private void ContainerDragged(object sender, EventArgs e) { FilterContainer fc = (FilterContainer)sender; int scroll = pnl_container.VerticalScroll.Value; // Create a container replacement panel that is only used to occupy the previous spot occupied by the filter container _containerReplacePanel = new Panel { BorderStyle = BorderStyle.FixedSingle, Size = fc.Size }; _containerReplacePanel.PerformLayout(); // Remove the filter container from the container panel pnl_container.SuspendLayout(); pnl_container.Controls.Add(_containerReplacePanel); pnl_container.Controls.SetChildIndex(_containerReplacePanel, pnl_container.Controls.GetChildIndex(fc)); pnl_container.Controls.Remove(fc); pnl_container.ResumeLayout(); pnl_container.VerticalScroll.Value = scroll; pnl_container.PerformLayout(); // Create the form that is effectively dragged by the user _dragForm = new ContainerDragForm(fc); _dragForm.ContainerDragging += _containerDraggingHandler; _dragForm.Show(); }
public ICollection <PersistentEvent> GetMostRecent(string projectId, DateTime utcStart, DateTime utcEnd, PagingOptions paging, bool includeHidden = false, bool includeFixed = false, bool includeNotFound = true) { var filter = new FilterContainer(); if (!includeHidden) { filter &= !Filter <PersistentEvent> .Term(e => e.IsHidden, true); } if (!includeFixed) { filter &= !Filter <PersistentEvent> .Term(e => e.IsFixed, true); } if (!includeNotFound) { filter &= !Filter <PersistentEvent> .Term(e => e.Type, "404"); } if (utcStart != DateTime.MinValue) { filter &= Filter <PersistentEvent> .Range(r => r.OnField(e => e.Date).GreaterOrEquals(utcStart)); } if (utcEnd != DateTime.MaxValue) { filter &= Filter <PersistentEvent> .Range(r => r.OnField(e => e.Date).LowerOrEquals(utcEnd)); } return(Find(new ElasticSearchOptions <PersistentEvent>().WithProjectId(projectId).WithFilter(filter).WithIndices(utcStart, utcEnd).WithPaging(paging).WithSort(s => s.OnField(e => e.Date).Descending()))); }
public IActionResult EntityLogs(EntityLogsModel model) { model.Attributes = _attributeFinder.FindByEntityId(model.EntityId); FilterContainer <EntityLog> container = FilterContainerBuilder.Build <EntityLog>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); container.And(n => n.EntityId == model.EntityId); if (model.OperationType.HasValue) { container.And(n => n.OperationType == model.OperationType.Value); } if (model.GetAll) { List <EntityLog> result = _entityLogService.Query(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { PagedList <EntityLog> result = _entityLogService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(DynamicResult(model, $"~/Views/Entity/{WebContext.ActionName}.cshtml")); }
public IActionResult Get(SerialNumberModel model) { FilterContainer <SerialNumberRule> filter = FilterContainerBuilder.Build <SerialNumberRule>(); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name == model.Name); } if (model.GetAll) { model.Page = 1; model.PageSize = 25000; } else if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <SerialNumberRule> result = _serialNumberRuleFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(JOk(model)); }
public async Task Run() { var web3 = new Web3.Web3(TestConfiguration.BlockchainUrls.Infura.Rinkeby); var transactionHandler = new SimpleTransactionHandler(); var handlers = new HandlerContainer { TransactionHandler = transactionHandler }; //only tx sent to this address var transactionFilter = TransactionFilter.To("0xc0e15e11306334258d61fee52a22d15e6c9c59e0"); var filter = new FilterContainer(transactionFilter); var blockProcessor = BlockProcessorFactory.Create( web3, handlers, filter, processTransactionsInParallel: false); var processingStrategy = new ProcessingStrategy(blockProcessor); var blockchainProcessor = new BlockchainProcessor(processingStrategy); var result = await blockchainProcessor.ExecuteAsync(2830143, 2830153); Assert.True(result); Assert.Equal(12, transactionHandler.TransactionsHandled.Count); Assert.Empty(transactionHandler.ContractCreationTransactionsHandled); }
public IActionResult Index(ReportModel model) { FilterContainer <Report> filter = FilterContainerBuilder.Build <Report>(); filter.And(n => n.SolutionId == SolutionId.Value); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Report> result = _reportService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
private static AggregationDescriptor <FlowLog> GetAggregationDescriptor(AggregationDescriptor <FlowLog> descriptor, List <AggregationParameter> parameters) { if (parameters != null && parameters.Any()) { foreach (var parameter in parameters) { if (parameter.SourceAggExpression != null) { descriptor.Filters(parameter.AggregationIdentifier, f => f.Filters(filter => { FilterContainer container = new FilterContainer(); container &= filter.Query(t => t.Terms(parameter.SourceAggExpression.Field, parameter.SourceAggExpression.Values)); if (parameter.DestAggExpression != null) { container &= filter.Query(t => t.Terms(parameter.DestAggExpression.Field, parameter.DestAggExpression.Values)); } return(container); } ).Aggregations(ag1 => ag1.Terms(actionAggKey, t1 => t1.Field(f1 => f1.action). Aggregations(ag2 => ag2.Terms(protocolAggKey, t2 => t2.Field(f2 => f2.protocol). Aggregations(ag3 => ag3.Terms(dstPortAggKey, t3 => t3.Field(f3 => f3.dstport). Aggregations(a => a.Sum(sumOfBytesAggKey, byField => byField.Field(fieldName => fieldName.bytes)) .Sum(sumOfPacketsAggKey, byField => byField.Field(fieldName => fieldName.packets))))))))) ); } } } return(descriptor); }
public IActionResult Index(DashBoardModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <SystemForm> filter = FilterContainerBuilder.Build <SystemForm>(); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <SystemForm> result = _systemFormFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true, FormType.Dashboard); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public Task <FindResults <PersistentEvent> > GetMostRecentAsync(string projectId, DateTime utcStart, DateTime utcEnd, PagingOptions paging, bool includeHidden = false, bool includeFixed = false, bool includeNotFound = true) { var filter = new FilterContainer(); if (!includeHidden) { filter &= !Filter <PersistentEvent> .Term(e => e.IsHidden, true); } if (!includeFixed) { filter &= !Filter <PersistentEvent> .Term(e => e.IsFixed, true); } if (!includeNotFound) { filter &= !Filter <PersistentEvent> .Term(e => e.Type, "404"); } return(FindAsync(new ExceptionlessQuery() .WithProjectId(projectId) .WithElasticFilter(filter) .WithDateRange(utcStart, utcEnd, EventIndex.Fields.PersistentEvent.Date) .WithIndices(utcStart, utcEnd, $"'{_index.VersionedName}-'yyyyMM") .WithPaging(paging) .WithSort(EventIndex.Fields.PersistentEvent.Date, SortOrder.Descending))); }
public override void InitFilter(FilterContainer container, Configuration conf) { IDictionary <string, string> @params = new Dictionary <string, string>(); IList <string> proxies = WebAppUtils.GetProxyHostsAndPortsForAmFilter(conf); StringBuilder sb = new StringBuilder(); foreach (string proxy in proxies) { sb.Append(proxy.Split(":")[0]).Append(AmIpFilter.ProxyHostsDelimiter); } sb.Length = sb.Length - 1; @params[AmIpFilter.ProxyHosts] = sb.ToString(); string prefix = WebAppUtils.GetHttpSchemePrefix(conf); string proxyBase = GetApplicationWebProxyBase(); sb = new StringBuilder(); foreach (string proxy_1 in proxies) { sb.Append(prefix).Append(proxy_1).Append(proxyBase).Append(AmIpFilter.ProxyHostsDelimiter ); } sb.Length = sb.Length - 1; @params[AmIpFilter.ProxyUriBases] = sb.ToString(); container.AddFilter(FilterName, FilterClass, @params); }
public IActionResult Index(EntityMapModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <EntityMap> filter = FilterContainerBuilder.Build <EntityMap>(); filter.And(x => x.ParentEntityMapId == Guid.Empty); if (!model.EntityId.Equals(Guid.Empty)) { filter.And(n => n.TargetEntityId == model.EntityId); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <EntityMap> result = _entityMapFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public static FilterContainer ToContainer(PlainFilter filter, FilterContainer filterContainer = null) { if (filter == null) return null; var c = filterContainer ?? new FilterContainer(); IFilterContainer fc = c; filter.WrapInContainer(c); fc.Cache = filter.Cache; fc.CacheKey = filter.CacheKey; fc.FilterName = filter.FilterName; return c; }
public static PlainFilter operator &(PlainFilter leftQuery, PlainFilter rightQuery) { var lc = new FilterContainer(); leftQuery.WrapInContainer(lc); var rc = new FilterContainer(); rightQuery.WrapInContainer(rc); var query = ((lc && rc) as IFilterContainer).Bool; return new BoolFilter() { Must = query.Must, MustNot = query.MustNot, Should = query.Should }; }
private FilterContainer Read109_FilterContainer(bool isNullable, bool checkType) { XmlQualifiedName type = checkType ? base.GetXsiType() : null; bool flag = false; if (isNullable) { flag = base.ReadNull(); } if ((checkType && (type != null)) && ((type.Name != this.id56_FilterContainer) || (type.Namespace != this.id2_Item))) { if ((type.Name == this.id129_PanelContentContainer) && (type.Namespace == this.id2_Item)) { return this.Read172_PanelContentContainer(isNullable, false); } if ((type.Name == this.id57_NamedFilter) && (type.Namespace == this.id2_Item)) { return this.Read110_NamedFilter(isNullable, false); } if ((type.Name == this.id71_VirtualHighligher) && (type.Namespace == this.id2_Item)) { return this.Read114_VirtualHighligher(isNullable, false); } if ((type.Name != this.id72_ListViewHighlighter) || (type.Namespace != this.id2_Item)) { throw base.CreateUnknownTypeException(type); } return this.Read115_ListViewHighlighter(isNullable, false); } if (flag) { return null; } FilterContainer o = new FilterContainer(); bool[] flagArray = new bool[1]; while (base.Reader.MoveToNextAttribute()) { if (!base.IsXmlnsAttribute(base.Reader.Name)) { base.UnknownNode(o); } } base.Reader.MoveToElement(); if (base.Reader.IsEmptyElement) { base.Reader.Skip(); return o; } base.Reader.ReadStartElement(); base.Reader.MoveToContent(); int whileIterations = 0; int readerCount = base.ReaderCount; while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None)) { if (base.Reader.NodeType == XmlNodeType.Element) { if ((!flagArray[0] && (base.Reader.LocalName == this.id176_AggregatedFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read108_AggregatedVirtualItemFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id177_NameFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read103_VirtualItemNameFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id178_PropertyFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read84_VirtualPropertyFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id179_ContentFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read87_VirtualItemContentFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id180_NameListFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read107_VirtualItemNameListFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id181_HexContentFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read105_VirtualItemHexContentFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id182_AttributeFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read94_VirtualItemAttributeFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id183_SizeFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read98_VirtualItemSizeFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id184_DateFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read99_VirtualItemDateFilter(false, true); flagArray[0] = true; } else if ((!flagArray[0] && (base.Reader.LocalName == this.id185_TimeFilter)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.SerializableFilter = this.Read91_VirtualItemTimeFilter(false, true); flagArray[0] = true; } else { base.UnknownNode(o, ":AggregatedFilter, :NameFilter, :PropertyFilter, :ContentFilter, :NameListFilter, :HexContentFilter, :AttributeFilter, :SizeFilter, :DateFilter, :TimeFilter"); } } else { base.UnknownNode(o, ":AggregatedFilter, :NameFilter, :PropertyFilter, :ContentFilter, :NameListFilter, :HexContentFilter, :AttributeFilter, :SizeFilter, :DateFilter, :TimeFilter"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref whileIterations, ref readerCount); } base.ReadEndElement(); return o; }
private void Write109_FilterContainer(string n, string ns, FilterContainer o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } } else { if (!needType) { System.Type type = o.GetType(); if (type != typeof(FilterContainer)) { if (type == typeof(PanelContentContainer)) { this.Write172_PanelContentContainer(n, ns, (PanelContentContainer) o, isNullable, true); return; } if (type == typeof(NamedFilter)) { this.Write110_NamedFilter(n, ns, (NamedFilter) o, isNullable, true); return; } if (type == typeof(VirtualHighligher)) { this.Write114_VirtualHighligher(n, ns, (VirtualHighligher) o, isNullable, true); return; } if (type != typeof(ListViewHighlighter)) { throw base.CreateUnknownTypeException(o); } this.Write115_ListViewHighlighter(n, ns, (ListViewHighlighter) o, isNullable, true); return; } } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("FilterContainer", ""); } if (o.SerializableFilter != null) { if (o.SerializableFilter is VirtualItemSizeFilter) { this.Write98_VirtualItemSizeFilter("SizeFilter", "", (VirtualItemSizeFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemDateFilter) { this.Write99_VirtualItemDateFilter("DateFilter", "", (VirtualItemDateFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemHexContentFilter) { this.Write105_VirtualItemHexContentFilter("HexContentFilter", "", (VirtualItemHexContentFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemTimeFilter) { this.Write91_VirtualItemTimeFilter("TimeFilter", "", (VirtualItemTimeFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemContentFilter) { this.Write87_VirtualItemContentFilter("ContentFilter", "", (VirtualItemContentFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemAttributeFilter) { this.Write94_VirtualItemAttributeFilter("AttributeFilter", "", (VirtualItemAttributeFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemNameFilter) { this.Write103_VirtualItemNameFilter("NameFilter", "", (VirtualItemNameFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is AggregatedVirtualItemFilter) { this.Write108_AggregatedVirtualItemFilter("AggregatedFilter", "", (AggregatedVirtualItemFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualPropertyFilter) { this.Write84_VirtualPropertyFilter("PropertyFilter", "", (VirtualPropertyFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter is VirtualItemNameListFilter) { this.Write107_VirtualItemNameListFilter("NameListFilter", "", (VirtualItemNameListFilter) o.SerializableFilter, false, false); } else if (o.SerializableFilter != null) { throw base.CreateUnknownTypeException(o.SerializableFilter); } } base.WriteEndElement(o); } }