Externalize() 공개 메소드

public Externalize ( IEnumerable interactions ) : void
interactions IEnumerable
리턴 void
예제 #1
0
        public Bundle CreateBundle(Snapshot snapshot, int?start = null)
        {
            Bundle bundle = new Bundle();

            bundle.Type  = snapshot.Type;
            bundle.Total = snapshot.Count;
            bundle.Id    = UriHelper.CreateUuid().ToString();

            IEnumerable <string> keysInBundle = snapshot.Keys;

            if (start.HasValue)
            {
                keysInBundle = keysInBundle.Skip(start.Value);
            }

            IList <string>      keys         = keysInBundle.Take(snapshot.CountParam ?? DEFAULT_PAGE_SIZE).ToList();
            IList <Interaction> interactions = fhirStore.Get(keys, snapshot.SortBy).ToList();

            IList <Interaction> included = GetIncludesRecursiveFor(interactions, snapshot.Includes);

            interactions.Append(included);

            transfer.Externalize(interactions);
            bundle.Append(interactions);
            BuildLinks(bundle, snapshot, start);

            return(bundle);
        }
예제 #2
0
        /// <summary>
        /// Create a new resource with a server assigned id.
        /// </summary>
        /// <param name="collection">The resource type, in lowercase</param>
        /// <param name="resource">The data for the Resource to be created</param>
        /// <returns>
        /// Returns
        ///     201 Created - on successful creation
        /// </returns>
        public FhirResponse Create(IKey key, Resource resource)
        {
            Validate.Key(key);
            Validate.ResourceType(key, resource);
            Validate.HasTypeName(key);
            Validate.HasNoResourceId(key);
            Validate.HasNoVersion(key);

            Entry entry = Entry.POST(key, resource);

            transfer.Internalize(entry);

            Store(entry);

            // API: The api demands a body. This is wrong
            //CCR: The documentations specifies that servers should honor the Http return preference header
            Entry result = fhirStore.Get(entry.Key);

            transfer.Externalize(result);
            return(Respond.WithResource(HttpStatusCode.Created, result));
        }
예제 #3
0
파일: Pager.cs 프로젝트: manjufmcna/spark
        public Bundle CreateBundle(Snapshot snapshot, int start, int count)
        {
            Bundle bundle = new Bundle();

            bundle.Type  = snapshot.Type;
            bundle.Total = snapshot.Count;
            bundle.Id    = UriHelper.CreateUuid().ToString();

            IList <string>      keys         = snapshot.Keys.Skip(start).Take(count).ToList();
            IList <Interaction> interactions = store.Get(keys, snapshot.SortBy).ToList();

            transfer.Externalize(interactions);

            bundle.Append(interactions);

            Include(bundle, snapshot.Includes);
            BuildLinks(bundle, snapshot, start, count);


            return(bundle);
        }
예제 #4
0
        public FhirResponse Read(Key key)
        {
            Validate.HasTypeName(key);
            Validate.HasResourceId(key);
            Validate.HasNoVersion(key);
            Validate.Key(key);

            var interaction = store.Get(key);

            if (interaction == null)
            {
                return(Respond.NotFound(key));
            }
            else if (interaction.IsDeleted())
            {
                transfer.Externalize(interaction);
                return(Respond.Gone(interaction));
            }
            else
            {
                transfer.Externalize(interaction);
                return(Respond.WithResource(interaction));
            }
        }