public async Task <IActionResult> GetStatusAsync(Guid operationId) { _logger.LogInformation("DICOM Web Get Operation Status request received for ID '{OperationId}'", operationId); OperationStatusResponse response = await _mediator.GetOperationStatusAsync(operationId, HttpContext.RequestAborted); if (response == null) { return(NotFound()); } HttpStatusCode statusCode; OperationStatus operationStatus = response.OperationStatus; if (operationStatus.Status == OperationRuntimeStatus.NotStarted || operationStatus.Status == OperationRuntimeStatus.Running) { Response.AddLocationHeader(_urlResolver.ResolveOperationStatusUri(operationId)); statusCode = HttpStatusCode.Accepted; } else { statusCode = HttpStatusCode.OK; } return(StatusCode((int)statusCode, operationStatus)); }
/// <summary> /// Convert to <see cref="GetExtendedQueryTagEntry"/>. /// </summary> /// <param name="resolver">An optional <see cref="IUrlResolver"/> for resolving resource paths.</param> /// <returns>The extended query tag entry.</returns> public GetExtendedQueryTagEntry ToGetExtendedQueryTagEntry(IUrlResolver resolver = null) { return(new GetExtendedQueryTagEntry { Path = Path, VR = VR, PrivateCreator = PrivateCreator, Level = Level, Status = Status, Errors = ErrorCount > 0 && resolver != null ? new ExtendedQueryTagErrorReference(ErrorCount, resolver.ResolveQueryTagErrorsUri(Path)) : null, Operation = OperationId.HasValue && resolver != null ? new OperationReference(OperationId.GetValueOrDefault(), resolver.ResolveOperationStatusUri(OperationId.GetValueOrDefault())) : null, QueryStatus = QueryStatus }); }
public async Task <AddExtendedQueryTagResponse> AddExtendedQueryTagsAsync( IEnumerable <AddExtendedQueryTagEntry> extendedQueryTags, CancellationToken cancellationToken = default) { _extendedQueryTagEntryValidator.ValidateExtendedQueryTags(extendedQueryTags); var normalized = extendedQueryTags .Select(item => item.Normalize()) .ToList(); // Add the extended query tags to the DB IReadOnlyList <ExtendedQueryTagStoreEntry> added = await _extendedQueryTagStore.AddExtendedQueryTagsAsync( normalized, _maxAllowedCount, ready : false, cancellationToken : cancellationToken); // Start re-indexing Guid operationId = await _client.StartReindexingInstancesAsync(added.Select(x => x.Key).ToList(), cancellationToken); return(new AddExtendedQueryTagResponse(new OperationReference(operationId, _uriResolver.ResolveOperationStatusUri(operationId)))); }