Sahina Bose has posted comments on this change. Change subject: restapi : RestApi to export volume profile to pdf ......................................................................
Patch Set 35: (3 comments) http://gerrit.ovirt.org/#/c/28340/35/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/pdf/FOPMessageBodyWriter.java File backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/pdf/FOPMessageBodyWriter.java: Line 71: InputStream templateStream = null; Line 72: try { Line 73: String xslName = "/" + type.getSimpleName() + "AsPdf.xsl"; Line 74: templateStream = type.getResourceAsStream(xslName); Line 75: if (templateStream != null) { You could use the try-with-resources syntax here. Line 76: StreamSource transformSource = new StreamSource(templateStream); Line 77: Line 78: Method factoryMethod = null; Line 79: for (Method currentMethod : objectFactory.getClass().getDeclaredMethods()) { Line 91: Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, entityStream); Line 92: Result res = new SAXResult(fop.getDefaultHandler()); Line 93: xslfoTransformer.transform(source, res); Line 94: } else { Line 95: log.error("No profile data is available for the selected volume"); Since this is a generic class, the logged error could avoid reference to profile data Line 96: } Line 97: } else { Line 98: log.error("Error while generating PDF.Null InputStream"); Line 99: } http://gerrit.ovirt.org/#/c/28340/35/backend/manager/modules/restapi/interface/definition/src/main/resources/GlusterVolumeProfileDetailsAsPdf.xsl File backend/manager/modules/restapi/interface/definition/src/main/resources/GlusterVolumeProfileDetailsAsPdf.xsl: Line 46: <fo:block font-family="Arial" font-size="10pt" font-weight="bold">Write Blocks</fo:block> Line 47: </fo:table-cell> Line 48: </fo:table-header> Line 49: <fo:table-body> Line 50: <xsl:for-each select="block_statistic"> You could avoid repetition of this by defining an xsl:template match="block-statistic" Line 51: <fo:table-row border="solid 0.1mm black"> Line 52: <fo:table-cell text-align="center" border="1pt solid black"> Line 53: <fo:block> Line 54: <xsl:value-of select="concat(concat(statistic[name/text()='block.size']/values/value/datum, ' '), statistic[name/text()='block.size']/unit)" /> -- To view, visit http://gerrit.ovirt.org/28340 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie3ff28f5cf18bd7a2bcb53a169873fe6ae3541ed Gerrit-PatchSet: 35 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> Gerrit-Reviewer: Alexander Wels <[email protected]> Gerrit-Reviewer: Juan Hernandez <[email protected]> Gerrit-Reviewer: Kanagaraj M <[email protected]> Gerrit-Reviewer: Ramesh N <[email protected]> Gerrit-Reviewer: Sahina Bose <[email protected]> Gerrit-Reviewer: Shubhendu Tripathi <[email protected]> Gerrit-Reviewer: anmolbabu <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
