diff --git a/build.gradle b/build.gradle index ccb9e37e..1351f98d 100644 --- a/build.gradle +++ b/build.gradle @@ -101,9 +101,6 @@ dependencies { implementation 'org.apache.tika:tika-parsers:1.3' implementation "commons-fileupload:commons-fileupload:1.3.1" - implementation 'net.sf.jasperreports:jasperreports:6.4.1' - implementation 'net.sf.jasperreports:jasperreports-functions:6.4.1' - implementation 'au.org.ala:jasper-liberation-fonts-2.00.1:1.3' implementation 'net.glxn:qrgen:1.4' implementation 'org.apache.xmlgraphics:batik-bridge:1.9' implementation 'org.apache.xmlgraphics:batik-svggen:1.9' @@ -218,35 +215,4 @@ bootWar { publish { dependsOn assemble -} - - -tasks.register('reportCompile') { - ant.property(name: 'jasper.path', value: 'jasperreports-6.4.1.jar') - -// ant.taskdef(resource: "com/abc/ant/antlib.xml", classpath: ant.properties['jasper.path'], loaderref: 'abc') - - - println "\n- Starting JasperReports *.jrxml compilation process..." - println configurations.runtimeClasspath.asPath - // define the Jasper Reports Compile Task - ant.taskdef(name:'reportCompile', classname: 'net.sf.jasperreports.ant.JRAntCompileTask', classpath: configurations.runtimeClasspath.asPath) - - // remove existing jasper files - ant.delete{ - fileset('dir':'grails-app/conf/reports', 'defaultexcludes':'yes'){ - include('name':'**/*.jasper') - } - } - - // create a temporary directory for use by the jasper compiler - ant.mkdir(dir:'target/jasper') - - // compile the reports - ant.reportCompile(srcdir:'grails-app/conf/reports', destdir:'grails-app/conf/reports', tempdir:'target/jasper', keepJava:true, xmlvalidation:true){ - include(name:'**/*.jrxml') -// include(classpath: configurations.developmentOnly.asPath) -// include(name:'**/*.jrtx') - } - println "-------\n- JasperReports compilation process finished" } \ No newline at end of file diff --git a/grails-app/assets/javascripts/profileEditor/templates/exportPdf.tpl.htm b/grails-app/assets/javascripts/profileEditor/templates/exportPdf.tpl.htm deleted file mode 100644 index 1cd24597..00000000 --- a/grails-app/assets/javascripts/profileEditor/templates/exportPdf.tpl.htm +++ /dev/null @@ -1,49 +0,0 @@ -
- Select the items you wish to include in the PDF. -
- -Lower level taxa cannot be exported as it exceeds the threshold limit of {{config.pdfHighThresholdLimit}}
-Producing this PDF may take some time. Please enter your email address, and you will be notified when the file is ready for download.
- -The material in profiles is protected by copyright laws and may be used as permitted under the Copyright Act 1968 or in accordance with licences granted by the copyright owner.
Images and maps used in this profile have been contributed to the ALA and are subject to copyright. Your right to use these is subject to the terms of the licence that the contributor has applied to the image or map. You may not remove any copyright or other notices applied to maps. In some cases you may need to seek the permission of the copyright owner to use images. Information on using images can be found here.
Text used in this profile has been contributed by the editors and others identified. Except where indicated, text is licensed under a Creative Commons Attribution 4.0 License.
No rights are granted to the Commonwealth Coat of Arms or to any logos or trademarks used on the site.
If you believe material available on this website infringes any rights or breaches any contract or licence obligations please contact us support@ala.org.au with details.
", - "profileLink": "http://localhost:8080/profile-hub/opus/39295895-f9cd-4189-bc19-64bd46cd689b/profile/bee218e6-e0a4-4b99-8c5e-e63a6e1b93aa", - "version": "1", - "lastUpdated": "2016-02-05T02:06:09Z", - "issn": "2207-7820" - }, - "profiles": [ - { - "profile": { - "status": [ - { - "value": "Racemose", - "key": "Inflorescence arrangement" - }, - { - "value": "Globular", - "key": "Inflorescence shape" - }, - { - "value": "Lemon yellow to golden", - "key": "Inflorescence colour" - }, - { - "value": "Scattered", - "key": "Phyllode arrangement" - }, - { - "value": "Phyllodineae", - "key": "Section taxonomy" - }, - { - "value": "3.87", - "key": "Pca1" - }, - { - "value": "4.48", - "key": "Pca2" - }, - { - "value": "10.7", - "key": "Pca3" - }, - { - "value": "1.15", - "key": "Plant height" - }, - { - "value": "5.5", - "key": "Phyllode length median" - }, - { - "value": "0.09", - "key": "Annual mean temp" - }, - { - "value": "0.05", - "key": "Annual precip" - }, - { - "value": "0.1", - "key": "Annual mean rad" - }, - { - "value": "0.06", - "key": "Precip seasonality" - }, - { - "value": "0.11", - "key": "Temperature season" - }, - { - "value": "0.12", - "key": "Rad season" - }, - { - "value": "0.11", - "key": "Ridgetop" - }, - { - "value": "0.01", - "key": "Rockgrainsz" - }, - { - "value": "0.08", - "key": "Precip cold quart" - }, - { - "value": "0.1", - "key": "Clay" - }, - { - "value": "0.1", - "key": "Sand" - } - ], - "nslProtologue": "Candolle, A.P. de (ed.) (1825), Leguminosae. Prodromus Systematis Naturalis Regni Vegetabilis 2", - "occurrencesUrl": "http://avh.ala.org.au/occurrences/search?q=lsid%3Aurn%3Alsid%3Abiodiversity.org.au%3Aapni.taxon%3A298640+AND+%28data_resource_uid%3A%22dr376%22%29", - "hasConservationStatus": true, - "lastAttributeChange": null, - "description": "Woody trees or shrubs, rarely (in Australia) lianas; branches rarely (in Australia) with prickles. Leaves bipinnate or modified to polymorphic phyllodes, rarely reduced to scales or absent; foliar glands normally present; stipules normally present (but commonly caducous) and scarious, sometimes spinose. Inflorescences simple or racemose, infrequently paniculate; flowers white to golden (rarely mauve-pink), 2 or more aggregated into globular heads or oblongoid to cylindrical spikes, (3–) 4 or 5 (–6)-merous; sepals free to united, rarely absent; stamens numerous, normally free, rarely united basally into a short tube or irregularly faciculate; ovary single (rarely to 5), sessile or (rarely in Australia) stipitate. Legumes dehiscent or (rarely in Australia) indehiscent. Seeds normally with a pleurogram and without endosperm; funicle arillate or exarillate.", - "distribution": { - "creators": "P.G. Kodela", - "title": "Occurrence", - "text": "widely distributed from the coast west to Moree and Griffith areas.\nGrows in many different communities in various soil types.\nNC CC SC NT CT ST NWS CWS SWS NWP SWP\n\nQld Vic. *Tas. W.A. S.A.", - "order": -1, - "source": null, - "original": null, - "uuid": "db7ded4f-ab7c-4b1b-8ccb-465f540786ee", - "editors": "", - "required": false, - "mapImageUrl": "http://biocache.ala.org.au//ws/mapping/wms/image?q=lsid%3Aurn%3Alsid%3Abiodiversity.org.au%3Aapni.taxon%3A298640+AND+%28data_resource_uid%3A%22dr376%22%29&extents=96.173828125,-47.11468820158343,169.826171875,-2.5694811631203973&outlineColour=0&dpi=300&scale=on&baselayer=world&fileName=occurrencemap.jpg&format=jpg&outline=true&popacity=1&pradiuspx=5&pcolour=00ff85", - "occurrencesUrl": "http://avh.ala.org.au/occurrences/search?q=lsid%3Aurn%3Alsid%3Abiodiversity.org.au%3Aapni.taxon%3A298640+AND+%28data_resource_uid%3A%22dr376%22%29", - "plainText": "widely distributed from the coast west to Moree and Griffith areas.\nGrows in many different communities in various soil types.\nNC CC SC NT CT ST NWS CWS SWS NWP SWP\n\nQld Vic. *Tas. W.A. S.A.", - "profile": { - "scientificName": "Acacia paradoxa", - "uuid": "bee218e6-e0a4-4b99-8c5e-e63a6e1b93aa", - "opus": { - "title": "NSW flora", - "uuid": "39295895-f9cd-4189-bc19-64bd46cd689b", - "shortName": null - } - } - }, - "acknowledgements": [ - { - "category": "Tester", - "text": "Angel" - } - ], - "bibliography": [ - { - "text": "Aiton, W. 1789: Hortus Kewensis 3
Allan, H.H. 1961: Flora of New Zealand. Vol. I. Indigenous Tracheophyta: Psilopsida, Lycopsida,Filicopsida, Gymnospermae, Dicotyledones. Government Printer, Wellington.
de Labillardière, J.J.H. 1806: Novae Hollandiae Plantarum Specimen. Vol. Vol. 2. Huzard, Paris.
Generation of the PDF you requested from ${pdf.opusTitle} has failed.
-Please try generating the PDF again.
-This is an automated email. Please do not reply.
- """) - } -} diff --git a/grails-app/services/au/org/ala/profile/hub/ExportService.groovy b/grails-app/services/au/org/ala/profile/hub/ExportService.groovy deleted file mode 100644 index b3305508..00000000 --- a/grails-app/services/au/org/ala/profile/hub/ExportService.groovy +++ /dev/null @@ -1,795 +0,0 @@ -package au.org.ala.profile.hub - -import au.org.ala.profile.hub.reports.BackCoverImageRenderer -import au.org.ala.profile.hub.reports.ColourParser -import au.org.ala.profile.hub.reports.ColourUtils -import au.org.ala.profile.hub.reports.GradientRenderer -import au.org.ala.profile.hub.reports.JasperExportFormat -import au.org.ala.profile.hub.reports.JasperReportDef -import au.org.ala.profile.hub.util.HubConstants -import au.org.ala.ws.service.WebService -import grails.converters.JSON -import grails.gorm.transactions.NotTransactional -import net.glxn.qrgen.QRCode -import net.glxn.qrgen.image.ImageType -import net.sf.jasperreports.engine.JRParameter -import net.sf.jasperreports.engine.JRSimpleTemplate -import net.sf.jasperreports.engine.JRTemplate -import net.sf.jasperreports.engine.data.JsonDataSource -import net.sf.jasperreports.engine.design.JRDesignStyle -import net.sf.jasperreports.engine.fill.JRFileVirtualizer -import net.sf.jasperreports.engine.type.ModeEnum -import net.sf.jasperreports.engine.util.SimpleFileResolver -import org.apache.commons.io.IOUtils -import org.apache.http.entity.ContentType -import org.springframework.web.context.request.RequestContextHolder -import grails.web.mapping.LinkGenerator - -import java.awt.Color -import java.util.concurrent.ConcurrentLinkedQueue - -import static au.org.ala.profile.hub.reports.ColourUtils.contrastRatio -import static au.org.ala.profile.hub.reports.ColourUtils.darken -import static au.org.ala.profile.hub.reports.ColourUtils.lighten -import static au.org.ala.profile.hub.reports.ColourUtils.relativeLuminance -import static groovyx.gpars.GParsPool.withPool -import static org.owasp.html.Sanitizers.BLOCKS -import static org.owasp.html.Sanitizers.FORMATTING -import static org.owasp.html.Sanitizers.IMAGES -import static org.owasp.html.Sanitizers.LINKS -import static org.owasp.html.Sanitizers.STYLES -import static org.owasp.html.Sanitizers.TABLES - -class ExportService { - - private static final int THREAD_COUNT = 10 - static transactional = false - static final String LOCAL_IMAGE_THUMBNAIL_REGEX = "http.*?/image/thumbnail/(${Utils.UUID_REGEX_PATTERN}).*" - public static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX" - public static final double AUTHOR_ADJUSTMENT = 0.135 - public static final double PROTOLOGUE_ADJUSTMENT = 0.63 - - ProfileService profileService - BiocacheService biocacheService - ImageService imageService - WebService webService - EmailService emailService - NslService nslService - KeybaseService keybaseService - JasperService jasperService - MapService mapService - def grailsApplication - LinkGenerator grailsLinkGenerator - - Map statusRegions = [ - "" : "IUCN", - "IUCN" : "IUCN", - "Australia" : "AU", - "Australian Capital Territory": "ACT", - "New South Wales" : "NSW", - "Northern Territory" : "NT", - "Queensland" : "QLD", - "South Australia" : "SA", - "Tasmania" : "TAS", - "Victoria" : "VIC", - "Western Australia" : "WA" - ] - - - void createPdfAsych(Map params, boolean latest = false) { - profileService.createPDFJob(params, latest) - } - - @NotTransactional - void createAndEmailPDF(Map params, boolean latest = false) { - String filename = UUID.randomUUID() - File f = new File("${grailsApplication.config.temp.file.location}/${filename}.pdf") - f.withOutputStream { fileStream -> - createPdf(params, fileStream, latest) - } - - String url = "${grailsApplication.config.grails.serverURL}/opus/${params.opusId}/profile/${params.profileId}/file/${filename}.pdf" - emailService.sendEmail(params.email, "${params.opusTitle}The PDF you requested from ${params.opusTitle} can now be downloaded from this url.
-Please note that this file will only remain on the server for a few days.
-This is an automated email. Please do not reply.
- """) - } - - @NotTransactional - void createPdf(Map params, OutputStream outputStream, boolean latest = false) { - createPdf(params, { outputStream }, latest) - } - - /** - * Create a PDF for the given parameters and send the generated PDF bytes to an output stream generated by the closure argument. - * @param params The PDF parameters - * @param outputStreamSupplier A supplier of an output stream. Useful to delay acquiring the output stream for environments like JEE where simply getting the OutputStream can cause side effects. - * @param latest (optional) = defaults to false - */ - @NotTransactional - void createPdf(Map params, Closure