コード例 #1
0
ファイル: FhirService.cs プロジェクト: schellack/spark
        /*
         * public void InjectKeys(Bundle bundle)
         * {
         *  foreach (ResourceEntry entry in bundle.Entries.OfType<ResourceEntry>())
         *  {
         *      if (entry.Id == null)
         *      {
         *          string collection = entry.GetResourceTypeName();
         *          string id = generator.NextKey(entry.Resource);
         *          Uri key = BuildKey(collection, id);
         *          entry.Id = key;
         *      }
         *  }
         * }
         */

        public Bundle Transaction(Bundle bundle)
        {
            IEnumerable <BundleEntry> entries = importer.Import(bundle.Entries);

            try
            {
                store.Add(entries);
                index.Process(entries);

                exporter.RemoveBodyFromEntries(entries);
                bundle.Entries = entries.ToList();

                exporter.Externalize(bundle);
                return(bundle);
            }
            catch
            {
                // todo: Purge batch from index
                //store.PurgeBatch(transaction);
                throw;
            }
        }
コード例 #2
0
ファイル: FhirService.cs プロジェクト: HowardEdidin/spark
        public Bundle Transaction(Bundle bundle)
        {
            IEnumerable <BundleEntry> entries = _importer.Import(bundle.Entries);

            Guid transaction = Guid.NewGuid();

            try
            {
                entries = _store.AddEntries(entries, transaction);
                _index.Process(entries);

                _exporter.RemoveBodyFromEntries(entries);
                bundle.Entries = entries.ToList();

                _exporter.EnsureAbsoluteUris(bundle);
                return(bundle);
            }
            catch
            {
                // todo: Purge batch from index
                _store.PurgeBatch(transaction);
                throw;
            }
        }