adamsaghy commented on code in PR #6090:
URL: https://github.com/apache/fineract/pull/6090#discussion_r3527695714
##########
fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java:
##########
@@ -48,8 +51,18 @@ public String retrieveXBRLReport(@QueryParam("startDate")
final Date startDate,
@QueryParam("currency") final String currency) {
final var data = xbrlResultService.getXBRLResult(startDate, endDate,
currency);
+ final MixReportXBRLDocument document =
this.xbrlBuilder.buildDocumentGraph(data);
- // TODO: make this type safe?
- return this.xbrlBuilder.build(data);
+ try {
+ final JAXBContext context =
JAXBContext.newInstance(MixReportXBRLDocument.class);
+ final Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.TRUE);
+
+ final StringWriter writer = new StringWriter();
+ marshaller.marshal(document, writer);
+ return writer.toString();
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to serialize XBRL report
document graph", e);
+ }
Review Comment:
Cant we just return `MixReportXBRLDocument` and let the framework do the
serialization?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]