use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class Regenerator method generateOperations.
public void generateOperations(ResourceDefn r, String root) throws IOException {
ListResource list = new ListResource();
list.setId(r.getName() + "-operations");
list.setStatus(ListStatus.CURRENT);
list.setMode(ListMode.WORKING);
for (Operation op : r.getOperations()) {
ListResourceEntryComponent li = list.addEntry();
li.getItem().setReference("OperationDefinition/" + r.getName() + "-" + op.getName());
}
File fn = new File(Utilities.path(root, list.fhirType().toLowerCase() + "-" + list.getId() + ".gen.xml"));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), list);
fn.setLastModified(r.getTimestamp());
for (Operation op : r.getOperations()) {
generateOperation(root, r, op);
}
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class ResourceParser method parseExamples.
private void parseExamples(ResourceDefn r, String n, String t) throws FHIRException, Exception {
ListResource list = (ListResource) parseXml("list-" + t + "-examples.xml");
for (ListResourceEntryComponent le : list.getEntry()) {
boolean reg = le.hasExtension(BuildExtensions.EXT_NOT_REGISTERED) ? !BuildExtensions.readBoolExtension(le, BuildExtensions.EXT_NOT_REGISTERED) : true;
ExampleType type = ExampleType.XmlFile;
if (le.getFlag().hasCoding(BuildExtensions.EXT_EXAMPLE_TYPE, "container")) {
type = ExampleType.Container;
} else if (le.getFlag().hasCoding(BuildExtensions.EXT_EXAMPLE_TYPE, "csv")) {
type = ExampleType.CsvFile;
} else if (le.getFlag().hasCoding(BuildExtensions.EXT_EXAMPLE_TYPE, "tool")) {
type = ExampleType.Tool;
}
String id = le.getItem().getReference().substring(le.getItem().getReference().lastIndexOf("/") + 1);
String ig = le.getExtensionString(BuildExtensions.EXT_IG);
CSFile path = Utilities.noString(ig) ? new CSFile(Utilities.path(folder, le.getExtensionString(BuildExtensions.EXT_TITLE) + ".xml")) : new CSFile(Utilities.path(rootFolder(), "guides", ig, le.getExtensionString(BuildExtensions.EXT_TITLE) + "." + ext(type)));
Example ex = new Example(le.getItem().getDisplay(), id, le.getExtensionString(BuildExtensions.EXT_DESCRIPTION), path, reg, type, false);
r.getExamples().add(ex);
}
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class ResourceParser method parseOperations.
private void parseOperations(ResourceDefn r, String n, String t) throws FHIRException, Exception {
ListResource list = (ListResource) parseXml("list-" + t + "-operations.xml");
for (ListResourceEntryComponent le : list.getEntry()) {
String id = le.getItem().getReference().substring(le.getItem().getReference().indexOf("/") + 1);
OperationDefinition opd = (OperationDefinition) parseXml("operationdefinition-" + id + ".xml");
opd.setVersion(version);
r.getOperations().add(convertOperation(opd));
}
}
use of org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent in project kindling by HL7.
the class SpreadSheetCreator method addExamples.
private void addExamples(XSSFWorkbook excel) throws FHIRFormatError, FileNotFoundException, IOException {
ListResource list = (ListResource) parseXml(fnExamples());
list.setText(null);
XSSFSheet sheet = excel.createSheet(SN_EXAMPLES);
addExampleColumns(sheet);
int rowCount = 0;
for (ListResourceEntryComponent li : list.getEntry()) {
rowCount++;
addExample(sheet, li, rowCount);
}
}
Aggregations