4343. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:51:30 PM 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.

4343.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:30 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-web\src\main\java\gov\va\nvap\web\util\letter LetterGenerator.java Fri Apr 21 20:03:30 2017 UTC

4343.2 Comparison summary

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

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

4343.4 Active regular expressions

No regular expressions were active.

4343.5 Comparison detail

        1   package go v.va.nvap. web.util.l etter;
        2  
        3   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        4   import gov .va.nvap.s ervice.pdq .PatientDe mographics ;
        5   import gov .va.nvap.s vc.consent mgmt.stub. dao.DelayR easonDAO;
        6   import gov .va.nvap.s vc.consent mgmt.stub. dao.MailNo tification DAO;
        7   import gov .va.nvap.s vc.consent mgmt.stub. dao.MailTe mplateDAO;
        8   import gov .va.nvap.s vc.consent mgmt.stub. data.Conse ntDirectiv e;
        9   import gov .va.nvap.s vc.consent mgmt.stub. data.Delay edConsent;
        10   import gov .va.nvap.s vc.facilit y.data.Fac ility;
        11   import gov .va.nvap.s vc.facilit y.intf.Ent ityDoesNot ExistExcep tion;
        12   import gov .va.nvap.s vc.facilit y.intf.Fac ilityServi ce;
        13   import gov .va.nvap.w eb.util.fi le.PdfGene rator;
        14   import jav a.io.ByteA rrayOutput Stream;
        15   import jav a.io.IOExc eption;
        16   import jav a.io.Input Stream;
        17   import jav a.text.Sim pleDateFor mat;
        18   import jav a.util.Arr ayList;
        19   import jav a.util.Dat e;
        20   import jav a.util.Has hMap;
        21   import jav a.util.Sca nner;
        22   import org .apache.co mmons.io.I OUtils;
        23  
        24   /**
        25    *
        26    * @author  Johann So nnenberg
        27    */
        28   public cla ss LetterG enerator {
        29  
        30       privat e Facility Service fa cilityServ ice;
        31  
        32       privat e MailTemp lateDAO ma ilTemplate DAO;
        33  
        34       privat e DelayRea sonDAO del ayReasonDA O;
        35  
        36       privat e MailNoti ficationDA O mailNoti ficationDA O;
        37  
        38       public  ByteArray OutputStre am generat e(String t ype, Strin g facility Station, O bject ssaD elay, Obje ct eheDela y, Delayed Consent de layedConse nt, String [] delayed Reasons, C onsentDire ctive cons entDirecti ve, Patien tDemograph ics patien tDemograph ics, Strin g currentU ser, Strin g signatur e) throws  EntityDoes NotExistEx ception, I OException  {
        39           fi nal Simple DateFormat  letterFor mat = new  SimpleDate Format("MM /dd/yyyy") ;
        40           In putStream  inputStrea m = null;
        41           St ring templ ateString  = "";
        42           Ar rayList<Ha shMap<Stri ng, String >> patient Details =  new ArrayL ist<HashMa p<String,  String>>() ;
        43           Fa cility fac ility = th is.facilit yService.g etFacility ByStationN umber(faci lityStatio n);
        44           fi nal HashMa p<String,  String> fo rmFields =  new HashM ap();
        45  
        46           if  (type.equ als("delay ed")) {
        47                if (ssaD elay != nu ll) {
        48                    inpu tStream =  IOUtils.to InputStrea m(this.get MailTempla teDAO().ge tByLetterT ype(3L).ge tText(), " UTF-8");
        49                } else i f (eheDela y != null)  {
        50                    inpu tStream =  IOUtils.to InputStrea m(this.get MailTempla teDAO().ge tByLetterT ype(2L).ge tText(), " UTF-8");
        51                }
        52  
        53                template String = n ew Scanner (inputStre am, "UTF-8 ").useDeli miter("\\A ").next();
        54                if(input Stream !=  null) {
        55                    inpu tStream.cl ose();
        56                }
        57                formFiel ds.put("[e ntryDate]" , letterFo rmat.forma t(delayedC onsent.get DateAdded( )));
        58                String d elayReason String = " ";
        59                for (int  i = 0; i  < delayedR easons.len gth; i++)  {
        60                    dela yedReasons [i] = dela yedReasons [i].replac eAll("[^0- 9]+", "");
        61                    dela yedReasons [i] = this .getDelayR easonDAO() .findByDel ayReasonId (Long.pars eLong(dela yedReasons [i])).getN ame();
        62                    if ( delayedRea sons.lengt h == (i +  1)) {
        63                         if (delaye dReasons.l ength > 5)  {
        64                             delayR easonStrin g += "\n"  + delayedR easons[i];
        65                         } else {
        66                             delayR easonStrin g += delay edReasons[ i];
        67                         }
        68                    } el se {
        69                         delayReaso nString +=  delayedRe asons[i] +  ", ";
        70                    }
        71                }
        72                template String = t emplateStr ing.replac e("[reason sForDelay] ", delayRe asonString );
        73           }  else if (t ype.equals ("revoked" )) {
        74                inputStr eam = IOUt ils.toInpu tStream(th is.getMail TemplateDA O().getByL etterType( 1L).getTex t(), "UTF- 8");
        75                template String = n ew Scanner (inputStre am, "UTF-8 ").useDeli miter("\\A ").next();
        76                formFiel ds.put("[p urpose]",  consentDir ective.get PurposeOfU se().getPo uValue());
        77                formFiel ds.put("[o ptoutDate] ", letterF ormat.form at(consent Directive. getOptoutD ate()));
        78                formFiel ds.put("[e xpirationD ate]", let terFormat. format(con sentDirect ive.getExp irationDat e()));
        79           }  else if (t ype.equals ("expiring ")) {
        80                inputStr eam = IOUt ils.toInpu tStream(th is.getMail TemplateDA O().getByL etterType( 4L).getTex t(), "UTF- 8");
        81                template String = n ew Scanner (inputStre am, "UTF-8 ").useDeli miter("\\A ").next();
        82                inputStr eam.close( );
        83  
        84                if (!Nul lChecker.i sNullOrEmp ty(consent Directive) ) {
        85                    if ( consentDir ective.get OptinConse ntType().g etName().e quals("SSA  Authoriza tion")) {
        86                         formFields .put("[con sentDescri ption]", " Authorized  access to  Social Se curity Adm inistratio n");
        87                         formFields .put("[con sentName]" , consentD irective.g etOptinCon sentType() .getName() );
        88                    } el se if (con sentDirect ive.getOpt inConsentT ype().getN ame().equa ls("NwHIN  Authorizat ion")) {
        89                         formFields .put("[con sentDescri ption]", " Authorized  access to  Providers  and Organ izations") ;
        90                         formFields .put("[con sentName]" , "eHealth  Exchange  Authorizat ion");
        91                    }
        92                    form Fields.put ("[purpose ]", consen tDirective .getPurpos eOfUse().g etPouValue ());
        93                    form Fields.put ("[entryDa te]", lett erFormat.f ormat(cons entDirecti ve.getOpti nTS()));
        94                    form Fields.put ("[expirat ionDate]",  letterFor mat.format (consentDi rective.ge tExpiratio nDate()));
        95                }
        96           }
        97  
        98           // get patien t details
        99           fo rmFields.p ut("[date] ", new Sim pleDateFor mat("dd MM M, yyyy"). format(new  Date()));
        100           fo rmFields.p ut("[first Name]", pa tientDemog raphics.ge tFirstName ());
        101           fo rmFields.p ut("[lastN ame]", pat ientDemogr aphics.get LastName() );
        102           fo rmFields.p ut("[middl eName]", p atientDemo graphics.g etMiddleNa me());
        103           fo rmFields.p ut("[facil ityName]",  facility. getFacilit yName());
        104           St ring addre ss1 = (fac ility.getA ddress() ! = null) ?  facility.g etAddress( ) : "";
        105           fo rmFields.p ut("[facil ityAddress 1]", addre ss1);
        106           St ring addre ss2 = (fac ility.getC ity() != n ull) ? fac ility.getC ity() + ",  " : "";
        107           ad dress2 +=  (facility. getState()  != null)  ? facility .getState( ) + " " :  "";
        108           ad dress2 +=  (facility. getPostalC ode() != n ull) ? fac ility.getP ostalCode( ) : "";
        109           fo rmFields.p ut("[facil ityAddress 2]", addre ss2);
        110           St ring phone  = (facili ty.getPhon e() != nul l) ? facil ity.getPho ne() : "";
        111  
        112           if  (!NullChe cker.isNul lOrEmpty(p hone)) {
        113                phone =  "(" + phon e.substrin g(0, 3) +  ") " + pho ne.substri ng(3, 6) +  "-" + pho ne.substri ng(6);
        114           }
        115           fo rmFields.p ut("[facil ityPhone]" , phone);
        116  
        117           // Get and fo rmat patie nt address .
        118           St ring addre ss = patie ntDemograp hics.getSt reetAddres sLine1() +  "\n";
        119           if  (!patient Demographi cs.getStre etAddressL ine2().equ als("")) {
        120                address  += patient Demographi cs.getStre etAddressL ine2() + " \n";
        121           }
        122           if  (!patient Demographi cs.getStre etAddressL ine3().equ als("")) {
        123                address  += patient Demographi cs.getStre etAddressL ine3() + " \n";
        124           }
        125  
        126           ad dress += p atientDemo graphics.g etResidenc eCity() +  ", " + pat ientDemogr aphics.get ResidenceS tate() + "  " + patie ntDemograp hics.getRe sidenceZip 4();
        127  
        128           te mplateStri ng = templ ateString. replace("[ patientAdd ress]", ad dress);
        129  
        130           te mplateStri ng = templ ateString. replace("[ signature] ", signatu re);
        131  
        132           pa tientDetai ls.add(for mFields);
        133  
        134           Pd fGenerator  pdfGenera tor = new  PdfGenerat or();
        135           By teArrayOut putStream  pdfStream  = pdfGener ator.creat e(template String, pa tientDetai ls, type);
        136  
        137           re turn pdfSt ream;
        138       }
        139  
        140       //muta tors
        141       public  FacilityS ervice get FacilitySe rvice() {
        142           re turn facil ityService ;
        143       }
        144  
        145       public  MailTempl ateDAO get MailTempla teDAO() {
        146           re turn mailT emplateDAO ;
        147       }
        148  
        149       public  DelayReas onDAO getD elayReason DAO() {
        150           re turn delay ReasonDAO;
        151       }
        152  
        153       public  MailNotif icationDAO  getMailNo tification DAO() {
        154           re turn mailN otificatio nDAO;
        155       }
        156  
        157       public  void setF acilitySer vice(Facil ityService  facilityS ervice) {
        158           th is.facilit yService =  facilityS ervice;
        159       }
        160  
        161       public  void setM ailTemplat eDAO(MailT emplateDAO  mailTempl ateDAO) {
        162           th is.mailTem plateDAO =  mailTempl ateDAO;
        163       }
        164  
        165       public  void setD elayReason DAO(DelayR easonDAO d elayReason DAO) {
        166           th is.delayRe asonDAO =  delayReaso nDAO;
        167       }
        168  
        169       public  void setM ailNotific ationDAO(M ailNotific ationDAO m ailNotific ationDAO)  {
        170           th is.mailNot ificationD AO = mailN otificatio nDAO;
        171       }
        172   }