/// <inheritdoc /> public async Task <StoreResponse> Handle( StoreRequest message, CancellationToken cancellationToken) { EnsureArg.IsNotNull(message, nameof(message)); if (await AuthorizationService.CheckAccess(DataActions.Write, cancellationToken) != DataActions.Write) { throw new UnauthorizedDicomActionException(DataActions.Write); } StoreRequestValidator.ValidateRequest(message); // Find a reader that can parse the request body. IDicomInstanceEntryReader dicomInstanceEntryReader = _dicomInstanceEntryReaderManager.FindReader(message.RequestContentType); if (dicomInstanceEntryReader == null) { throw new UnsupportedMediaTypeException( string.Format(CultureInfo.InvariantCulture, DicomCoreResource.UnsupportedContentType, message.RequestContentType)); } // Read list of entries. IReadOnlyList <IDicomInstanceEntry> instanceEntries = await dicomInstanceEntryReader.ReadAsync( message.RequestContentType, message.RequestBody, cancellationToken); // Process list of entries. return(await _storeService.ProcessAsync(instanceEntries, message.StudyInstanceUid, cancellationToken)); }
/// <inheritdoc /> public IDicomInstanceEntryReader FindReader(string contentType) { LogFindingReaderDelegate(_logger, contentType, null); IDicomInstanceEntryReader dicomInstanceEntryReader = _dicomInstanceEntryReaderManager.FindReader(contentType); if (dicomInstanceEntryReader == null) { LogNoReaderFoundDelegate(_logger, null); } else { LogReaderFoundDelegate(_logger, dicomInstanceEntryReader.GetType().Name, null); } return(dicomInstanceEntryReader); }