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\jasperreport\data | JasperReportDataSource.java | Wed May 29 15:26:14 2019 UTC |
| 2 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\report\jasperreport\data | JasperReportDataSource.java | Mon Jun 10 19:27:47 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 372 |
| 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.data; | |
| 6 | ||
| 7 | // Java cl asses | |
| 8 | import jav a.io.Seria lizable; | |
| 9 | import jav a.util.Map ; | |
| 10 | ||
| 11 | import org .apache.co mmons.bean utils.Prop ertyUtils; | |
| 12 | ||
| 13 | import gov .va.med.fw .report.Re portConfig uration; | |
| 14 | import gov .va.med.fw .report.da ta.QueryCr iteria; | |
| 15 | import gov .va.med.fw .report.da ta.ReportD ataExcepti on; | |
| 16 | import gov .va.med.fw .report.da ta.ReportD ataIterato r; | |
| 17 | import net .sf.jasper reports.en gine.JRExc eption; | |
| 18 | import net .sf.jasper reports.en gine.JRFie ld; | |
| 19 | import net .sf.jasper reports.en gine.data. JRAbstract BeanDataSo urce; | |
| 20 | ||
| 21 | /** | |
| 22 | * Project : Framewor k</br> Cre ated on: 5 :59:36 PM </br> | |
| 23 | * | |
| 24 | * @author DN S
|
|
| 25 | */ | |
| 26 | public cla ss JasperR eportDataS ource exte nds JRAbst ractBeanDa taSource i mplements Serializab le { | |
| 27 | ||
| 28 | /* * | |
| 29 | * An instan ce of seri alVersionU ID | |
| 30 | * / | |
| 31 | pr ivate stat ic final l ong serial VersionUID = -693240 5518646356 851L; | |
| 32 | ||
| 33 | /* * | |
| 34 | * An instan ce of data Iterator | |
| 35 | * / | |
| 36 | pr ivate Repo rtDataIter ator dataI terator = null; | |
| 37 | ||
| 38 | /* * | |
| 39 | * An instan ce of inde x | |
| 40 | * / | |
| 41 | pr ivate int index = 0; | |
| 42 | ||
| 43 | /* * | |
| 44 | * An instan ce of bean | |
| 45 | * / | |
| 46 | pr ivate Obje ct bean = null; | |
| 47 | ||
| 48 | /* * | |
| 49 | * An instan ce of meta Data | |
| 50 | * / | |
| 51 | pr ivate Map metaData = null; | |
| 52 | ||
| 53 | /* * | |
| 54 | * An instan ce of conf iguration | |
| 55 | * / | |
| 56 | pr ivate Repo rtConfigur ation conf iguration = null; | |
| 57 | ||
| 58 | /* * | |
| 59 | * An instan ce of useF ieldDescri ption | |
| 60 | * / | |
| 61 | pr ivate bool ean useFie ldDescript ion = fals e; | |
| 62 | ||
| 63 | /* * | |
| 64 | * A default construct or | |
| 65 | * | |
| 66 | * @param it erator | |
| 67 | * @param me taData | |
| 68 | * @param co nfig | |
| 69 | * / | |
| 70 | pu blic Jaspe rReportDat aSource(Re portDataIt erator ite rator, Map metaData, | |
| 71 | Report Configurat ion config ) { | |
| 72 | this (iterator, metaData, config, f alse); | |
| 73 | } | |
| 74 | ||
| 75 | /* * | |
| 76 | * A default construct or | |
| 77 | * | |
| 78 | * @param da taIterator | |
| 79 | * @param me taData | |
| 80 | * @param co nfig | |
| 81 | * @param us eFieldDesc ription | |
| 82 | * / | |
| 83 | pu blic Jaspe rReportDat aSource(Re portDataIt erator dat aIterator, Map metaD ata, | |
| 84 | Report Configurat ion config , boolean useFieldDe scription) { | |
| 85 | supe r(useField Descriptio n); | |
| 86 | ||
| 87 | this .metaData = metaData ; | |
| 88 | this .dataItera tor = data Iterator; | |
| 89 | this .useFieldD escription = useFiel dDescripti on; | |
| 90 | this .configura tion = con fig; | |
| 91 | } | |
| 92 | ||
| 93 | pu blic Jaspe rReportDat aSource ge tSubDataSo urce(Objec t key, Obj ect data) { | |
| 94 | Jasp erReportDa taSource s ubDataSour ce = null; | |
| 95 | Quer yCriteria criteria = this.conf iguration != null ? this.confi guration.g etQueryCri teria() | |
| 96 | : null; | |
| 97 | if ( criteria ! = null) { | |
| 98 | QueryC riteria su bCriteria = new Quer yCriteria( ); | |
| 99 | subCri teria.addC riterion(k ey, data); | |
| 100 | criter ia.setSubR eportCrite ria(subCri teria); | |
| 101 | Report DataIterat or iterato r = new Re portDataIt erator(thi s.dataIter ator.getRe portDAO(), | |
| 102 | this.confi guration); | |
| 103 | subDat aSource = new Jasper ReportData Source(ite rator, thi s.metaData , this.con figuration , | |
| 104 | this.useFi eldDescrip tion); | |
| 105 | } | |
| 106 | retu rn subData Source; | |
| 107 | } | |
| 108 | ||
| 109 | /* * | |
| 110 | * @see net. sf.jasperr eports.eng ine.JRData Source#nex t() | |
| 111 | * / | |
| 112 | pu blic boole an next() throws JRE xception { | |
| 113 | try { | |
| 114 | bean = dataItera tor.getRec ord(index+ +); | |
| 115 | return (bean != null); | |
| 116 | } ca tch (Repor tDataExcep tion e) { | |
| 117 | throw new JRExce ption("Fai led to che ck for a n ext record ", e); | |
| 118 | } | |
| 119 | } | |
| 120 | ||
| 121 | /* * | |
| 122 | * @see net. sf.jasperr eports.eng ine.JRRewi ndableData Source#mov eFirst() | |
| 123 | * / | |
| 124 | pu blic void moveFirst( ) throws J RException { | |
| 125 | try { | |
| 126 | index = 0; | |
| 127 | bean = this.data Iterator.g etRecord(i ndex); | |
| 128 | } ca tch (Repor tDataExcep tion e) { | |
| 129 | throw new JRExce ption("Fai led to set to a firs t record", e); | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | pu blic Objec t getField Values() t hrows JREx ception { | |
| 134 | retu rn bean; | |
| 135 | } | |
| 136 | ||
| 137 | pu blic Objec t getField Value(JRFi eld field) throws JR Exception { | |
| 138 | ||
| 139 | Obje ct value = null; | |
| 140 | if ( bean != nu ll) { | |
| 141 | ||
| 142 | String propertyN ame = this .getProper tyNameByFi eld(field) ; | |
| 143 | try { | |
| 144 | // This is probabl y a result of Hibern ate execut ing a sql | |
| 145 | // state ment | |
| 146 | if (bean instanceo f Map) { | |
| 147 | value = (( Map) bean) .get(prope rtyName); | |
| 148 | } else i f (bean in stanceof O bject[]) { | |
| 149 | ||
| 150 | // A meta data map m ust be pro vided if a result co llection | |
| 151 | // is an a rray of Ob ject | |
| 152 | if (this.m etaData == null || t his.metaDa ta.isEmpty ()) { | |
| 153 | th row new JR Exception( | |
| 154 | "Missi ng a meta data map t o retrieve value for property: " | |
| 155 | + property Name); | |
| 156 | } | |
| 157 | Object met a = this.m etaData.ge t(property Name); | |
| 158 | Integer in dex = meta instanceo f Integer ? (Integer ) meta : n ull; | |
| 159 | ||
| 160 | if(index ! = null) { | |
| 161 | va lue = ((Ob ject[]) be an)[index. intValue() ]; | |
| 162 | } | |
| 163 | else { | |
| 164 | va lue = 0; | |
| 165 | } | |
| 166 | } else { | |
| 167 | value = Pr opertyUtil s.getPrope rty(bean, propertyNa me); | |
| 168 | } | |
| 169 | } catc h (java.la ng.Illegal AccessExce ption e) { | |
| 170 | throw ne w JRExcept ion("Error retrievin g field va lue from b ean : " + propertyNa me, e); | |
| 171 | } catc h (java.la ng.reflect .Invocatio nTargetExc eption e) { | |
| 172 | throw ne w JRExcept ion("Error retrievin g field va lue from b ean : " + propertyNa me, e); | |
| 173 | } catc h (java.la ng.NoSuchM ethodExcep tion e) { | |
| 174 | throw ne w JRExcept ion("Error retrievin g field va lue from b ean : " + propertyNa me, e); | |
| 175 | } catc h (Illegal ArgumentEx ception e) { | |
| 176 | if (!e.g etMessage( ).startsWi th("Null p roperty va lue for ") ) { | |
| 177 | throw e; | |
| 178 | } | |
| 179 | } | |
| 180 | } | |
| 181 | retu rn value; | |
| 182 | } | |
| 183 | ||
| 184 | pr ivate Stri ng getProp ertyNameBy Field(JRFi eld field) { | |
| 185 | retu rn this.us eFieldDesc ription ? field.getD escription () : field .getName() ; | |
| 186 | } | |
| 187 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.