Ejemplo n.º 1
0
        /// <summary>Loads the local.</summary>
        /// <exception cref="ArgumentNullException">      Thrown when one or more required arguments are
        ///  null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when one or more arguments are outside the
        ///  required range.</exception>
        /// <param name="localLoadType">         Type of the local load.</param>
        /// <param name="officialExpansionsOnly">(Optional) True to official expansions only.</param>
        /// <returns>The local.</returns>
        public FhirVersionInfo LoadLocal(
            string localLoadType,
            bool officialExpansionsOnly = false)
        {
            if (string.IsNullOrEmpty(_localPublishDirectory))
            {
                throw new ArgumentNullException($"Loading a local FHIR build requires a --fhir-publish-directory");
            }

            GetLocalVersionInfo(
                out string fhirVersion,
                out string versionString,
                out string buildId,
                out string buildDate);

            int majorVersion = FhirVersionInfo.GetMajorVersion(versionString);

            if (majorVersion == 0)
            {
                throw new ArgumentOutOfRangeException($"Unknown FHIR version: {versionString}");
            }

            _localVersion = new FhirVersionInfo(majorVersion)
            {
                ReleaseName           = buildId,
                PackageName           = $"hl7.fhir.r{majorVersion}.core",
                ExamplesPackageName   = string.Empty,
                ExpansionsPackageName = $"hl7.fhir.r{majorVersion}.expansions",
                VersionString         = versionString,
                IsDevBuild            = true,
                DevBranch             = string.Empty,
                IsLocalBuild          = true,
                IsOnDisk = true,
            };

            // load the package
            Loader.LoadLocalBuild(_localPublishDirectory, _fhirSpecDirectory, ref _localVersion, localLoadType, officialExpansionsOnly);

            return(_localVersion);
        }
        /// <summary>Initializes a new instance of the <see cref="FhirServerInfo"/> class.</summary>
        /// <param name="serverInteractions">       The server interaction flags.</param>
        /// <param name="url">                      FHIR Base URL for the server.</param>
        /// <param name="fhirVersion">              The server-reported FHIR version.</param>
        /// <param name="softwareName">             The FHIR Server software name.</param>
        /// <param name="softwareVersion">          The FHIR Server software version.</param>
        /// <param name="softwareReleaseDate">      The FHIR Server software release date.</param>
        /// <param name="implementationDescription">Information describing the implementation.</param>
        /// <param name="implementationUrl">        URL of the implementation.</param>
        /// <param name="resourceInteractions">     The server interactions by resource.</param>
        /// <param name="serverSearchParameters">   The search parameters for searching all resources.</param>
        /// <param name="serverOperations">         The operations defined at the system level operation.</param>
        public FhirServerInfo(
            List <string> serverInteractions,
            string url,
            string fhirVersion,
            string softwareName,
            string softwareVersion,
            string softwareReleaseDate,
            string implementationDescription,
            string implementationUrl,
            Dictionary <string, FhirServerResourceInfo> resourceInteractions,
            Dictionary <string, FhirServerSearchParam> serverSearchParameters,
            Dictionary <string, FhirServerOperation> serverOperations)
        {
            Url         = url;
            FhirVersion = fhirVersion;

            _fhirMajorVersion = FhirVersionInfo.GetMajorVersion(fhirVersion);

            SoftwareName              = softwareName;
            SoftwareVersion           = softwareVersion;
            SoftwareReleaseDate       = softwareReleaseDate;
            ImplementationDescription = implementationDescription;
            ImplementationUrl         = implementationUrl;
            ResourceInteractions      = resourceInteractions;
            ServerSearchParameters    = serverSearchParameters;
            ServerOperations          = serverOperations;

            _serverInteractions = new List <SystemRestfulInteraction>();

            if (serverInteractions != null)
            {
                foreach (string interaction in serverInteractions)
                {
                    _serverInteractions.Add(interaction.ToFhirEnum <SystemRestfulInteraction>());
                }
            }
        }