Search in sources :

Example 1 with FlatFormat

use of org.ehrbase.serialisation.flatencoding.FlatFormat in project openEHR_SDK by ehrbase.

the class Helper method getFlatJson.

public static RMDataFormat getFlatJson(String template, FlatFormat flatFormat) throws XmlException, IOException {
    TemplateDocument templateDocument = TemplateDocument.Factory.parse(IOUtils.toInputStream(template, StandardCharsets.UTF_8));
    RMDataFormat flatJson = new FlatJasonProvider(t -> Optional.ofNullable(templateDocument.getTemplate())).buildFlatJson(flatFormat, templateDocument.getTemplate().getTemplateId().getValue());
    return flatJson;
}
Also used : IOUtils(org.apache.commons.io.IOUtils) XmlException(org.apache.xmlbeans.XmlException) TemplateDocument(org.openehr.schemas.v1.TemplateDocument) FlatJasonProvider(org.ehrbase.serialisation.flatencoding.FlatJasonProvider) RMDataFormat(org.ehrbase.serialisation.RMDataFormat) Optional(java.util.Optional) IOException(java.io.IOException) FlatFormat(org.ehrbase.serialisation.flatencoding.FlatFormat) StandardCharsets(java.nio.charset.StandardCharsets) TemplateDocument(org.openehr.schemas.v1.TemplateDocument) RMDataFormat(org.ehrbase.serialisation.RMDataFormat) FlatJasonProvider(org.ehrbase.serialisation.flatencoding.FlatJasonProvider)

Aggregations

IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Optional (java.util.Optional)1 IOUtils (org.apache.commons.io.IOUtils)1 XmlException (org.apache.xmlbeans.XmlException)1 RMDataFormat (org.ehrbase.serialisation.RMDataFormat)1 FlatFormat (org.ehrbase.serialisation.flatencoding.FlatFormat)1 FlatJasonProvider (org.ehrbase.serialisation.flatencoding.FlatJasonProvider)1 TemplateDocument (org.openehr.schemas.v1.TemplateDocument)1