CreateSnapshot() 공개 메소드

public CreateSnapshot ( Hl7.Fhir.Model.Bundle type, Uri link, IEnumerable keys, string sortby, IEnumerable includes = null ) : Spark.Core.Snapshot
type Hl7.Fhir.Model.Bundle
link System.Uri
keys IEnumerable
sortby string
includes IEnumerable
리턴 Spark.Core.Snapshot
예제 #1
0
        public FhirResponse Search(string type, SearchParams searchCommand)
        {
            _log.ServiceMethodCalled("search");

            Validate.TypeName(type);
            SearchResults results = fhirIndex.Search(type, searchCommand);

            if (results.HasErrors)
            {
                throw new SparkException(HttpStatusCode.BadRequest, results.Outcome);
            }

            UriBuilder builder = new UriBuilder(localhost.Uri(type));

            builder.Query = results.UsedParameters;
            Uri link = builder.Uri;

            var    snapshot = pager.CreateSnapshot(link, results, searchCommand);
            Bundle bundle   = pager.GetFirstPage(snapshot);

            if (results.HasIssues)
            {
                bundle.AddResourceEntry(results.Outcome, new Uri("outcome/1", UriKind.Relative).ToString());
            }

            return(Respond.WithBundle(bundle));
        }
예제 #2
0
        public FhirResponse Search(string type, SearchParams searchCommand)
        {
            Validate.TypeName(type);
            SearchResults results = index.Search(type, searchCommand);

            if (results.HasErrors)
            {
                throw new SparkException(HttpStatusCode.BadRequest, results.Outcome);
            }

            Uri link = new RestUrl(localhost.Uri(type)).AddPath(results.UsedParameters).Uri;


            string firstSort = null;

            if (searchCommand.Sort != null && searchCommand.Sort.Count() > 0)
            {
                firstSort = searchCommand.Sort[0].Item1; //TODO: Support sortorder and multiple sort arguments.
            }


            var    snapshot = pager.CreateSnapshot(Bundle.BundleType.Searchset, link, results, firstSort);
            Bundle bundle   = pager.GetFirstPage(snapshot);

            return(Respond.WithBundle(bundle, localhost.Base));
        }