327. EPMO Open Source Coordination Office Redaction File Detail Report

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.

327.1 Files compared

# Location File Last Modified
1 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\report\jasperreport JasperReportTemplate.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 JasperReportTemplate.java Wed Dec 12 19:46:45 2018 UTC

327.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 298
Changed 1 2
Inserted 0 0
Removed 0 0

327.3 Comparison options

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

327.4 Active regular expressions

No regular expressions were active.

327.5 Comparison detail

  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.Buffe redInputSt ream;
  9   import jav a.io.IOExc eption;
  10   import jav a.io.Input Stream;
  11   import jav a.util.Ite rator;
  12   import jav a.util.Map ;
  13   import jav a.util.Set ;
  14  
  15   import org .apache.co mmons.lang .Validate;
  16   import org .springfra mework.cor e.io.Class PathResour ce;
  17  
  18   import com .lowagie.t ext.pdf.Pd fReader;
  19  
  20   import gov .va.med.fw .report.Ab stractRepo rtTemplate ;
  21   import gov .va.med.fw .report.In validTempl ateExcepti on;
  22   import net .sf.jasper reports.en gine.JRExc eption;
  23   import net .sf.jasper reports.en gine.Jaspe rCompileMa nager;
  24   import net .sf.jasper reports.en gine.Jaspe rReport;
  25   import net .sf.jasper reports.en gine.desig n.JasperDe sign;
  26   import net .sf.jasper reports.en gine.util. JRLoader;
  27   import net .sf.jasper reports.en gine.xml.J RXmlLoader ;
  28  
  29   /**
  30    * A jaspe r template  in XML fo rmat. A re port templ ate is loa ded and co mpiled
  31    * into a  jasper des ign object  that is r eady for d ata popula tion.
  32    * 
  33    * Project : Framewor k</br> Cre ated on: 9 :49:52 AM  </br>
  34    * 
  35    * @author   DN S
  36    */
  37   public cla ss JasperR eportTempl ate extend s Abstract ReportTemp late {
  38  
  39           pr ivate stat ic final S tring REPO RT_TEMPLAT E_EXTENTIO N = ".jrxm l";
  40  
  41           pr ivate stat ic final S tring COMP ILED_REPOR T_EXTENTIO N = ".jasp er";
  42  
  43           /* *
  44            *  An instan ce of seri alVersionU ID
  45            * /
  46           pr ivate stat ic final l ong serial VersionUID  = 2415040 3868746125 49L;
  47  
  48           /* *
  49            *  A default  construct or
  50            * /
  51           pu blic Jaspe rReportTem plate() {
  52                    supe r();
  53           }
  54  
  55           /* *
  56            *  @see gov. va.med.fw. report.Abs tractRepor tTemplate# compileTem plates(jav a.util.Map )
  57            * /
  58           pr otected vo id compile Templates( Map templa tes) throw s InvalidT emplateExc eption {
  59  
  60                    Set  entries =  templates. entrySet() ;
  61                    for  (Iterator  i = entrie s.iterator (); i.hasN ext();) {
  62                             Map.En try entry  = (Map.Ent ry) i.next ();
  63                             Object  key = ent ry.getKey( );
  64                             Object  value = e ntry.getVa lue();
  65                             String  tplName =  (value !=  null && v alue insta nceof Stri ng) ? (Str ing) value  : null;
  66                             this.g etTemplate Cache().ca cheItem(ke y, this.lo adJasperRe portTempla te(tplName ));
  67                    }
  68           }
  69  
  70           /* *
  71            *  Precompil e a jasper  report te mplate
  72            *  
  73            *  @return A  precompil ed jasper  report
  74            *  @throws I nvalidTemp lateExcept ion
  75            *               Thrown  in case of  errors co mpiling a  report
  76            * /
  77           pr otected Ja sperReport  loadJaspe rReportTem plate(Stri ng name) t hrows Inva lidTemplat eException  {
  78  
  79                    Jasp erReport t emplate =  null;
  80                    Inpu tStream in Stream = n ull;
  81                    try  {
  82                             // Val idate a re port templ ate name f irst
  83                             // Onl y accept * .jrxml or  *.jasper
  84                             this.v alidateTem plateName( name);
  85  
  86                             // If  a report t emplate na me is *.jr xml, compi les it int o *.jasper  =
  87                             // Jas perReport
  88                             inStre am = getTe mplateStre am(name);
  89                             if (na me.endsWit h(REPORT_T EMPLATE_EX TENTION))  {
  90                                      // Load  a report t emplate in  XML forma t into mem ory
  91                                      JasperDe sign desig n = JRXmlL oader.load (inStream) ;
  92                                      template  = JasperC ompileMana ger.compil eReport(de sign);
  93                             } else  {
  94                                      Object c ompiled =  JRLoader.l oadObject( inStream);
  95                                      template  = compile d instance of JasperR eport ? (J asperRepor t) compile d : null;
  96                             }
  97                    } ca tch (JRExc eption e)  {
  98                             throw  new Invali dTemplateE xception(
  99                                               "Failed to  compile a  report te mplate ["  + name + " ]", e);
  100                    }
  101                    fina lly {
  102                             if(inS tream != n ull) {
  103                                      safeClos eInStream( inStream);
  104                             } 
  105                    }
  106                    retu rn templat e;
  107           }
  108  
  109           /* *
  110            *  Gets an b uffered in put stream  to a repo rt templat e file
  111            *  
  112            *  @param na me
  113            *              A report  template  file name
  114            *  @return A n input st ream
  115            *  @throws I nvalidTemp lateExcept ion
  116            *               Thrown  in case of  errors ac cessing a  file
  117            * /
  118           pr otected In putStream  getTemplat eStream(St ring name)  throws In validTempl ateExcepti on {
  119  
  120                    Inpu tStream st ream = nul l;
  121  
  122                    try  {
  123                             ClassP athResourc e resource  = new Cla ssPathReso urce(name) ;
  124                             stream  = new Buf feredInput Stream(res ource.getI nputStream ());
  125                    } ca tch (IOExc eption e)  {
  126                             throw  new Invali dTemplateE xception(" Template f ile not fo und ", e);
  127                    } ca tch (Secur ityExcepti on e) {
  128                             throw  new Invali dTemplateE xception(" Access not  granted t o a templa te file ",  e);
  129                    }
  130                    retu rn stream;
  131           }
  132  
  133           pr otected vo id validat eTemplateN ame(String  name) {
  134  
  135                    // V alidate fo r a report  template  name
  136                    Vali date.notNu ll(name, " A template  name must  not be NU LL");
  137                    Vali date.isTru e((name.en dsWith(REP ORT_TEMPLA TE_EXTENTI ON) || nam e
  138                                      .endsWit h(COMPILED _REPORT_EX TENTION)),  "Invalid  report tem plate file ");
  139           }
  140           
  141           //  close met hod requir ed by fort ify:
  142           pu blic stati c void saf eCloseInSt ream(Input Stream inS tream) {
  143                      if  (inStream  != null)  {
  144                         try {
  145                             inStre am.close() ;
  146                         } catch (I OException  e) {
  147                         }
  148                      }
  149           }
  150   }