Produced by Araxis Merge on 12/13/2018 10:35:28 AM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\report\jasperreport | AbstractJasperReportExporter.java | Fri Dec 7 17:36:40 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\report\jasperreport | AbstractJasperReportExporter.java | Wed Dec 12 19:46:45 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 340 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /********* ********** ********** ********** ********** ********** ********* | |
| 2 | * Copyrii ght 2004 V HA. All ri ghts reser ved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | // Package | |
| 5 | package go v.va.med.f w.report.j asperrepor t; | |
| 6 | ||
| 7 | // Java cl asses | |
| 8 | import jav a.io.ByteA rrayOutput Stream; | |
| 9 | ||
| 10 | import org .apache.co mmons.lang .Validate; | |
| 11 | ||
| 12 | import gov .va.med.fw .report.Ab stractRepo rtExporter ; | |
| 13 | import gov .va.med.fw .report.Re portConfig uration; | |
| 14 | import gov .va.med.fw .report.Re portExcept ion; | |
| 15 | import gov .va.med.fw .report.Re portTempla te; | |
| 16 | import gov .va.med.fw .report.da ta.ReportD ata; | |
| 17 | import gov .va.med.fw .report.ex celreport. ExcelRepor t; | |
| 18 | import gov .va.med.fw .report.ja sperreport .data.Jasp erReportDa ta; | |
| 19 | import net .sf.jasper reports.en gine.JRDat aSource; | |
| 20 | import net .sf.jasper reports.en gine.Jaspe rFillManag er; | |
| 21 | import net .sf.jasper reports.en gine.Jaspe rPrint; | |
| 22 | import net .sf.jasper reports.en gine.Jaspe rReport; | |
| 23 | ||
| 24 | /** | |
| 25 | * Provide s function alities to fill a re port and t o export a report to a stream | |
| 26 | * synchro nously and asynchron ously. To export and to fill a report | |
| 27 | * asynchr onously, c onfigure a bean in s pring cont ext with a asynchron ous | |
| 28 | * propert y set to t rue. A def ault behav iour is to fill a re port synch ronously. | |
| 29 | * | |
| 30 | * Project : Framewor k</br> Cre ated on: 2 :27:15 PM </br> | |
| 31 | * | |
| 32 | * @author DN S
|
|
| 33 | */ | |
| 34 | public abs tract clas s Abstract JasperRepo rtExporter extends A bstractRep ortExporte r { | |
| 35 | ||
| 36 | /* * | |
| 37 | * An instan ce of seri alVersionU ID | |
| 38 | * / | |
| 39 | pr ivate stat ic final l ong serial VersionUID = -856131 4655698663 11L; | |
| 40 | ||
| 41 | /* * | |
| 42 | * A flag to indicate whether or not to fi ll and to export a r eport | |
| 43 | * asynchron ously | |
| 44 | * / | |
| 45 | pr ivate bool ean asynch ronous = f alse; | |
| 46 | ||
| 47 | /* * | |
| 48 | * A default construct or | |
| 49 | * / | |
| 50 | pr otected Ab stractJasp erReportEx porter() { | |
| 51 | supe r(); | |
| 52 | } | |
| 53 | ||
| 54 | /* * | |
| 55 | * @see gov. va.med.fw. service.Ab stractComp onent#afte rPropertie sSet() | |
| 56 | * / | |
| 57 | pu blic void afterPrope rtiesSet() throws Ex ception { | |
| 58 | supe r.afterPro pertiesSet (); | |
| 59 | if ( this.async hronous) { | |
| 60 | Valida te.notNull (getLoginM anager(), "A login m anager is missing"); | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | /* * | |
| 65 | * @return R eturns the asynchron ous. | |
| 66 | * / | |
| 67 | pu blic boole an isAsync hronous() { | |
| 68 | retu rn asynchr onous; | |
| 69 | } | |
| 70 | ||
| 71 | /* * | |
| 72 | * @param as ynchronous | |
| 73 | * The asyn chronous t o set. | |
| 74 | * / | |
| 75 | pu blic void setAsynchr onous(bool ean asynch ronous) { | |
| 76 | this .asynchron ous = asyn chronous; | |
| 77 | } | |
| 78 | ||
| 79 | /* * | |
| 80 | * Fills a r eport with data | |
| 81 | * | |
| 82 | * @param co nfig | |
| 83 | * @param da ta | |
| 84 | * @param te mplate | |
| 85 | * @return | |
| 86 | * @throws R eportExcep tion | |
| 87 | * / | |
| 88 | pr otected Ob ject fill( ReportConf iguration config, Re portData d ata, Repor tTemplate template) | |
| 89 | throws ReportExc eption { | |
| 90 | ||
| 91 | Vali date.notNu ll(templat e, "A repo rt templat e must not be NULL " ); | |
| 92 | ||
| 93 | Jasp erPrint re port = nul l; | |
| 94 | ||
| 95 | try { | |
| 96 | // Fil l a jasper report te mplate wit h data to create a | |
| 97 | // rea dy-to-prin t jasper r eport obje ct | |
| 98 | report = JasperF illManager .fillRepor t(this.get JasperRepo rt(config, template) , config | |
| 99 | .getResour ceMapping( ), this.ge tJasperDat aSource(da ta)); | |
| 100 | } ca tch (Excep tion e) { | |
| 101 | logger .error("Fa iled to po pulate a r eport ", e ); | |
| 102 | throw new Report Exception( "Failed to populate a report " , e); | |
| 103 | } | |
| 104 | ||
| 105 | retu rn report; | |
| 106 | } | |
| 107 | ||
| 108 | /* * | |
| 109 | * Exports a report to a stream | |
| 110 | * | |
| 111 | * @param re port | |
| 112 | * A genera ted report | |
| 113 | * @return A stream of generate report | |
| 114 | * @throws R eportExcep tion | |
| 115 | * In case or errors getting a n output s tream of a generated | |
| 116 | * report | |
| 117 | * / | |
| 118 | pr otected By teArrayOut putStream export(Obj ect report ) throws R eportExcep tion { | |
| 119 | ||
| 120 | if ( !(report i nstanceof JasperPrin t)) { | |
| 121 | throw new Report Exception( "Invalid r eport type to export : " + repo rt); | |
| 122 | } | |
| 123 | ||
| 124 | retu rn this.ex portJasper Report((Ja sperPrint) report); | |
| 125 | } | |
| 126 | ||
| 127 | pr otected Ex celReport getExcelRe port(Repor tConfigura tion confi g, ReportT emplate te mplate) | |
| 128 | throws ReportExc eption { | |
| 129 | retu rn (ExcelR eport) tem plate.getE xcelTempla te(config) ; | |
| 130 | } | |
| 131 | ||
| 132 | pr otected Ja sperReport getJasper Report(Rep ortConfigu ration con fig, Repor tTemplate template) | |
| 133 | throws ReportExc eption { | |
| 134 | ||
| 135 | // G et a compi led jasper report te mplate | |
| 136 | Obje ct tpl = t emplate.ge tCompiledT emplate(co nfig); | |
| 137 | Jasp erReport j asperRepor t = tpl in stanceof J asperRepor t ? (Jaspe rReport) t pl : null; | |
| 138 | ||
| 139 | if ( jasperRepo rt == null ) { | |
| 140 | throw new Report Exception( "Invalid t ype or mis sing repor t template "); | |
| 141 | } | |
| 142 | retu rn jasperR eport; | |
| 143 | } | |
| 144 | ||
| 145 | pr otected JR DataSource getJasper DataSource (ReportDat a data) th rows Repor tException { | |
| 146 | ||
| 147 | // G et a jaspe r report d ata | |
| 148 | Jasp erReportDa ta reportD ata = data instanceo f JasperRe portData ? (JasperRe portData) data | |
| 149 | : null; | |
| 150 | JRDa taSource j asperData = reportDa ta != null ? reportD ata.getJas perDataSou rce() : nu ll; | |
| 151 | ||
| 152 | if ( jasperData == null) { | |
| 153 | throw new Report Exception( "Invalid t ype of rep ort data. jasperData object is null"); | |
| 154 | } | |
| 155 | retu rn jasperD ata; | |
| 156 | } | |
| 157 | ||
| 158 | /* * | |
| 159 | * Performs the actual task to e xport a Ja sperPrint (read-to-p rint) repo rt | |
| 160 | * to an out put stream | |
| 161 | * | |
| 162 | * @param pr int | |
| 163 | * A report to be pri nted | |
| 164 | * @return A n output s tream of a generated report | |
| 165 | * @throws R eportExcep tion | |
| 166 | * In case or errors getting a n output s tream of a generated | |
| 167 | * report | |
| 168 | * / | |
| 169 | pr otected ab stract Byt eArrayOutp utStream e xportJaspe rReport(Ja sperPrint print) | |
| 170 | throws ReportExc eption; | |
| 171 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.