예제 #1
0
        public SystemProcessOperationGraphType(
            ISystemProcessRepository operationRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.UserPolicy);

            this.Field(i => i.Id).Description("Identifier for the system process operation");
            this.Field(i => i.SystemProcessId).Description("Identifier for the system process");

            this.Field <SystemProcessGraphType>(
                "process",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessById-{context.Source.SystemProcessId}",
                    () => operationRepository.GetForId(context.Source.SystemProcessId));

                return(loader.LoadAsync());
            });

            this.Field(i => i.OperationState).Description("The last state of the operation");
            this.Field(i => i.OperationStart).Type(new DateTimeGraphType())
            .Description("The time the operation started at in the real world (UTC)");
            this.Field(i => i.OperationEnd, true).Type(new DateTimeGraphType())
            .Description("The time the operation ended at in the real world (UTC)");
        }
 public DashboardModel(
     ISystemProcessRepository systemProcessRepository,
     ISystemProcessOperationRuleRunRepository systemProcessRuleRunRepository,
     ISystemProcessOperationRepository systemProcessOperationRepository,
     ISystemProcessOperationDistributeRuleRepository systemProcessDistributeRepository,
     IExceptionRepository exceptionRepository,
     IApiHeartbeat apiHeartbeat,
     ISystemProcessOperationUploadFileRepository systemProcessUploadFileRepository,
     ILogger <DashboardModel> logger)
 {
     this._systemProcessRepository = systemProcessRepository
                                     ?? throw new ArgumentNullException(nameof(systemProcessRepository));
     this._systemProcessRuleRunRepository = systemProcessRuleRunRepository
                                            ?? throw new ArgumentNullException(
                                                      nameof(systemProcessRuleRunRepository));
     this._systemProcessOperationRepository = systemProcessOperationRepository
                                              ?? throw new ArgumentNullException(
                                                        nameof(systemProcessOperationRepository));
     this._systemProcessDistributeRepository = systemProcessDistributeRepository
                                               ?? throw new ArgumentNullException(
                                                         nameof(systemProcessDistributeRepository));
     this._exceptionRepository =
         exceptionRepository ?? throw new ArgumentNullException(nameof(exceptionRepository));
     this._apiHeartbeat = apiHeartbeat ?? throw new ArgumentNullException(nameof(apiHeartbeat));
     this._systemProcessUploadFileRepository = systemProcessUploadFileRepository
                                               ?? throw new ArgumentNullException(
                                                         nameof(systemProcessUploadFileRepository));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #3
0
        public SystemProcessContext(
            ISystemProcessRepository systemProcessRepository,
            ISystemProcessOperationContextFactory factory,
            IOperationLogging operationLogging)
        {
            this._systemProcessRepository = systemProcessRepository
                                            ?? throw new ArgumentNullException(nameof(systemProcessRepository));
            this._factory          = factory ?? throw new ArgumentNullException(nameof(factory));
            this._operationLogging = operationLogging ?? throw new ArgumentNullException(nameof(operationLogging));

            var systemProcess = new SystemProcess
            {
                Heartbeat         = DateTime.UtcNow,
                InstanceInitiated = DateTime.UtcNow,
                MachineId         = Environment.MachineName,
                ProcessId         = Process.GetCurrentProcess()?.Id.ToString(),
                SystemProcessType = ProcessType
            };

            systemProcess.Id = systemProcess.GenerateInstanceId();

            this.StartEvent(systemProcess);
        }