private void importResource(string filename, Resource resource) { Match match = Regex.Match(filename, @"\w+\(([^\)]+)\)\..*"); string id = null; if (match.Success) id = match.Groups[1].Value; if (id == null) id = Guid.NewGuid().ToString(); System.Console.Out.WriteLine(filename + " is a single resource with id " + id); ResourceEntry newEntry = ResourceEntry.Create(resource); string collection = resource.GetCollectionName(); // klopt het dat hier een hl7.org uri voor moet? Uri identity = ResourceIdentity.Build(new Uri("http://hl7.org/fhir") ,collection, id); newEntry.Resource = resource; newEntry.AuthorName = "(imported from file)"; newEntry.Id = identity; identity = ResourceIdentity.Build(new Uri("http://hl7.org/fhir"), collection, id, "1"); // identity.VersionId = "1"; newEntry.Links.SelfLink = identity; newEntry.LastUpdated = File.GetLastWriteTimeUtc(filename); newEntry.Published = File.GetCreationTimeUtc(filename); newEntry.Title = String.Format("{0} with id {1}", collection, id); add(newEntry); }
public void WriteMetaData(ResourceEntry entry, int level, Resource resource) { if (level == 0) { Write(InternalField.ID, container_id); string selflink = entry.Links.SelfLink.ToString(); Write(InternalField.SELFLINK, selflink); var resloc = new ResourceIdentity(container_id); Write(InternalField.JUSTID, resloc.Id); /* //For testing purposes: string term = resloc.Id; List<Tag> tags = new List<Tag>() { new Tag(term, "http://tags.hl7.org", "labello"+term) } ; tags.ForEach(Collect); /* */ if (entry.Tags != null) { entry.Tags.ToList().ForEach(Collect); } } else { string id = resource.Id; Write(InternalField.ID, container_id + "#" + id); } string category = resource.GetCollectionName(); //ModelInfo.GetResourceNameForType(resource.GetType()).ToLower(); Write(InternalField.RESOURCE, category); Write(InternalField.LEVEL, level); }
private void importResource(string filename, Resource resource) { System.Console.Out.WriteLine(filename + " is a single resource form filename: " + filename); ResourceEntry newEntry = ResourceEntry.Create(resource); newEntry.Resource = resource; newEntry.AuthorName = "(imported from file)"; Match match = Regex.Match(filename, @"\w+\(([^\)]+)\)\..*"); string name = match.Groups[1].Value; string id = (match.Success) ? match.Groups[1].Value : null; string collection = resource.GetCollectionName(); if (id != null) { Uri identity = ResourceIdentity.Build(hl7base, collection, id); newEntry.Id = identity; newEntry.Title = String.Format("{0} with id {1}", collection, id) ; } else { newEntry.Title = String.Format("{0} from file {1}", collection, filename); } //identity = ResourceIdentity.Build(new Uri("http://hl7.org/fhir"), collection, id, "1"); // identity.VersionId = "1"; //newEntry.Links.SelfLink = identity; //newEntry.LastUpdated = File.GetLastWriteTimeUtc(filename); newEntry.Published = File.GetCreationTimeUtc(filename); add(newEntry); }