当前位置: 首页>>代码示例>>C#>>正文


C# ErrorResultTO.AddError方法代码示例

本文整理汇总了C#中Dev2.DataList.Contract.ErrorResultTO.AddError方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorResultTO.AddError方法的具体用法?C# ErrorResultTO.AddError怎么用?C# ErrorResultTO.AddError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dev2.DataList.Contract.ErrorResultTO的用法示例。


在下文中一共展示了ErrorResultTO.AddError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MockExecutionImpl

 public System.Guid MockExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out DataList.Contract.ErrorResultTO tmpErrors)
 {
     
     tmpErrors = new ErrorResultTO();
     tmpErrors.AddError("Something bad happened");
     return Guid.Empty;
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:7,代码来源:MockDsfPluginActivity.cs

示例2: ExecuteConcreteAction

        protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors)
        {

            IList<OutputTO> outputs = new List<OutputTO>();

            allErrors = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables
            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath));
            colItr.AddVariableToIterateOn(inputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username));
            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(Password)); 
            colItr.AddVariableToIterateOn(passItr);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(InputPath, "Input Path", dataObject.Environment);
                AddDebugInputItemUserNamePassword(dataObject.Environment);
            }

            while(colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                IActivityIOPath ioPath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                                colItr.FetchNextValue(unameItr),
                                                                                colItr.FetchNextValue(passItr),
                                                                                true);

                IActivityIOOperationsEndPoint endpoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ioPath);
                try
                {
                    string result = broker.Get(endpoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch(Exception e)
                {
                    outputs[0].OutputStrings.Add(null);
                    allErrors.AddError(e.Message);
                    break;
                }

            }

            return outputs;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:51,代码来源:DsfFileRead.cs

示例3: Execute

        public override Guid Execute(out ErrorResultTO errors)
        {
            errors = new ErrorResultTO();
            var invokeErrors = new ErrorResultTO();
            Guid result = GlobalConstants.NullDataListID;

            try
            {
                EsbManagementServiceLocator emsl = new EsbManagementServiceLocator();
                IEsbManagementEndpoint eme = emsl.LocateManagementService(ServiceAction.Name);

                if(eme != null)
                {
                    // Web request for internal service ;)
                    if(Request.Args == null)
                    {
                        GenerateRequestDictionaryFromDataObject(out invokeErrors);
                        errors.MergeErrors(invokeErrors);
                    }

                    var res = eme.Execute(Request.Args, TheWorkspace);
                    Request.ExecuteResult = res;
                    errors.MergeErrors(invokeErrors);
                    result = DataObject.DataListID;
                    Request.WasInternalService = true;
                }
                else
                {
                    errors.AddError("Could not locate management service [ " + ServiceAction.ServiceName + " ]");
                }
            }
            catch(Exception ex)
            {
                errors.AddError(ex.Message);
            }

            return result;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:38,代码来源:InternalServiceContainer.cs

示例4: DoRecordSetAppending

        internal static void DoRecordSetAppending(ErrorResultTO errors, IBinaryDataListEntry entry, StringBuilder result)
        {
            var cnt = entry.FetchLastRecordsetIndex();
            var cols = entry.Columns;
            if(!cols.Any(c => c.ColumnIODirection == enDev2ColumnArgumentDirection.Both || c.ColumnIODirection == enDev2ColumnArgumentDirection.Input))
            {
                return;
            }
            for(var i = 1; i <= cnt; i++)
            {
                string error;
                var rowData = entry.FetchRecordAt(i, out error);
                errors.AddError(error);

                result.Append("<");
                result.Append(entry.Namespace);
                result.Append(">");

                foreach(var col in rowData)
                {

                    var fName = col.FieldName;

                    if(cols.Any(c => c.ColumnName == fName &&
                        (c.ColumnIODirection == enDev2ColumnArgumentDirection.Both || c.ColumnIODirection == enDev2ColumnArgumentDirection.Input)))
                    {

                        result.Append("<");
                        result.Append(fName);
                        result.Append(">");
                        try
                        {
                            result.Append(col.TheValue);
                        }
                        // ReSharper disable EmptyGeneralCatchClause
                        catch (Exception)
                        {
                        }
                        result.Append("</");
                        result.Append(fName);
                        result.Append(">");
                    }
                }

                result.Append("</");
                result.Append(entry.Namespace);
                result.Append(">");
            }
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:49,代码来源:StudioTranslator.cs

示例5: ExecuteConcreteAction

        protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {

            IList<OutputTO> outputs = new List<OutputTO>();

            allErrors = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables
            
            var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));
            colItr.AddVariableToIterateOn(outputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
            colItr.AddVariableToIterateOn(passItr);

            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", dataObject.Environment, update));
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
            }

            while(colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                Dev2CRUDOperationTO opTo = new Dev2CRUDOperationTO(Overwrite);

                try
                {
                    IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(outputItr),
                                                                                colItr.FetchNextValue(unameItr),
                                                                                colItr.FetchNextValue(passItr),
                                                                                true);

                    IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                    string result = broker.Create(dstEndPoint, opTo, true);
                    outputs.Add(DataListFactory.CreateOutputTO(Result, result));
                }
                catch(Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return outputs;
        }
开发者ID:ndubul,项目名称:Chillas,代码行数:52,代码来源:DsfPathCreate.cs

示例6: ForEachBootstrapTOOld

        //MO - Changed : new ctor that accepts the new arguments
        public ForEachBootstrapTOOld(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, Guid dlID, IDataListCompiler compiler, out ErrorResultTO errors)
        {
            errors = new ErrorResultTO();
            ForEachType = forEachType;
            IDev2IteratorCollection colItr = Dev2ValueObjectFactory.CreateIteratorCollection();
            IndexIterator localIndexIterator;
            IndexList indexList;

            switch(forEachType)
            {
                case enForEachType.InRecordset:
                    IBinaryDataListEntry recordset = compiler.Evaluate(dlID, enActionType.User, recordsetName, false, out errors);

                    if(recordset == null || !recordset.IsRecordset)
                    {
                        errors.AddError("When selecting a recordset only valid recordsets can be used");
                        break;
                    }


                    var isEmpty = recordset.IsEmpty();
                    if(isEmpty)
                    {
                        indexList = new IndexList(new HashSet<int> { 1 }, 0);
                        localIndexIterator = new IndexIterator(new HashSet<int> { 1 }, 0);
                    }
                    else
                    {
                        indexList = new IndexList(new HashSet<int>(), 0) { MinValue = 1, MaxValue = recordset.FetchLastRecordsetIndex() };
                        localIndexIterator = new IndexIterator(new HashSet<int>(), 0);
                    }

                    localIndexIterator.IndexList = indexList;
                    IndexIterator = localIndexIterator;
                    break;

                case enForEachType.InRange:
                    if(string.IsNullOrWhiteSpace(from))
                    {
                        errors.AddError("The from field can not be left empty.");
                        break;
                    }

                    if(string.IsNullOrWhiteSpace(to))
                    {
                        errors.AddError("The to field can not be left empty.");
                        break;
                    }

                    if(from.Contains("(*)"))
                    {
                        errors.AddError("The Star notation is not accepted in the From field.");
                        break;
                    }

                    var fromItr = CreateDataListEvaluateIterator(from, dlID, compiler, colItr, errors);
                    colItr.AddIterator(fromItr);

                    int intFrom;
                    if(!int.TryParse(colItr.FetchNextRow(fromItr).TheValue, out intFrom) || intFrom < 1)
                    {
                        errors.AddError("From range must be a whole number from 1 onwards.");
                        break;
                    }

                    if(to.Contains("(*)"))
                    {
                        errors.AddError("The Star notation is not accepted in the To field.");
                        break;
                    }

                    var toItr = CreateDataListEvaluateIterator(to, dlID, compiler, colItr, errors);
                    colItr.AddIterator(toItr);

                    int intTo;
                    if(!int.TryParse(colItr.FetchNextRow(toItr).TheValue, out intTo) || intTo < 1)
                    {
                        errors.AddError("To range must be a whole number from 1 onwards.");
                        break;
                    }
                    if(intFrom > intTo)
                    {
                        indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo };
                        ReverseIndexIterator revIdxItr = new ReverseIndexIterator(new HashSet<int>(), 0) { IndexList = indexList };
                        IndexIterator = revIdxItr;
                    }
                    else
                    {
                        indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo };
                        localIndexIterator = new IndexIterator(new HashSet<int>(), 0) { IndexList = indexList };
                        IndexIterator = localIndexIterator;
                    }

                    break;
                case enForEachType.InCSV:
                    var csvIndexedsItr = CreateDataListEvaluateIterator(csvNumbers, dlID, compiler, colItr, errors);
                    colItr.AddIterator(csvIndexedsItr);
                    ErrorResultTO allErrors;
                    List<int> listOfIndexes = SplitOutCsvIndexes(colItr.FetchNextRow(csvIndexedsItr).TheValue, out allErrors);
//.........这里部分代码省略.........
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:101,代码来源:ForEachBootstrapTO.cs

示例7: ExecuteConcreteAction

        protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {

            IList<OutputTO> outputs = new List<OutputTO>();


            allErrors = new ErrorResultTO();

            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables

            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath, update));
            colItr.AddVariableToIterateOn(inputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
            colItr.AddVariableToIterateOn(passItr);

            var privateKeyItr = new WarewolfIterator(dataObject.Environment.Eval(PrivateKeyFile, update));
            colItr.AddVariableToIterateOn(privateKeyItr);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(InputPath, "Input Path", dataObject.Environment, update);
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Private Key File", dataObject.Environment, update);
                }
            }

            while(colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();

                try
                {
                    IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                                colItr.FetchNextValue(unameItr),
                                                                                colItr.FetchNextValue(passItr),
                                                                                true, colItr.FetchNextValue(privateKeyItr));
                    IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                    string result = broker.Delete(dstEndPoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch(Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
                    //outputs[0].OutputStrings.Add(null);
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return outputs;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:61,代码来源:DsfPathDelete.cs

示例8: Invoke

        /// <summary>
        /// Invokes the specified service as per the dataObject against theHost
        /// </summary>
        /// <param name="dataObject">The data object.</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Can only execute workflows from web browser</exception>
        public Guid Invoke(IDSFDataObject dataObject, out ErrorResultTO errors)
        {
            var result = GlobalConstants.NullDataListID;
            var time = new Stopwatch();
            time.Start();
            errors = new ErrorResultTO();
            int update = 0;
            // BUG 9706 - 2013.06.22 - TWR : added pre debug dispatch
            if(dataObject.Environment.HasErrors())
            {
                errors.AddError(dataObject.Environment.FetchErrors());
                DispatchDebugErrors(errors, dataObject, StateType.Before);
            }
            errors.ClearErrors();
            try
            {
                var serviceId = dataObject.ResourceID;

                // we need to get better at getting this ;)

                var serviceName = dataObject.ServiceName;
                if(serviceId == Guid.Empty && string.IsNullOrEmpty(serviceName))
                {
                    errors.AddError(Resources.DynamicServiceError_ServiceNotSpecified);
                }
                else
                {

                    try
                    {
                        var sl = new ServiceLocator();
                        Dev2Logger.Log.Debug("Finding service");
                        var theService = serviceId == Guid.Empty ? sl.FindService(serviceName, _workspace.ID) : sl.FindService(serviceId, _workspace.ID);

                        if(theService == null)
                        {
                            errors.AddError("Service [ " + serviceName + " ] not found.");
                        }
                        else if(theService.Actions.Count <= 1)
                        {
                            #region Execute ESB container

                            var theStart = theService.Actions.FirstOrDefault();
                            if(theStart != null && theStart.ActionType != Common.Interfaces.Core.DynamicServices.enActionType.InvokeManagementDynamicService && theStart.ActionType != Common.Interfaces.Core.DynamicServices.enActionType.Workflow && dataObject.IsFromWebServer)
                            {
                                throw new Exception("Can only execute workflows from web browser");
                            }
                            Dev2Logger.Log.Debug("Mapping Action Dependencies");
                            MapServiceActionDependencies(theStart, sl);

                            // Invoke based upon type ;)
                            if(theStart != null)
                            {
                                theStart.DataListSpecification = theService.DataListSpecification;
                                Dev2Logger.Log.Debug("Getting container");
                                var container = GenerateContainer(theStart, dataObject, _workspace);
                                ErrorResultTO invokeErrors;
                                result = container.Execute(out invokeErrors, update);
                                errors.MergeErrors(invokeErrors);
                            }
                            #endregion
                        }
                        else
                        {
                            errors.AddError("Malformed Service [ " + serviceId + " ] it contains multiple actions");
                        }
                    }
                    catch(Exception e)
                    {
                        errors.AddError(e.Message);
                    }
                    finally
                    {
                        if (dataObject.Environment.HasErrors())
                        {
                            var errorString = dataObject.Environment.FetchErrors();
                            var executionErrors = ErrorResultTO.MakeErrorResultFromDataListString(errorString);
                            errors.MergeErrors(executionErrors);
                        }

                        dataObject.Environment.AddError(errors.MakeDataListReady());

                        if(errors.HasErrors())
                        {
                            Dev2Logger.Log.Error(errors.MakeDisplayReady());
                        }
                    }
                }
            }
            finally
            {
                time.Stop();
                ServerStats.IncrementTotalRequests();
//.........这里部分代码省略.........
开发者ID:Robin--,项目名称:Warewolf,代码行数:101,代码来源:EsbServiceInvoker.cs

示例9: Execute

 public override Guid Execute(out ErrorResultTO errors, int update)
 {
     errors = new ErrorResultTO();
     errors.AddError(" [[CityName]] does not exist in your Data List");
     errors.AddError("Error");
     errors.AddError("Error 2");
     errors.AddError("Error 3");
     errors.AddError("Faulty Things Happened");
     return DataObject.DataListID;
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:10,代码来源:WebServiceContainerTests.cs

示例10: ExecuteConcreteAction

        protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {
            IList<OutputTO> outputs = new List<OutputTO>();
  
            allErrors = new ErrorResultTO();
            ColItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables          
            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath, update));
            ColItr.AddVariableToIterateOn(inputItr);

           
            var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));
            ColItr.AddVariableToIterateOn(outputItr);

           
            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
            ColItr.AddVariableToIterateOn(unameItr);

            
            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
            ColItr.AddVariableToIterateOn(passItr);

            
            var desunameItr = new WarewolfIterator(dataObject.Environment.Eval(DestinationUsername, update));
            ColItr.AddVariableToIterateOn(desunameItr);

            
            var despassItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedDestinationPassword,update));
            ColItr.AddVariableToIterateOn(despassItr);

            AddItemsToIterator(dataObject.Environment, update);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(InputPath, "Source Path", dataObject.Environment, update));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                AddDebugInputItem(new DebugEvalResult(OutputPath, "Destination Path", dataObject.Environment, update));
                AddDebugInputItemDestinationUsernamePassword(dataObject.Environment, DestinationPassword, DestinationUsername, update);
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItems(dataObject.Environment, update);
            }

            while(ColItr.HasMoreData())
            {
                var hasError = false;
                IActivityIOPath src = null;
                IActivityIOPath dst = null;
                try
                {
                    src = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(inputItr),
                                                                                 ColItr.FetchNextValue(unameItr),
                                                                                 ColItr.FetchNextValue(passItr),
                                                                                 true);


                }
                catch(IOException ioException)
                {
                    allErrors.AddError("Source: " + ioException.Message);
                    hasError = true;
                }
                try
                {
                    dst = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(outputItr),
                                                                                     ColItr.FetchNextValue(desunameItr),
                                                                                     ColItr.FetchNextValue(despassItr),
                                                                                     true);

                }
                catch(IOException ioException)
                {
                    allErrors.AddError("Destination:" + ioException.Message);
                    hasError = true;
                }

                if(hasError)
                {
                    outputs[0].OutputStrings.Add(null);
                    MoveRemainingIterators();
                    continue;
                }
                IActivityIOOperationsEndPoint scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(src);
                IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);

                try
                {
                    IActivityOperationsBroker broker = GetOperationBroker();
                    var result = ExecuteBroker(broker, scrEndPoint, dstEndPoint);
                    outputs[0].OutputStrings.Add(result);

                }
                catch(Exception e)
                {
                    allErrors.AddError(e.Message);
                    outputs[0].OutputStrings.Add(null);
                }
            }
//.........这里部分代码省略.........
开发者ID:ndubul,项目名称:Chillas,代码行数:101,代码来源:DsfAbstractMultipleFilesActivity.cs

示例11: MakeErrorResultFromDataListString

 /// <summary>
 /// Makes ErrorResultTO from a error string from the data list.
 /// </summary>
 /// <param name="errorsString">Error string to convert</param>
 /// <returns>ErrorResultsTO</returns>
 public static ErrorResultTO MakeErrorResultFromDataListString(string errorsString)
 {
     ErrorResultTO result = new ErrorResultTO();
     try
     {
         if(!string.IsNullOrEmpty(errorsString))
         {
             errorsString = string.Concat("<Error>", errorsString, "</Error>");
             XElement errorNode = XElement.Parse(errorsString);
             foreach(XElement element in errorNode.Elements("InnerError"))
             {
                 result.AddError(element.Value);
             }
         }
     }
     catch(Exception)
     {
         result.AddError(errorsString);
     }
     return result;
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:26,代码来源:ErrorResultTO.cs

示例12: ExecutionImpl

 protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int undate)
 {
     tmpErrors = new ErrorResultTO();
     tmpErrors.AddError("This is an error");
     return Guid.NewGuid();
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:6,代码来源:DsfActivityTests.cs

示例13: CreateListsOfIDataListItemModelToBindTo

        /// <summary>
        ///     Creates the list of data list item view model to bind to.
        /// </summary>
        /// <param name="errorString">The error string.</param>
        /// <returns></returns>
        public void CreateListsOfIDataListItemModelToBindTo(out string errorString)
        {
            errorString = string.Empty;
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            if(!string.IsNullOrEmpty(Resource.DataList))
            {
                ErrorResultTO errors = new ErrorResultTO();
                try
                {
                    IBinaryDataList binarnyDl = CreateBinaryDataListFromXmlData(Resource.DataList, out errors);
                    if (!errors.HasErrors())
                    {
                        ConvertBinaryDataListToListOfIDataListItemModels(binarnyDl, out errorString);
                    }
                    else
                    {
                        string errorMessage = errors.FetchErrors().Aggregate(string.Empty, (current, error) => current + error);
                        throw new Exception(errorMessage);
                    }
                    if (binarnyDl != null)
                        compiler.ForceDeleteDataListByID(binarnyDl.UID);
                }
                catch(Exception)
                {
                    errors.AddError("Invalid variable list. Please insure that your variable list has valid entries");
                }
               

            }
            else
            {
                RecsetCollection.Clear();
                AddRecordSet();
                ScalarCollection.Clear();
            }

            BaseCollection = new OptomizedObservableCollection<DataListHeaderItemModel>();

            DataListHeaderItemModel varNode = DataListItemModelFactory.CreateDataListHeaderItem("Variable");
            if(ScalarCollection.Count == 0)
            {
                var dataListItemModel = DataListItemModelFactory.CreateDataListModel(string.Empty);
                ScalarCollection.Add(dataListItemModel);
            }
            varNode.Children = ScalarCollection;
            BaseCollection.Add(varNode);

            //AddRecordsetNamesIfMissing();

            DataListHeaderItemModel recordsetsNode = DataListItemModelFactory.CreateDataListHeaderItem("Recordset");
            if(RecsetCollection.Count == 0)
            {
                AddRecordSet();
            }
            recordsetsNode.Children = RecsetCollection;
            BaseCollection.Add(recordsetsNode);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:62,代码来源:DataListViewModel.cs

示例14: Plugin

        /// <summary>
        /// Invokes a plugin assembly
        /// </summary>
        /// <param name="plugin">The action of type Plugin</param>
        /// <param name="req">The req.</param>
        /// <param name="formatOutput">Indicates if the output of the plugin should be run through the formatter</param>
        /// <returns>
        /// Unlimited object
        /// </returns>
        public Guid Plugin(ServiceAction plugin, IDSFDataObject req, bool formatOutput)
        {
            Guid result = GlobalConstants.NullDataListID;
            Guid tmpID = GlobalConstants.NullDataListID;

            var errors = new ErrorResultTO();
            var allErrors = new ErrorResultTO();

            try
            {
                AppDomain tmpDomain = plugin.PluginDomain;

                //Instantiate the Remote Oject handler which will allow cross application domain access
                var remoteHandler =
                    (RemoteObjectHandler)
                    tmpDomain.CreateInstanceFromAndUnwrap(typeof(IFrameworkDataChannel).Module.Name,
                                                          typeof(RemoteObjectHandler).ToString());

                var dataBuilder = new StringBuilder("<Args><Args>");
                foreach(ServiceActionInput sai in plugin.ServiceActionInputs)
                {
                    dataBuilder.Append("<Arg>");
                    dataBuilder.Append("<TypeOf>");
                    dataBuilder.Append(sai.NativeType);
                    dataBuilder.Append("</TypeOf>");
                    dataBuilder.Append("<Value>");
                    dataBuilder.Append(sai.Value); // Fetch value and assign
                    dataBuilder.Append("</Value>");
                    dataBuilder.Append("</Arg>");
                }

                dataBuilder.Append("</Args></Args>");

                //xele.Value = (remoteHandler.RunPlugin(plugin.Source.AssemblyLocation, plugin.Source.AssemblyName, plugin.SourceMethod, data));
                string exeValue =
                    (remoteHandler.RunPlugin(plugin.Source.AssemblyLocation, plugin.Source.AssemblyName,
                                             plugin.SourceMethod, dataBuilder.ToString(), plugin.OutputDescription,
                                             formatOutput));

                // TODO : Now create a new dataList and merge the result into the current dataList ;)
                string dlShape = ClientCompiler.ShapeDev2DefinitionsToDataList(plugin.ServiceActionOutputs,
                                                                                enDev2ArgumentType.Output, false,
                                                                                out errors);
                allErrors.MergeErrors(errors);
                tmpID = ClientCompiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML), exeValue, dlShape,
                                                  out errors);
                ClientCompiler.SetParentID(tmpID, req.DataListID); // set parent for merge op in finally...

                allErrors.MergeErrors(errors);

                //Unload the temporary application domain
                //AppDomain.Unload(tmpDomain); -- throws exception when attempting to access after first unload?! -- A strange world C# / Winblows dev is
            }
            catch(Exception ex)
            {
                allErrors.AddError(ex.Message);
            }
            finally
            {
                // handle any errors that might have occured
                IBinaryDataListEntry be = Dev2BinaryDataListFactory.CreateEntry(enSystemTag.Error.ToString(),
                                                                                string.Empty);
                string error;
                be.TryPutScalar(
                    Dev2BinaryDataListFactory.CreateBinaryItem(allErrors.MakeDataListReady(),
                                                               enSystemTag.Error.ToString()), out error);
                errors.AddError(error);
                SvrCompiler.Upsert(null, req.DataListID,
                                    DataListUtil.BuildSystemTagForDataList(enSystemTag.Error, true), be, out errors);

                // now merge and delete tmp
                if(tmpID != GlobalConstants.NullDataListID)
                {
                    // Travis.Frisinger - 29.01.2013 - Bug 8352
                    // We merge here since we never have the shape generated here in the request DL ;)
                    Guid mergeID = ClientCompiler.Merge(req.DataListID, tmpID, enDataListMergeTypes.Union, enTranslationDepth.Data_With_Blank_OverWrite, false, out errors);

                    if(mergeID == GlobalConstants.NullDataListID)
                    {
                        allErrors.AddError("Failed to merge data from Plugin Invoke");
                        allErrors.MergeErrors(errors);
                    }

                    //ClientCompiler.Shape(tmpID, enDev2ArgumentType.Output, plugin.ServiceActionOutputs, out errors);
                    ClientCompiler.DeleteDataListByID(tmpID);
                    result = req.DataListID;
                }
            }

            return result;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:100,代码来源:DynamicServicesInvoker.cs

示例15: Invoke

        public Guid Invoke(DynamicService service, dynamic xmlRequest, Guid dataListId, out ErrorResultTO errors)
        {
            //dynamic result = new UnlimitedObject();
            //dynamic forwardResult = new UnlimitedObject();
            var allErrors = new ErrorResultTO();
            errors = new ErrorResultTO();

            if(service == null)
            {
                allErrors.AddError("Dynamic Service not found exception");
                return GlobalConstants.NullDataListID;
            }

            string dataList = service.DataListSpecification;


            // PBI : 5376 Amendedment for DataList Server
            Guid result = GlobalConstants.NullDataListID;
            string data = xmlRequest.XmlString.Trim();
            byte[] incomingData = Encoding.UTF8.GetBytes(data);
            Guid serviceDataId;


            var performDataListInMerge = false;

            if(dataList != string.Empty)
            {
                serviceDataId = SvrCompiler.ConvertTo(null, DataListFormat.CreateFormat(GlobalConstants._XML),
                                                       incomingData, dataList, out errors);
                errors = new ErrorResultTO(); // re-set to avoid carring

                // PBI : 5376
                // If dataListID == NullID, create a new list and set it as the current ID
                // Else, create a new list, union the old data into the new and continue on ;)
                if(dataListId != GlobalConstants.NullDataListID)
                {
                    serviceDataId = SvrCompiler.Merge(null, serviceDataId, dataListId, enDataListMergeTypes.Union,
                                                       enTranslationDepth.Data, false, out errors);
                }
                else
                {
                    performDataListInMerge = true;
                }
            }
            else
            {
                serviceDataId = SvrCompiler.CloneDataList(dataListId, out errors);
                performDataListInMerge = true;
            }

            if (errors.HasErrors())
            {
                allErrors.MergeErrors(errors);
            }
            IDSFDataObject dataObject = new DsfDataObject(xmlRequest.XmlString, serviceDataId);
            dataObject.DataList = dataList;

            if(performDataListInMerge)
            {
                SvrCompiler.ConditionalMerge(null, DataListMergeFrequency.Always, serviceDataId,
                                              dataObject.DatalistInMergeID,
                                              DataListMergeFrequency.Always, dataObject.DatalistInMergeType,
                                              dataObject.DatalistInMergeDepth);
            }

            // TODO  : Reset the AmbientDataList to this ID?

            // Fetch data for Input binding...
            DataListTranslatedPayloadTO tmpData = null;
            dynamic inputBinding = null;

            // End PBI Amendments

            foreach(ServiceAction serviceAction in service.Actions)
            {
                //TraceWriter.WriteTrace(_managementChannel, string.Format("Validating the inputs of Service '{0}'", service.Name), Resources.TraceMessageType_Message);
                foreach(ServiceActionInput sai in serviceAction.ServiceActionInputs)
                {
                    //Assigning the input the value from the callers request data
                    //TraceWriter.WriteTrace(_managementChannel, string.Format("Discovered input '{0}'", sai.Name), Resources.TraceMessageType_Message);
                    if(sai.CascadeSource)
                    {
                        TraceWriter.WriteTrace(_managementChannel, string.Format("Input '{0}' is cascaded", sai.Name),
                                               Resources.TraceMessageType_Message);
                        //This is a cascaded input so retrieve the value from the
                        //previous actions response
                        //sai.Value = forwardResult.GetValue(sai.Name);
                    }
                    else
                    {
                        if(tmpData == null)
                        {
                            tmpData = SvrCompiler.ConvertFrom(null, serviceDataId, enTranslationDepth.Data,
                                                               DataListFormat.CreateFormat(GlobalConstants._XML),
                                                               out errors);

                            if(!DataListUtil.isNullADL(tmpData.FetchAsString()))
                            {
                                inputBinding = new UnlimitedObject(tmpData.FetchAsString());
                            }
//.........这里部分代码省略.........
开发者ID:Robin--,项目名称:Warewolf,代码行数:101,代码来源:DynamicServicesInvoker.cs


注:本文中的Dev2.DataList.Contract.ErrorResultTO.AddError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。