Search in sources :

Example 11 with ListResourceEntryComponent

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);
    }
}
Also used : XmlParser(org.hl7.fhir.r5.formats.XmlParser) ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) FileOutputStream(java.io.FileOutputStream) Operation(org.hl7.fhir.definitions.model.Operation) ListResource(org.hl7.fhir.r5.model.ListResource) File(java.io.File)

Example 12 with ListResourceEntryComponent

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);
    }
}
Also used : ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) Example(org.hl7.fhir.definitions.model.Example) OperationExample(org.hl7.fhir.definitions.model.Operation.OperationExample) CSFile(org.hl7.fhir.utilities.CSFile) ListResource(org.hl7.fhir.r5.model.ListResource) ExampleType(org.hl7.fhir.definitions.model.Example.ExampleType)

Example 13 with ListResourceEntryComponent

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));
    }
}
Also used : ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) ListResource(org.hl7.fhir.r5.model.ListResource) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition)

Example 14 with ListResourceEntryComponent

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);
    }
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) ListResource(org.hl7.fhir.r5.model.ListResource)

Aggregations

ListResourceEntryComponent (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent)12 ListResource (org.hl7.fhir.r5.model.ListResource)10 File (java.io.File)4 XSSFSheet (org.apache.poi.xssf.usermodel.XSSFSheet)4 FileOutputStream (java.io.FileOutputStream)3 XmlParser (org.hl7.fhir.r5.formats.XmlParser)3 OperationDefinition (org.hl7.fhir.r5.model.OperationDefinition)3 Example (org.hl7.fhir.definitions.model.Example)2 OperationExample (org.hl7.fhir.definitions.model.Operation.OperationExample)2 BooleanType (org.hl7.fhir.r5.model.BooleanType)2 StringType (org.hl7.fhir.r5.model.StringType)2 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)2 HashSet (java.util.HashSet)1 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)1 ExampleType (org.hl7.fhir.definitions.model.Example.ExampleType)1 Operation (org.hl7.fhir.definitions.model.Operation)1 Profile (org.hl7.fhir.definitions.model.Profile)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 Annotation (org.hl7.fhir.r4b.model.Annotation)1 ListResourceEntryComponent (org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent)1