use of org.hl7.fhir.r5.renderers.spreadsheets.CodeSystemSpreadsheetGenerator in project org.hl7.fhir.core by hapifhir.
the class ValidationService method generateSpreadsheet.
public void generateSpreadsheet(CliContext cliContext, ValidationEngine validator) throws Exception {
CanonicalResource cr = validator.loadCanonicalResource(cliContext.getSources().get(0), cliContext.getSv());
boolean ok = true;
if (cr instanceof StructureDefinition) {
new StructureDefinitionSpreadsheetGenerator(validator.getContext(), false, false).renderStructureDefinition((StructureDefinition) cr).finish(new FileOutputStream(cliContext.getOutput()));
} else if (cr instanceof CodeSystem) {
new CodeSystemSpreadsheetGenerator(validator.getContext()).renderCodeSystem((CodeSystem) cr).finish(new FileOutputStream(cliContext.getOutput()));
} else if (cr instanceof ValueSet) {
new ValueSetSpreadsheetGenerator(validator.getContext()).renderValueSet((ValueSet) cr).finish(new FileOutputStream(cliContext.getOutput()));
} else if (cr instanceof ConceptMap) {
new ConceptMapSpreadsheetGenerator(validator.getContext()).renderConceptMap((ConceptMap) cr).finish(new FileOutputStream(cliContext.getOutput()));
} else {
ok = false;
System.out.println(" ...Unable to generate spreadsheet for " + cliContext.getSources().get(0) + ": no way to generate a spreadsheet for a " + cr.fhirType());
}
if (ok) {
System.out.println(" ...generated spreadsheet successfully");
}
}
Aggregations