Ejemplo n.º 1
0
        protected override PowerShellResults <JsonDictionary <object> > ExecuteCore(Workflow workflow)
        {
            PowerShellResults <JsonDictionary <object> > powerShellResults = new PowerShellResults <JsonDictionary <object> >();
            PowerShellResults powerShellResults2 = workflow.Run(base.Input, base.Table, base.DataObjectStore, base.ProfileBuilder.Class, delegate(string result, bool fillAllColumns)
            {
            });

            powerShellResults.MergeErrors(powerShellResults2);
            powerShellResults.MergeProgressData <JsonDictionary <object> >(powerShellResults2 as PowerShellResults <JsonDictionary <object> >);
            if (powerShellResults.ErrorRecords.Length == 0)
            {
                using (EcpPerformanceData.DDITypeConversion.StartRequestTimer())
                {
                    Dictionary <string, object>     dictionary = null;
                    List <JsonDictionary <object> > list       = new List <JsonDictionary <object> >();
                    IList <string> outputList = base.GetOutputVariables(base.OutputVariableWorkflow);
                    DataColumn[]   columns    = (from DataColumn c in base.Table.Columns
                                                 where outputList == null || outputList.Contains(c.ColumnName, StringComparer.OrdinalIgnoreCase)
                                                 select c).ToArray <DataColumn>();
                    foreach (object obj in base.Table.DefaultView)
                    {
                        DataRowView dataRowView = (DataRowView)obj;
                        base.ExtractDataRow(dataRowView.Row, columns, out dictionary);
                        list.Add(dictionary);
                    }
                    this.AddSortDataToResult(powerShellResults, list, outputList);
                    if (this.sortOptions != null && outputList.Contains(this.sortOptions.PropertyName))
                    {
                        Func <JsonDictionary <object>[], JsonDictionary <object>[]> ddisortFunction = this.sortOptions.GetDDISortFunction();
                        powerShellResults.Output = ddisortFunction(list.ToArray());
                    }
                    else
                    {
                        powerShellResults.Output = list.ToArray();
                    }
                    GetListWorkflow getListWorkflow = workflow as GetListWorkflow;
                    if (getListWorkflow != null)
                    {
                        int resultSizeInt = getListWorkflow.GetResultSizeInt32(base.Input, base.Table);
                        if (resultSizeInt > 0 && resultSizeInt < list.Count)
                        {
                            powerShellResults.Output = powerShellResults.Output.Take(resultSizeInt).ToArray <JsonDictionary <object> >();
                            if (!powerShellResults.Warnings.Contains(Strings.WarningMoreResultsAvailable))
                            {
                                powerShellResults.Warnings = powerShellResults.Warnings.Concat(new string[]
                                {
                                    Strings.WarningMoreResultsAvailable
                                }).ToArray <string>();
                            }
                        }
                    }
                }
            }
            DDIHelper.Trace(TraceType.InfoTrace, "Result: ");
            DDIHelper.Trace <PowerShellResults <JsonDictionary <object> > >(TraceType.InfoTrace, powerShellResults);
            return(powerShellResults);
        }
Ejemplo n.º 2
0
 protected GetListWorkflow(GetListWorkflow workflow) : base(workflow)
 {
     this.ResultSize = workflow.ResultSize;
 }