TypeName() public static méthode

public static TypeName ( string name ) : void
name string
Résultat void
Exemple #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));
        }
Exemple #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));
        }
Exemple #3
0
        public FhirResponse History(string type, HistoryParameters parameters)
        {
            Validate.TypeName(type);
            Uri link = localhost.Uri(type, RestOperation.HISTORY);

            IEnumerable <string> keys = fhirStore.History(type, parameters.Since);
            var    snapshot           = pager.CreateSnapshot(Bundle.BundleType.History, link, keys, parameters.SortBy, parameters.Count, null);
            Bundle bundle             = pager.GetFirstPage(snapshot);

            return(Respond.WithResource(bundle));
        }
Exemple #4
0
        public FhirResponse History(string type, DateTimeOffset?since, string sortby)
        {
            Validate.TypeName(type);
            Uri link = localhost.Uri(type, RestOperation.HISTORY);

            IEnumerable <string> keys = store.History(type, since);
            var    snapshot           = pager.CreateSnapshot(Bundle.BundleType.History, link, keys, sortby);
            Bundle bundle             = pager.GetFirstPage(snapshot);

            return(Respond.WithResource(bundle));
        }
 public static void Key(IKey key)
 {
     if (key.HasResourceId())
     {
         Validate.ResourceId(key.ResourceId);
     }
     if (key.HasVersionId())
     {
         Validate.VersionId(key.VersionId);
     }
     if (!string.IsNullOrEmpty(key.TypeName))
     {
         Validate.TypeName(key.TypeName);
     }
 }
Exemple #6
0
        public FhirResponse Search(string type, IEnumerable <Tuple <string, string> > parameters, int pageSize, string sortby)
        {
            Validate.TypeName(type);
            Uri link = localhost.Uri(type);

            IEnumerable <string> keys = store.List(type);
            var    snapshot           = pager.CreateSnapshot(Bundle.BundleType.Searchset, link, keys, sortby);
            Bundle bundle             = pager.GetFirstPage(snapshot);

            return(Respond.WithBundle(bundle, localhost.Base));
            // DSTU2: search

            /*
             * Query query = FhirParser.ParseQueryFromUriParameters(collection, parameters);
             * ICollection<string> includes = query.Includes;
             *
             * SearchResults results = index.Search(query);
             *
             * if (results.HasErrors)
             * {
             *  throw new SparkException(HttpStatusCode.BadRequest, results.Outcome);
             * }
             *
             * Uri link = localhost.Uri(type).AddPath(results.UsedParameters);
             *
             * Bundle bundle = pager.GetFirstPage(link, keys, sortby);
             *
             * /*
             * if (results.HasIssues)
             * {
             *  var outcomeEntry = BundleEntryFactory.CreateFromResource(results.Outcome, new Uri("outcome/1", UriKind.Relative), DateTimeOffset.Now);
             *  outcomeEntry.SelfLink = outcomeEntry.Id;
             *  bundle.Entries.Add(outcomeEntry);
             * }
             * return Respond.WithBundle(bundle);
             */
        }