コード例 #1
0
 public WriteDataListMessage(long handle, Guid datalistID, IBinaryDataList datalist, ErrorResultTO errors)
 {
     Handle = handle;
     DatalistID = datalistID;
     Datalist = datalist;
     Errors = errors;
 }
コード例 #2
0
        public static ActivityUpsertTO CreateEntriesFromOutputTOs(IList<OutputTO> outputToList, IDataListCompiler compiler, Guid dlId, out ErrorResultTO errors)
        {

            errors = new ErrorResultTO();
            ActivityUpsertTO result = new ActivityUpsertTO();

            foreach(OutputTO outputTo in outputToList)
            {

                // I first need to detect if the entry is a recordset!!!!!!!!!!!
                // Then if scalar upsert scalar else upsert a recordset-- how was this to ever work?!?!

                // Break into parts so we can correctly create the required entry......

                IBinaryDataListEntry entry = Dev2BinaryDataListFactory.CreateEntry(RecsetName, string.Empty, dlId);

                int idx = 1;
                foreach(string output in outputTo.OutputStrings)
                {
                    IBinaryDataListItem itemToAdd = Dev2BinaryDataListFactory.CreateBinaryItem(output, RecsetName, FieldName, idx);
                    idx++;
                    string error;
                    entry.TryAppendRecordItem(itemToAdd, out error);
                    if(error != string.Empty)
                    {
                        errors.AddError(error);
                    }
                }
                // push entry one time, no looping ;)  
                result.AddEntry(entry, outputTo.OutPutDescription);
            }

            return result;
        }
コード例 #3
0
        protected override void ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
        {
            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;
                webserviceExecution.Execute(out invokeErrors, update);
                string err = invokeErrors.MakeDataListReady();
                if (!string.IsNullOrEmpty(err))
                {
                    dataObject.Environment.AddError(err);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Converts the and only map inputs.
 /// </summary>
 /// <param name="input">The input.</param>
 /// <param name="shape">The shape.</param>
 /// <param name="errors">The errors.</param>
 /// <returns></returns>
 public IBinaryDataList ConvertAndOnlyMapInputs(byte[] input, StringBuilder shape, out ErrorResultTO errors)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public override void BeforeExecution(ErrorResultTO errors)
 {
     SetupSqlServer(errors);
 }
コード例 #6
0
 public WriteDataListMessage(long handle, Guid datalistID, IBinaryDataList datalist, ErrorResultTO errors)
 {
     Handle     = handle;
     DatalistID = datalistID;
     Datalist   = datalist;
     Errors     = errors;
 }
コード例 #7
0
        public List <DebugItem> GetDebugValues(IList <IDev2Definition> values, IDSFDataObject dataObject, out ErrorResultTO errors)
        {
            errors = new ErrorResultTO();
            var results = new List <DebugItem>();
            var added   = new List <string>();

            foreach (IDev2Definition dev2Definition in values)
            {
                var defn = GetVariableName(dev2Definition);
                if (added.Any(a => a == defn))
                {
                    continue;
                }

                added.Add(defn);
                DebugItem itemToAdd = new DebugItem();
                _add(new DebugEvalResult(DataListUtil.ReplaceRecordBlankWithStar(defn), "", dataObject.Environment), itemToAdd);
                results.Add(itemToAdd);
            }

            foreach (IDebugItem debugInput in results)
            {
                debugInput.FlushStringBuilder();
            }

            return(results);
        }
コード例 #8
0
        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());
        }
コード例 #9
0
 public DeleteDataListResultMessage(long handle, ErrorResultTO errors)
 {
     Handle = handle;
     Errors = errors;
 }
コード例 #10
0
 public PersistChildChainResultMessage(long handle, bool result, ErrorResultTO errors)
 {
     Handle = handle;
     Result = result;
     Errors = errors;
 }
コード例 #11
0
        protected override void ExecuteTool(IDSFDataObject dataObject, int update)
        {
            ErrorResultTO allErrors = new ErrorResultTO();
            ErrorResultTO errors    = new ErrorResultTO();

            // Process if no errors

            if (dataObject.IsDebugMode())
            {
                InitializeDebug(dataObject);
            }

            if (!errors.HasErrors())
            {
                try
                {
                    //Execute the concrete action for the specified activity
                    IList <OutputTO> outputs = ExecuteConcreteAction(dataObject, out errors, update);

                    allErrors.MergeErrors(errors);

                    if (outputs.Count > 0)
                    {
                        foreach (OutputTO output in outputs)
                        {
                            if (output.OutputStrings.Count > 0)
                            {
                                foreach (string value in output.OutputStrings)
                                {
                                    if (output.OutPutDescription == GlobalConstants.ErrorPayload)
                                    {
                                        errors.AddError(value);
                                    }
                                    else
                                    {
                                        foreach (var region in DataListCleaningUtils.SplitIntoRegions(output.OutPutDescription))
                                        {
                                            dataObject.Environment.Assign(region, value, update);
                                        }
                                    }
                                }
                            }
                        }
                        allErrors.MergeErrors(errors);
                    }
                    else
                    {
                        foreach (var region in DataListCleaningUtils.SplitIntoRegions(Result))
                        {
                            dataObject.Environment.Assign(region, "", update);
                        }
                    }
                    if (dataObject.IsDebugMode())
                    {
                        if (!String.IsNullOrEmpty(Result))
                        {
                            AddDebugOutputItem(new DebugEvalResult(Result, "", dataObject.Environment, update));
                        }
                    }
                }
                catch (Exception ex)
                {
                    allErrors.AddError(ex.Message);
                }
                finally
                {
                    // Handle Errors
                    if (allErrors.HasErrors())
                    {
                        foreach (var err in allErrors.FetchErrors())
                        {
                            dataObject.Environment.Errors.Add(err);
                        }
                    }

                    if (dataObject.IsDebugMode())
                    {
                        DispatchDebugState(dataObject, StateType.Before, update);
                        DispatchDebugState(dataObject, StateType.After, update);
                    }
                }
            }
        }
コード例 #12
0
 public Guid ExecuteRequest(IDSFDataObject dataObject, EsbExecuteRequest request, Guid workspaceID,
                            out ErrorResultTO errors)
 {
     errors = new ErrorResultTO();
     return(Guid.NewGuid());
 }
コード例 #13
0
 /// <summary>
 /// Status : New
 /// Purpose : To provide an overidable concrete method to execute an activity's logic through
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="error">The error.</param>
 /// <param name="update"></param>
 /// <returns></returns>
 protected abstract IList <OutputTO> ExecuteConcreteAction(IDSFDataObject context, out ErrorResultTO error, int update);
コード例 #14
0
        private IDev2Tokenizer CreateSplitPattern(ref string stringToSplit, IEnumerable <DataSplitDTO> args, IExecutionEnvironment compiler, out ErrorResultTO errors, int update)
        {
            Dev2TokenizerBuilder dtb = new Dev2TokenizerBuilder {
                ToTokenize = stringToSplit, ReverseOrder = ReverseOrder
            };

            errors = new ErrorResultTO();

            foreach (DataSplitDTO t in args)
            {
                t.At = t.At ?? "";
                string entry;

                switch (t.SplitType)
                {
                case "Index":
                    try
                    {
                        entry = compiler.EvalAsListOfStrings(t.At, update).FirstOrDefault();
                        if (entry == null)
                        {
                            throw new Exception("null iterator expression");
                        }
                        string index    = entry;
                        int    indexNum = Convert.ToInt32(index);
                        if (indexNum > 0)
                        {
                            dtb.AddIndexOp(indexNum);
                        }
                    }
                    catch (Exception ex)
                    {
                        errors.AddError(ex.Message);
                    }
                    break;

                case "End":
                    dtb.AddEoFOp();
                    break;

                case "Space":
                    dtb.AddTokenOp(" ", t.Include);
                    break;

                case "Tab":
                    dtb.AddTokenOp("\t", t.Include);
                    break;

                case "New Line":
                    if (stringToSplit.Contains("\r\n"))
                    {
                        dtb.AddTokenOp("\r\n", t.Include);
                    }
                    else if (stringToSplit.Contains("\n"))
                    {
                        dtb.AddTokenOp("\n", t.Include);
                    }
                    else if (stringToSplit.Contains("\r"))
                    {
                        dtb.AddTokenOp("\r", t.Include);
                    }
                    break;

                case "Chars":
                    if (!string.IsNullOrEmpty(t.At))
                    {
                        entry = compiler.EvalAsListOfStrings(t.At, update).FirstOrDefault();


                        string escape = t.EscapeChar;
                        if (!String.IsNullOrEmpty(escape))
                        {
                            escape = compiler.EvalAsListOfStrings(t.EscapeChar, update).FirstOrDefault();
                        }

                        dtb.AddTokenOp(entry, t.Include, escape);
                    }
                    break;
                }
                _indexCounter++;
            }
            return(string.IsNullOrEmpty(dtb.ToTokenize) || errors.HasErrors() ? null : dtb.Generate());
        }
コード例 #15
0
        protected override void ExecuteTool(IDSFDataObject dataObject, int update)
        {
            _indexCounter = 1;

            ErrorResultTO        allErrors = new ErrorResultTO();
            var                  env       = dataObject.Environment;
            WarewolfListIterator iter      = new WarewolfListIterator();

            InitializeDebug(dataObject);
            try
            {
                var sourceString = SourceString ?? "";
                if (dataObject.IsDebugMode())
                {
                    AddDebugInputItem(new DebugEvalResult(sourceString, "String to Split", env, update));
                    AddDebugInputItem(new DebugItemStaticDataParams(ReverseOrder ? "Backward" : "Forward", "Process Direction"));
                    AddDebugInputItem(new DebugItemStaticDataParams(SkipBlankRows ? "Yes" : "No", "Skip blank rows"));
                    AddDebug(ResultsCollection, dataObject.Environment, update);
                }
                var res = new WarewolfIterator(env.Eval(sourceString, update));
                iter.AddVariableToIterateOn(res);
                IDictionary <string, int> positions = new Dictionary <string, int>();
                CleanArguments(ResultsCollection);
                ResultsCollection.ToList().ForEach(a =>
                {
                    if (!positions.ContainsKey(a.OutputVariable))
                    {
                        if (update == 0)
                        {
                            positions.Add(a.OutputVariable, 1);
                        }
                        else
                        {
                            positions.Add(a.OutputVariable, update);
                        }
                    }
                    IsSingleValueRule.ApplyIsSingleValueRule(a.OutputVariable, allErrors);
                });
                bool singleInnerIteration = ArePureScalarTargets(ResultsCollection);
                var  resultsEnumerator    = ResultsCollection.GetEnumerator();
                var  debugDictionary      = new List <string>();
                while (res.HasMoreData())
                {
                    const int OpCnt = 0;

                    var item = res.GetNextValue(); // item is the thing we split on
                    if (!string.IsNullOrEmpty(item))
                    {
                        string val       = item;
                        var    blankRows = new List <int>();
                        if (SkipBlankRows)
                        {
                            var strings         = val.Split(new[] { Environment.NewLine, "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
                            var newSourceString = string.Join(Environment.NewLine, strings);
                            val = newSourceString;
                        }
                        else
                        {
                            var strings = val.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                            for (int blankRow = 0; blankRow < strings.Length; blankRow++)
                            {
                                if (String.IsNullOrEmpty(strings[blankRow]))
                                {
                                    blankRows.Add(blankRow);
                                }
                            }
                        }

                        ErrorResultTO  errors;
                        IDev2Tokenizer tokenizer = CreateSplitPattern(ref val, ResultsCollection, env, out errors, update);
                        allErrors.MergeErrors(errors);

                        if (!allErrors.HasErrors())
                        {
                            if (tokenizer != null)
                            {
                                int pos = 0;
                                int end = ResultsCollection.Count - 1;

                                // track used tokens so we can adjust flushing ;)
                                while (tokenizer.HasMoreOps())
                                {
                                    var currentval = resultsEnumerator.MoveNext();
                                    if (!currentval)
                                    {
                                        if (singleInnerIteration)
                                        {
                                            break;
                                        }
                                        resultsEnumerator.Reset();
                                        resultsEnumerator.MoveNext();
                                    }
                                    string tmp = tokenizer.NextToken();

                                    if (tmp.StartsWith(Environment.NewLine) && !SkipBlankRows)
                                    {
                                        resultsEnumerator.Reset();
                                        while (resultsEnumerator.MoveNext())
                                        {
                                            var tovar = resultsEnumerator.Current.OutputVariable;
                                            if (!String.IsNullOrEmpty(tovar))
                                            {
                                                var assignToVar = ExecutionEnvironment.ConvertToIndex(tovar, positions[tovar]);
                                                env.AssignWithFrame(new AssignValue(assignToVar, ""), update);
                                                positions[tovar] = positions[tovar] + 1;
                                            }
                                        }
                                        resultsEnumerator.Reset();
                                        resultsEnumerator.MoveNext();
                                    }
                                    if (blankRows.Contains(OpCnt) && blankRows.Count != 0)
                                    {
                                        tmp = tmp.Replace(Environment.NewLine, "");
                                        while (pos != end + 1)
                                        {
                                            pos++;
                                        }
                                    }
                                    var outputVar = resultsEnumerator.Current.OutputVariable;

                                    if (!String.IsNullOrEmpty(outputVar))
                                    {
                                        var assignVar = ExecutionEnvironment.ConvertToIndex(outputVar, positions[outputVar]);
                                        if (ExecutionEnvironment.IsRecordsetIdentifier(assignVar))
                                        {
                                            env.AssignWithFrame(new AssignValue(assignVar, tmp), update);
                                        }
                                        else if (ExecutionEnvironment.IsScalar(assignVar) && positions[outputVar] == 1)
                                        {
                                            env.AssignWithFrame(new AssignValue(assignVar, tmp), update);
                                        }
                                        else
                                        {
                                            env.AssignWithFrame(new AssignValue(assignVar, tmp), update);
                                        }
                                        positions[outputVar] = positions[outputVar] + 1;
                                    }
                                    if (dataObject.IsDebugMode())
                                    {
                                        var debugItem   = new DebugItem();
                                        var outputVarTo = resultsEnumerator.Current.OutputVariable;
                                        AddDebugItem(new DebugEvalResult(outputVarTo, "", env, update), debugItem);
                                        if (!debugDictionary.Contains(outputVarTo))
                                        {
                                            debugDictionary.Add(outputVarTo);
                                        }
                                    }
                                    if (pos == end)
                                    {
                                    }
                                    else
                                    {
                                        pos++;
                                    }
                                }
                            }
                        }
                    }
                    env.CommitAssign();
                    if (singleInnerIteration)
                    {
                        break;
                    }
                }

                if (dataObject.IsDebugMode())
                {
                    var outputIndex = 1;
                    foreach (var varDebug in debugDictionary)
                    {
                        var debugItem = new DebugItem();
                        AddDebugItem(new DebugItemStaticDataParams("", outputIndex.ToString(CultureInfo.InvariantCulture)), debugItem);
                        var dataSplitUsesStarForOutput = varDebug.Replace("().", "(*).");
                        AddDebugItem(new DebugEvalResult(dataSplitUsesStarForOutput, "", env, update), debugItem);
                        _debugOutputs.Add(debugItem);
                        outputIndex++;
                    }
                }
            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error("DSFDataSplit", e);
                allErrors.AddError(e.Message);
            }
            finally
            {
                // Handle Errors
                var hasErrors = allErrors.HasErrors();
                if (hasErrors)
                {
                    DisplayAndWriteError("DsfDataSplitActivity", allErrors);
                    var errorString = allErrors.MakeDisplayReady();
                    dataObject.Environment.AddError(errorString);
                }

                if (dataObject.IsDebugMode())
                {
                    DispatchDebugState(dataObject, StateType.Before, update);
                    DispatchDebugState(dataObject, StateType.After, update);
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Clones the specified type of.
        /// </summary>
        /// <param name="depth">The depth.</param>
        /// <param name="errorResult">The error result.</param>
        /// <param name="onlySystemTags">if set to <c>true</c> [only system tags].</param>
        /// <returns></returns>
        public IBinaryDataList Clone(enTranslationDepth depth, out ErrorResultTO errorResult, bool onlySystemTags)
        {
            // set parent child reference
            BinaryDataList result = new BinaryDataList { ParentUID = ParentUID };

            errorResult = new ErrorResultTO();

            // clone the dictionary
            foreach(string e in _templateDict.Keys)
            {

                if((onlySystemTags && e.IndexOf(GlobalConstants.SystemTagNamespaceSearch, StringComparison.Ordinal) >= 0) || !onlySystemTags)
                {
                    string error;
                    // fetch this instance via clone, fetch toClone instance and merge the data
                    IBinaryDataListEntry cloned = _templateDict[e].Clone(depth, UID, out error);
                    // Copy over the intellisesne parts ;)
                    result._intellisenseParts = _intellisenseParts;
                    errorResult.AddError(error);
                    if(error == string.Empty)
                    {
                        // safe to add
                        result._templateDict[e] = cloned;
                    }
                }
            }

            // if only system tags, clean the intellisense parts out ;)
            if(onlySystemTags)
            {
                var parts =
                    result._intellisenseParts.Where(
                        c => c.Name.IndexOf(GlobalConstants.SystemTagNamespaceSearch, StringComparison.Ordinal) >= 0);
                result._intellisenseParts = parts.ToList();
            }


            return result;
        }
コード例 #17
0
        protected override IList <OutputTO> TryExecuteConcreteAction(IDSFDataObject context, out ErrorResultTO error, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            error = new ErrorResultTO();

            var 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 passItr = new WarewolfIterator(context.Environment.Eval(DecryptedPassword, update));

            colItr.AddVariableToIterateOn(passItr);

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

            colItr.AddVariableToIterateOn(privateKeyItr);

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

            if (context.IsDebugMode())
            {
                AddDebugInputItem(InputPath, "Input Path", context.Environment, update);
                AddDebugInputItemUserNamePassword(context.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Private Key File", context.Environment, update);
                }
            }
            while (colItr.HasMoreData())
            {
                var broker = ActivityIOFactory.CreateOperationsBroker();

                try
                {
                    var dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                     Username,
                                                                     colItr.FetchNextValue(passItr),
                                                                     true, colItr.FetchNextValue(privateKeyItr));

                    var dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);

                    var result = broker.Delete(dstEndPoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch (Exception e)
                {
                    outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
                    error.AddError(e.Message);
                    break;
                }
            }

            return(outputs);
        }
コード例 #18
0
 public T FetchServerModel <T>(IDSFDataObject dataObject, Guid workspaceID, out ErrorResultTO errors, int update)
 {
     throw new NotImplementedException();
 }
コード例 #19
0
 public ReadDataListResultMessage(long handle, IBinaryDataList datalist, ErrorResultTO errors)
 {
     Handle = handle;
     Datalist = datalist;
     Errors = errors;
 }
コード例 #20
0
 public ReadDataListMessage(long handle, Guid datalistID, ErrorResultTO errors)
 {
     Handle = handle;
     DatalistID = datalistID;
     Errors = errors;
 }
コード例 #21
0
 public IList <KeyValuePair <enDev2ArgumentType, IList <IDev2Definition> > > ShapeForSubRequest(
     IDSFDataObject dataObject, string inputDefs, string outputDefs, out ErrorResultTO errors)
 {
     throw new NotImplementedException();
 }
コード例 #22
0
        private void AssignField(IDSFDataObject dataObject, int update, int innerCount, ActivityDTO t, ErrorResultTO allErrors)
        {
            var assignValue      = new AssignValue(t.FieldName, t.FieldValue);
            var isCalcEvaluation = DataListUtil.IsCalcEvaluation(t.FieldValue, out string cleanExpression);

            if (isCalcEvaluation)
            {
                assignValue = new AssignValue(t.FieldName, cleanExpression);
            }
            DebugItem debugItem = null;

            if (dataObject.IsDebugMode())
            {
                debugItem = AddSingleInputDebugItem(dataObject.Environment, innerCount, assignValue, update);
            }

            try
            {
                if (isCalcEvaluation)
                {
                    DoCalculation(dataObject.Environment, t.FieldName, t.FieldValue, update);
                }
                else
                {
                    dataObject.Environment.AssignWithFrame(assignValue, update);
                }
            } catch (Exception e)
            {
                allErrors.AddError(e.Message);
            }

            if (debugItem != null)
            {
                _debugInputs.Add(debugItem);
            }
            if (dataObject.IsDebugMode())
            {
                if (DataListUtil.IsValueRecordset(assignValue.Name) && DataListUtil.GetRecordsetIndexType(assignValue.Name) == enRecordsetIndexType.Blank && !assignValue.Name.Contains(DataListUtil.ObjectStartMarker))
                {
                    var length = dataObject.Environment.GetLength(DataListUtil.ExtractRecordsetNameFromValue(assignValue.Name));
                    assignValue = new AssignValue(DataListUtil.ReplaceRecordsetBlankWithIndex(assignValue.Name, length), assignValue.Value);
                }
                AddSingleDebugOutputItem(dataObject.Environment, innerCount, assignValue, update);
            }
        }
コード例 #23
0
 public Guid CorrectDataList(IDSFDataObject dataObject, Guid workspaceID, out ErrorResultTO errors,
                             IDataListCompiler compiler)
 {
     throw new NotImplementedException();
 }
コード例 #24
0
        public void DispatchDebugState(IDSFDataObject dataObject, StateType stateType, bool hasErrors, string existingErrors, out ErrorResultTO errors, DateTime?workflowStartTime = null, bool interrogateInputs = false, bool interrogateOutputs = false)
        {
            errors = new ErrorResultTO();
            if (dataObject != null)
            {
                Guid parentInstanceId;
                Guid.TryParse(dataObject.ParentInstanceID, out parentInstanceId);
                IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
                bool hasError     = dataObject.Environment.HasErrors();
                var  errorMessage = String.Empty;
                if (hasError)
                {
                    errorMessage = dataObject.Environment.FetchErrors();
                }
                if (String.IsNullOrEmpty(existingErrors))
                {
                    existingErrors = errorMessage;
                }
                else
                {
                    existingErrors += Environment.NewLine + errorMessage;
                }
                var debugState = new DebugState
                {
                    ID                    = dataObject.OriginalInstanceID,
                    ParentID              = parentInstanceId,
                    WorkspaceID           = dataObject.WorkspaceID,
                    StateType             = stateType,
                    StartTime             = workflowStartTime ?? DateTime.Now,
                    EndTime               = DateTime.Now,
                    ActivityType          = ActivityType.Workflow,
                    DisplayName           = dataObject.ServiceName,
                    IsSimulation          = dataObject.IsOnDemandSimulation,
                    ServerID              = dataObject.ServerID,
                    OriginatingResourceID = dataObject.ResourceID,
                    OriginalInstanceID    = dataObject.OriginalInstanceID,
                    Server                = string.Empty,
                    Version               = string.Empty,
                    SessionID             = dataObject.DebugSessionID,
                    EnvironmentID         = dataObject.EnvironmentID,
                    ClientID              = dataObject.ClientID,
                    Name                  = stateType.ToString(),
                    HasError              = hasErrors || hasError,
                    ErrorMessage          = existingErrors
                };

                if (interrogateInputs)
                {
                    ErrorResultTO invokeErrors;
                    var           defs   = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Input);
                    var           inputs = GetDebugValues(defs, dataObject, out invokeErrors);
                    errors.MergeErrors(invokeErrors);
                    debugState.Inputs.AddRange(inputs);
                }
                if (interrogateOutputs)
                {
                    ErrorResultTO invokeErrors;

                    var defs   = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Output);
                    var inputs = GetDebugValues(defs, dataObject, out invokeErrors);
                    errors.MergeErrors(invokeErrors);
                    debugState.Outputs.AddRange(inputs);
                }
                if (stateType == StateType.End)
                {
                    debugState.NumberOfSteps = dataObject.NumberOfSteps;
                }

                if (stateType == StateType.Start)
                {
                    debugState.ExecutionOrigin            = dataObject.ExecutionOrigin;
                    debugState.ExecutionOriginDescription = dataObject.ExecutionOriginDescription;
                }

                if (dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer))
                {
                    var debugDispatcher = GetDebugDispatcher();
                    if (debugState.StateType == StateType.End)
                    {
                        while (!debugDispatcher.IsQueueEmpty)
                        {
                            Thread.Sleep(100);
                        }
                        debugDispatcher.Write(debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID, dataObject.ParentInstanceID, dataObject.RemoteDebugItems);
                    }
                    else
                    {
                        debugDispatcher.Write(debugState);
                    }
                }
            }
        }
コード例 #25
0
 public void ExecuteLogErrorRequest(IDSFDataObject dataObject, Guid workspaceID, string uri,
                                    out ErrorResultTO errors, int update)
 {
     throw new NotImplementedException();
 }
コード例 #26
0
 public override void AfterExecution(ErrorResultTO errors)
 {
     DestroySqlServer();
 }
コード例 #27
0
 public IExecutionEnvironment UpdatePreviousEnvironmentWithSubExecutionResultUsingOutputMappings(IDSFDataObject dataObject, string outputDefs, int update, bool handleErrors, ErrorResultTO errors)
 {
     return(null);
 }
コード例 #28
0
ファイル: WebServices.cs プロジェクト: kapiya/Warewolf
 public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors)
 {
     ExecuteRequest(service, throwError, out errors, DefaultWebExecute);
 }
コード例 #29
0
 public IExecutionEnvironment ExecuteSubRequest(IDSFDataObject dataObject, Guid workspaceID, string inputDefs, string outputDefs,
                                                out ErrorResultTO errors, int update, bool b)
 {
     errors = new ErrorResultTO();
     return(dataObject.Environment);
 }
コード例 #30
0
 public WriteDataListResultMessage(long handle, bool result, ErrorResultTO errors)
 {
     Handle = handle;
     Result = result;
     Errors = errors;
 }
コード例 #31
0
        protected override IList <OutputTO> TryExecuteConcreteAction(IDSFDataObject context, out ErrorResultTO error, int update)
        {
            IsNotCertVerifiable = true;

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

            using (var 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 unameItr = new WarewolfIterator(context.Environment.Eval(Username, update));
                colItr.AddVariableToIterateOn(unameItr);

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

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

                if (context.IsDebugMode())
                {
                    AddDebugInputItem(InputPath, "Input Path", context.Environment, update);
                    AddDebugInputItem(new DebugItemStaticDataParams(GetReadType().GetDescription(), "Read"));
                    AddDebugInputItemUserNamePassword(context.Environment, update);
                    if (!string.IsNullOrEmpty(PrivateKeyFile))
                    {
                        AddDebugInputItem(PrivateKeyFile, "Private Key File", context.Environment, update);
                    }
                }

                while (colItr.HasMoreData())
                {
                    var broker = ActivityIOFactory.CreateOperationsBroker();
                    var ioPath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                        colItr.FetchNextValue(unameItr),
                                                                        colItr.FetchNextValue(passItr),
                                                                        true, colItr.FetchNextValue(privateKeyItr));
                    var endPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ioPath);

                    try
                    {
                        ExecuteConcreteAction(outputs, broker, endPoint);
                    }
                    catch (Exception e)
                    {
                        outputs.Add(DataListFactory.CreateOutputTO(null));
                        error.AddError(e.Message);
                        break;
                    }
                }

                return(outputs);
            }
        }
コード例 #32
0
 public IBinaryDataList ConvertTo(object input, StringBuilder shape, out ErrorResultTO errors)
 {
     throw new NotImplementedException();
 }
コード例 #33
0
 protected virtual void ExecuteWebRequest(WebService service, out ErrorResultTO errors)
 {
     WebServices.ExecuteRequest(service, true, out errors);
 }
コード例 #34
0
        /*
         * Adjust Clone to simply copy the object instance
         * 
         * 
         */
        public IBinaryDataList Merge(IBinaryDataList right, enDataListMergeTypes mergeType, enTranslationDepth depth, bool newList, out ErrorResultTO errors)
        {
            IBinaryDataList mergeResult = newList ? Clone(depth, out errors, false) : this;

            // do the merge ;)
            ((BinaryDataList)mergeResult).MergeIntoInstance(right, mergeType, depth, out errors);

            return mergeResult;
        }
コード例 #35
0
        protected override object ExecuteService(List <MethodParameter> methodParameters, out ErrorResultTO errors, IOutputFormatter formater = null)
        {
            Service.Source = Source;
            ExecuteWebRequest(Service, out errors);
            string result = String.IsNullOrEmpty(Service.JsonPath) || String.IsNullOrEmpty(Service.JsonPathResult)
                ? Scrubber.Scrub(Service.RequestResponse)
                : Scrubber.Scrub(Service.JsonPathResult);

            Service.RequestResponse = null;
            return(result);
        }
コード例 #36
0
        /// <summary>
        /// Merges the into instance.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <param name="typeOf">The type of.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="errorResult">The error result.</param>
        private void MergeIntoInstance(IBinaryDataList obj, enDataListMergeTypes typeOf, enTranslationDepth depth, out ErrorResultTO errorResult)
        {

            errorResult = new ErrorResultTO();
            BinaryDataList toClone = (BinaryDataList)obj;
            if(obj.ParentUID != UID)
            {
                ParentUID = toClone.ParentUID;
            }
            IList<string> lamdaErrors = new List<string>();
            IList<string> errorList = new List<string>();
            IList<string> unionKeyHits = new List<string>();

            // clone the dictionary
            IList<string> tmp = _templateDict.Keys.ToList();  // must be this way since we modify the collection...
            foreach(string e in tmp)
            {
                string error;
                IBinaryDataListEntry cloned;

                if(typeOf == enDataListMergeTypes.Union)
                {
                    // fetch this instance via clone, fetch toClone instance and merge the data
                    IBinaryDataListEntry fetchTmp;
                    if(toClone._templateDict.TryGetValue(e, out fetchTmp))
                    {
                        unionKeyHits.Add(e);
                        cloned = fetchTmp.Clone(depth, UID, out error);
                        if(error != string.Empty)
                        {
                            lamdaErrors.Add(error);
                        }
                        else
                        {
                            DepthMerge(depth, cloned, e, out lamdaErrors);
                        }

                        // We need to ensure that the intellisense dictionary is populated with this key ;)

                    }
                }
                else if(typeOf == enDataListMergeTypes.Intersection)
                {
                    IBinaryDataListEntry toFetch;
                    if(toClone.TryGetEntry(e, out toFetch, out error))
                    {
                        cloned = toClone._templateDict[e].Clone(depth, UID, out error);
                        if(error != string.Empty)
                        {
                            lamdaErrors.Add(error);
                        }
                        else
                        {
                            DepthMerge(depth, cloned, e, out lamdaErrors);
                        }
                    }
                    else
                    {
                        lamdaErrors.Add("Missing DataList item [ " + e + " ] ");
                    }
                }

                // compile error list ?!
                foreach(string err in lamdaErrors)
                {
                    errorList.Add(err);
                }
                lamdaErrors.Clear();
            }


            // now process key misses for union
            if(typeOf == enDataListMergeTypes.Union)
            {
                //toClone._templateDict.Keys
                foreach(string k in (toClone._templateDict.Keys.ToArray().Except(unionKeyHits)))
                {
                    string error;
                    IBinaryDataListEntry cloned = toClone._templateDict[k].Clone(depth, UID, out error);
                    if(error != string.Empty)
                    {
                        lamdaErrors.Add(error);
                    }
                    else
                    {
                        DepthMerge(depth, cloned, k, out lamdaErrors);
                    }
                }
            }

            // now build the silly composite object since lamba is an daft construct
            // how about proper exception handling MS?!
            foreach(string err in errorList)
            {
                errorResult.AddError(err);
            }
        }
コード例 #37
0
 public override void BeforeExecution(ErrorResultTO errors)
 {
 }
コード例 #38
0
 public WriteDataListResultMessage(long handle, bool result, ErrorResultTO errors)
 {
     Handle = handle;
     Result = result;
     Errors = errors;
 }
コード例 #39
0
 public override void AfterExecution(ErrorResultTO errors)
 {
 }
コード例 #40
0
 protected override object ExecuteService(out ErrorResultTO errors, IOutputFormatter formater = null)
 {
     errors = new ErrorResultTO();
     DidExecuteServiceInvoke = true;
     return(null);
 }
コード例 #41
0
        public void AddAlias(Guid dlId, string parentColumn, string parentNamespace, string childColumn, out ErrorResultTO errors)
        {
            errors = new ErrorResultTO();
            // TODO : This needs to change so we can track at all levels what the root alias is ;)
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();

            Guid masterId = dlId;
            string masterRs = parentNamespace;
            string masterCol = parentColumn;
            Guid searchId = dlId;

            IBinaryDataListEntry masterEntry = null;

            int aliasSearchRounds = 0;
            BinaryDataListAlias binaryDataListAlias = null;

            while(searchId != Guid.Empty)
            {
                ErrorResultTO invokeErrors;
                var bdl = compiler.FetchBinaryDataList(searchId, out invokeErrors);
                errors.MergeErrors(invokeErrors);


                if(bdl != null)
                {
                    string error;
                    bdl.TryGetEntry(masterRs, out masterEntry, out error);
                    errors.AddError(error);

                    if(masterEntry != null)
                    {
                        var aliases = masterEntry.FetchAlias();

                        if(aliases.TryGetValue(masterCol, out binaryDataListAlias))
                        {
                            // we have a hit ;)
                            masterId = binaryDataListAlias.MasterKeyID;
                            searchId = masterId;
                            masterRs = binaryDataListAlias.MasterNamespace;
                            masterCol = binaryDataListAlias.MasterColumn;
                            aliasSearchRounds++;
                        }
                        else
                        {
                            // ensure we copy over the alias entry's keys ;)
                            if(IsEmtpy)
                            {
                                var keyItr = masterEntry.FetchRecordsetIndexes();

                                _myKeys = new IndexList(keyItr.FetchGaps(), keyItr.MaxIndex(), keyItr.MinIndex());

                                IsEmtpy = false;
                            }

                            searchId = Guid.Empty; // signal end ;)
                        }
                    }
                    else
                    {
                        if(aliasSearchRounds == 0)
                        {
                            throw new Exception("Missing Entry");
                        }
                        // we hit the bottom earlier, handle it ;)
                        if(binaryDataListAlias != null)
                        {
                            masterEntry = binaryDataListAlias.MasterEntry;
                        }
                        searchId = Guid.Empty; // signal end ;)
                    }

                }
                else
                {
                    throw new Exception("Missing DataList");
                }
            }


            // Check MasterKeyID to see if it contains an alias, if so keep bubbling until we at end ;)
            _keyToAliasMap[childColumn] = new BinaryDataListAlias { MasterKeyID = masterId, ChildKey = GenerateKeyPrefix(Namespace, DataListKey), MasterKey = GenerateKeyPrefix(masterRs, masterId), MasterColumn = masterCol, MasterNamespace = masterRs, MasterEntry = masterEntry };
        }