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;
}
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();
}
}
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);
}
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);
}
}
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;
}
Aggregations