81. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/2/2019 1:06:56 PM Central 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.

81.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ARS_Backend\ars_app\src\main\java\gov\va\med\ewv\controller EwvClaimController.java Wed Mar 27 19:21:14 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\main\java\gov\va\med\ewv\controller EwvClaimController.java Thu Mar 28 17:50:58 2019 UTC

81.2 Comparison summary

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

81.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

81.4 Active regular expressions

No regular expressions were active.

81.5 Comparison detail

  1   package go v.va.med.e wv.control ler;
  2  
  3  
  4   import jav a.io.File;
  5   import jav a.io.FileI nputStream ;
  6   import jav a.io.FileN otFoundExc eption;
  7  
  8   import jav ax.activat ion.Mimety pesFileTyp eMap;
  9   import jav ax.servlet .ServletCo ntext;
  10   import jav ax.validat ion.Valid;
  11  
  12   import org .apache.co mmons.io.F ilenameUti ls;
  13   import org .apache.lo gging.log4 j.LogManag er;
  14   import org .apache.lo gging.log4 j.Logger;
  15   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  16   import org .springfra mework.cor e.io.Input StreamReso urce;
  17   import org .springfra mework.htt p.HttpStat us;
  18   import org .springfra mework.htt p.MediaTyp e;
  19   import org .springfra mework.htt p.Response Entity;
  20   import org .springfra mework.web .bind.anno tation.Get Mapping;
  21   import org .springfra mework.web .bind.anno tation.Mod elAttribut e;
  22   import org .springfra mework.web .bind.anno tation.Pat hVariable;
  23   import org .springfra mework.web .bind.anno tation.Req uestBody;
  24   import org .springfra mework.web .bind.anno tation.Req uestMappin g;
  25   import org .springfra mework.web .bind.anno tation.Req uestMethod ;
  26   import org .springfra mework.web .bind.anno tation.Res tControlle r;
  27  
  28   import gov .va.med.ar s.constant s.ErrorMes sages;
  29   import gov .va.med.ar s.exceptio ns.Generic Exception;
  30   import gov .va.med.ew v.bean.Arc hiveFileRe quest;
  31   import gov .va.med.ew v.bean.Fil eUploadReq uest;
  32   import gov .va.med.ew v.model.re sponse.Ewd PdfReferen cesFileArc hiveRespon se;
  33   import gov .va.med.ew v.model.re sponse.Ewd PdfReferen cesFileUpl oadRespons e;
  34   import gov .va.med.ew v.model.re sponse.Ewv ClaimDetai lResponse;
  35   import gov .va.med.ew v.model.re sponse.Ewv PdfReferen cesRespons e;
  36   import gov .va.med.ew v.service. IEwvClaimS ervice;
  37   import gov .va.med.ew v.service. IEwvPdfRef erenceServ ice;
  38  
  39   /**
  40    * RESTFul  Web Servi ces Contro ller that  handles th e RESTFul  Web Servic es request ed pertain ing to
  41    * EWV inf ormation.
  42    * 
  43    * @author   DN S      PEREZF
  44    *
  45    */
  46   @RestContr oller
  47   @RequestMa pping("api /v1")
  48   public cla ss EwvClai mControlle r {
  49  
  50           
  51           pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(EwvC laimContro ller.class );
  52           
  53           @A utowired
  54           pr ivate IEwv ClaimServi ce ewvClai mService;
  55           
  56           @A utowired
  57           pr ivate IEwv PdfReferen ceService  ewvPdfRefe renceServi ce;
  58           
  59           @A utowired
  60           Se rvletConte xt context ;
  61           
  62           /* *
  63            *  RESTFul W eb Service  that retu rns back C laim infor mation ass ociated th e the give n
  64            *  Claim "pd iNumber" N umber. Req uest and R esponse Bo dy is JSON  formatted  string me ssage.
  65            *  
  66            *  @param pd iNumber -  Claim Numb er that un iquely ide ntifies a  claim
  67            *  
  68            *  @return -  JSON form atted resp onse of an  EwvClaimD etailRespo nse Java c lass insta nce
  69            *  
  70            *  @throws G enericExce ption - th rown if so me type of  error is  encountere d
  71            * /
  72           @G etMapping( value = "/ ewvClaim/{ pdiNumber} ")
  73       public  ResponseE ntity<?> g etDetail(@ PathVariab le("pdiNum ber") Stri ng pdiNumb er) throws  GenericEx ception {
  74                    
  75                    logg er.info("I nvoked the  controlle r to retri eve the cl aim detail s for pdiN umber : "  + pdiNumbe r);
  76                    EwvC laimDetail Response e wvClaim =  null;
  77                    
  78                    try  {
  79                             ewvCla im = ewvCl aimService .getEwvCla im(pdiNumb er);
  80                    } ca tch(Generi cException  e) {
  81                             logger .error("Ex ception oc cured for  pdiNumber  : "+ pdiNu mber);
  82                             throw  new Generi cException ("ERROR",  e.getError Descriptio n(), HttpS tatus.OK);
  83                    }
  84                             
  85                    retu rn Respons eEntity.ok ().body(ew vClaim);
  86       }
  87           
  88           
  89           /* *
  90            *  RESTful W eb Service  that retu rns back a ll the PDF  Reference s informat ion that i s in the
  91            *  database.  Response  Body is a  JSON forma tted strin g message.
  92            *  
  93            *  @return -  JSON form atted resp onse of an  EwvPdfRef erencesRes ponse Java  class ins tance  
  94            *  
  95            *  @throws G enericExce ption - th rown if so me type of  error is  encountere d
  96            * /
  97           @G etMapping( value = "/ pdfReferen ce/getAllP dfReferenc es")
  98           pu blic Respo nseEntity< ?> getAllP dfReferenc es() throw s GenericE xception {
  99                    
  100                    logg er.info("I nvoked the  controlle r to retri eve all th e PDF Refe rences: In side \"get AllPdfRefe rences\" m ethod");
  101                    EwvP dfReferenc esResponse  pdfRefere ncesRespon se = null;
  102                    
  103                    try  {
  104                             pdfRef erencesRes ponse = ew vPdfRefere nceService .getAllPdf References ();
  105                    } ca tch(Generi cException  e) {
  106                             logger .error("Ex ception oc cured when  calling t he \"getAl lPdfRefere nces\" met hod");
  107                             throw  new Generi cException ("ERROR",  e.getError Descriptio n(), HttpS tatus.OK);
  108                    }
  109                    
  110                    retu rn Respons eEntity.ok ().body(pd fReference sResponse) ;
  111           }
  112           
  113            / **
  114              * RESTFul  Web Servic e that mar ks one or  more PDF R eferences  to the Arc hived stat e. Request  and Respo nse Body i s JSON for matted str ing messag e.
  115             
  116              * @param a rchiveFile Request -  instance o f ArchiveF ileRequest  Java clas s that is  fed into t he Request  Body as a  JSON form atted stri ng
  117             
  118              * @return  - JSON for matted res ponse of a n EwvClaim DetailResp onse Java  class inst ance; it w ill show w hich PDF R eferences  have been  placed 
  119              *            successf ully in th e Archived  state and  which hav e not. In  those inst ances that  are unsuc cessful, t he reason  for not be ing
  120              *            successf ul will be  included  in the res ponse
  121             
  122              * @throws  GenericExc eption - t hrown if s ome type o f error is  encounter ed
  123              */
  124            @ RequestMap ping(value  = "/filea rchive", m ethod = Re questMetho d.POST,  p roduces =  "applicati on/json") 
  125            p ublic Resp onseEntity <?> upload ArchiveFla g(@Request Body Archi veFileRequ est archiv eFileReque st) throws  GenericEx ception {
  126                 //Strin g result =  null;
  127                // List< ArchivedPd fReference > archived PdfReferen ces;
  128                    EwdP dfReferenc esFileArch iveRespons e result =  null;
  129                             
  130                try {
  131                    // S ystem.out. println(ar chiveFileR equest.toS tring());
  132                    resu lt = ewvPd fReference Service.up dateUpload edFiles(ar chiveFileR equest.get ArchivedPd fReference s());
  133                }
  134                // Here  Catch IOEx ception on ly.
  135                // Other  Exception s catch by  RestGloba lException Handler cl ass.
  136                catch (E xception e ) {
  137                     e.p rintStackT race();
  138                     //  return new  ResponseE ntity<>("E rror: " +  e.getMessa ge(), Http Status.BAD _REQUEST);
  139                     thr ow new Gen ericExcept ion("ERROR ", e.getMe ssage(), H ttpStatus. OK);
  140                }
  141  
  142                // retur n new Resp onseEntity <String>(" Updated ar chive flag  " , HttpS tatus.OK);
  143                
  144                // The b elow canno t be used,  because i t will not  return ba ck a JSON- formatted  response!
  145                // retur n Response Entity.ok( ).body(res ult.toStri ng().repla ceAll("\\\ \", ""));
  146                
  147                return R esponseEnt ity.ok().b ody(result );
  148            }
  149            
  150           
  151           /* *
  152            *  RESTFul W eb Service  that uplo ads a list  of files  into the s erver file  system as  well as i nsert PDF  References  of those  files into
  153            *  the datab ase. The I nput to th e RESTFul  Web Servic e will be  of Content  Type "mul tipart/*"  (or more l ikely "mul tipart/for m-data") 
  154            *  where the  Body of t he Request  had multi ple parts.  The Respo nse Body i s a JSON f ormatted s tring mess age.
  155            *  
  156            *  @param fi leUploadRe quest - in stance of  a FileUplo adRequest  that is fe d into the  Request B ody as a " multipart/ *" format
  157            *  
  158            *  @return -  JSON form atted resp onse of an  EwdPdfRef erencesFil eUploadRes ponse Java  class ins tance; it  will show  which File
  159            *             have had  their cont ents store d successf ully into  the server  file syst em as well  as their  PDF Refere nce inform ation
  160            *             in the da tabase and  which hav e not. In  those inst ances that  are unsuc cessful, t he reason  for not be ing
  161            *             successfu l will be  included i n the resp onse
  162            *  
  163            *  @throws G enericExce ption - th rown if so me type of  error is  encountere d
  164            * /
  165       @Reque stMapping( value = "/ fileupload ",  header s=("conten t-type=mul tipart/*") , method =  RequestMe thod.POST,  produces  = "applica tion/json" )
  166       public  ResponseE ntity<?> u ploadFileM ulti(@Mode lAttribute  FileUploa dRequest f ileUploadR equest) th rows Gener icExceptio n {
  167     
  168           Ew dPdfRefere ncesFileUp loadRespon se result  = null;
  169           // List<Archi vedPdfRefe rence> arc hivedPdfRe ferences;
  170                    
  171           tr y {
  172                result =  ewvPdfRef erenceServ ice.saveUp loadedFile s(fileUplo adRequest. getMultipa rtFiles()) ;
  173           }
  174           //  Here Catc h IOExcept ion only.
  175           //  Other Exc eptions ca tch by Res tGlobalExc eptionHand ler class.
  176           ca tch (Excep tion e) {
  177                e.printS tackTrace( );
  178                // retur n new Resp onseEntity <>("Error:  " + e.get Message(),  HttpStatu s.BAD_REQU EST);
  179                throw ne w GenericE xception(" ERROR", e. getMessage (), HttpSt atus.BAD_R EQUEST);
  180           }
  181  
  182           //  return ne w Response Entity<Str ing>("Uplo aded to: "  + result,  HttpStatu s.OK);
  183           
  184           //  The below  cannot be  used, bec ause it wi ll not ret urn back a  JSON-form atted resp onse!
  185           //  return Re sponseEnti ty.ok().bo dy(result. toString() .replaceAl l("\\\\",  ""));
  186        
  187           re turn Respo nseEntity. ok().body( result);
  188       }
  189       
  190       
  191       @GetMa pping("/fi le/retriev al/{fileId }")
  192           pu blic Respo nseEntity< ?> fileRet rieval(@Va lid @PathV ariable("f ileId") St ring fileI d) throws  FileNotFou ndExceptio n, Generic Exception  {
  193                    Stri ng fullPat h = ewvPdf ReferenceS ervice.get PathForThe Attachment (fileId);
  194                             if(ful lPath != n ull) {
  195                                      File fil e = new Fi le(fullPat h);
  196                                 In putStreamR esource is r = new In putStreamR esource(ne w FileInpu tStream(fi le));
  197                                 re turn Respo nseEntity. ok().heade r("Content -Dispositi on", Filen ameUtils.g etName(ful lPath)).co ntentLengt h(file.len gth()).con tentType(M ediaType.v alueOf(new  Mimetypes FileTypeMa p().getCon tentType(f ile))).bod y(isr);
  198                             } else  {
  199                                      throw ne w GenericE xception(E rrorMessag es.BAD_REQ UEST, "Req uired Data  is missin g", HttpSt atus.BAD_R EQUEST);
  200                             }
  201           }
  202  
  203           
  204   }