protected CallMethodResult GetDefaultSalesAreaPassPriorityId(Guid id)
 {
     return(CallMethodResult.Create(new GuidResult
     {
         Id = Repository.GetDefaultSalesAreaPassPriorityId()
     }));
 }
 protected CallMethodResult RemoveByScenarioId(Guid scenarioId)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.RemoveByScenarioId(scenarioId);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
 protected CallMethodResult RemoveByScenarioIdAndProcessors(Guid scenarioId, IEnumerable <string> processors)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.RemoveByScenarioIdAndProcessors(scenarioId, processors);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #4
0
        protected CallMethodResult Search(
            string description,
            DateTime?executedStartDate,
            DateTime?executedEndDate,
            List <RunStatus> status,
            StringMatchHowManyWordsToMatch howManyWordsToMatch,
            StringMatchWordOrders wordOrder,
            StringMatchWordComparisons wordComparison,
            bool caseSensitive,
            string charactersToIgnore)
        {
            var queryModel = new RunSearchQueryModel
            {
                Description       = description,
                ExecutedStartDate = executedStartDate,
                ExecutedEndDate   = executedEndDate,
                Status            = status
            };

            var stringMatchRules = new StringMatchRules(howManyWordsToMatch, wordOrder, wordComparison, caseSensitive,
                                                        new char[] { ' ' }, charactersToIgnore.ToCharArray());

            var res = Repository.Search(queryModel, stringMatchRules);

            TestContext.LastOperationCount   = res?.Items?.Count ?? 0;
            TestContext.LastCollectionResult = res?.Items;
            TestContext.LastSingleResult     = null;

            return(CallMethodResult.CreateHandled());
        }
 protected CallMethodResult GetDefaultScenarioId(Guid id)
 {
     return(CallMethodResult.Create(new GuidResult
     {
         Id = Repository.GetDefaultScenarioId()
     }));
 }
 protected CallMethodResult DeleteByExternalSpotRef(string externalSpotRef)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.Delete(externalSpotRef);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #7
0
 protected CallMethodResult SearchBySalesAreas(IDictionary <string, string> parameters)
 {
     return(CallMethodResult.Create(
                Repository.Search(
                    parameters.GetBySpecflowService <DateTimeRange>("scheduledDatesRange"),
                    parameters.GetBySpecflowService <List <string> >("salesAreaNames"))));
 }
 protected CallMethodResult DeleteBefore(DateTime modifiedTime)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.DeleteBefore(modifiedTime);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #9
0
        protected CallMethodResult Search(
            string externalIdentifier,
            string name,
            string clashCode,
            DateTime?fromDateInclusive,
            DateTime?toDateInclusive,
            string nameOrRef)
        {
            var queryModel = new ProductSearchQueryModel
            {
                Externalidentifier = externalIdentifier,
                Name              = name,
                ClashCode         = clashCode,
                FromDateInclusive = fromDateInclusive ?? default,
                ToDateInclusive   = toDateInclusive ?? default,
                NameOrRef         = nameOrRef
            };
            var res = Repository.Search(queryModel, NodaTime.SystemClock.Instance.GetCurrentInstant().ToDateTimeUtc());

            TestContext.LastOperationCount   = res?.Items?.Count ?? 0;
            TestContext.LastCollectionResult = res?.Items;
            TestContext.LastSingleResult     = TestContext.LastOperationCount == 1 ? res.Items.First() : null;

            return(CallMethodResult.CreateHandled());
        }
    }
예제 #10
0
 protected CallMethodResult DeleteRange(IEnumerable <int> ids)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.DeleteRange(ids);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #11
0
 protected CallMethodResult DeleteByKey(MetaDataKeys key)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.DeleteByKey(key);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
        protected CallMethodResult RemoveByRunId(Guid runId)
        {
            Repository.RemoveByRunId(runId);
            Repository.SaveChanges();

            return(CallMethodResult.CreateHandled());
        }
 protected CallMethodResult DeleteRangeByExternalRefs(IEnumerable <string> externalRefs)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.DeleteRangeByExternalRefs(externalRefs);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #14
0
 protected CallMethodResult Delete(string salesArea)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.Delete(salesArea);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #15
0
        protected CallMethodResult Delete(IList <Guid> ids)
        {
            DbContext.WaitForIndexesAfterSaveChanges();
            Repository.Delete(ids);
            DbContext.SaveChanges();

            return(CallMethodResult.CreateHandled());
        }
예제 #16
0
 protected CallMethodResult GetSchedules(IDictionary <string, string> parameters)
 {
     return(CallMethodResult.Create(
                Repository.GetSchedule(
                    parameters.GetBySpecflowService <List <string> >("salesAreaNames"),
                    parameters.GetBySpecflowService <DateTime>("fromDate"),
                    parameters.GetBySpecflowService <DateTime>("toDate"))));
 }
        protected CallMethodResult RemoveRatingsSchedule(DateTime scheduleDay, string salesarea)
        {
            DbContext.WaitForIndexesAfterSaveChanges();
            var schedule = Repository.GetSchedule(scheduleDay, salesarea);

            Repository.Remove(schedule);
            DbContext.SaveChanges();
            return(CallMethodResult.CreateHandled());
        }
예제 #18
0
        protected CallMethodResult Delete(IDictionary <string, string> parameters)
        {
            DbContext.WaitForIndexesAfterSaveChanges();
            Repository.Delete(parameters.GetBySpecflowService <List <string> >("ids")
                              .ConvertAll(x => x.Trim().SpecflowConvert <Guid>())
                              );
            DbContext.SaveChanges();

            return(CallMethodResult.CreateHandled());
        }
예제 #19
0
        protected CallMethodResult GetByKeys(List <MetaDataKeys> keys)
        {
            var res = Repository.GetByKeys(keys);

            TestContext.LastOperationCount   = res?.SelectMany(x => x.Value).Count() ?? 0;
            TestContext.LastCollectionResult = null;
            TestContext.LastSingleResult     = null;

            return(CallMethodResult.CreateHandled());
        }
예제 #20
0
        protected CallMethodResult GetDesc(Guid id)
        {
            var result = Repository.GetDesc(id);

            TestContext.LastSingleResult     = result?.Item2;
            TestContext.LastOperationCount   = result != null ? 1 : 0;
            TestContext.LastCollectionResult = null;

            return(CallMethodResult.CreateHandled());
        }
예제 #21
0
        protected CallMethodResult CountBreaksAndProgrammes(DateTime dateFrom, DateTime dateTo)
        {
            var res = Repository.CountBreaksAndProgrammes(dateFrom, dateTo);

            return(CallMethodResult.Create(new CountBreaksAndProgrammesResult
            {
                BreakCount = res.breaksCount,
                ProgrammeCount = res.programmesCount
            }));
        }
예제 #22
0
        protected CallMethodResult Exists(Guid scenarioId, string fileId)
        {
            var res = Repository.Exists(scenarioId, fileId);

            AssignTestContextSingleResult(new ExistsResult
            {
                Result = res
            });
            return(CallMethodResult.CreateHandled());
        }
예제 #23
0
 protected CallMethodResult DeleteByCombination(
     string salesArea,
     string demographic,
     DateTime?startDate,
     DateTime?endDate)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.DeleteByCombination(salesArea, demographic, startDate, endDate);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #24
0
 protected CallMethodResult DeleteByCriteria(
     List <string> salesAreaNames,
     DateTime?startDate,
     DateTime?endDate,
     RestrictionType?restrictionType,
     bool matchAllSpecifiedSalesAreas)
 {
     DbContext.WaitForIndexesAfterSaveChanges();
     Repository.Delete(salesAreaNames, matchAllSpecifiedSalesAreas, startDate, endDate, restrictionType);
     DbContext.SaveChanges();
     return(CallMethodResult.CreateHandled());
 }
예제 #25
0
        protected CallMethodResult SearchAdvertiser(string nameOrRef)
        {
            var queryModel = new AdvertiserSearchQueryModel
            {
                AdvertiserNameorRef = nameOrRef,
            };
            var res = Repository.Search(queryModel, _clock.GetCurrentInstant().ToDateTimeUtc());

            TestContext.LastOperationCount   = res?.Items?.Count ?? 0;
            TestContext.LastCollectionResult = res?.Items;
            TestContext.LastSingleResult     = TestContext.LastOperationCount == 1 ? res.Items.First() : null;

            return(CallMethodResult.CreateHandled());
        }
예제 #26
0
        protected CallMethodResult Search(string nameOrRef)
        {
            var queryModel = new ClashSearchQueryModel
            {
                NameOrRef = nameOrRef
            };
            var res = Repository.Search(queryModel);

            TestContext.LastOperationCount   = res?.Items?.Count ?? 0;
            TestContext.LastCollectionResult = res?.Items;
            TestContext.LastSingleResult     = TestContext.LastOperationCount == 1 ? res.Items.First() : null;

            return(CallMethodResult.CreateHandled());
        }
예제 #27
0
        protected CallMethodResult UpdateScenarios(Guid id, string name, int customId, bool isLibraried)
        {
            var scenario = Repository.Get(id);

            scenario.Name        = name;
            scenario.CustomId    = customId;
            scenario.IsLibraried = isLibraried;
            DbContext.WaitForIndexesAfterSaveChanges();
            Repository.Update(new List <Scenario>()
            {
                scenario
            });
            DbContext.SaveChanges();
            return(CallMethodResult.CreateHandled());
        }
        protected CallMethodResult Search(DateTime?startDate, DateTime?endDate)
        {
            var queryModel = new ClashExceptionSearchQueryModel
            {
                StartDate = startDate ?? default,
                EndDate   = endDate ?? default
            };
            var res = Repository.Search(queryModel);

            TestContext.LastOperationCount   = res?.Items?.Count ?? 0;
            TestContext.LastCollectionResult = res?.Items;
            TestContext.LastSingleResult     = null;

            return(CallMethodResult.CreateHandled());
        }
예제 #29
0
        protected CallMethodResult UpdateRange(Guid uid, string parentExternalIdentifier,
                                               string description, int defaultOffPeakExposureCount)
        {
            var clash = Repository.Get(uid);

            clash.ParentExternalidentifier = parentExternalIdentifier;
            clash.Description = description;
            clash.DefaultOffPeakExposureCount = defaultOffPeakExposureCount;

            DbContext.WaitForIndexesAfterSaveChanges();
            Repository.UpdateRange(new[] { clash });
            DbContext.SaveChanges();

            return(CallMethodResult.CreateHandled());
        }
예제 #30
0
        protected CallMethodResult InsertOrReplace(string externalCampaignNumber, string salesArea, string externalBreakNo, string multipartSpot, Guid id, string externalSpotRef)
        {
            var spot = new Spot
            {
                ExternalCampaignNumber = externalCampaignNumber,
                SalesArea       = salesArea,
                ExternalBreakNo = externalBreakNo,
                MultipartSpot   = multipartSpot,
                Uid             = id,
                ExternalSpotRef = externalSpotRef
            };

            Repository.InsertOrReplace(new[] { spot });
            DbContext.SaveChanges();
            return(CallMethodResult.CreateHandled());
        }
        /// <summary>
        /// Calls a method on an object.
        /// </summary>
        protected virtual ServiceResult Call(
            ISystemContext context,
            CallMethodRequest methodToCall,
            NodeState source,
            MethodState method,
            CallMethodResult result)
        {
            ServerSystemContext systemContext = context as ServerSystemContext;
            List<ServiceResult> argumentErrors = new List<ServiceResult>();
            VariantCollection outputArguments = new VariantCollection();

            ServiceResult error = method.Call(
                context,
                source.NodeId,
                methodToCall.InputArguments,
                argumentErrors,
                outputArguments);

            if (ServiceResult.IsBad(error))
            {
                return error;
            }

            // check for argument errors.
            bool argumentsValid = true;

            for (int jj = 0; jj < argumentErrors.Count; jj++)
            {
                ServiceResult argumentError = argumentErrors[jj];

                if (argumentError != null)
                {
                    result.InputArgumentResults.Add(argumentError.StatusCode);
                                  
                    if (ServiceResult.IsBad(argumentError))
                    {
                        argumentsValid = false;
                    }
                }
                else
                {
                    result.InputArgumentResults.Add(StatusCodes.Good);
                }

                // only fill in diagnostic info if it is requested.
                if ((systemContext.OperationContext.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
                {
                    if (ServiceResult.IsBad(argumentError))
                    {
                        argumentsValid = false;
                        result.InputArgumentDiagnosticInfos.Add(new DiagnosticInfo(argumentError, systemContext.OperationContext.DiagnosticsMask, false, systemContext.OperationContext.StringTable));
                    }
                    else
                    {
                        result.InputArgumentDiagnosticInfos.Add(null);
                    }
                }
            }

            // check for validation errors.
            if (!argumentsValid)
            {
                result.StatusCode = StatusCodes.BadInvalidArgument;
                return result.StatusCode;
            }

            // do not return diagnostics if there are no errors.
            result.InputArgumentDiagnosticInfos.Clear();

            // return output arguments.
            result.OutputArguments = outputArguments;

            return ServiceResult.Good;
        }
        /// <summary>
        /// Calls a method on the specified nodes.
        /// </summary>
        public virtual void Call(
            OperationContext         context, 
            IList<CallMethodRequest> methodsToCall, 
            IList<CallMethodResult>  results, 
            IList<ServiceResult>     errors)
        {
            ServerSystemContext systemContext = m_systemContext.Copy(context);
            IDictionary<NodeId,NodeState> operationCache = new NodeIdDictionary<NodeState>();
            List<CallOperationState> nodesToValidate = new List<CallOperationState>();

            lock (Lock)
            {
                for (int ii = 0; ii < methodsToCall.Count; ii++)
                {                    
                    CallMethodRequest methodToCall = methodsToCall[ii];

                    // skip items that have already been processed.
                    if (methodToCall.Processed)
                    {
                        continue;
                    }
                    
                    // check for valid handle.
                    NodeState source = GetManagerHandle(systemContext, methodToCall.ObjectId, operationCache) as NodeState;

                    if (source == null)
                    {
                        continue;
                    }

                    // owned by this node manager.
                    methodToCall.Processed = true;

                    // check for valid method.
                    MethodState method = GetManagerHandle(systemContext, methodToCall.MethodId, operationCache) as MethodState;

                    if (method == null)
                    {
                        errors[ii] = StatusCodes.BadMethodInvalid;
                        continue;
                    }

                    // check if method belongs to the object.
                    if (!Object.ReferenceEquals(method.Parent, source))
                    {
                        errors[ii] = StatusCodes.BadMethodInvalid;
                        continue;
                    }
                    
                    CallMethodResult result = results[ii] = new CallMethodResult();

                    // check if the node is ready for reading.
                    if (source.ValidationRequired)
                    {
                        errors[ii] = StatusCodes.BadNodeIdUnknown;
                        
                        // must validate node in a seperate operation.
                        CallOperationState operation = new CallOperationState();
                        
                        operation.Source = source;
                        operation.Method = method;
                        operation.Index = ii;

                        nodesToValidate.Add(operation);

                        continue;
                    }
                    
                    // call the method.
                    errors[ii] = Call(
                        systemContext,
                        methodToCall,
                        source,
                        method,
                        result);
                }
                                
                // check for nothing to do.
                if (nodesToValidate.Count == 0)
                {
                    return;
                }

                // validates the nodes (reads values from the underlying data source if required).
                for (int ii = 0; ii < nodesToValidate.Count; ii++)
                {
                    CallOperationState operation = nodesToValidate[ii];

                    // validate the object.
                    if (!ValidateNode(systemContext, operation.Source))
                    {
                        continue;
                    }
                             
                    // call the method.
                    CallMethodResult result = results[operation.Index];

                    errors[operation.Index] = Call(
                        systemContext,
                        methodsToCall[operation.Index],
                        operation.Source,
                        operation.Method,
                        result);
                }
            }
        }
예제 #33
0
        /// <summary>
        /// Calls a method on the specified nodes.
        /// </summary>
        public virtual void Call(
            OperationContext context,
            IList<CallMethodRequest> methodsToCall,
            IList<CallMethodResult> results,
            IList<ServiceResult> errors)
        {
            ServerSystemContext systemContext = SystemContext.Copy(context);
            IDictionary<NodeId, NodeState> operationCache = new NodeIdDictionary<NodeState>();

            for (int ii = 0; ii < methodsToCall.Count; ii++)
            {
                CallMethodRequest methodToCall = methodsToCall[ii];

                // skip items that have already been processed.
                if (methodToCall.Processed)
                {
                    continue;
                }
                
                MethodState method = null;

                lock (Lock)
                {
                    // check for valid handle.
                    NodeHandle handle = GetManagerHandle(systemContext, methodToCall.ObjectId, operationCache);

                    if (handle == null)
                    {
                        continue;
                    }

                    // owned by this node manager.
                    methodToCall.Processed = true;

                    // validate the source node.
                    NodeState source = ValidateNode(systemContext, handle, operationCache);

                    if (source == null)
                    {
                        errors[ii] = StatusCodes.BadNodeIdUnknown;
                        continue;
                    }

                    // find the method.
                    method = source.FindMethod(systemContext, methodToCall.MethodId);

                    if (method == null)
                    {
                        // check for loose coupling.
                        if (source.ReferenceExists(ReferenceTypeIds.HasComponent, false, methodToCall.MethodId))
                        {
                            method = (MethodState)FindPredefinedNode(methodToCall.MethodId, typeof(MethodState));
                        }
                        
                        if (method == null)
                        {
                            errors[ii] = StatusCodes.BadMethodInvalid;
                            continue;
                        }
                    }
                }

                // call the method.
                CallMethodResult result = results[ii] = new CallMethodResult();

                errors[ii] = Call(
                    systemContext,
                    methodToCall,
                    method,
                    result);
            }
        }
예제 #34
0
        /// <summary>
        /// Handles a cal operation.
        /// </summary>
        public override void Call(
            OperationContext context,
            IList<CallMethodRequest> methodsToCall,
            IList<CallMethodResult> results,
            IList<ServiceResult> errors)
        {
            ServerSystemContext systemContext = SystemContext.Copy(context);
            IDictionary<NodeId, NodeState> operationCache = new NodeIdDictionary<NodeState>();

            CallMethodRequestCollection requests = new CallMethodRequestCollection();
            List<int> indexes = new List<int>();

            // validates the nodes and constructs requests for external nodes.
            for (int ii = 0; ii < methodsToCall.Count; ii++)
            {
                CallMethodRequest methodToCall = methodsToCall[ii];

                // skip items that have already been processed.
                if (methodToCall.Processed)
                {
                    continue;
                }

                MethodState method = null;

                lock (Lock)
                {
                    // check for valid handle.
                    NodeHandle handle = GetManagerHandle(systemContext, methodToCall.ObjectId, operationCache);

                    if (handle == null)
                    {
                        continue;
                    }

                    // owned by this node manager.
                    methodToCall.Processed = true;

                    // validate the source node.
                    NodeState source = ValidateNode(systemContext, handle, operationCache);

                    if (source == null)
                    {
                        errors[ii] = StatusCodes.BadNodeIdUnknown;
                        continue;
                    }

                    // determine if a local node.
                    if (PredefinedNodes.ContainsKey(handle.NodeId))
                    {
                        // find the method.
                        method = source.FindMethod(systemContext, methodToCall.MethodId);

                        if (method == null)
                        {
                            // check for loose coupling.
                            if (source.ReferenceExists(ReferenceTypeIds.HasComponent, false, methodToCall.MethodId))
                            {
                                method = (MethodState)FindPredefinedNode(methodToCall.MethodId, typeof(MethodState));
                            }

                            if (method == null)
                            {
                                errors[ii] = StatusCodes.BadMethodInvalid;
                                continue;
                            }
                        }
                    }
                }

                if (method != null)
                {
                    // call the method.
                    CallMethodResult result = results[ii] = new CallMethodResult();

                    errors[ii] = Call(
                        systemContext,
                        methodToCall,
                        method,
                        result);
                        
                    continue;
                }

                CallMethodRequest request = (CallMethodRequest)methodToCall.Clone();
                request.ObjectId = m_mapper.ToRemoteId(methodToCall.ObjectId);
                request.MethodId = m_mapper.ToRemoteId(methodToCall.MethodId);

                for (int jj = 0; jj < request.InputArguments.Count; jj++)
                {
                    request.InputArguments[jj] = m_mapper.ToRemoteVariant(methodToCall.InputArguments[jj]);
                }

                requests.Add(request);
                indexes.Add(ii);
            }

            // send request to external system.
            try
            {
                Opc.Ua.Client.Session client = GetClientSession(systemContext);

                CallMethodResultCollection results2 = null;
                DiagnosticInfoCollection diagnosticInfos = null;

                ResponseHeader responseHeader = client.Call(
                    null,
                    requests,
                    out results2,
                    out diagnosticInfos);

                // these do sanity checks on the result - make sure response matched the request.
                ClientBase.ValidateResponse(results2, requests);
                ClientBase.ValidateDiagnosticInfos(diagnosticInfos, requests);

                // set results.
                for (int ii = 0; ii < requests.Count; ii++)
                {
                    results[indexes[ii]] = results2[ii];
                    errors[indexes[ii]] = ServiceResult.Good;

                    if (results2[ii].StatusCode != StatusCodes.Good)
                    {
                        errors[indexes[ii]] = new ServiceResult(results[ii].StatusCode, ii, diagnosticInfos, responseHeader.StringTable);
                    }
                    else
                    {
                        for (int jj = 0; jj < results2[ii].OutputArguments.Count; jj++)
                        {
                            results2[ii].OutputArguments[jj] = m_mapper.ToLocalVariant(results2[ii].OutputArguments[jj]);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // handle unexpected communication error.
                ServiceResult error = ServiceResult.Create(e, StatusCodes.BadUnexpectedError, "Could not access external system.");

                for (int ii = 0; ii < requests.Count; ii++)
                {
                    errors[indexes[ii]] = error;
                }
            }
        }
예제 #35
0
        /// <summary>
        /// Calls a method defined on a object.
        /// </summary>
        public virtual void Call(
            OperationContext               context, 
            CallMethodRequestCollection    methodsToCall,
            out CallMethodResultCollection results,
            out DiagnosticInfoCollection   diagnosticInfos)
        {
            if (context == null)       throw new ArgumentNullException("context");
            if (methodsToCall == null) throw new ArgumentNullException("methodsToCall");
            
            bool diagnosticsExist = false;
            results = new CallMethodResultCollection(methodsToCall.Count);
            diagnosticInfos = new DiagnosticInfoCollection(methodsToCall.Count);
            List<ServiceResult> errors = new List<ServiceResult>(methodsToCall.Count);

            // add placeholder for each result.
            bool validItems = false;

            for (int ii = 0; ii < methodsToCall.Count; ii++)
            {
                results.Add(null);
                errors.Add(null);

                if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
                {
                    diagnosticInfos.Add(null);
                }

                // validate request paramaters.
                errors[ii] = ValidateCallRequestItem(methodsToCall[ii]);

                if (ServiceResult.IsBad(errors[ii]))
                {
                    methodsToCall[ii].Processed = true;

                    // add diagnostics if requested.
                    if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
                    {
                        diagnosticInfos[ii] = ServerUtils.CreateDiagnosticInfo(m_server, context, errors[ii]);
                        diagnosticsExist = true;
                    }

                    continue;
                }                

                // found at least one valid item.
                validItems = true;
                methodsToCall[ii].Processed = false;
            }
            
            // call each node manager.
            if (validItems)
            {
                foreach (INodeManager nodeManager in m_nodeManagers)
                {
                    nodeManager.Call(
                        context,
                        methodsToCall,
                        results,
                        errors);
                }
            }
                            
            for (int ii = 0; ii < methodsToCall.Count; ii++)
            {
                // set an error code for calls that were not handled by any node manager.
                if (!methodsToCall[ii].Processed)
                {
                    results[ii] = new CallMethodResult();
                    errors[ii] = StatusCodes.BadNodeIdUnknown;
                }

                // update the diagnostic info and ensure the status code in the result is the same as the error code.
                if (errors[ii] != null && errors[ii].Code != StatusCodes.Good)
                {
                    if (results[ii] == null)
                    {
                        results[ii] = new CallMethodResult();
                    }

                    results[ii].StatusCode = errors[ii].Code;
                    
                    // add diagnostics if requested.
                    if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
                    {
                        diagnosticInfos[ii] = ServerUtils.CreateDiagnosticInfo(m_server, context, errors[ii]);
                        diagnosticsExist = true;
                    }
                }
            }

            // clear the diagnostics array if no diagnostics requested or no errors occurred.
            UpdateDiagnostics(context, diagnosticsExist, ref diagnosticInfos);
        }