Пример #1
0
 private TCMVSettingsExt ConvertSettingsExt(CMVSettingsEx settings)
 {
     return(new TCMVSettingsExt()
     {
         CMVTarget = settings.CmvTarget,
         IsSummary = false,
         MaxCMV = settings.MaxCMV,
         MaxCMVPercent = settings.MaxCMVPercent,
         MinCMV = settings.MinCMV,
         MinCMVPercent = settings.MinCMVPercent,
         OverrideTargetCMV = settings.OverrideTargetCMV,
         CMVDetailPercents = settings.CustomCMVDetailTargets
     });
 }
Пример #2
0
        /// <summary>
        /// Processes the detailed CMV request by passing the request to Raptor and returning the result.
        /// </summary>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <CMVRequest>(item);
#if RAPTOR
                if (request.IsCustomCMVTargets && (configStore.GetValueBool("ENABLE_TREX_GATEWAY_CMV") ?? false))
                {
#endif
                var settings = new CMVSettingsEx(request.CmvSettings.CmvTarget, request.CmvSettings.MaxCMV, request.CmvSettings.MaxCMVPercent,
                                                 request.CmvSettings.MinCMV, request.CmvSettings.MinCMVPercent, request.CmvSettings.OverrideTargetCMV,
                                                 (CompactionProjectSettings.DefaultSettings.customCMVTargets.ToArray()));

                await PairUpAssetIdentifiers(request.ProjectUid.Value, request.Filter);
                await PairUpImportedFileIdentifiers(request.ProjectUid.Value, filter1 : request.Filter);

                var cmvDetailsRequest = new CMVDetailsRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    settings.CustomCMVDetailTargets,
                    AutoMapperUtility.Automapper.Map <OverridingTargets>(request.LiftBuildSettings),
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));
                log.LogDebug($"{nameof(DetailedCMVExecutor)} trexRequest {JsonConvert.SerializeObject(cmvDetailsRequest)}");

                return(await trexCompactionDataProxy.SendDataPostRequest <CMVDetailedResult, CMVDetailsRequest>(cmvDetailsRequest, "/cmv/details", customHeaders));

#if RAPTOR
            }

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUTC, request.OverrideEndUTC, request.OverrideAssetIds);

            var externalRequestDescriptor = ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor(
                request.CallId ?? Guid.NewGuid(), 0,
                TASNodeCancellationDescriptorType.cdtCMVDetailed);

            var liftBuildSettings = RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod);

            TCMVDetails        cmvDetails;
            TASNodeErrorStatus raptorResult;

            if (!request.IsCustomCMVTargets)
            {
                raptorResult = raptorClient.GetCMVDetails(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    externalRequestDescriptor,
                    ConvertSettings(request.CmvSettings),
                    raptorFilter,
                    liftBuildSettings,
                    out cmvDetails);
            }
            else
            {
                raptorResult = raptorClient.GetCMVDetailsExt(
                    request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                    externalRequestDescriptor,
                    ConvertSettingsExt((CMVSettingsEx)request.CmvSettings),
                    raptorFilter,
                    liftBuildSettings,
                    out cmvDetails);
            }

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(cmvDetails));
            }

            throw CreateServiceException <DetailedCMVExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }