Esempio n. 1
0
        //public void OnGet()
        //{
        //    //PiSystems = adapter.GetPiSystemsAsync().GetAwaiter().GetResult();
        //    OnGet(0, 10);
        //}

        public void OnGet(int index, int quantity)
        {
            ListContinuationToken ltoken;

            if (index == 0 && quantity == 0)
            {
                ltoken = new ListContinuationToken {
                    Index = 0, Quantity = 10
                };
            }
            else
            {
                ltoken = new ListContinuationToken {
                    Index = index, Quantity = quantity
                };
            }

            ltoken = adapter.GetPiSystemsAsync(ltoken).GetAwaiter().GetResult();

            if (ltoken == null)
            {
                return;
            }

            foreach (string item in ltoken.Items)
            {
                EventMetadata metadata = adapter.GetMetadataAsync(item).GetAwaiter().GetResult();
                Container.Add(item, metadata);
            }

            Index    = ltoken.Index;
            Quantity = ltoken.Quantity;
        }
        protected override void ProcessRecord()
        {
            string url = $"{ServiceUrl}/api/resource/PageSigmaAlgebra";

            RestRequestBuilder builder =
                new RestRequestBuilder("POST", url, RestConstants.ContentType.Json, false, SecurityToken);
            RestRequest           request   = new RestRequest(builder);
            ListContinuationToken listToken =
                request.Post <ListContinuationToken, ListContinuationToken>(ContinuationToken);

            WriteObject(listToken);
        }
Esempio n. 3
0
        public async Task <ListContinuationToken> GetListAsync(ListContinuationToken token)
        {
            _ = token ?? throw new ArgumentNullException(nameof(token));

            long id = 1;
            ISigmaAlgebraChain chain = GrainFactory.GetGrain <ISigmaAlgebraChain>(id);

            _ = token.Filter != null ? await chain.GetCountAsync(token.Filter) : await chain.GetCountAsync();

            if (token.Filter != null)
            {
                List <string> filterItems = await GetListAsync(token.Index, token.PageSize, token.Filter);

                return(await Task.FromResult(new ListContinuationToken(token.Index + filterItems.Count, token.Quantity,
                                                                       token.PageSize, token.Filter, filterItems)));
            }

            List <string> items = await GetListAsync(token.Index, token.PageSize);

            return(await Task.FromResult(new ListContinuationToken(token.Index + items.Count, token.Quantity,
                                                                   token.PageSize, items)));
        }
Esempio n. 4
0
        public async Task <ActionResult <ListContinuationToken> > GetSigmaAlgebra(ListContinuationToken token)
        {
            try
            {
                ListContinuationToken continuationToken = await graphManager.GetSigmaAlgebraAsync(token);

                logger?.LogInformation("Returning sigma algebra");
                if (continuationToken == null)
                {
                    logger?.LogWarning("No sigma algebras found.");
                }
                else
                {
                    logger?.LogInformation("Sigma algebras returned.");
                }

                return(StatusCode(200, continuationToken));
            }
            catch (Exception ex)
            {
                logger?.LogError(ex, "Error getting sigma algebra");
                return(StatusCode(500, ex.Message));
            }
        }
 public SerializableListContinuationToken(ListContinuationToken listContinuationToken)
 {
     this.ListContinuationToken = listContinuationToken;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferEntry" /> class.
 /// </summary>
 /// <param name="relativePath">Relative path of the file indicated by this entry.</param>
 /// <param name="continuationToken">Continuation token when listing to this entry.</param>
 public TransferEntry(string relativePath, ListContinuationToken continuationToken)
 {
     this.RelativePath      = relativePath;
     this.ContinuationToken = continuationToken;
 }
 public SerializableListContinuationToken(ListContinuationToken listContinuationToken)
 {
     this.ListContinuationToken = listContinuationToken;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferEntry" /> class.
 /// </summary>
 /// <param name="relativePath">Relative path of the file indicated by this entry.</param>
 /// <param name="continuationToken">Continuation token when listing to this entry.</param>
 public TransferEntry(string relativePath, ListContinuationToken continuationToken)
 {
     this.RelativePath = relativePath;
     this.ContinuationToken = continuationToken;
 }
Esempio n. 9
0
 public async Task <ListContinuationToken> GetPiSystemsAsync(ListContinuationToken token)
 {
     return(await manager.GetSigmaAlgebraAsync(token));
 }
Esempio n. 10
0
        public async Task <ListContinuationToken> GetSigmaAlgebraAsync(ListContinuationToken token)
        {
            ISigmaAlgebra resourceList = client.GetGrain <ISigmaAlgebra>("resourcelist");

            return(await resourceList.GetListAsync(token));
        }