public async Task DeleteSearchParameterAsync(RawResource searchParamResource)
        {
            try
            {
                var searchParam        = _modelInfoProvider.ToTypedElement(searchParamResource);
                var searchParameterUrl = searchParam.GetStringScalar("url");

                // First we delete the status metadata from the data store as this fuction depends on the
                // the in memory definition manager.  Once complete we remove the SearchParameter from
                // the definition manager.
                await _searchParameterStatusManager.DeleteSearchParameterStatusAsync(searchParameterUrl);

                _searchParameterDefinitionManager.DeleteSearchParameter(searchParam);
            }
            catch (FhirException fex)
            {
                fex.Issues.Add(new OperationOutcomeIssue(
                                   OperationOutcomeConstants.IssueSeverity.Error,
                                   OperationOutcomeConstants.IssueType.Exception,
                                   Core.Resources.CustomSearchDeleteError));

                throw;
            }
            catch (Exception ex)
            {
                var customSearchException = new ConfigureCustomSearchException(Core.Resources.CustomSearchDeleteError);
                customSearchException.Issues.Add(new OperationOutcomeIssue(
                                                     OperationOutcomeConstants.IssueSeverity.Error,
                                                     OperationOutcomeConstants.IssueType.Exception,
                                                     ex.Message));

                throw customSearchException;
            }
        }
Example #2
0
        public async Task DeleteSearchParameterAsync(RawResource searchParamResource, CancellationToken cancellationToken)
        {
            try
            {
                // We need to make sure we have the latest search parameters before trying to delete
                // existing search parameter. This is to avoid trying to update a search parameter that
                // was recently added and that hasn't propogated to all fhir-server instances.
                await GetAndApplySearchParameterUpdates(cancellationToken);

                var searchParam        = _modelInfoProvider.ToTypedElement(searchParamResource);
                var searchParameterUrl = searchParam.GetStringScalar("url");

                // First we delete the status metadata from the data store as this fuction depends on the
                // the in memory definition manager.  Once complete we remove the SearchParameter from
                // the definition manager.
                _logger.LogTrace("Deleting the search parameter '{url}'", searchParameterUrl);
                await _searchParameterStatusManager.DeleteSearchParameterStatusAsync(searchParameterUrl, cancellationToken);

                _searchParameterDefinitionManager.DeleteSearchParameter(searchParam);
            }
            catch (FhirException fex)
            {
                fex.Issues.Add(new OperationOutcomeIssue(
                                   OperationOutcomeConstants.IssueSeverity.Error,
                                   OperationOutcomeConstants.IssueType.Exception,
                                   Core.Resources.CustomSearchDeleteError));

                throw;
            }
            catch (Exception ex)
            {
                var customSearchException = new ConfigureCustomSearchException(Core.Resources.CustomSearchDeleteError);
                customSearchException.Issues.Add(new OperationOutcomeIssue(
                                                     OperationOutcomeConstants.IssueSeverity.Error,
                                                     OperationOutcomeConstants.IssueType.Exception,
                                                     ex.Message));

                throw customSearchException;
            }
        }
 public void DeleteSearchParameter(ITypedElement searchParam)
 {
     _inner.DeleteSearchParameter(searchParam);
 }