IsSameVersion() public static method

public static IsSameVersion ( IKey orignal, IKey replacement ) : void
orignal IKey
replacement IKey
return void
Exemplo n.º 1
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, );
        //    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);
         */
        //}

        //public FhirResponse Update(IKey key, Resource resource)
        //{
        //    Validate.HasTypeName(key);
        //    Validate.HasNoVersion(key);
        //    Validate.ResourceType(key, resource);

        //    Interaction original = store.Get(key);

        //    if (original == null)
        //    {
        //        return Respond.WithError(HttpStatusCode.MethodNotAllowed,
        //            "Cannot update resource {0}/{1}, because it doesn't exist on this server",
        //            key.TypeName, key.ResourceId);
        //    }

        //    Interaction interaction = Interaction.PUT(key, resource);
        //    interaction.Resource.AffixTags(original.Resource);

        //    transfer.Internalize(interaction);
        //    Store(interaction);

        //    // todo: does this require a response?
        //    transfer.Externalize(interaction);
        //    return Respond.WithEntry(HttpStatusCode.OK, interaction);
        //}

        public FhirResponse VersionSpecificUpdate(IKey versionedkey, Resource resource)
        {
            Validate.HasTypeName(versionedkey);
            Validate.HasVersion(versionedkey);

            Key   key     = versionedkey.WithoutVersion();
            Entry current = fhirStore.Get(key);

            Validate.IsSameVersion(current.Key, versionedkey);

            return(this.Put(key, resource));
        }