Exemplo n.º 1
0
        public static Expression <Func <Output, bool> > GetQuery(OutputFilter filter)
        {
            Expression <Func <Output, bool> > expression = order => true;

            if (!string.IsNullOrEmpty(filter.Description))
            {
                expression = expression.And(x => x.Description.Contains(filter.Description));
            }

            if (filter.State.HasValue)
            {
                expression = expression.And(x => x.State == (OutputState)Enum.Parse(typeof(OutputState),
                                                                                    filter.State.ToString()));
            }

            if (filter.DateInitial.HasValue)
            {
                expression = expression.And(x => x.Date >= filter.DateInitial);
            }

            if (filter.DateEnd.HasValue)
            {
                expression = expression.And(x => x.Date <= filter.DateEnd);
            }

            return(expression);
        }
Exemplo n.º 2
0
        public void GetErrorFilterTest()
        {
            bool         enableMultiLine         = true;
            Regex        errRegex                = new Regex(@"(?s)<error>[\\s*]*(?<ErrorMessage>.*?)[\\s*]*</error>");
            OutputFilter errorFilter             = OutputFilter.GetErrorFilter(errRegex, enableMultiLine);
            const string ErrText                 = @"
* BEFORE *
* <error> *
* err1 *
* </error> *
* AFTER *
* <error>err2</error> * <error>err3</error> *
";
            var          expectedErrOutputChunks = new[]
            {
                @" *
* err1 *
* ",
                "err2",
                "err3"
            };

            var expectedErrOutput = string.Join(Environment.NewLine, expectedErrOutputChunks);

            XAssert.AreEqual(expectedErrOutput, errorFilter.ExtractMatches(ErrText));
        }
Exemplo n.º 3
0
        private void FillDropDownlist()
        {
            //Add select text
            ddlOutputFormats.Items.Add(new ListItem(LocalizationManager.GetLocalizedString("CtrlSaveQuerySelectFormat"), "selectFormat"));

            List <string> _outputFormats = new List <string>();

            _outputFormats = (List <string>)PXWeb.Settings.Current.Presentation.CommandBar.OutputFormats;
            //Add a heading for dropdown
            //SaveQueryAsDropDownList.Items.Add(LocalizationManager.GetLocalizedString(SAVE_AS_CAPTION));
            //Add choice to save query for screen
            var screenItem = new ListItem(LocalizationManager.GetLocalizedString(SAVEQUERY_FOR_SCREEN), "SCREEN");

            screenItem.Selected = true; //Default selected
            ddlOutputFormats.Items.Add(screenItem);

            if (OutputFilter != null)
            {
                foreach (string item in _outputFormats)
                {
                    if (OutputFilter.UseOutputFormat(item))
                    {
                        ddlOutputFormats.Items.Add(new ListItem(LocalizationManager.GetLocalizedString(item), item));
                    }
                }
            }
        }
Exemplo n.º 4
0
        public PersonList GetPersonFromPersonId(int personId)
        {
            QueryDefinition qd = new QueryDefinition();

            Connects.Profiles.Service.DataContracts.Profiles profiles = new Connects.Profiles.Service.DataContracts.Profiles();
            profiles.Version                  = 2;
            profiles.QueryDefinition          = qd;
            profiles.QueryDefinition.PersonID = personId.ToString();

            OutputOptions oo = new OutputOptions();

            oo.SortType    = OutputOptionsSortType.QueryRelevance;
            oo.StartRecord = "0";

            OutputFilterList ofl = new OutputFilterList();
            OutputFilter     of  = new OutputFilter();

            of.Summary = false;
            of.Text    = "CoAuthorList";

            ofl.OutputFilter = new List <OutputFilter>();
            ofl.OutputFilter.Add(of);

            oo.OutputFilterList    = ofl;
            profiles.OutputOptions = oo;

            bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));

            profiles.Version = 2;

            return(ProfileSearch(profiles, isSecure));
        }
Exemplo n.º 5
0
        public void GetPipPropertyFilterTest()
        {
            bool         enableMultiLine            = true;
            OutputFilter propertyFilter             = OutputFilter.GetPipPropertiesFilter(enableMultiLine);
            const string OutputText                 = @"RandomTextPipProperty_SomeProp_123456_EndPropertyOtherRandomText";
            const string ExpectedPipPropertyMatches = @"SomeProp_123456";

            XAssert.AreEqual(ExpectedPipPropertyMatches, propertyFilter.ExtractMatches(OutputText));
        }
        public Client()
        {
            var receiver = TransponderReceiverFactory.CreateTransponderDataReceiver();

            _convertFilter       = new ConvertFilter(receiver, new CompasCourse(), new Velocity());
            _airplaneValidation  = new AirplaneValidation(_convertFilter);
            _outputFilter        = new OutputFilter(_airplaneValidation);
            _separationCondition = new CheckSeparationCondition(_airplaneValidation);
        }
Exemplo n.º 7
0
        //[Breadcrumb(Title = "Последовательность", FromAction = "Index")]
        public IActionResult Sequence(int id, int worshipId, OutputFilter filter)
        {
            if (filter == null)
            {
                filter = new OutputFilter()
                {
                    Language = "cs-ru"
                };
            }

            var worshipResult = _queryProcessor.Process(new OutputWorshipQuery(worshipId, filter));

            return(View(worshipResult));
        }
Exemplo n.º 8
0
        public void GetErrorFilterTest()
        {
            bool         enableMultiLine   = true;
            Regex        errRegex          = new Regex(@"(?s)<error>[\\s*]*(?<ErrorMessage>.*?)[\\s*]*</error>");
            OutputFilter errorFilter       = OutputFilter.GetErrorFilter(errRegex, enableMultiLine);
            const string ErrText           = @"
* BEFORE *
* <error> *
* err1 *
* </error> *
* AFTER *
* <error>err2</error> * <error>err3</error> *
";
            const string ExpectedErrOutput = @" *
* err1 *
* 
err2
err3";

            XAssert.AreEqual(ExpectedErrOutput, errorFilter.ExtractMatches(ErrText));
        }
Exemplo n.º 9
0
        public ChangeManager(IEnumerable <IProcessor> processors, OutputFilter outputFilter)
        {
            if (processors == null)
            {
                throw new ArgumentNullException("processors");
            }

            if (outputFilter == null)
            {
                throw new ArgumentNullException("outputFilter");
            }

            this.processors   = processors.ToArray();
            this.outputFilter = outputFilter;

            this.cancellation = new CancellationTokenSource();

            this.taskFactory = new TaskFactory(this.cancellation.Token);

            this.taskFactory.StartNew(() => this.ProcessInput(), TaskCreationOptions.LongRunning);
            this.taskFactory.StartNew(() => this.ProcessMetrics(), TaskCreationOptions.LongRunning);
        }
Exemplo n.º 10
0
        public ConfigurationAppStarter()
        {
            var processorsFactory = new ProcessorFactory();

            LogMonitorConfiguration configuration = LogMonitorConfiguration.Instance;

            this.processors = new List <IProcessor>();

            // Set to right "context"
            Environment.CurrentDirectory = Path.GetDirectoryName(typeof(Kernel).Assembly.Location);

            foreach (ParserElement parser in configuration.Parser)
            {
                processors.Add(processorsFactory.Create(parser.ScriptPath, parser.Pattern));
            }

            var outputFactory = new OutputFactory(
                GraphiteConfiguration.Instance == null ? null : GraphiteConfiguration.Instance.Graphite,
                GraphiteConfiguration.Instance == null ? null : GraphiteConfiguration.Instance.StatsD);

            this.outputFilter = outputFactory.CreateFilter(
                configuration.Output.Cast <IOutputConfiguration>());
        }
    private void BindGrdCoAuthors()
    {
        Profiles searchReq = ProfileHelper.GetNewProfilesDefinition();

        searchReq.QueryDefinition.PersonID = System.Convert.ToString(ProfileId);

        //searchReq.OutputOptions.OutputFilterList = new OutputFilterList();

        OutputFilterList    reqOutputFilterList = new OutputFilterList();
        List <OutputFilter> reqFilterList       = new List <OutputFilter>(1);

        OutputFilter reqFilter = new OutputFilter()
        {
            Summary = false, Text = "CoAuthorList"
        };

        reqFilterList.Add(reqFilter);
        reqOutputFilterList.OutputFilter = reqFilterList;

        searchReq.OutputOptions.OutputFilterList = reqOutputFilterList;

        grdAuthors.DataSource = new Connects.Profiles.Service.ServiceImplementation.ProfileService().ProfileSearch(searchReq).Person[0].PassiveNetworks.CoAuthorList.CoAuthor;
        grdAuthors.DataBind();
    }
Exemplo n.º 12
0
    public static Profiles AddPassiveNetworkOption(Profiles profile, bool summary)
    {
        OutputFilterList ofl = new OutputFilterList();

        ofl.Default = OutputFilterDefaultEnum.all;

        ofl.OutputFilter = new List <OutputFilter>();
        OutputFilter of = new OutputFilter();

        // Keyword List
        of.Summary = summary;
        of.Text    = "KeywordList";
        ofl.OutputFilter.Add(of);

        // SimilarPersonList
        of         = new OutputFilter();
        of.Summary = summary;
        of.Text    = "SimilarPersonList";
        ofl.OutputFilter.Add(of);

        // CoAuthorList
        of         = new OutputFilter();
        of.Summary = summary;
        of.Text    = "CoAuthorList";
        ofl.OutputFilter.Add(of);

        // NeighborList
        of         = new OutputFilter();
        of.Summary = summary;
        of.Text    = "NeighborList";
        ofl.OutputFilter.Add(of);

        profile.OutputOptions.OutputFilterList = ofl;

        return(profile);
    }
Exemplo n.º 13
0
 public OutputWorshipQuery(int id, [NotNull] OutputFilter filter)
 {
     Id     = id;
     Filter = filter ?? throw new ArgumentNullException(nameof(OutputFilter));
 }
Exemplo n.º 14
0
 internal PdfGenerator(string name, OutputFilter filter, Action <string, byte[]> writer = null)
 {
     this.name   = name;
     this.writer = writer ?? File.WriteAllBytes;
     this.filter = filter;
 }
 public void Setup()
 {
     _planeSource = Substitute.For <IAirplaneValidation>();
     _uut         = new OutputFilter(_planeSource);
 }
Exemplo n.º 16
0
 public OutputDayQuery(int typiconId, DateTime date, OutputFilter filter)
 {
     TypiconId = typiconId;
     Date      = date;
     Filter    = filter ?? throw new ArgumentNullException(nameof(OutputFilter));
 }
Exemplo n.º 17
0
        public Kernel(IEnumerable <IProcessor> processors, IEnumerable <IWatchConfiguration> watchList, OutputFilter outputFilter)
        {
            if (watchList == null)
            {
                throw new ArgumentNullException("watchList");
            }

            if (processors == null)
            {
                throw new ArgumentNullException("processors");
            }

            this.manager = new ChangeManager(processors, outputFilter);

            Lazy <W3CProcessor> w3CProcessor = new Lazy <W3CProcessor>(() => new W3CProcessor());
            DefaultPreProcessor preProcessor = new DefaultPreProcessor();

            foreach (var item in watchList)
            {
                FileNotificationService watcher = this.CreateWatcher(item);

                if (watcher != null)
                {
                    this.watchers.Add(watcher);

                    IPreProcessor selectedPreProcessor;

                    if (!string.IsNullOrEmpty(item.Type) && "w3c".Equals(item.Type, StringComparison.OrdinalIgnoreCase))
                    {
                        selectedPreProcessor = w3CProcessor.Value;
                    }
                    else
                    {
                        selectedPreProcessor = preProcessor;
                    }

                    watcher.ContentAdded += (object o, ContentEventArgs e) => this.manager.Add(selectedPreProcessor.Process(e.FileName, e.AddedContent));
                }
            }
        }
 public OutputDayBySystemNameQuery(string systemName, DateTime date, OutputFilter filter)
 {
     SystemName = systemName;
     Date       = date;
     Filter     = filter ?? throw new ArgumentNullException(nameof(OutputFilter));
 }