use of org.pentaho.platform.api.repository2.unified.MondrianSchemaAnnotator in project pentaho-platform by pentaho.
the class MondrianCatalogRepositoryHelper method includeAnnotatedSchema.
private Map<String, InputStream> includeAnnotatedSchema(final Map<String, InputStream> values) {
MondrianSchemaAnnotator annotator = PentahoSystem.get(MondrianSchemaAnnotator.class, ANNOTATOR_KEY, PentahoSessionHolder.getSession());
try {
if (annotator != null) {
byte[] schemaBytes = IOUtils.toByteArray(values.get(SCHEMA_XML));
byte[] annotationBytes = IOUtils.toByteArray(values.get(ANNOTATIONS_XML));
values.put(SCHEMA_XML, new ByteArrayInputStream(schemaBytes));
values.put(ANNOTATIONS_XML, new ByteArrayInputStream(annotationBytes));
values.put("schema.annotated.xml", annotator.getInputStream(new ByteArrayInputStream(schemaBytes), new ByteArrayInputStream(annotationBytes)));
}
} catch (IOException e) {
throw new RepositoryException(e);
}
return values;
}
Aggregations