void SetValues(NativeActivityContext context, bool whereErrors) { Result.Set(context, whereErrors); HasError.Set(context, whereErrors); IsValid.Set(context, whereErrors); }
protected override void OnExecute(NativeActivityContext context) { // ???? Why is this here.... context.Properties.ToObservableCollection(); IEsbChannel esbChannel = context.GetExtension <IEsbChannel>(); IDSFDataObject dataObject = context.GetExtension <IDSFDataObject>(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); ErrorResultTO errors; ErrorResultTO allErrors = new ErrorResultTO(); Guid datalistId = DataListExecutionID.Get(context); ParentServiceName = dataObject.ServiceName; ParentWorkflowInstanceId = context.WorkflowInstanceId.ToString(); string parentServiceName = string.Empty; string serviceName = string.Empty; // BUG 9634 - 2013.07.17 - TWR - changed isRemoteExecution to check EnvironmentID instead // This is now the wrong behavior - We need to keep the original EnvironmentID when not a remote workflow // This is because we put and empty GUID in when designing against a remote server that uses it's resources // The first time through this value is set correctly when executing those designed resource from our localhost // If we change it as per what was here, we always get a localhost tag instead of the remote host we are design against var isRemote = dataObject.IsRemoteWorkflow(); dataObject.EnvironmentID = context.GetValue(EnvironmentID); if ((isRemote || dataObject.IsRemoteInvokeOverridden) && dataObject.EnvironmentID == Guid.Empty) { dataObject.IsRemoteInvokeOverridden = true; } var oldResourceId = dataObject.ResourceID; InitializeDebug(dataObject); try { compiler.ClearErrors(dataObject.DataListID); if (ServiceServer != Guid.Empty) { // we need to adjust the originating server id so debug reflect remote server instead of localhost ;) dataObject.RemoteInvokerID = ServiceServer.ToString(); } dataObject.RemoteServiceType = context.GetValue(Type); dataObject.RunWorkflowAsync = RunWorkflowAsync; if (dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer)) { DispatchDebugState(context, StateType.Before); } var resourceId = context.GetValue(ResourceID); if (resourceId != Guid.Empty) { dataObject.ResourceID = resourceId; } // scrub it clean ;) ScrubDataList(compiler, datalistId, context.WorkflowInstanceId.ToString(), out errors); allErrors.MergeErrors(errors); // set the parent service parentServiceName = dataObject.ParentServiceName; serviceName = dataObject.ServiceName; dataObject.ParentServiceName = serviceName; _previousInstanceId = dataObject.ParentInstanceID; dataObject.ParentID = oldResourceId; dataObject.ParentInstanceID = UniqueID; dataObject.ParentWorkflowInstanceId = ParentWorkflowInstanceId; if (!DeferExecution) { // In all cases the ShapeOutput will have merged the execution data up into the current ErrorResultTO tmpErrors = new ErrorResultTO(); if (esbChannel == null) { throw new Exception("FATAL ERROR : Null ESB channel!!"); } else { // NEW EXECUTION MODEL ;) // PBI 7913 if (datalistId != GlobalConstants.NullDataListID) { BeforeExecutionStart(dataObject, allErrors); allErrors.MergeErrors(tmpErrors); dataObject.ServiceName = ServiceName; // set up for sub-exection ;) dataObject.ResourceID = ResourceID.Expression == null ? Guid.Empty : Guid.Parse(ResourceID.Expression.ToString()); // Execute Request ExecutionImpl(esbChannel, dataObject, InputMapping, OutputMapping, out tmpErrors); allErrors.MergeErrors(tmpErrors); AfterExecutionCompleted(tmpErrors); allErrors.MergeErrors(tmpErrors); dataObject.DataListID = datalistId; // re-set DL ID dataObject.ServiceName = ServiceName; } // ** THIS IS A HACK OF NOTE, WE NEED TO ADDRESS THIS! if (dataObject.IsDebugMode()) { //Dont remove this it is here to fix the data not being returned correctly string testData = compiler.ConvertFrom(dataObject.DataListID, DataListFormat.CreateFormat(GlobalConstants._Studio_Debug_XML), enTranslationDepth.Data, out errors).ToString(); if (string.IsNullOrEmpty(testData)) { } } } bool whereErrors = compiler.HasErrors(datalistId); Result.Set(context, whereErrors); HasError.Set(context, whereErrors); IsValid.Set(context, whereErrors); } } finally { if (!dataObject.WorkflowResumeable || !dataObject.IsDataListScoped) { // Handle Errors if (allErrors.HasErrors()) { DisplayAndWriteError("DsfActivity", allErrors); compiler.UpsertSystemTag(dataObject.DataListID, enSystemTag.Dev2Error, allErrors.MakeDataListReady(), out errors); // add to datalist in variable specified if (!String.IsNullOrEmpty(OnErrorVariable)) { var upsertVariable = DataListUtil.AddBracketsToValueIfNotExist(OnErrorVariable); compiler.Upsert(dataObject.DataListID, upsertVariable, allErrors.MakeDataListReady(), out errors); } } } if (dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer)) { DispatchDebugState(context, StateType.After); } dataObject.ParentInstanceID = _previousInstanceId; dataObject.ParentServiceName = parentServiceName; dataObject.ServiceName = serviceName; dataObject.RemoteInvokeResultShape = new StringBuilder(); // reset targnet shape ;) dataObject.RunWorkflowAsync = false; dataObject.RemoteInvokerID = Guid.Empty.ToString(); dataObject.EnvironmentID = Guid.Empty; dataObject.ResourceID = oldResourceId; } }