Example #1
0
        protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO errors, int update)
        {
            var execErrors = new ErrorResultTO();

            errors = new ErrorResultTO();
            errors.MergeErrors(execErrors);

            var databaseServiceExecution = ServiceExecution as DatabaseServiceExecution;
            if(databaseServiceExecution != null)
            {
                databaseServiceExecution.InstanceInputDefinitions = inputs; // set the output mapping for the instance ;)
                databaseServiceExecution.InstanceOutputDefintions = outputs; // set the output mapping for the instance ;)
            }
            //ServiceExecution.DataObj = dataObject;
            var result = ServiceExecution.Execute(out execErrors, update);
            var fetchErrors = execErrors.FetchErrors();
            foreach(var error in fetchErrors)
            {
                dataObject.Environment.Errors.Add(error);
            }
            
            errors.MergeErrors(execErrors);

            // Adjust the remaining output mappings ;)
            return result;
        }
 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;
 }
        private Guid FetchParentInstanceId(IDSFDataObject dataTransferObject)
        {
            Guid parentWorkflowInstanceId;

            Guid.TryParse(dataTransferObject.ParentWorkflowInstanceId, out parentWorkflowInstanceId);

            return parentWorkflowInstanceId;
        }
        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);

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

            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", dataObject.Environment, update));
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Destination Private Key File", 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, colItr.FetchNextValue(privateKeyItr));
                    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;
        }
Example #5
0
        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();
                IActivityIOPath ioPath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                                colItr.FetchNextValue(unameItr),
                                                                                colItr.FetchNextValue(passItr),
                                                                                true, colItr.FetchNextValue(privateKeyItr));
                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;
        }
 protected EsbExecutionContainer(ServiceAction sa, IDSFDataObject dataObject, IWorkspace theWorkspace, IEsbChannel esbChannel, EsbExecuteRequest request)
 {
     ServiceAction = sa;
     DataObject = dataObject;
     TheWorkspace = theWorkspace;
     EsbChannel = esbChannel;
     Request = request;
     DataObject.EsbChannel = EsbChannel;
 }
        /// <summary>
        /// Inits the entry point.
        /// </summary>
        /// <param name="workflowActivity">The workflow activity.</param>
        /// <param name="dataTransferObject">The data transfer object.</param>
        /// <param name="executionExtensions">The execution extensions.</param>
        /// <param name="instanceId">The instance id.</param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="bookmarkName">Name of the bookmark.</param>
        /// <returns></returns>
        // ReSharper disable once UnusedParameter.Local // ignored as not sure how this method is invoked and what the knock on effect maybe
        private WorkflowApplication InitEntryPoint(Activity workflowActivity, IDSFDataObject dataTransferObject, IEnumerable<object> executionExtensions, Guid instanceId, IWorkspace workspace, string bookmarkName)
        {
            dataTransferObject.WorkspaceID = workspace.ID;

            Dictionary<string, object> inputarguments = new Dictionary<string, object>();

            WorkflowApplication wfApp = null;

            Guid parentInstanceID = FetchParentInstanceId(dataTransferObject);

            if(parentInstanceID != Guid.Empty)
            {
                inputarguments.Add("ParentWorkflowInstanceId", parentInstanceID);

                if(!string.IsNullOrEmpty(dataTransferObject.ParentServiceName))
                {
                    inputarguments.Add("ParentServiceName", dataTransferObject.ParentServiceName);
                }
            }

            // Set the old AmbientDatalist as the DataListID ;)
            inputarguments.Add("AmbientDataList", new List<string> { dataTransferObject.DataListID.ToString() });

            if((parentInstanceID != Guid.Empty && instanceId == Guid.Empty) || string.IsNullOrEmpty(bookmarkName))
            {
                wfApp = new WorkflowApplication(workflowActivity, inputarguments);
            }
            else
            {
                if(!string.IsNullOrEmpty(bookmarkName))
                {
                    wfApp = new WorkflowApplication(workflowActivity);
                }
            }

            if(wfApp != null)
            {
                wfApp.InstanceStore = InstanceStore;

                if(executionExtensions != null)
                {
                    executionExtensions.ToList().ForEach(exec => wfApp.Extensions.Add(exec));
                }

                // Force a save to the server ;)
                IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
                IDev2DataLanguageParser parser = DataListFactory.CreateLanguageParser();


                wfApp.Extensions.Add(dataTransferObject);
                wfApp.Extensions.Add(compiler);
                wfApp.Extensions.Add(parser);

            }

            return wfApp;
        }
 public RemoteWorkflowExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel, IResourceCatalog resourceCatalog)
     : base(sa, dataObj, workspace, esbChannel)
 {
     if (resourceCatalog == null)
     {
         throw new ArgumentNullException("resourceCatalog");
     }
     _resourceCatalog = resourceCatalog;
 }
        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();

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

                    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;
        }
Example #10
0
 protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
 {
     _errorsTo = new ErrorResultTO();
     var pluginServiceExecution = GetNewPluginServiceExecution(dataObject);
     pluginServiceExecution.InstanceInputDefinitions = inputs;
     pluginServiceExecution.InstanceOutputDefintions = outputs;
     tmpErrors = new ErrorResultTO();
     tmpErrors.MergeErrors(_errorsTo);
     var result = ExecutePluginService(pluginServiceExecution, update);
     tmpErrors.MergeErrors(_errorsTo);
     return result;
 }
        protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors)
        {
            tmpErrors = new ErrorResultTO();
            var webserviceExecution = GetNewWebserviceExecution(dataObject);


            if(webserviceExecution != null && !tmpErrors.HasErrors())
            {
                webserviceExecution.InstanceOutputDefintions = outputs; // set the output mapping for the instance ;)
                webserviceExecution.InstanceInputDefinitions = inputs;
                ErrorResultTO invokeErrors;
                var result = webserviceExecution.Execute(out invokeErrors);
                dataObject.Environment.AddError(invokeErrors.MakeDataListReady());
                return result;
            }
            return Guid.NewGuid();
        }
 public InternalServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel, EsbExecuteRequest request)
     : base(sa, dataObj, theWorkspace, esbChannel, request)
 {
     var dataListTO = new DataListTO(sa.DataListSpecification.ToString());
     if(request.Args == null)
     {
         request.Args = new Dictionary<string, StringBuilder>();
         foreach(var input in dataListTO.Inputs)
         {
             var warewolfEvalResult = dataObj.Environment.Eval(DataListUtil.AddBracketsToValueIfNotExist(input),0,false);
             if(warewolfEvalResult.IsWarewolfAtomResult)
             {
                 var scalarResult = warewolfEvalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult;
                 if(scalarResult != null && !scalarResult.Item.IsNothing)
                 {
                     request.Args.Add(input, new StringBuilder(scalarResult.Item.ToString()));
                 }
             }
         }
     }
 }
        protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors)
        {
            _errorsTo = new ErrorResultTO();
            var compiler = DataListFactory.CreateDataListCompiler();

            ErrorResultTO invokeErrors;
            esbChannel.CorrectDataList(dataObject, dataObject.WorkspaceID, out invokeErrors, compiler);

            dataObject.DataListID = compiler.Shape(dataObject.DataListID, enDev2ArgumentType.Input, inputs, out invokeErrors);
            _errorsTo.MergeErrors(invokeErrors);

            _errorsTo.MergeErrors(invokeErrors);
            var pluginServiceExecution = GetNewPluginServiceExecution(dataObject);
            pluginServiceExecution.InstanceInputDefinitions = inputs;
            pluginServiceExecution.InstanceOutputDefintions = outputs;
            tmpErrors = new ErrorResultTO();
            tmpErrors.MergeErrors(_errorsTo);
            var result = ExecutePluginService(pluginServiceExecution);
            tmpErrors.MergeErrors(_errorsTo);
            return result;
        }
        /// <summary>
        /// Invokes the workflow.
        /// </summary>
        /// <param name="workflowActivity">The workflow activity.</param>
        /// <param name="dataTransferObject">The data transfer object.</param>
        /// <param name="executionExtensions">The execution extensions.</param>
        /// <param name="instanceId">The instance id.</param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="bookmarkName">Name of the bookmark.</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        public IDSFDataObject InvokeWorkflow(Activity workflowActivity, IDSFDataObject dataTransferObject, IList<object> executionExtensions, Guid instanceId, IWorkspace workspace, string bookmarkName, out ErrorResultTO errors)
        {

            return InvokeWorkflowImpl(workflowActivity, dataTransferObject, executionExtensions, instanceId, workspace, bookmarkName, dataTransferObject.IsDebug, out errors);
        }
            private void OnCompleted(WorkflowApplicationCompletedEventArgs args)
            {
                _result = args.GetInstanceExtensions<IDSFDataObject>().ToList().First();
                IDictionary<string, object> outputs = args.Outputs;

                try
                {
                    if(!_isDebug)
                    {

                        // Travis.Frisinger : 19.10.2012 - Duplicated Recordset Data Bug 6038

                        object parentId;

                        outputs.TryGetValue("ParentWorkflowInstanceId", out parentId);

                        parentId = _result.ParentWorkflowInstanceId;

                        object parentServiceName;
                        outputs.TryGetValue("ParentServiceName", out parentServiceName);

                        var parentServiceNameStr = string.IsNullOrEmpty(_result.ParentServiceName) ? string.Empty : _result.ParentServiceName;

                        if(!string.IsNullOrEmpty(parentServiceNameStr) && Guid.TryParse(parentId.ToString(), out _parentWorkflowInstanceID))
                        {
                            if(_parentWorkflowInstanceID != _currentInstanceID)
                            {
                                // BUG 7850 - TWR - 2013.03.11 - ResourceCatalog refactor
                                var services = ResourceCatalog.Instance.GetDynamicObjects<DynamicServiceObjectBase>(_workspace.ID, parentServiceNameStr);
                                if(services != null && services.Count > 0)
                                {
                                    var service = services[0] as DynamicService;
                                    if(service != null)
                                    {
                                        _currentInstanceID = _parentWorkflowInstanceID;

                                        var actionSet = service.Actions;

                                        if(_result.WorkflowResumeable)
                                        {
                                            var serviceAction = actionSet.First();
                                            PooledServiceActivity wfActivity = serviceAction.PopActivity();

                                            try
                                            {
                                                ErrorResultTO invokeErrors;
                                                _result = _owner.InvokeWorkflow(wfActivity.Value, _result, _executionExtensions, _parentWorkflowInstanceID, _workspace, "dsfResumption", out invokeErrors);
                                                // attach any execution errors
                                                if(AllErrors != null)
                                                {
                                                    AllErrors.MergeErrors(invokeErrors);
                                                }
                                            }
                                            finally
                                            {
                                                serviceAction.PushActivity(wfActivity);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch(Exception ex)
                {
                    Dev2Logger.Log.Error(ex);
                    ExecutionStatusCallbackDispatcher.Instance.Post(_result.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback);
                }
                finally
                {

                    try
                    {
                        if(_waitHandle != null) _waitHandle.Set();
                        ExecutableServiceRepository.Instance.Remove(this);
                        if(DataTransferObject != null)
                        {
                            DataTransferObject.NumberOfSteps = _previousNumberOfSteps;
                        }
                    }
                    catch(Exception e)
                    {
                        // Best effort ;)
                        Dev2Logger.Log.Error(e);
                    }
                }


                // force a throw to kill the engine ;)
                if(args.TerminationException != null)
                {
                    _instance.Terminate("Force Terminate", new TimeSpan(0, 0, 1, 0));
                }

                // Not compatable with run.Dispose() 

            }
            public WorkflowApplicationRun(WorkflowApplicationFactory owner, ManualResetEventSlim waitHandle, IDSFDataObject dataTransferObject, WorkflowApplication instance, IWorkspace workspace, IList<object> executionExtensions, Guid parentWorkflowInstanceId, bool isDebug, ErrorResultTO errors, IExecutionToken executionToken)
            {
                _owner = owner;
                _waitHandle = waitHandle;
                _result = dataTransferObject;
                _instance = instance;
                _workspace = workspace;
                _executionExtensions = executionExtensions;
                _isDebug = isDebug;
                _parentWorkflowInstanceID = parentWorkflowInstanceId;
                _executionToken = executionToken;

                _instance.PersistableIdle = OnPersistableIdle;
                _instance.Unloaded = OnUnloaded;
                _instance.Completed = OnCompleted;
                _instance.Aborted = OnAborted;
                _instance.OnUnhandledException = OnUnhandledException;

                AllErrors = errors;
            }
        static void TryConvert(IDSFDataObject dataObject, XmlNodeList children, List<string> inputDefs, int update, int level = 0)
        {
            try
            {
                // spin through each element in the XML
            foreach (XmlNode c in children)
            {
                    if(c.Name != GlobalConstants.NaughtyTextNode)
                {
                        if(level > 0)
                    {
                        var c1 = c;
                        var scalars = inputDefs.Where(definition => definition == c1.Name);
                        var recSets = inputDefs.Where(definition => DataListUtil.ExtractRecordsetNameFromValue(definition) == c1.Name);
                        var scalarDefs = scalars as string[] ?? scalars.ToArray();
                        var recSetDefs = recSets as string[] ?? recSets.ToArray();
                            if(recSetDefs.Length != 0)
                        {
                            var nl = c.ChildNodes;
                                foreach(XmlNode subc in nl)
                            {
                                    foreach(var definition in recSetDefs)
                                {
                                        if(DataListUtil.IsValueRecordset(definition))
                                    {
                                            if(DataListUtil.ExtractFieldNameFromValue(definition) == subc.Name)
                                        {
                                            var recSetAppend = DataListUtil.ReplaceRecordsetIndexWithBlank(definition);
                                            var a = subc.InnerXml;
                                            a = RemoveXMLPrefix(a);
                                                dataObject.Environment.AssignWithFrame(new AssignValue(recSetAppend, a),update);

                                        }
                                    }
                                }
                            }
                        }
                            if(scalarDefs.Length != 0)
                        {
                            // fetch recordset index
                            // process recordset
                            var a = c.InnerXml;
                            a = RemoveXMLPrefix(a);
                            dataObject.Environment.Assign(DataListUtil.AddBracketsToValueIfNotExist(c.Name), a,update);
                        }
                    }
                    else
                    {
                            if(level == 0)
                        {
                                TryConvert(dataObject, c.ChildNodes, inputDefs, update, ++level);
                        }
                    }
                }
            }
            }
            finally
            {
                dataObject.Environment.CommitAssign();
            }
        }
 public static void UpdateEnvironmentFromInputPayload(IDSFDataObject dataObject, StringBuilder rawPayload, string dataList,int update)
 {
     string toLoad = DataListUtil.StripCrap(rawPayload.ToString()); // clean up the rubish ;)
     if(toLoad.IsJSON())
     {
         XNode node = JsonConvert.DeserializeXNode(toLoad, "Root");
         if(node == null)
         {
             return;
         }
         toLoad = node.ToString();
     }
     XmlDocument xDoc = new XmlDocument();
     toLoad = string.Format("<Tmp{0}>{1}</Tmp{0}>", Guid.NewGuid().ToString("N"), toLoad);
     xDoc.LoadXml(toLoad);
     dataList = dataList.Replace("ADL>", "DataList>").Replace("root>", "DataList>");
     if (xDoc.DocumentElement != null)
     {
         XmlNodeList children = xDoc.DocumentElement.ChildNodes;
         var dataListTO = new DataListTO(dataList);
         TryConvert(dataObject, children, dataListTO.Inputs, update);
     }
 }
        public static string GetXmlOutputFromEnvironment(IDSFDataObject dataObject,string dataList,int update)
        {
            var environment = dataObject.Environment;
            var dataListTO = new DataListTO(dataList);
            StringBuilder result = new StringBuilder("<DataList>");
            var scalarOutputs = dataListTO.Outputs.Where(s => !DataListUtil.IsValueRecordset(s));
            var recSetOutputs = dataListTO.Outputs.Where(DataListUtil.IsValueRecordset);
            var groupedRecSets = recSetOutputs.GroupBy(DataListUtil.ExtractRecordsetNameFromValue);
            foreach (var groupedRecSet in groupedRecSets)
            {
                var i = 1;
                var warewolfListIterators = new WarewolfListIterator();
                Dictionary<string, IWarewolfIterator> iterators = new Dictionary<string, IWarewolfIterator>();
                foreach (var name in groupedRecSet)
                {
                    var warewolfEvalResult = WarewolfDataEvaluationCommon.WarewolfEvalResult.NewWarewolfAtomResult(DataASTMutable.WarewolfAtom.Nothing);
                    try
                    {
                        warewolfEvalResult = environment.Eval(name, update,false);
                    }
                    // ReSharper disable once RESP510236
                    // ReSharper disable once RESP510241
                    catch(Exception e)
                    {
                        Dev2Logger.Log.Debug("Null Variable",e);
                    }
                    var warewolfIterator = new WarewolfIterator(warewolfEvalResult);
                    iterators.Add(DataListUtil.ExtractFieldNameFromValue(name), warewolfIterator);
                    warewolfListIterators.AddVariableToIterateOn(warewolfIterator);
                }
                while (warewolfListIterators.HasMoreData())
                {
                    result.Append("<");
                    result.Append(groupedRecSet.Key);
                    result.Append(string.Format(" Index=\"{0}\">", i));
                    foreach (var namedIterator in iterators)
                    {
                        try
                        {
                            var value = warewolfListIterators.FetchNextValue(namedIterator.Value);
                            result.Append("<");
                            result.Append(namedIterator.Key);
                            result.Append(">");
                            result.Append(value);
                            result.Append("</");
                            result.Append(namedIterator.Key);
                            result.Append(">");
                        }
                        catch(Exception e)
                        {
                            Dev2Logger.Log.Debug(e.Message,e);
                        }
                    }
                    result.Append("</");
                    result.Append(groupedRecSet.Key);
                    result.Append(">");
                    i++;
                }

            }

            foreach (var output in scalarOutputs)
            {
                var evalResult = environment.Eval(DataListUtil.AddBracketsToValueIfNotExist(output), update,false);
                if (evalResult.IsWarewolfAtomResult)
                {
                    var scalarResult = evalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult;
                    if (scalarResult != null && !scalarResult.Item.IsNothing)
                    {
                        result.Append("<");
                        result.Append(output);
                        result.Append(">");
                        result.Append(scalarResult.Item);
                        result.Append("</");
                        result.Append(output);
                        result.Append(">");
                    }
                }
            }

            result.Append("</DataList>");

            return result.ToString();
        }
 /// <summary>
 /// Need to add loc property to AbstractActivity ;)
 /// </summary>
 /// <param name="sa"></param>
 /// <param name="dataObj"></param>
 /// <param name="workspace"></param>
 /// <param name="esbChannel"></param>
 public RemoteWorkflowExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel)
     : this(sa, dataObj, workspace, esbChannel, ResourceCatalog.Instance)
 {
 }
Example #21
0
 protected override void ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public void CreateNewEnvironmentFromInputMappings(IDSFDataObject dataObject, string inputDefs, int update)
 {
 }
Example #23
0
 public IExecutionEnvironment UpdatePreviousEnvironmentWithSubExecutionResultUsingOutputMappings(IDSFDataObject dataObject, string outputDefs, int update, bool handleErrors, ErrorResultTO errors)
 {
     return(null);
 }
Example #24
0
 public void ExecuteLogErrorRequest(IDSFDataObject dataObject, Guid workspaceID, string uri,
                                    out ErrorResultTO errors, int update)
 {
     throw new NotImplementedException();
 }
Example #25
0
 public Guid CorrectDataList(IDSFDataObject dataObject, Guid workspaceID, out ErrorResultTO errors,
                             IDataListCompiler compiler)
 {
     throw new NotImplementedException();
 }
Example #26
0
 public IList <KeyValuePair <enDev2ArgumentType, IList <IDev2Definition> > > ShapeForSubRequest(
     IDSFDataObject dataObject, string inputDefs, string outputDefs, out ErrorResultTO errors)
 {
     throw new NotImplementedException();
 }
Example #27
0
        private IDev2Activity ExecuteDecision(IDSFDataObject dataObject)
        {
            InitializeDebug(dataObject);

            if (dataObject.IsDebugMode())
            {
                _debugInputs = CreateDebugInputs(dataObject.Environment);
                DispatchDebugState(dataObject, StateType.Before, 0);
            }

            var errorIfNull = !Conditions.TheStack.Any(decision => decision.EvaluationFn == enDecisionType.IsNull || decision.EvaluationFn == enDecisionType.IsNotNull);

            var stack = Conditions.TheStack.Select(a => ParseDecision(dataObject.Environment, a, errorIfNull));

            var factory = Dev2DecisionFactory.Instance();
            var res     = stack.SelectMany(a =>
            {
                if (a.EvaluationFn == enDecisionType.IsError)
                {
                    return(new[] { dataObject.Environment.AllErrors.Count > 0 });
                }
                if (a.EvaluationFn == enDecisionType.IsNotError)
                {
                    return(new[] { dataObject.Environment.AllErrors.Count == 0 });
                }
                IList <bool> ret = new List <bool>();
                var iter         = new WarewolfListIterator();
                var c1           = new WarewolfAtomIterator(a.Cols1);
                var c2           = new WarewolfAtomIterator(a.Cols2);
                var c3           = new WarewolfAtomIterator(a.Cols3);
                iter.AddVariableToIterateOn(c1);
                iter.AddVariableToIterateOn(c2);
                iter.AddVariableToIterateOn(c3);
                while (iter.HasMoreData())
                {
                    try
                    {
                        ret.Add(factory.FetchDecisionFunction(a.EvaluationFn).Invoke(new[] { iter.FetchNextValue(c1), iter.FetchNextValue(c2), iter.FetchNextValue(c3) }));
                    }
                    catch (Exception)
                    {
                        if (errorIfNull)
                        {
                            throw;
                        }
                        ret.Add(false);
                    }
                }
                return(ret);
            });

            var results   = res as IList <bool> ?? res.ToList();
            var resultval = true;

            if (results.Any())
            {
                if (And)
                {
                    if (results.Any(b => b == false))
                    {
                        resultval = false;
                    }
                }
                else
                {
                    resultval = results.Any(b => b);
                }
            }

            Result = GetResultString(resultval.ToString(), Conditions);
            if (dataObject.IsDebugMode())
            {
                _debugOutputs = GetDebugOutputs(resultval.ToString());
            }
            if (resultval)
            {
                if (TrueArm != null)
                {
                    var activity = TrueArm.FirstOrDefault();
                    return(activity);
                }
            }
            else
            {
                if (FalseArm != null)
                {
                    var activity = FalseArm.FirstOrDefault();
                    return(activity);
                }
            }

            return(null);
        }
 public DatabaseServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel)
     : base(sa, dataObj, workspace, esbChannel)
 {
     _databaseServiceExecution = new DatabaseServiceExecution(dataObj);
 }
Example #29
0
 public void ExecuteMock(IDSFDataObject dataObject, int update)
 {
     ExecuteTool(dataObject, update);
 }
Example #30
0
 public T FetchServerModel <T>(IDSFDataObject dataObject, Guid workspaceID, out ErrorResultTO errors, int update)
 {
     throw new NotImplementedException();
 }
 public DatabaseServiceExecution(IDSFDataObject dataObj)
     : base(dataObj, true)
 {
 }
        public static string GetJsonOutputFromEnvironment(IDSFDataObject dataObject,string dataList,int update)
        {
            var environment = dataObject.Environment;
            var dataListTO = new DataListTO(dataList);
            StringBuilder result = new StringBuilder("{");
            var keyCnt = 0;
            var scalarOutputs = dataListTO.Outputs.Where(s => !DataListUtil.IsValueRecordset(s));
            var recSetOutputs = dataListTO.Outputs.Where(DataListUtil.IsValueRecordset);
            var groupedRecSets = recSetOutputs.GroupBy(DataListUtil.ExtractRecordsetNameFromValue);
            var recSets = groupedRecSets as IGrouping<string, string>[] ?? groupedRecSets.ToArray();
            foreach (var groupedRecSet in recSets)
            {
                var i = 0;
                var warewolfListIterators = new WarewolfListIterator();
                Dictionary<string, IWarewolfIterator> iterators = new Dictionary<string, IWarewolfIterator>();
                foreach (var name in groupedRecSet)
                {
                    var warewolfIterator = new WarewolfIterator(environment.Eval(name, update,false));
                    iterators.Add(DataListUtil.ExtractFieldNameFromValue(name), warewolfIterator);
                    warewolfListIterators.AddVariableToIterateOn(warewolfIterator);

                }
                result.Append("\"");
                result.Append(groupedRecSet.Key);
                result.Append("\" : [");

                while (warewolfListIterators.HasMoreData())
                {
                    int colIdx = 0;
                    result.Append("{");
                    foreach (var namedIterator in iterators)
                    {
                        try
                        {
                            var value = warewolfListIterators.FetchNextValue(namedIterator.Value);
                            result.Append("\"");
                            result.Append(namedIterator.Key);
                            result.Append("\":\"");
                            result.Append(value);
                            result.Append("\"");
                            colIdx++;
                            if (colIdx < iterators.Count)
                            {
                                result.Append(",");
                            }
                        }
                        catch(Exception e)
                        {
                            Dev2Logger.Log.Debug(e.Message,e);
                            colIdx++;
                        }

                    }
                    if (warewolfListIterators.HasMoreData())
                    {
                        result = new StringBuilder(result.ToString().TrimEnd(','));
                        result.Append("}");
                        result.Append(",");
                    }
                }
                result.Append("}");
                result.Append("]");
                i++;
                if (i <= recSets.Length)
                {
                    result.Append(",");
                }
            }

            var scalars = scalarOutputs as string[] ?? scalarOutputs.ToArray();
            foreach (var output in scalars)
            {
                var evalResult = environment.Eval(DataListUtil.AddBracketsToValueIfNotExist(output), update,false);
                if (evalResult.IsWarewolfAtomResult)
                {
                    var scalarResult = evalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult;
                    if (scalarResult != null && !scalarResult.Item.IsNothing)
                    {
                        result.Append("\"");
                        result.Append(output);
                        result.Append("\":\"");
                        result.Append(scalarResult.Item);
                        result.Append("\"");

                    }
                }
                keyCnt++;
                if (keyCnt < scalars.Length)
                {
                    result.Append(",");
                }
            }
            var jsonOutputFromEnvironment = result.ToString();
            jsonOutputFromEnvironment = jsonOutputFromEnvironment.TrimEnd(',');
            jsonOutputFromEnvironment += "}";
            return jsonOutputFromEnvironment;
        }
Example #33
0
 public void TestExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
 {
     base.ExecutionImpl(esbChannel, dataObject, inputs, outputs, out tmpErrors, update);
 }
 public static void UpdateEnvironmentFromXmlPayload(IDSFDataObject dataObject, StringBuilder rawPayload, string dataList, int update)
 {
     string toLoad = DataListUtil.StripCrap(rawPayload.ToString()); // clean up the rubish ;)
     XmlDocument xDoc = new XmlDocument();
     toLoad = string.Format("<Tmp{0}>{1}</Tmp{0}>", Guid.NewGuid().ToString("N"), toLoad);
     xDoc.LoadXml(toLoad);
     if(dataList != null)
     {
         dataList = dataList.Replace("ADL>", "DataList>").Replace("root>","DataList>");
         if (xDoc.DocumentElement != null)
         {
             XmlNodeList children = xDoc.DocumentElement.ChildNodes;
             var dataListTO = new DataListTO(dataList,true);
             TryConvert(dataObject, children, dataListTO.Inputs, update);
         }
     }
 }
Example #35
0
        protected override IList <OutputTO> TryExecuteConcreteAction(IDSFDataObject context, out ErrorResultTO error, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            error  = new ErrorResultTO();
            ColItr = new WarewolfListIterator();

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

            ColItr.AddVariableToIterateOn(inputItr);


            var outputItr = new WarewolfIterator(context.Environment.Eval(OutputPath, update));

            ColItr.AddVariableToIterateOn(outputItr);

            var userItr = new WarewolfIterator(context.Environment.Eval(Username, update));

            ColItr.AddVariableToIterateOn(userItr);

            var passItr = new WarewolfIterator(context.Environment.Eval(DecryptedPassword, update));

            ColItr.AddVariableToIterateOn(passItr);

            var privateKeyItr = new WarewolfIterator(context.Environment.Eval(PrivateKeyFile, update));

            ColItr.AddVariableToIterateOn(privateKeyItr);

            var desUserItr = new WarewolfIterator(context.Environment.Eval(DestinationUsername, update));

            ColItr.AddVariableToIterateOn(desUserItr);

            var despassItr = new WarewolfIterator(context.Environment.Eval(DecryptedDestinationPassword, update));

            ColItr.AddVariableToIterateOn(despassItr);

            var destPrivateKeyItr = new WarewolfIterator(context.Environment.Eval(DestinationPrivateKeyFile, update));

            ColItr.AddVariableToIterateOn(destPrivateKeyItr);

            AddItemsToIterator(context.Environment, update);

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

            if (context.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(InputPath, "Source Path", context.Environment, update));
                AddDebugInputItemUserNamePassword(context.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(new DebugEvalResult(PrivateKeyFile, "Source Private Key File", context.Environment, update));
                }
                AddDebugInputItem(new DebugEvalResult(OutputPath, "Destination Path", context.Environment, update));
                AddDebugInputItemDestinationUsernamePassword(context.Environment, DestinationPassword, DestinationUsername, update);
                if (!string.IsNullOrEmpty(DestinationPrivateKeyFile))
                {
                    AddDebugInputItem(new DebugEvalResult(DestinationPrivateKeyFile, "Destination Private Key File", context.Environment, update));
                }
                AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
                AddDebugInputItems(context.Environment, update);
            }

            while (ColItr.HasMoreData())
            {
                var             hasError = false;
                IActivityIOPath src      = null;
                IActivityIOPath dst      = null;
                try
                {
                    src = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(inputItr),
                                                                 ColItr.FetchNextValue(userItr),
                                                                 ColItr.FetchNextValue(passItr),
                                                                 true, ColItr.FetchNextValue(privateKeyItr));
                }
                catch (IOException ioException)
                {
                    error.AddError("Source: " + ioException.Message);
                    hasError = true;
                }
                try
                {
                    dst = ActivityIOFactory.CreatePathFromString(ColItr.FetchNextValue(outputItr),
                                                                 ColItr.FetchNextValue(desUserItr),
                                                                 ColItr.FetchNextValue(despassItr),
                                                                 true, ColItr.FetchNextValue(destPrivateKeyItr));
                }
                catch (IOException ioException)
                {
                    error.AddError("Destination:" + ioException.Message);
                    hasError = true;
                }

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

                try
                {
                    var broker = GetOperationBroker?.Invoke();
                    var result = ExecuteBroker(broker, scrEndPoint, dstEndPoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch (Exception e)
                {
                    error.AddError(e.Message);
                    outputs[0].OutputStrings.Add(null);
                }
            }

            return(outputs);
        }
        /// <summary>
        /// Invokes the workflow impl.
        /// </summary>
        /// <param name="workflowActivity">The workflow activity.</param>
        /// <param name="dataTransferObject">The data transfer object.</param>
        /// <param name="executionExtensions">The execution extensions.</param>
        /// <param name="instanceId">The instance id.</param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="bookmarkName">Name of the bookmark.</param>
        /// <param name="isDebug">if set to <c>true</c> [is debug].</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        private IDSFDataObject InvokeWorkflowImpl(Activity workflowActivity, IDSFDataObject dataTransferObject, IList<object> executionExtensions, Guid instanceId, IWorkspace workspace, string bookmarkName, bool isDebug, out ErrorResultTO errors)
        {
            Tracker.TrackEvent(TrackerEventGroup.Workflows, TrackerEventName.Executed, string.Format("RES-{0}", dataTransferObject.ResourceID));

            if(AllErrors == null)
            {
                AllErrors = new ErrorResultTO();
            }
            IExecutionToken exeToken = new ExecutionToken { IsUserCanceled = false };

            ExecutionStatusCallbackDispatcher.Instance.Post(dataTransferObject.ExecutionCallbackID, ExecutionStatusCallbackMessageType.StartedCallback);
            WorkflowApplication wfApp = InitEntryPoint(workflowActivity, dataTransferObject, executionExtensions, instanceId, workspace, bookmarkName);
            errors = new ErrorResultTO();

            if(wfApp != null)
            {
                // add termination token
                wfApp.Extensions.Add(exeToken);

                using(ManualResetEventSlim waitHandle = new ManualResetEventSlim(false))
                {
                    WorkflowApplicationRun run = new WorkflowApplicationRun(this, waitHandle, dataTransferObject, wfApp, workspace, executionExtensions, FetchParentInstanceId(dataTransferObject), isDebug, errors, exeToken);


                    if(instanceId == Guid.Empty)
                    {
                        Interlocked.Increment(ref Balance);
                        run.Run();
                        _runTime = DateTime.Now;
                        waitHandle.Wait();
                    }
                    else
                    {
                        Interlocked.Increment(ref Balance);

                        try
                        {
                            if(!string.IsNullOrEmpty(bookmarkName))
                            {
                                dataTransferObject.CurrentBookmarkName = bookmarkName;
                                run.Resume(dataTransferObject);
                            }
                            else
                            {
                                run.Run();
                                _runTime = DateTime.Now;
                            }

                            waitHandle.Wait();
                        }
                        catch(InstanceNotReadyException e1)
                        {
                            Interlocked.Decrement(ref Balance);
                            ExecutionStatusCallbackDispatcher.Instance.Post(dataTransferObject.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback);

                            errors.AddError(e1.Message);
                            AllErrors.AddError(e1.Message);
                            return null;
                        }
                        catch(InstancePersistenceException e2)
                        {
                            Interlocked.Decrement(ref Balance);
                            ExecutionStatusCallbackDispatcher.Instance.Post(dataTransferObject.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback);

                            errors.AddError(e2.Message);
                            AllErrors.AddError(e2.Message);
                            return run.DataTransferObject.Clone();
                        }
                        catch(Exception ex)
                        {
                            Interlocked.Decrement(ref Balance);

                            errors.AddError(ex.Message);
                            AllErrors.AddError(ex.Message);

                            ExecutionStatusCallbackDispatcher.Instance.Post(dataTransferObject.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback);

                            return run.DataTransferObject.Clone();
                        }
                    }

                    Interlocked.Decrement(ref Balance);
                    dataTransferObject = run.DataTransferObject.Clone();
                    var wfappUtils = new WfApplicationUtils();

                    ErrorResultTO invokeErrors;
                    if (dataTransferObject.IsDebugMode())
                    {
                        wfappUtils.DispatchDebugState(dataTransferObject, StateType.End, AllErrors.HasErrors(), AllErrors.MakeDisplayReady(), out invokeErrors, _runTime, false, true);
                    }
                    //AllErrors.MergeErrors(invokeErrors);
                    // avoid memory leak ;)
                    run.Dispose();
                }
            }
            else
            {
                errors.AddError("Internal System Error : Could not create workflow execution wrapper");
            }

            return dataTransferObject;
        }
        protected override void ExecuteTool(IDSFDataObject dataObject, int update)
        {
            IDev2MergeOperations mergeOperations = new Dev2MergeOperations();
            ErrorResultTO        allErrors       = new ErrorResultTO();
            ErrorResultTO        errorResultTo   = new ErrorResultTO();

            InitializeDebug(dataObject);
            try
            {
                CleanArguments(MergeCollection);

                if (MergeCollection.Count <= 0)
                {
                    return;
                }
                IWarewolfListIterator warewolfListIterator = new WarewolfListIterator();
                allErrors.MergeErrors(errorResultTo);
                Dictionary <int, List <IWarewolfIterator> > listOfIterators = new Dictionary <int, List <IWarewolfIterator> >();

                #region Create a iterator for each row in the data grid in the designer so that the right iteration happen on the data

                int dictionaryKey = 0;
                foreach (DataMergeDTO row in MergeCollection)
                {
                    allErrors.MergeErrors(errorResultTo);

                    if (dataObject.IsDebugMode())
                    {
                        DebugItem debugItem = new DebugItem();
                        AddDebugItem(new DebugItemStaticDataParams("", (MergeCollection.IndexOf(row) + 1).ToString(CultureInfo.InvariantCulture)), debugItem);
                        AddDebugItem(new DebugEvalResult(row.InputVariable, "", dataObject.Environment, update, true), debugItem);
                        AddDebugItem(new DebugItemStaticDataParams(row.MergeType, "With"), debugItem);
                        AddDebugItem(new DebugEvalResult(row.At, "Using", dataObject.Environment, update), debugItem);
                        AddDebugItem(new DebugEvalResult(row.Padding, "Pad", dataObject.Environment, update), debugItem);

                        //Old workflows don't have this set.
                        if (row.Alignment == null)
                        {
                            row.Alignment = string.Empty;
                        }

                        AddDebugItem(DataListUtil.IsEvaluated(row.Alignment) ? new DebugItemStaticDataParams("", row.Alignment, "Align") : new DebugItemStaticDataParams(row.Alignment, "Align"), debugItem);

                        _debugInputs.Add(debugItem);
                    }
                    var listOfEvalResultsForInput = dataObject.Environment.EvalForDataMerge(row.InputVariable, update);
                    var innerIterator             = new WarewolfListIterator();
                    var innerListOfIters          = new List <WarewolfIterator>();

                    foreach (var listOfIterator in listOfEvalResultsForInput)
                    {
                        var inIterator = new WarewolfIterator(listOfIterator);
                        innerIterator.AddVariableToIterateOn(inIterator);
                        innerListOfIters.Add(inIterator);
                    }
                    var atomList = new List <DataASTMutable.WarewolfAtom>();
                    while (innerIterator.HasMoreData())
                    {
                        var stringToUse = "";
                        foreach (var warewolfIterator in innerListOfIters)
                        {
                            stringToUse += warewolfIterator.GetNextValue();
                        }
                        atomList.Add(DataASTMutable.WarewolfAtom.NewDataString(stringToUse));
                    }
                    var finalString     = string.Join("", atomList);
                    var inputListResult = WarewolfDataEvaluationCommon.WarewolfEvalResult.NewWarewolfAtomListresult(new WarewolfAtomList <DataASTMutable.WarewolfAtom>(DataASTMutable.WarewolfAtom.Nothing, atomList));
                    if (DataListUtil.IsFullyEvaluated(finalString))
                    {
                        inputListResult = dataObject.Environment.Eval(finalString, update);
                    }

                    var inputIterator   = new WarewolfIterator(inputListResult);
                    var atIterator      = new WarewolfIterator(dataObject.Environment.Eval(row.At, update));
                    var paddingIterator = new WarewolfIterator(dataObject.Environment.Eval(row.Padding, update));
                    warewolfListIterator.AddVariableToIterateOn(inputIterator);
                    warewolfListIterator.AddVariableToIterateOn(atIterator);
                    warewolfListIterator.AddVariableToIterateOn(paddingIterator);

                    listOfIterators.Add(dictionaryKey, new List <IWarewolfIterator> {
                        inputIterator, atIterator, paddingIterator
                    });
                    dictionaryKey++;
                }

                #endregion

                #region Iterate and Merge Data

                if (!allErrors.HasErrors())
                {
                    while (warewolfListIterator.HasMoreData())
                    {
                        int pos = 0;
                        foreach (var iterator in listOfIterators)
                        {
                            var val = warewolfListIterator.FetchNextValue(iterator.Value[0]);
                            var at  = warewolfListIterator.FetchNextValue(iterator.Value[1]);
                            var pad = warewolfListIterator.FetchNextValue(iterator.Value[2]);

                            if (val != null)
                            {
                                if (at != null)
                                {
                                    if (pad != null)
                                    {
                                        if (MergeCollection[pos].MergeType == "Index")
                                        {
                                            if (string.IsNullOrEmpty(at))
                                            {
                                                allErrors.AddError("The 'Using' value cannot be blank.");
                                            }

                                            int atValue;
                                            if (!Int32.TryParse(at, out atValue) || atValue < 0)
                                            {
                                                allErrors.AddError("The 'Using' value must be a real number.");
                                            }
                                            if (pad.Length > 1)
                                            {
                                                allErrors.AddError("'Padding' must be a single character");
                                            }
                                        }
                                        else
                                        {
                                            if (MergeCollection[pos].MergeType == "Chars" && string.IsNullOrEmpty(at))
                                            {
                                                allErrors.AddError("The 'Using' value cannot be blank.");
                                            }
                                        }
                                        mergeOperations.Merge(val, MergeCollection[pos].MergeType, at, pad, MergeCollection[pos].Alignment);
                                        pos++;
                                    }
                                }
                            }
                        }
                    }
                    if (!allErrors.HasErrors())
                    {
                        if (string.IsNullOrEmpty(Result))
                        {
                            AddDebugOutputItem(new DebugItemStaticDataParams("", ""));
                        }
                        else
                        {
                            dataObject.Environment.Assign(Result, mergeOperations.MergeData.ToString(), update);
                            allErrors.MergeErrors(errorResultTo);

                            if (dataObject.IsDebugMode() && !allErrors.HasErrors())
                            {
                                AddDebugOutputItem(new DebugEvalResult(Result, "", dataObject.Environment, update));
                            }
                        }
                    }
                }

                #endregion Iterate and Merge Data
            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error("DSFDataMerge", e);
                allErrors.AddError(e.Message);
            }
            finally
            {
                #region Handle Errors

                if (allErrors.HasErrors())
                {
                    if (dataObject.IsDebugMode())
                    {
                        AddDebugOutputItem(new DebugItemStaticDataParams("", Result, ""));
                    }
                    DisplayAndWriteError("DsfDataMergeActivity", allErrors);
                    var errorString = allErrors.MakeDisplayReady();
                    dataObject.Environment.AddError(errorString);
                }

                if (dataObject.IsDebugMode())
                {
                    DispatchDebugState(dataObject, StateType.Before, update);
                    DispatchDebugState(dataObject, StateType.After, update);
                }

                #endregion
            }
        }
 public void Resume(IDSFDataObject dataObject)
 {
     var instanceID = dataObject.WorkflowInstanceId;
     var bookmarkName = dataObject.CurrentBookmarkName;
     var existingDlid = dataObject.DataListID;
     _instance.Load(instanceID);
     _instance.ResumeBookmark(bookmarkName, existingDlid);
 }
Example #39
0
 public PluginServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : base(sa, dataObj, theWorkspace, esbChannel)
 {
     _pluginServiceExecution = new PluginServiceExecution(dataObj, true);
 }
 private PersistableIdleAction OnPersistableIdle(WorkflowApplicationIdleEventArgs args)
 {
     _result = args.GetInstanceExtensions<IDSFDataObject>().ToList().First();
     _waitHandle.Set();
     return PersistableIdleAction.Unload;
 }
Example #41
0
 public IDev2Activity Execute(IDSFDataObject data, int update)
 {
     return(null);
 }
 private void Dispose(bool disposing)
 {
     if(disposing)
     {
         _owner = null;
         _instance = null;
         _workspace = null;
         _result = null;
         _waitHandle = null;
     }
 }
 protected EsbExecutionContainer(ServiceAction sa, IDSFDataObject dataObject, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : this(sa, dataObject, theWorkspace, esbChannel, null)
 {
 }
 public PluginServiceExecution MockGetNewPluginServiceExecution(IDSFDataObject context)
 {
     return GetNewPluginServiceExecution(context);
 }
 public IExecutionEnvironment ExecuteSubRequest(IDSFDataObject dataObject, Guid workspaceID, string inputDefs, string outputDefs,
                                                out ErrorResultTO errors, int update, bool b)
 {
     errors = new ErrorResultTO();
     return(dataObject.Environment);
 }
 public override IExecutionEnvironment Execute(IDSFDataObject inputs, IDev2Activity activity)
 {
     return null;
 }
 public abstract IExecutionEnvironment Execute(IDSFDataObject inputs,IDev2Activity activity);
        // ReSharper restore RedundantOverridenMember

        protected override void OnExecute(NativeActivityContext context)
        {
            IDSFDataObject dataObject = context.GetExtension <IDSFDataObject>();

            ExecuteTool(dataObject, 0);
        }
Example #49
0
 public Guid ExecuteRequest(IDSFDataObject dataObject, EsbExecuteRequest request, Guid workspaceID,
                            out ErrorResultTO errors)
 {
     errors = new ErrorResultTO();
     return(Guid.NewGuid());
 }