Beispiel #1
0
        private ContractExecutionResult ProcessWithRaptor(ExportReport request)
        {
            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient);

            bool success = raptorClient.GetProductionDataExport(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                                ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(request.CallId ?? Guid.NewGuid(), 0,
                                                                                                                      TASNodeCancellationDescriptorType.cdtProdDataExport),
                                                                RaptorConverters.convertToRaptorUserPreferences(request.UserPrefs), (int)request.ExportType, request.CallerId, raptorFilter,
                                                                RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                                request.TimeStampRequired, request.CellSizeRequired, request.RawData, request.RestrictSize, true,
                                                                request.Tolerance, request.IncludeSurveydSurface,
                                                                request.Precheckonly, request.Filename, RaptorConverters.convertToRaptorMachines(request.MachineList), (int)request.CoordType, (int)request.OutputType,
                                                                request.DateFromUTC, request.DateToUTC,
                                                                RaptorConverters.convertToRaptorTranslations(request.Translations),
                                                                RaptorConverters.convertToRaptorProjectExtents(request.ProjectExtents), out var dataexport);

            if (success)
            {
                try
                {
                    return(ExportResult.Create(
                               File.ReadAllBytes(BuildFilePath(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID, request.CallerId, request.Filename, true)),
                               dataexport.ReturnCode));
                }
                catch (Exception ex)
                {
                    throw new ServiceException(HttpStatusCode.NoContent,
                                               new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError,
                                                                           "Failed to retrieve received export data: " + ex.Message));
                }
            }

            throw CreateServiceException <ExportReportExecutor>(dataexport.ReturnCode);
        }