private oval_results TryToGetOvalResultsDocumentFromCollectedAnalysis(CollectRequest collectRequest, string definitionsText, Result collectResult)
        {
            IEnumerable<string> errors;
            var scMS = new MemoryStream(Encoding.UTF8.GetBytes(collectResult.SystemCharacteristics));
            var collectedSC = oval_system_characteristics.GetOvalSystemCharacteristicsFromStream(scMS, out errors);

            var docMS = new MemoryStream(Encoding.UTF8.GetBytes(definitionsText));
            var definitions = oval_definitions.GetOvalDefinitionsFromStream(docMS, out errors);
            if (definitions == null || (definitions != null && definitions.definitions == null))
            {
                return null;
            }
            
            oval_variables externalVariables;
            if (collectRequest.ExternalVariables != null)
            {
                externalVariables = oval_variables.GetOvalVariablesFromText(collectRequest.ExternalVariables, out errors);
            }
            else
            {
                externalVariables = null;
            }

            return oval_results.CreateFromDocuments(definitions, collectedSC, externalVariables);
        }
示例#2
0
 public Result CreateDTOFromCollectResult(IDocumentSession session, CollectRequest collectRequest)
 {
     var collectResultDTO = new Result();
     collectResultDTO.Date = collectRequest.Result.Date;
     collectResultDTO.SystemCharacteristics = collectRequest.Result.SystemCharacteristics;
     collectResultDTO.Status = collectRequest.Result.Status;
     collectResultDTO.ExecutionLogs = this.GetExecutionErrorLogs(session, collectRequest).ToArray();
     return collectResultDTO;
 }
        public oval_results GetDocument(CollectRequest collectRequest, string definitions, Result collectResult)
        {
            if ((collectRequest != null) && (collectRequest.HasResult()))
            {
                var ovalResults = TryToGetOvalResultsDocumentFromCollectedAnalysis(collectRequest, definitions, collectResult);
                if (ovalResults != null)
                {
                    ovalResults.Analyze();
                    return ovalResults;
                }
            }

            return null;
        }