Search in sources :

Example 1 with OperationDefinitionParameterComponent

use of org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.

the class SpreadSheetCreator method addOpParam.

private int addOpParam(XSSFSheet sheet, XSSFSheet bindings, String path, OperationDefinitionParameterComponent param, int rowCount) {
    path = path + "." + param.getName();
    Row row = sheet.createRow(rowCount++);
    int columnCount = 0;
    addCell(path, row, columnCount++);
    addCell(use(param), row, columnCount++);
    addCell("" + param.getMin() + ".." + param.getMax(), row, columnCount++);
    addCell(type(param), row, columnCount++);
    addCell(bind(param, bindings), row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(param.getDocumentation(), row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(status(param), row, columnCount++);
    addCell(ext(param, BuildExtensions.EXT_COMMITTEE_NOTES), row, columnCount++);
    for (OperationDefinitionParameterComponent pp : param.getPart()) {
        rowCount = addOpParam(sheet, bindings, path, pp, rowCount);
    }
    return rowCount;
}
Also used : Row(org.apache.poi.ss.usermodel.Row) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 2 with OperationDefinitionParameterComponent

use of org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.

the class SpreadSheetReloader method moveParts.

private void moveParts(String path, OperationDefinitionParameterComponent pp, Map<String, OperationDefinitionParameterComponent> params) {
    for (OperationDefinitionParameterComponent p : pp.getPart()) {
        String npath = path + "." + (p.hasUse() ? ":" + p.getUse() : "");
        params.put(npath, p);
        moveParts(npath, p, params);
        p.getPart().clear();
    }
}
Also used : OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 3 with OperationDefinitionParameterComponent

use of org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.

the class SpreadSheetReloader method processOperations.

private void processOperations(XSSFWorkbook excel) throws IOException {
    ListResource list = (ListResource) parseXml(fnOperations());
    XSSFSheet src = getSheet(excel, SN_OPERATIONS);
    XSSFSheet bindings = getSheet(excel, SN_BINDINGS);
    list.getEntry().clear();
    XSSFRow cols = src.getRow(0);
    OperationDefinition opd = null;
    Map<String, OperationDefinitionParameterComponent> params = new HashMap<>();
    for (int i = 1; i <= src.getLastRowNum(); i++) {
        XSSFRow row = src.getRow(i);
        if (row != null && hasValue(row, cols, CN_NAME)) {
            String name = getValue(row, cols, CN_NAME);
            if (name == null || !name.contains(".")) {
                if (opd != null) {
                    saveXml(fnOpDef(resourceName + "-" + opd.getCode()), opd);
                }
                opd = processOperation(row, cols, name, list.getEntry());
                moveParams(opd, params);
                list.addEntry().getItem().setReference("OperationDefinition/" + resourceName + "-" + opd.getCode());
            } else {
                processOperationParameter(row, cols, name, opd, params, bindings);
            }
        }
    }
    if (opd != null) {
        saveXml(fnOpDef(resourceName + "-" + opd.getCode()), opd);
    }
    saveXml(fnOperations(), list);
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) XSSFRow(org.apache.poi.xssf.usermodel.XSSFRow) HashMap(java.util.HashMap) ListResource(org.hl7.fhir.r5.model.ListResource) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 4 with OperationDefinitionParameterComponent

use of org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.

the class SpreadSheetReloader method parseBinding.

private void parseBinding(OperationDefinitionParameterComponent param, String value, XSSFSheet bindings) {
    if (Utilities.noString(value)) {
        param.setBinding(null);
    } else {
        XSSFRow cols = bindings.getRow(0);
        XSSFRow row = lookupRow(bindings, cols, CN_BINDING_NAME, value);
        if (row == null) {
            throw new FHIRException("Unable to find binding " + value + " in " + xlsx);
        }
        OperationDefinitionParameterBindingComponent bs = param.getBinding();
        bs.removeExtension(BuildExtensions.EXT_NAME);
        readExt(bs, row, cols, CN_BINDING_NAME, BuildExtensions.EXT_BINDING_NAME, ExtensionType.String);
        readExt(bs, row, cols, CN_DEFINITION, BuildExtensions.EXT_DEFINITION, ExtensionType.String);
        bs.setStrength(BindingStrength.fromCode(getValue(row, cols, CN_STRENGTH)));
        bs.setValueSet(getValue(row, cols, CN_VALUE_SET));
        readExt(bs, row, cols, CN_OID, BuildExtensions.EXT_VS_OID, ExtensionType.String);
        readExt(bs, row, cols, CN_URI, BuildExtensions.EXT_URI, ExtensionType.String);
        readExt(bs, row, cols, CN_WEBSITE_EMAIL, BuildExtensions.EXT_WEBSITE, ExtensionType.Uri);
        readExt(bs, row, cols, CN_V2, BuildExtensions.EXT_V2_MAP, ExtensionType.String);
        readExt(bs, row, cols, CN_V3, BuildExtensions.EXT_V3_MAP, ExtensionType.String);
        readExt(bs, row, cols, CN_COPYRIGHT, BuildExtensions.EXT_COPYRIGHT, ExtensionType.String);
        readExt(bs, row, cols, CN_COMMITTEE_NOTES, BuildExtensions.EXT_COMMITTEE_NOTES, ExtensionType.Markdown);
    }
}
Also used : XSSFRow(org.apache.poi.xssf.usermodel.XSSFRow) OperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 5 with OperationDefinitionParameterComponent

use of org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.

the class SpreadSheetCreator method bind.

private String bind(OperationDefinitionParameterComponent ed, XSSFSheet bindings) {
    if (ed.hasBinding()) {
        Row row = bindings.createRow(bindingRowCount++);
        int columnCount = 0;
        String name;
        OperationDefinitionParameterBindingComponent bs = ed.getBinding();
        sortExtensions(ed.getBinding());
        if (bs.hasExtension(BuildExtensions.EXT_BINDING_NAME)) {
            name = bs.getExtensionString(BuildExtensions.EXT_BINDING_NAME);
        } else {
            name = "??";
        }
        addCell(name, row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_DEFINITION), row, columnCount++);
        addCell(bs.getStrength().toCode(), row, columnCount++);
        addCell(bs.getValueSet(), row, columnCount++);
        addCell(null, row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_VS_OID), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_URI), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_WEBSITE), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_V2_MAP), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_V3_MAP), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_COPYRIGHT), row, columnCount++);
        addCell(ext(bs, BuildExtensions.EXT_COMMITTEE_NOTES), row, columnCount++);
        return name;
    }
    return null;
}
Also used : OperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent) Row(org.apache.poi.ss.usermodel.Row)

Aggregations

OperationDefinitionParameterComponent (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)13 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)12 Row (org.apache.poi.ss.usermodel.Row)3 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)3 Extension (org.hl7.fhir.r5.model.Extension)3 OperationDefinitionParameterBindingComponent (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent)3 ArrayList (java.util.ArrayList)2 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)2 OperationParameter (org.hl7.fhir.definitions.model.OperationParameter)2 OperationDefinitionParameterComponent (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent)2 OperationDefinitionParameterComponent (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent)2 OperationDefinitionParameterComponent (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent)2 FHIRException (org.hl7.fhir.exceptions.FHIRException)2 OperationDefinitionParameterComponent (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent)2 OperationDefinitionParameterComponent (org.hl7.fhir.r4b.model.OperationDefinition.OperationDefinitionParameterComponent)2 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)2 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)2 UriType (org.hl7.fhir.r5.model.UriType)2 URISyntaxException (java.net.URISyntaxException)1 HashMap (java.util.HashMap)1