Search in sources :

Example 6 with OldSpreadsheetParser

use of org.hl7.fhir.definitions.parsers.spreadsheets.OldSpreadsheetParser in project kindling by HL7.

the class SourceParser method loadConformancePackages.

private void loadConformancePackages(String n, List<ValidationMessage> issues) throws Exception {
    String usage = "core";
    String[] v = ini.getStringProperty("profiles", n).split("\\:");
    File spreadsheet = new CSFile(Utilities.path(rootDir, v[1]));
    if (TextFile.fileToString(spreadsheet.getAbsolutePath()).contains("urn:schemas-microsoft-com:office:spreadsheet")) {
        OldSpreadsheetParser sparser = new OldSpreadsheetParser(n, new CSFileInputStream(spreadsheet), spreadsheet.getName(), spreadsheet.getAbsolutePath(), definitions, srcDir, logger, registry, version, context, genDate, false, page, false, ini, wg(v[0]), definitions.getProfileIds(), fpUsages, page.getConceptMaps(), exceptionIfExcelNotNormalised, page.packageInfo(), page.getRc());
        try {
            Profile pack = new Profile(usage);
            pack.setTitle(n);
            pack.setSource(spreadsheet.getAbsolutePath());
            pack.setSourceType(ConformancePackageSourceType.Spreadsheet);
            if (definitions.getPackMap().containsKey(n))
                throw new Exception("Duplicate Pack id " + n);
            definitions.getPackList().add(pack);
            definitions.getPackMap().put(n, pack);
            sparser.parseConformancePackage(pack, definitions, Utilities.getDirectoryForFile(spreadsheet.getAbsolutePath()), pack.getCategory(), issues, null);
            errors.addAll(sparser.getErrors());
        } catch (Exception e) {
            throw new Exception("Error Parsing StructureDefinition: '" + n + "': " + e.getMessage(), e);
        }
    } else {
        Profile pack = new Profile(usage);
        parseConformanceDocument(pack, n, spreadsheet, usage, null);
        if (definitions.getPackMap().containsKey(n))
            throw new Exception("Duplicate Pack id " + n);
        definitions.getPackList().add(pack);
        definitions.getPackMap().put(n, pack);
        throw new Error("check this!");
    }
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError) OldSpreadsheetParser(org.hl7.fhir.definitions.parsers.spreadsheets.OldSpreadsheetParser) CSFile(org.hl7.fhir.utilities.CSFile) IniFile(org.hl7.fhir.utilities.IniFile) File(java.io.File) CSFile(org.hl7.fhir.utilities.CSFile) TextFile(org.hl7.fhir.utilities.TextFile) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream) Profile(org.hl7.fhir.definitions.model.Profile) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Aggregations

OldSpreadsheetParser (org.hl7.fhir.definitions.parsers.spreadsheets.OldSpreadsheetParser)6 CSFile (org.hl7.fhir.utilities.CSFile)6 CSFileInputStream (org.hl7.fhir.utilities.CSFileInputStream)6 File (java.io.File)5 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 FHIRException (org.hl7.fhir.exceptions.FHIRException)4 IniFile (org.hl7.fhir.utilities.IniFile)4 TextFile (org.hl7.fhir.utilities.TextFile)4 SAXException (org.xml.sax.SAXException)4 ConstraintStructure (org.hl7.fhir.definitions.model.ConstraintStructure)2 LogicalModel (org.hl7.fhir.definitions.model.LogicalModel)2 Profile (org.hl7.fhir.definitions.model.Profile)2 ProfileUtilities (org.hl7.fhir.r5.conformance.ProfileUtilities)2 XmlParser (org.hl7.fhir.r5.formats.XmlParser)2 Resource (org.hl7.fhir.r5.model.Resource)2 XLSXmlParser (org.hl7.fhir.utilities.xls.XLSXmlParser)2 FileInputStream (java.io.FileInputStream)1 ArrayList (java.util.ArrayList)1