Produced by Araxis Merge on 6/11/2019 10:54:14 AM Eastern Daylight 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 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\report | ConfigurableReportBuilder.java | Wed May 29 15:26:02 2019 UTC |
| 2 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\report | ConfigurableReportBuilder.java | Mon Jun 10 19:27:47 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 474 |
| Changed | 2 | 4 |
| 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; | |
| 6 | ||
| 7 | // Java cl asses | |
| 8 | ||
| 9 | import org .apache.co mmons.lang .Validate; | |
| 10 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 11 | import org .springfra mework.bea ns.factory .annotatio n.Qualifie r; | |
| 12 | import org .springfra mework.ste reotype.Se rvice; | |
| 13 | ||
| 14 | import gov .va.med.fw .report.da ta.Abstrac tReportDat aService; | |
| 15 | import gov .va.med.fw .report.da ta.ReportD ata; | |
| 16 | import gov .va.med.fw .report.da ta.ReportD ataDAO; | |
| 17 | import gov .va.med.fw .report.da ta.ReportD ataService ; | |
| 18 | import gov .va.med.fw .service.A bstractCom ponent; | |
| 19 | ||
| 20 | // ESR cla sses | |
| 21 | ||
| 22 | /** | |
| 23 | * Allows concrete r eport buil der implem entations to be conf igured thr ough | |
| 24 | * spring context fi le | |
| 25 | * | |
| 26 | * Project : Framewor k</br> Cre ated on: 4 :59:46 PM </br> | |
| 27 | * | |
| 28 | * @author DN S
|
|
| 29 | */ | |
| 30 | public cla ss Configu rableRepor tBuilder e xtends Abs tractCompo nent imple ments Repo rtBuilder { | |
| 31 | ||
| 32 | pr ivate stat ic final l ong serial VersionUID = 8201546 7776964547 57L; | |
| 33 | ||
| 34 | pu blic stati c final St ring DATA_ SERVICE_TA G = ".data Service"; | |
| 35 | pu blic stati c final St ring REPOR T_TEMPLATE _TAG = ".r eportTempl ate"; | |
| 36 | ||
| 37 | @A utowired | |
| 38 | pr ivate Repo rtNameReso lver repor tNameResol ver = null ; | |
| 39 | ||
| 40 | pr ivate Repo rtDataServ ice report DataServic e = null; | |
| 41 | pr ivate Repo rtTemplate reportTem plate = nu ll; | |
| 42 | // @A utowired | |
| 43 | // pr ivate Repo rtDataDAO reportData DAO = null ; | |
| 44 | pr ivate bool ean asynch ronous = f alse; | |
| 45 | ||
| 46 | /* * | |
| 47 | * A default construct or | |
| 48 | * / | |
| 49 | pu blic Confi gurableRep ortBuilder (final Rep ortDataSer vice repor tDataServi ce) { | |
| 50 | supe r(); | |
| 51 | this .reportDat aService = reportDat aService; | |
| 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 | ||
| 60 | Vali date.notNu ll(reportD ataService , "reportD ataService cannot be null"); | |
| 61 | ||
| 62 | // s et name re solver if it is set the report level | |
| 63 | if ( reportName Resolver ! = null) { | |
| 64 | ||
| 65 | if (th is.reportT emplate!=n ull) { | |
| 66 | ((Abstra ctReportTe mplate) th is.reportT emplate).s etNameReso lver(repor tNameResol ver); | |
| 67 | } else { | |
| 68 | logger.w arn("$$$$$ figure ou t why repo rtTemplate is null") ; | |
| 69 | } | |
| 70 | ||
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | /* * | |
| 75 | * @see gov. va.med.fw. report.Rep ortBuilder #buildRepo rt(gov.va. med.fw.rep ort.Report Configurat ion) | |
| 76 | * / | |
| 77 | pu blic void buildRepor t(ReportCo nfiguratio n configur ation) thr ows Report Exception { | |
| 78 | this .buildRepo rt(configu ration, th is.doReque stData(con figuration )); | |
| 79 | } | |
| 80 | ||
| 81 | /* * | |
| 82 | * @see gov. va.med.fw. report.Rep ortBuilder #buildRepo rt(gov.va. med.fw.rep ort.Report Configurat ion, | |
| 83 | * gov. va.med.fw. report.dat a.ReportDa ta) | |
| 84 | * / | |
| 85 | pu blic void buildRepor t(ReportCo nfiguratio n configur ation, Rep ortData da ta) | |
| 86 | throws ReportExc eption { | |
| 87 | this .doBuildRe port(confi guration, data); | |
| 88 | } | |
| 89 | ||
| 90 | /* * | |
| 91 | * @param co nfiguratio n | |
| 92 | * @return | |
| 93 | * @throws R eportExcep tion | |
| 94 | * / | |
| 95 | pr otected Re portData d oRequestDa ta(ReportC onfigurati on configu ration) th rows Repor tException { | |
| 96 | ||
| 97 | // I f a servic e is confi gured to o btain a re port's dat a, use it to | |
| 98 | // r equest for data | |
| 99 | Repo rtDataServ ice servic e = this.g etReportDa taService( configurat ion); | |
| 100 | Repo rtData dat a = servic e != null ? service. requestRep ortData(co nfiguratio n) : null; | |
| 101 | ||
| 102 | retu rn data; | |
| 103 | } | |
| 104 | ||
| 105 | /* * | |
| 106 | * @param co nfiguratio n | |
| 107 | * @param da ta | |
| 108 | * @return | |
| 109 | * @throws R eportExcep tion | |
| 110 | * / | |
| 111 | pr otected vo id doBuild Report(Rep ortConfigu ration con figuration , ReportDa ta data) | |
| 112 | throws ReportExc eption { | |
| 113 | ||
| 114 | Repo rtExporter exporter = this.get ReportExpo rter(confi guration.g etReportOu tputType() ); | |
| 115 | Repo rtTemplate reportTem plate = th is.getRepo rtTemplate (configura tion); | |
| 116 | if ( asynchrono us) { | |
| 117 | new Th read( | |
| 118 | new Asynch ronousRepo rtExporter (exporter, configura tion, data , reportTe mplate)) | |
| 119 | .start(); | |
| 120 | } el se { | |
| 121 | export er.exportR eport(conf iguration, data, rep ortTemplat e); | |
| 122 | } | |
| 123 | } | |
| 124 | ||
| 125 | /* * | |
| 126 | * @param fo rmat | |
| 127 | * @return | |
| 128 | * @throws R eportExcep tion | |
| 129 | * / | |
| 130 | pr otected Re portExport er getRepo rtExporter (ReportExp ortedType. Code type) throws Re portExcept ion { | |
| 131 | ||
| 132 | Vali date.notNu ll(type, " A report o utput type must not be NULL"); | |
| 133 | ||
| 134 | Repo rtExporter exporter = null; | |
| 135 | try { | |
| 136 | // Get report ex porter (pd f, excel.. ) | |
| 137 | export er = (Repo rtExporter ) this.get Component( type.getAl ias(), Rep ortExporte r.class); | |
| 138 | } ca tch (Excep tion e) { | |
| 139 | throw new Report Exception( "Failed to obtain a report exp orter ", e ); | |
| 140 | } | |
| 141 | retu rn exporte r; | |
| 142 | } | |
| 143 | ||
| 144 | /* * | |
| 145 | * Returns a service t hat is use d to retri eve report data | |
| 146 | * | |
| 147 | * @param co nfig | |
| 148 | * A report configura tion | |
| 149 | * @return R eportDataS ervice a s ervice for getting r eport data | |
| 150 | * / | |
| 151 | pr otected Re portDataSe rvice getR eportDataS ervice(Rep ortConfigu ration con fig) | |
| 152 | throws ReportExc eption { | |
| 153 | retu rn reportD ataService ; | |
| 154 | } | |
| 155 | ||
| 156 | /* * | |
| 157 | * Returns a class tha t encapsul ates an ac tual repor t template | |
| 158 | * | |
| 159 | * @param co nfig | |
| 160 | * A report configura tion | |
| 161 | * @return R eportTempl ate a clas s that enc apsulates an actual report | |
| 162 | * t emplate | |
| 163 | * @throws R eportExcep tion | |
| 164 | * In case of errors loading a template | |
| 165 | * / | |
| 166 | pr otected Re portTempla te getRepo rtTemplate (ReportCon figuration config) t hrows Repo rtExceptio n { | |
| 167 | retu rn reportT emplate; | |
| 168 | } | |
| 169 | ||
| 170 | pu blic Repor tNameResol ver getRep ortNameRes olver() { | |
| 171 | retu rn reportN ameResolve r; | |
| 172 | } | |
| 173 | ||
| 174 | pu blic void setReportN ameResolve r(ReportNa meResolver reportNam eResolver) { | |
| 175 | this .reportNam eResolver = reportNa meResolver ; | |
| 176 | } | |
| 177 | ||
| 178 | // pu blic Repor tDataDAO g etReportDa taDAO() { | |
| 179 | // retu rn reportD ataDAO; | |
| 180 | // } | |
| 181 | // | |
| 182 | // pu blic void setReportD ataDAO(Rep ortDataDAO reportDat aDAO) { | |
| 183 | // this .reportDat aDAO = rep ortDataDAO ; | |
| 184 | // } | |
| 185 | ||
| 186 | pu blic Repor tDataServi ce getRepo rtDataServ ice() { | |
| 187 | retu rn reportD ataService ; | |
| 188 | } | |
| 189 | ||
| 190 | pu blic void setReportD ataService (ReportDat aService r eportDataS ervice) { | |
| 191 | this .reportDat aService = reportDat aService; | |
| 192 | } | |
| 193 | ||
| 194 | pu blic Repor tTemplate getReportT emplate() { | |
| 195 | retu rn reportT emplate; | |
| 196 | } | |
| 197 | ||
| 198 | pu blic void setReportT emplate(Re portTempla te reportT emplate) { | |
| 199 | this .reportTem plate = re portTempla te; | |
| 200 | } | |
| 201 | ||
| 202 | pu blic boole an isAsync hronous() { | |
| 203 | retu rn asynchr onous; | |
| 204 | } | |
| 205 | ||
| 206 | pu blic void setAsynchr onous(bool ean asynch ronous) { | |
| 207 | this .asynchron ous = asyn chronous; | |
| 208 | } | |
| 209 | ||
| 210 | /* * | |
| 211 | * Define As ynchronous Report exp orter | |
| 212 | * | |
| 213 | * @author DNS | |
| 214 | * | |
| 215 | * / | |
| 216 | pr otected cl ass Asynch ronousRepo rtExporter implement s Runnable { | |
| 217 | priv ate Report Exporter r eportExpor ter; | |
| 218 | priv ate Report Configurat ion config uration; | |
| 219 | priv ate Report Data data; | |
| 220 | priv ate Report Template r eportTempl ate; | |
| 221 | ||
| 222 | publ ic Asynchr onousRepor tExporter( ReportExpo rter repor tExporter, | |
| 223 | ReportCo nfiguratio n configur ation, Rep ortData da ta, Report Template r eportTempl ate) { | |
| 224 | this.r eportExpor ter = repo rtExporter ; | |
| 225 | this.c onfigurati on = confi guration; | |
| 226 | this.d ata = data ; | |
| 227 | this.r eportTempl ate = repo rtTemplate ; | |
| 228 | } | |
| 229 | ||
| 230 | publ ic void ru n() { | |
| 231 | try { | |
| 232 | reportEx porter.exp ortReport( this.confi guration, data, repo rtTemplate ); | |
| 233 | } catc h (Excepti on e) { | |
| 234 | logger.e rror("Repo rt export failed ", e); | |
| 235 | } fina lly { | |
| 236 | } | |
| 237 | } | |
| 238 | } | |
| 239 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.