public byte[] Export(DB.IObjectRepository tdb, SimpleSchema schema, ExportFormats format, IGSettingsManager igSettings, List <string> categories, List <DB.Template> templates, bool includeVocabulary, bool returnJson = true) { var uri = HttpContext.Current != null && HttpContext.Current.Request != null ? HttpContext.Current.Request.Url : new Uri(AppSettings.DefaultBaseUrl); switch (format) { case ExportFormats.FHIR_Bundle: ImplementationGuideExporter exporter = new ImplementationGuideExporter(tdb, schema, uri.Scheme, uri.Authority); fhir_dstu2.Hl7.Fhir.Model.Bundle bundle = exporter.GetImplementationGuides(include: "ImplementationGuide:resource", implementationGuideId: igSettings.ImplementationGuideId); return(ConvertToBytes(fhir_dstu2.Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToXml(bundle))); case ExportFormats.Native_XML: NativeExporter proprietaryExporter = new NativeExporter(tdb, templates, igSettings, true, categories); if (returnJson) { return(ConvertToBytes(proprietaryExporter.GenerateJSONExport())); } else { return(ConvertToBytes(proprietaryExporter.GenerateXMLExport())); } case ExportFormats.Templates_DSTU_XML: DecorExporter decorExporter = new DecorExporter(templates, tdb, igSettings.ImplementationGuideId); return(ConvertToBytes(decorExporter.GenerateXML())); default: throw new Exception("Invalid export format for the specified implementation guide type"); } }
public string Export(DB.IObjectRepository tdb, SimpleSchema schema, ExportFormats format, IGSettingsManager igSettings, List <string> categories, List <DB.Template> templates, bool includeVocabulary, bool returnJson = true) { switch (format) { case ExportFormats.FHIR: string export = FHIRExporter.GenerateExport(tdb, templates, igSettings, categories, includeVocabulary); if (returnJson) { fhir_dstu1.Hl7.Fhir.Model.Bundle bundle = fhir_dstu1.Hl7.Fhir.Serialization.FhirParser.ParseBundleFromXml(export); export = fhir_dstu1.Hl7.Fhir.Serialization.FhirSerializer.SerializeBundleToJson(bundle); } return(export); case ExportFormats.Proprietary: NativeExporter proprietaryExporter = new NativeExporter(tdb, templates, igSettings, true, categories); return(proprietaryExporter.GenerateXMLExport()); case ExportFormats.TemplatesDSTU: DecorExporter decorExporter = new DecorExporter(templates, tdb, igSettings.ImplementationGuideId); return(decorExporter.GenerateXML()); case ExportFormats.Snapshot: default: throw new Exception("Invalid export format for the specified implementation guide type"); } }
public string Export(DB.IObjectRepository tdb, SimpleSchema schema, ExportFormats format, IGSettingsManager igSettings, List <string> categories, List <DB.Template> templates, bool includeVocabulary, bool returnJson = true) { string requestScheme = HttpContext.Current != null && HttpContext.Current.Request != null ? HttpContext.Current.Request.Url.Scheme : null; string requestAuthority = HttpContext.Current != null && HttpContext.Current.Request != null ? HttpContext.Current.Request.Url.Authority : null; switch (format) { case ExportFormats.FHIR: throw new NotImplementedException(); case ExportFormats.Proprietary: NativeExporter nativeExporter = new NativeExporter(tdb, templates, igSettings, true, categories); return(nativeExporter.GenerateXMLExport()); case ExportFormats.TemplatesDSTU: DecorExporter decorExporter = new DecorExporter(templates, tdb, igSettings.ImplementationGuideId); return(decorExporter.GenerateXML()); default: throw new Exception("Invalid export format for the specified implementation guide type"); } }
public byte[] Export( DB.IObjectRepository tdb, SimpleSchema schema, ExportFormats format, IGSettingsManager igSettings, List <string> categories, List <DB.Template> templates, bool includeVocabulary, bool returnJson = true) { var templateIds = templates.Select(y => y.Id); switch (format) { case ExportFormats.Microsoft_Word_DOCX: ImplementationGuide ig = tdb.ImplementationGuides.Single(y => y.Id == igSettings.ImplementationGuideId); MSWord.ImplementationGuideGenerator docxGenerator = new MSWord.ImplementationGuideGenerator(tdb, igSettings.ImplementationGuideId, templateIds); // TODO: Re-factor ITypeExporter to accept ExportSettings MSWord.ExportSettings exportConfig = new MSWord.ExportSettings(); exportConfig.Use(c => { c.GenerateTemplateConstraintTable = true; c.GenerateTemplateContextTable = true; c.GenerateDocTemplateListTable = true; c.GenerateDocContainmentTable = true; c.AlphaHierarchicalOrder = true; c.DefaultValueSetMaxMembers = 100; c.GenerateValueSetAppendix = true; c.IncludeXmlSamples = true; c.IncludeChangeList = true; c.IncludeTemplateStatus = true; c.IncludeNotes = false; c.SelectedCategories = categories; }); docxGenerator.BuildImplementationGuide(exportConfig, ig.ImplementationGuideType.GetPlugin()); return(docxGenerator.GetDocument()); case ExportFormats.FHIR_Bundle: throw new NotImplementedException(); case ExportFormats.Native_XML: NativeExporter nativeExporter = new NativeExporter(tdb, templates, igSettings, true, categories); if (returnJson) { return(System.Text.Encoding.UTF8.GetBytes(nativeExporter.GenerateJSONExport())); } else { return(System.Text.Encoding.UTF8.GetBytes(nativeExporter.GenerateXMLExport())); } case ExportFormats.Templates_DSTU_XML: DecorExporter decorExporter = new DecorExporter(templates, tdb, igSettings.ImplementationGuideId); return(System.Text.Encoding.UTF8.GetBytes(decorExporter.GenerateXML())); default: throw new Exception("Invalid export format for the specified implementation guide type"); } }