use of org.hl7.fhir.exceptions.FHIRFormatError in project org.hl7.fhir.core by hapifhir.
the class ISO21090Importer method addParentProperties.
private void addParentProperties(List<ElementDefinition> elements, String name, String parent, boolean attrMode, boolean snapshot) throws FHIRFormatError {
DataType dt = types.get(parent);
if (dt == null)
throw new Error("No find " + parent);
if (dt.getParent() != null)
addParentProperties(elements, name, dt.getParent(), attrMode, snapshot);
produceProperties(elements, name, dt.getProperties(), attrMode, snapshot);
}
use of org.hl7.fhir.exceptions.FHIRFormatError in project org.hl7.fhir.core by hapifhir.
the class ExamplesPackageBuilder method process.
private void process(String source) throws FHIRFormatError, FileNotFoundException, IOException {
Set<String> set = new HashSet<>();
for (File f : new File(source).listFiles()) {
if (f.getName().endsWith(".json")) {
JsonObject obj = JsonTrackingParser.parseJson(new FileInputStream(f));
if (obj.has("resourceType") && obj.has("id")) {
String type = obj.get("resourceType").getAsString();
String id = obj.get("id").getAsString();
byte[] content = TextFile.fileToBytes(f);
if (type.equals("ConceptMap")) {
System.out.println("convert " + f.getName());
content = r5ToR4B(content);
TextFile.bytesToFile(content, f);
}
// TextFile.bytesToFile(content, Utilities.path(dest2, type+"-"+id+".json"));
// if (!set.contains(type+"/"+id)) {
// set.add(type+"/"+id);
// pck.addFile(Category.RESOURCE, type+"-"+id+".json", content);
// }
}
}
}
// pck.finish();
//
}
use of org.hl7.fhir.exceptions.FHIRFormatError in project org.hl7.fhir.core by hapifhir.
the class LoincToDEConvertor method saveBundle.
private void saveBundle() throws FHIRFormatError, IOException, XmlPullParserException {
XmlParser xml = new XmlParser();
FileOutputStream s = new FileOutputStream(dest);
xml.compose(s, bundle, true);
s.close();
}
use of org.hl7.fhir.exceptions.FHIRFormatError in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpansionCache method loadCache.
private void loadCache() throws FHIRFormatError, IOException {
File[] files = new File(cacheFolder).listFiles();
for (File f : files) {
if (f.getName().endsWith(".xml")) {
final FileInputStream is = new FileInputStream(f);
try {
Resource r = context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
if (r instanceof OperationOutcome) {
OperationOutcome oo = (OperationOutcome) r;
expansions.put(ToolingExtensions.getExtension(oo, VS_ID_EXT).getValue().toString(), new ValueSetExpansionOutcome(new XhtmlComposer(true, false).composePlainText(oo.getText().getDiv())));
} else {
ValueSet vs = (ValueSet) r;
expansions.put(vs.getUrl(), new ValueSetExpansionOutcome(vs, null));
}
} finally {
IOUtils.closeQuietly(is);
}
}
}
}
use of org.hl7.fhir.exceptions.FHIRFormatError in project org.hl7.fhir.core by hapifhir.
the class LoincToDEConvertor method saveBundle.
private void saveBundle() throws FHIRFormatError, IOException, XmlPullParserException {
XmlParser xml = new XmlParser();
FileOutputStream s = new FileOutputStream(dest);
xml.compose(s, bundle, true);
s.close();
}
Aggregations