Esempio n. 1
0
        public void Build(ICapabilityStatementBuilder builder)
        {
            if (_operationConfiguration.Export.Enabled)
            {
                AddExportDetailsHelper(builder);
            }

            if (_operationConfiguration.Reindex.Enabled)
            {
                builder.Apply(AddReindexDetails);
            }

            if (_operationConfiguration.ConvertData.Enabled)
            {
                builder.Apply(AddConvertDataDetails);
            }

            if (_featureConfiguration.SupportsAnonymizedExport)
            {
                builder.Apply(AddAnonymizedExportDetails);
            }

            builder.Apply(AddMemberMatchDetails);
            builder.Apply(AddPatientEverythingDetails);
        }
 public void Build(ICapabilityStatementBuilder builder)
 {
     if (_featureConfiguration.SupportsXml)
     {
         builder.Apply(x => x.Format.Add(KnownContentTypes.XmlContentType));
     }
 }
 public ConformanceBuilderTests()
 {
     _searchParameterDefinitionManager = Substitute.For <ISearchParameterDefinitionManager>();
     _builder = CapabilityStatementBuilder.Create(
         ModelInfoProvider.Instance,
         _searchParameterDefinitionManager);
 }
        public void GivenAConformanceBuilder_WhenVersionofResourceIsDifferentFromDefault_ThenResourceUsesResourceSpecificVersionLogic()
        {
            IOptions <CoreFeatureConfiguration> configuration = Substitute.For <IOptions <CoreFeatureConfiguration> >();
            Dictionary <string, string>         overrides     = new();
            VersioningConfiguration             versionConfig = new();

            versionConfig.ResourceTypeOverrides.Add("Patient", "no-version");

            configuration.Value.Returns(new CoreFeatureConfiguration()
            {
                Versioning = versionConfig
            });
            var supportedProfiles = Substitute.For <IKnowSupportedProfiles>();
            var builder           = CapabilityStatementBuilder.Create(
                ModelInfoProvider.Instance,
                _searchParameterDefinitionManager,
                configuration,
                supportedProfiles);
            ICapabilityStatementBuilder capabilityStatement = builder.ApplyToResource("Patient", c =>
            {
                c.Interaction.Add(new ResourceInteractionComponent
                {
                    Code = "create",
                });
            });
            ITypedElement resource = capabilityStatement.Build();

            var patientResource = ((CapabilityStatement)resource.ToPoco()).Rest.First().Resource.First();

            Assert.True(patientResource.Type == ResourceType.Patient);
            Assert.True(patientResource.Versioning == CapabilityStatement.ResourceVersionPolicy.NoVersion);
        }
Esempio n. 5
0
 // Make the $test operation appear in the CapabilityStatement, if it is declared as supported in the SupportedOperationsOptions
 // See http://docs.simplifier.net/vonk/configuration/appsettings.html - Enable or disable interactions
 public void ContributeToCapabilityStatement(ICapabilityStatementBuilder builder)
 {
     Check.NotNull(builder, nameof(builder));
     if (_supportedInteractionOptions.SupportsCustomOperation(_operationName))
     {
         builder.UseRestComponentEditor(rce =>
         {
             rce.AddOperation(_operationName, "http://example.com/fhir/OperationDefinition/test-operation");
         });
     }
 }
Esempio n. 6
0
        public void Build(ICapabilityStatementBuilder builder)
        {
            EnsureArg.IsNotNull(builder, nameof(builder));

            builder.AddDefaultResourceInteractions()
            .AddDefaultSearchParameters();

            if (_coreFeatures.SupportsBatch)
            {
                builder.AddRestInteraction(SystemRestfulInteraction.Batch);
            }
        }
        private void AddResourceSpecificExportDetails(ICapabilityStatementBuilder builder, string operationType, string resourceType)
        {
            Uri operationDefinitionUri = _urlResolver.ResolveOperationDefinitionUrl(operationType);

            builder.ApplyToResource(resourceType, resourceComponent =>
            {
                resourceComponent.Operation.Add(new OperationComponent()
                {
                    Name       = operationType,
                    Definition = operationDefinitionUri.ToString(),
                });
            });
        }
        public ConformanceBuilderTests()
        {
            IOptions <CoreFeatureConfiguration> configuration = Substitute.For <IOptions <CoreFeatureConfiguration> >();

            configuration.Value.Returns(new CoreFeatureConfiguration());

            _searchParameterDefinitionManager = Substitute.For <ISearchParameterDefinitionManager>();
            _supportedProfiles = Substitute.For <IKnowSupportedProfiles>();
            _builder           = CapabilityStatementBuilder.Create(
                ModelInfoProvider.Instance,
                _searchParameterDefinitionManager,
                configuration,
                _supportedProfiles);
        }
Esempio n. 9
0
 public void Build(ICapabilityStatementBuilder builder)
 {
     if (_securityConfiguration.Enabled)
     {
         builder.Apply(statement =>
         {
             if (_securityConfiguration.EnableAadSmartOnFhirProxy)
             {
                 AddProxyOAuthSecurityService(statement, RouteNames.AadSmartOnFhirProxyAuthorize, RouteNames.AadSmartOnFhirProxyToken);
             }
             else
             {
                 AddOAuthSecurityService(statement);
             }
         });
     }
 }
        public override async Task <ResourceElement> GetCapabilityStatementOnStartup(CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_listedCapabilityStatement == null)
            {
                await _defaultCapabilitySemaphore.WaitAsync(cancellationToken);

                try
                {
                    if (_listedCapabilityStatement == null)
                    {
                        _builder = CapabilityStatementBuilder.Create(_modelInfoProvider, _searchParameterDefinitionManager, _supportedProfiles)
                                   .Apply(x =>
                        {
                            x.FhirVersion = _modelInfoProvider.SupportedVersion.ToString();
                            x.Software    = new SoftwareComponent
                            {
                                Name    = Resources.ServerName,
                                Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                            };
                        });

                        using (IScoped <IEnumerable <IProvideCapability> > providerFactory = _capabilityProviders())
                        {
                            foreach (IProvideCapability provider in providerFactory.Value)
                            {
                                provider.Build(_builder);
                            }
                        }

                        foreach (Action <ListedCapabilityStatement> postConfiguration in _configurationUpdates)
                        {
                            _builder.Apply(statement => postConfiguration(statement));
                        }

                        _listedCapabilityStatement = _builder.Build().ToResourceElement();
                    }
                }
                finally
                {
                    _configurationUpdates.Clear();
                    _defaultCapabilitySemaphore.Release();
                }
            }

            return(_listedCapabilityStatement);
        }
Esempio n. 11
0
        public void Build(ICapabilityStatementBuilder builder)
        {
            if (_operationConfiguration.Export.Enabled)
            {
                AddExportDetailsHelper(builder);
            }

            if (_operationConfiguration.Reindex.Enabled)
            {
                builder.Apply(AddReindexDetails);
            }

            if (_featureConfiguration.SupportsAnonymizedExport)
            {
                builder.Apply(AddAnonymizedExportDetails);
            }
        }
Esempio n. 12
0
 public void Build(ICapabilityStatementBuilder builder)
 {
     if (_securityConfiguration.Enabled)
     {
         builder.Update(statement =>
         {
             if (_securityConfiguration.EnableAadSmartOnFhirProxy)
             {
                 AddProxyOAuthSecurityService(statement, _urlResolver, RouteNames.AadSmartOnFhirProxyAuthorize, RouteNames.AadSmartOnFhirProxyToken);
             }
             else
             {
                 AddOAuthSecurityService(statement, _securityConfiguration.Authentication.Authority, _httpClientFactory, _logger);
             }
         });
     }
 }
        public void Build(ICapabilityStatementBuilder builder)
        {
            EnsureArg.IsNotNull(builder, nameof(builder));

            builder.Apply(capabilityStatement =>
            {
                Uri operationDefinitionUri = _resolver.ResolveOperationDefinitionUrl(OperationsConstants.PurgeHistory);
                capabilityStatement.Rest.Server().Operation.Add(new OperationComponent()
                {
                    Name       = OperationsConstants.PurgeHistory,
                    Definition = new ReferenceComponent
                    {
                        Reference = operationDefinitionUri.ToString(),
                    },
                });
            });
        }
Esempio n. 14
0
 public void Build(ICapabilityStatementBuilder builder)
 {
     if (_schemaInformation.Current >= SchemaVersionConstants.PurgeHistoryVersion)
     {
         builder.Apply(capabilityStatement =>
         {
             Uri operationDefinitionUri = _resolver.ResolveOperationDefinitionUrl(OperationsConstants.PurgeHistory);
             capabilityStatement.Rest.Server().Operation.Add(new OperationComponent
             {
                 Name       = OperationsConstants.PurgeHistory,
                 Definition = new ReferenceComponent
                 {
                     Reference = operationDefinitionUri.ToString(),
                 },
             });
         });
     }
 }
Esempio n. 15
0
        public void Build(ICapabilityStatementBuilder builder)
        {
            EnsureArg.IsNotNull(builder, nameof(builder));
            builder.AddDefaultResourceInteractions()
            .AddDefaultSearchParameters();

            // if (_coreFeatures.SupportsBatch)
            //            {
            //                // Batch supported added in listedCapability
            //                builder.AddRestInteraction(SystemRestfulInteraction.Batch);
            //            }
            //
            //            if (_coreFeatures.SupportsTransaction)
            //            {
            //                // Transaction supported added in listedCapability
            //                builder.AddRestInteraction(SystemRestfulInteraction.Transaction);
            //            }
        }
Esempio n. 16
0
        public void Build(ICapabilityStatementBuilder builder)
        {
            EnsureArg.IsNotNull(builder, nameof(builder));

            builder.PopulateDefaultResourceInteractions()
            .SyncSearchParameters()
            .AddGlobalSearchParameters()
            .SyncProfiles();

            if (_coreFeatures.SupportsBatch)
            {
                // Batch supported added in listedCapability
                builder.AddGlobalInteraction(SystemRestfulInteraction.Batch);
            }

            if (_coreFeatures.SupportsTransaction)
            {
                // Transaction supported added in listedCapability
                builder.AddGlobalInteraction(SystemRestfulInteraction.Transaction);
            }
        }
        public override async Task <ResourceElement> GetCapabilityStatementOnStartup(CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_listedCapabilityStatement == null)
            {
                await _defaultCapabilitySemaphore.WaitAsync(cancellationToken);

                try
                {
                    if (_listedCapabilityStatement == null)
                    {
                        _builder = CapabilityStatementBuilder.Create(_modelInfoProvider, _searchParameterDefinitionManager, _configuration, _supportedProfiles);

                        using (IScoped <IEnumerable <IProvideCapability> > providerFactory = _capabilityProviders())
                        {
                            foreach (IProvideCapability provider in providerFactory.Value)
                            {
                                provider.Build(_builder);
                            }
                        }

                        foreach (Action <ListedCapabilityStatement> postConfiguration in _configurationUpdates)
                        {
                            _builder.Apply(statement => postConfiguration(statement));
                        }

                        _listedCapabilityStatement = _builder.Build().ToResourceElement();
                    }
                }
                finally
                {
                    _configurationUpdates.Clear();
                    _defaultCapabilitySemaphore.Release();
                }
            }

            return(_listedCapabilityStatement);
        }
 private void AddExportDetailsHelper(ICapabilityStatementBuilder builder)
 {
     builder.Update(AddExportDetails);
 }
 private void AddExportDetailsHelper(ICapabilityStatementBuilder builder)
 {
     AddResourceSpecificExportDetails(builder, OperationsConstants.PatientExport, KnownResourceTypes.Patient);
     AddResourceSpecificExportDetails(builder, OperationsConstants.GroupExport, KnownResourceTypes.Group);
     builder.Apply(AddExportDetails);
 }