Ejemplo n.º 1
0
        public override async Task RefreshDataSetAsync(ConnectedSystemDataSet dataSet, CancellationToken cancellationToken)
        {
            Logger.LogDebug($"Refreshing DataSet {dataSet.Name}");

            var inputText        = dataSet.QueryConfig.Query ?? throw new ConfigurationException($"Missing Query in QueryConfig for dataSet '{dataSet.Name}'");
            var query            = new SubstitutionString(inputText);
            var substitutedQuery = query.ToString();
            // Send the query off to ServiceNow
            var connectedSystemItems = await _serviceNowClient
                                       .GetAllByQueryAsync(
                dataSet.QueryConfig.Type,
                substitutedQuery,
                extraQueryString : dataSet.QueryConfig.Options,
                cancellationToken : cancellationToken)
                                       .ConfigureAwait(false);

            Logger.LogDebug($"Got {connectedSystemItems.Count} results for {dataSet.Name}.");

            await ProcessConnectedSystemItemsAsync(
                dataSet,
                connectedSystemItems,
                ConnectedSystem,
                cancellationToken
                ).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        public override async Task RefreshDataSetAsync(ConnectedSystemDataSet dataSet, CancellationToken cancellationToken)
        {
            Logger.LogDebug($"Refreshing Jira DataSet {dataSet.Name}");

            var inputText        = dataSet.QueryConfig.Query ?? throw new ConfigurationException($"Missing Query in QueryConfig for dataSet '{dataSet.Name}'");
            var query            = new SubstitutionString(inputText);
            var substitutedQuery = query.ToString();

            List <JObject> connectedSystemItems;

            switch (dataSet.QueryConfig.Type)
            {
            case "Issue":
                var issues = await _jiraClient
                             .Issues
                             .GetIssuesFromJqlAsync(dataSet.QueryConfig.Query, token : cancellationToken)
                             .ConfigureAwait(false);

                connectedSystemItems = issues
                                       .Select(issue => JObject.FromObject(issue))
                                       .ToList();
                break;

            default:
                throw new NotSupportedException($"Jira type '{dataSet.QueryConfig.Type}' not supported.");
            }
            Logger.LogDebug($"Got {connectedSystemItems.Count} results for Jira dataset {dataSet.Name}.");

            await ProcessConnectedSystemItemsAsync(
                dataSet,
                connectedSystemItems,
                ConnectedSystem,
                cancellationToken
                ).ConfigureAwait(false);
        }
Ejemplo n.º 3
0
        public override async Task RefreshDataSetAsync(ConnectedSystemDataSet dataSet, CancellationToken cancellationToken)
        {
            using var connection = new SqlConnection(_connectedSystem.Credentials.ConnectionString);

            Logger.LogDebug($"Opening MS SQL connection for {_connectedSystem.Name}...");
            await connection
            .OpenAsync(cancellationToken)
            .ConfigureAwait(false);

            Logger.LogDebug($"Refreshing DataSet {dataSet.Name}");

            // Process any ncalc in the query
            var inputText        = dataSet.QueryConfig.Query ?? throw new ConfigurationException($"Missing Query in QueryConfig for dataSet '{dataSet.Name}'");
            var query            = new SubstitutionString(inputText);
            var substitutedQuery = query.ToString();

            // Send the query off to MS SQL Server
            var results = (await connection.QueryAsync <object>(substitutedQuery).ConfigureAwait(false)).ToList();

            Logger.LogDebug($"Got {results.Count} results for {dataSet.Name}.");

            // Convert to JObjects for easier generic manipulation
            var connectedSystemItems = results
                                       .ConvertAll(entity => JObject.FromObject(entity))
            ;

            await ProcessConnectedSystemItemsAsync(
                dataSet,
                connectedSystemItems,
                ConnectedSystem,
                cancellationToken)
            .ConfigureAwait(false);
        }
        public override async System.Threading.Tasks.Task RefreshDataSetAsync(ConnectedSystemDataSet dataSet, CancellationToken cancellationToken)
        {
            Logger.LogDebug($"Refreshing DataSet {dataSet.Name}");

            var inputText        = dataSet.QueryConfig.Query ?? throw new ConfigurationException($"Missing Query in QueryConfig for dataSet '{dataSet.Name}'");
            var query            = new SubstitutionString(inputText);
            var substitutedQuery = query.ToString();
            // Send the query off to AutoTask
            var autoTaskResult = await _autoTaskClient
                                 .GetAllAsync(substitutedQuery, cancellationToken)
                                 .ConfigureAwait(false);

            Logger.LogDebug($"Got {autoTaskResult.Count():N0} results for {dataSet.Name}.");
            // Convert to JObjects for easier generic manipulation
            var connectedSystemItems = autoTaskResult
                                       .Select(entity => JObject.FromObject(entity))
                                       .ToList();

            await ProcessConnectedSystemItemsAsync(
                dataSet,
                connectedSystemItems,
                ConnectedSystem,
                cancellationToken
                ).ConfigureAwait(false);
        }
Ejemplo n.º 5
0
        public override async Task RefreshDataSetAsync(ConnectedSystemDataSet dataSet, CancellationToken cancellationToken)
        {
            Logger.LogDebug($"Refreshing DataSet {dataSet.Name}");
            var inputText        = dataSet.QueryConfig.Query ?? throw new ConfigurationException($"Missing Query in QueryConfig for dataSet '{dataSet.Name}'");
            var query            = new SubstitutionString(inputText);
            var substitutedQuery = query.ToString();

            var connectedSystemItems = await _salesforceClient.GetAllJObjectsAsync(substitutedQuery).ConfigureAwait(false);

            Logger.LogDebug($"Got {connectedSystemItems.Count} results for {dataSet.Name}.");

            await ProcessConnectedSystemItemsAsync(
                dataSet,
                connectedSystemItems,
                ConnectedSystem,
                cancellationToken)
            .ConfigureAwait(false);
        }