4308. EPMO Open Source Coordination Office Redaction File Detail Report

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

4308.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:51:27 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\report DocumentDisclosureReportResults.java Fri Apr 21 20:15:58 2017 UTC

4308.2 Comparison summary

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

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

4308.4 Active regular expressions

No regular expressions were active.

4308.5 Comparison detail

        1   package go v.va.nvap. web.report ;
        2  
        3   import gov .va.med.nh in.adapter .audit.Act ionType;
        4   import gov .va.med.nh in.adapter .audit.Act ionValuesT ype;
        5   import gov .va.med.nh in.adapter .audit.Aud itType;
        6   import gov .va.med.nh in.adapter .audit.Fie ldType;
        7   import gov .va.med.nh in.adapter .audit.Get Audits;
        8   import gov .va.med.nh in.adapter .audit.Get AuditsResp onse;
        9   import gov .va.med.nh in.adapter .audit.Pag eInfoType;
        10   import gov .va.med.nh in.adapter .audit.Sor tDirection ;
        11   import gov .va.med.nh in.adapter .audit.Sor tFieldType ;
        12   import gov .va.med.nh in.adapter .audit.Sor tFieldsTyp e;
        13   import gov .va.med.nh in.adapter .audit.Str ingValuesT ype;
        14   import gov .va.nvap.c ommon.date .Gregorian DateUtil;
        15   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        16   import gov .va.nvap.s ervice.ada pter.audit .AdapterAu ditManager ;
        17   import gov .va.nvap.s ervice.ada pter.audit .DirectAud itManager;
        18   import gov .va.nvap.s ervice.ada pter.audit .DirectSer viceEndpoi nt;
        19   import gov .va.nvap.s ervice.ada pter.audit .DirectSer viceExcept ion;
        20   import gov .va.nvap.s ervice.ada pter.doc.A dapterExce ption;
        21   import gov .va.nvap.s ervice.aud it.AuditEx ception;
        22   import gov .va.nvap.w eb.dao.Fac ilityDAO;
        23   import gov .va.nvap.w eb.dao.Use rDocumentD AO;
        24   import gov .va.nvap.w eb.helper. document.D ocumentHel per;
        25   import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r;
        26   import gov .va.nvap.w eb.helper. report.Rep ortHelper;
        27   import gov .va.nvap.w eb.patient .ExcelGene ratorThrea d;
        28   import gov .va.nvap.w eb.user.Us erHelper;
        29   import gov .va.nvap.w eb.util.Pa ginator;
        30   import gov .va.nvap.w eb.util.xl s.CsvExpor ter;
        31   import gov .va.nvap.w eb.util.xl s.ExcelExp orter;
        32  
        33   import jav a.io.IOExc eption;
        34   import jav a.util.Arr ayList;
        35   import jav a.util.Dat e;
        36   import jav a.util.Has hMap;
        37   import jav a.util.Lis t;
        38   import jav a.util.Map ;
        39   import jav a.util.Lin kedHashMap ;
        40   import jav ax.ejb.EJB ;
        41   import jav ax.servlet .ServletEx ception;
        42   import jav ax.servlet .http.Http ServletReq uest;
        43   import jav ax.servlet .http.Http ServletRes ponse;
        44   import jav ax.servlet .http.Http Session;
        45  
        46   /**
        47    * Disclos ures Detai l Report r esults ser vlet
        48    *
        49    * @author  Asha Amri traj
        50    */
        51   public cla ss Documen tDisclosur eReportRes ults exten ds
        52       gov.va .nvap.web. app.Respon seDispatch erHttpServ let {
        53  
        54       /**
        55        * Ser ial UID.
        56        */
        57       privat e static f inal long  serialVers ionUID = - 8891575215 151013736L ;
        58  
        59       privat e AdapterA uditManage r adapterA uditManage r;
        60       privat e final Di rectAuditM anager dir ectAuditMa nager = ne w DirectSe rviceEndpo int();
        61  
        62       public  void expo rtToCsv(fi nal HttpSe rvletReque st request ,
        63           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception, I OException  {
        64  
        65           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        66           fi nal String  documentD isclosureS ource = (S tring) ses sion.getAt tribute("d ocumentDis closureSou rce");
        67           Li st<Map<Str ing, Objec t>> result s;
        68           if  ("direct" .equals(do cumentDisc losureSour ce)) {
        69                results  = this.get Results(se ssion, new  Paginator (Integer.M AX_VALUE)) ;
        70           }  else {
        71                results  = this.get Results(se ssion, new  Paginator (this.getR eportHelpe r().getCon sentDirect ivesReport CapAsInt() ));
        72           }
        73  
        74           Cs vExporter  csvExporte r = new Cs vExporter( );
        75  
        76           Ma p<String,  String> cs vReportMap  = new Lin kedHashMap <String, S tring>();
        77  
        78           cs vReportMap .put("SSN" , "ssn");
        79           cs vReportMap .put("Pati ent Last N ame", "las tName");
        80           cs vReportMap .put("Pati ent First  Name", "fi rstName");
        81           cs vReportMap .put("Date  of Disclo sures (CT) ", "auditT imeFormatt ed");
        82           cs vReportMap .put("Disc losures",  "disclosur eTitle");
        83           cs vReportMap .put("Pati ent Prefer red Facili ty", "pati entFacilit yName");
        84           cs vReportMap .put("Pati ent Prefer red Facili ty Station  ID", "pat ientFacili tyNumber") ;
        85           cs vReportMap .put("eHea lth Exchan ge Organiz ation", "o rganizatio nName");
        86           cs vReportMap .put("OID" , "oid");
        87           cs vReportMap .put("User  ID", "use rId");
        88           cs vReportMap .put("Purp ose of Use ", "purpos eForUse");
        89           cs vReportMap .put("User  Role", "r oleName");
        90  
        91           cs vExporter. exportToCS V(response , "Disclos ures_Detai l_Report",  results,  (LinkedHas hMap<Strin g, String> ) csvRepor tMap);
        92       }
        93  
        94       /**
        95        * Exp ort to exc el - This  method is  called whe n the user  clicks on  the excel  icon in t he JSP. Re flection i s used in  the
        96        * Res ponseDispa tcherHttpS ervlet to  call this  method bas ed on the  http param eters.
        97        *
        98        * @pa ram reques t HTTP Req uest
        99        * @pa ram respon se HTTP Re sponse
        100        * @th rows Servl etExceptio n
        101        * @th rows IOExc eption
        102        */
        103       public  void expo rtToExcel( final Http ServletReq uest reque st,
        104           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        105           IO Exception  {
        106           Ex celGenerat orThread e xGenThread  = new Exc elGenerato rThread("e xGenThread ");
        107  
        108           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        109  
        110           ex GenThread. setReportS ource((Str ing) sessi on.getAttr ibute("doc umentDiscl osureSourc e"));
        111  
        112                    // C reate a ma p of key w hich is ba sed on the  result da ta key and  the
        113           //  heading v alue
        114           //  The headi ng is used  to create  the colum n headers  and the ke y is used
        115           //  to pull t he data fr om the res ults
        116           fi nal Map<St ring, Stri ng> disclo sureMap =  new Linked HashMap<St ring, Stri ng>();
        117  
        118           fi nal Object  startDate Str = sess ion.getAtt ribute("do cumentDisc losureQuer yStartDate ");
        119           fi nal Object  endDateSt r = sessio n.getAttri bute("docu mentDisclo sureQueryE ndDate");
        120  
        121           //  Generate  filters.
        122           fi nal Map<St ring, List <Object>>  filterMap  = new Link edHashMap< String, Li st<Object> >();
        123           fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String,  Object>();
        124  
        125           fi lters.put( "Disclosur e Source",  session.g etAttribut e("documen tDisclosur eSource")) ;
        126           fi lters.put( "SSN", ses sion.getAt tribute("d ocumentDis closureQue rySSN"));
        127           fi lters.put( "Last Name ", session .getAttrib ute("docum entDisclos ureQueryLa stName"));
        128           fi lters.put( "First Nam e", sessio n.getAttri bute("docu mentDisclo sureQueryF irstName") );
        129           // filters.pu t("User ID ", session .getAttrib ute("docum entDisclos ureQueryUs erId"));
        130           fi lters.put( "Start Dat e", this.g etReportHe lper().get FormattedD ate((Date)  startDate Str));
        131           fi lters.put( "End Date" , this.get ReportHelp er().getFo rmattedDat e((Date) e ndDateStr) );
        132           fi lters.put( "Purpose o f Use", Ex celExporte r.getFilte rValue(ses sion.getAt tribute("p urposeOfUs e")));
        133           fi lters.put( "Patient P referred F acility",  ExcelExpor ter.getPat ientPrefer redFacilit yFilter(ge tFacilityD AO(), (Str ing) sessi on.getAttr ibute("doc umentDiscl osureQuery Facility") ));
        134           fi lters.put( "eHealth E xchange Or g", ExcelE xporter.ge tFilterVal ue(session .getAttrib ute("docum entDisclos ureQueryOr gName")));
        135           Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, se ssion.getA ttribute(" patientTyp es").toStr ing());
        136           ex GenThread. setFilterM ap(filterM ap);
        137  
        138           di sclosureMa p.put("ssn ", "SSN");
        139           di sclosureMa p.put("las tName", "P atient Las t Name");
        140           di sclosureMa p.put("fir stName", " Patient Fi rst Name") ;
        141           di sclosureMa p.put("aud itTimeForm atted", "D ate of Dis closures ( CT)");
        142           di sclosureMa p.put("doc umentTitle ", "Disclo sures");
        143           di sclosureMa p.put("pat ientFacili tyName", " Patient Pr eferred Fa cility");
        144           di sclosureMa p.put("pat ientFacili tyNumber",  "Patient  Preferred  Facility S tation ID" );
        145           di sclosureMa p.put("org anizationN ame", "eHe alth Excha nge Organi zation");
        146           di sclosureMa p.put("org anizationI d", "OID") ;
        147           di sclosureMa p.put("use rId", "Use r ID");
        148           di sclosureMa p.put("pur poseOfUse" , "Purpose  of Use");
        149           di sclosureMa p.put("rol eName", "U ser Role") ;
        150           ex GenThread. setReportM ap(disclos ureMap);
        151  
        152           //  Set names  for Excel  generator  thread
        153           ex GenThread. setTitle(" Disclosure s Detailed  Report");
        154  
        155           ex GenThread. setExcelEx porter(thi s.getExcel Exporter() );
        156           ex GenThread. setAdapter AuditManag er(adapter AuditManag er);
        157           ex GenThread. setDirectA uditManage r(directAu ditManager );
        158           ex GenThread. setReportH elper(getR eportHelpe r());
        159           ex GenThread. setUserId( UserHelper .getUserNa me(request ));
        160           ex GenThread. setUserDoc umentDao(g etUserDocu mentDAO()) ;
        161           ex GenThread. setCmsHelp er(getCmsH elper());
        162  
        163           //  Set searc h attribut es for get ting audit  results
        164           ex GenThread. setAttribu tes(mapSes sionAttrib utes(sessi on));
        165  
        166           ex GenThread. start();
        167  
        168           th is.forward (request,  response,  "show");
        169       }
        170  
        171       privat e Map<Stri ng, Object > mapSessi onAttribut es(HttpSes sion sessi on) {
        172           Ma p<String,  Object> at tributes =  new HashM ap<String,  Object>() ;
        173  
        174           at tributes.p ut("ssn",  (String) s ession
        175                    .get Attribute( "documentD isclosureQ uerySSN")) ;
        176           at tributes.p ut("lastNa me", (Stri ng) sessio n
        177                    .get Attribute( "documentD isclosureQ ueryLastNa me"));
        178           at tributes.p ut("firstN ame", (Str ing) sessi on
        179                    .get Attribute( "documentD isclosureQ ueryFirstN ame"));
        180           at tributes.p ut("userId ", (String ) session
        181                    .get Attribute( "documentD isclosureQ ueryUserId "));
        182  
        183           Da te startDa te = (Date ) session. getAttribu te("docume ntDisclosu reQuerySta rtDate");
        184           Da te endDate  = (Date)  session.ge tAttribute ("document Disclosure QueryEndDa te");
        185           at tributes.p ut("startD ate", star tDate);
        186           at tributes.p ut("endDat e", endDat e);
        187  
        188           at tributes.p ut("organi zation", ( String) se ssion
        189                    .get Attribute( "documentD isclosureQ ueryOrgani zation"));
        190           at tributes.p ut("facili ty", (Stri ng) sessio n.getAttri bute("docu mentDisclo sureQueryF acility")) ;
        191           at tributes.p ut("purpos eOfUse", ( String) se ssion.getA ttribute(" purposeOfU se"));
        192           at tributes.p ut("patien tTypes", ( Integer) s ession.get Attribute( "patientTy pes"));
        193           //  sort
        194           at tributes.p ut("sortVa lue", (Str ing) sessi on
        195                    .get Attribute( "documentD isclosureS ortValue") );
        196           at tributes.p ut("sortDi rection",  (String) s ession
        197                    .get Attribute( "documentD isclosureS ortDirecti on"));
        198  
        199           //  Set Actio n Types
        200           fi nal Action ValuesType  actionsTy pe = new A ctionValue sType();
        201           ac tionsType. getValue() .add(Actio nType.RETR IEVE_DOCUM ENT);
        202           ac tionsType. setNotIn(f alse);
        203           at tributes.p ut("action sType", ac tionsType) ;
        204  
        205           re turn attri butes;
        206       }
        207  
        208       public  ConsentMa nagementHe lper getCm sHelper()  {
        209           fi nal Consen tManagemen tHelper cm sHelper =  this.getBe an("cmsHel per",
        210                ConsentM anagementH elper.clas s);
        211           re turn cmsHe lper;
        212       }
        213  
        214       public  DocumentH elper getD ocumentHel per() {
        215           re turn this. getBean("a dapterDocu mentHelper ", Documen tHelper.cl ass);
        216       }
        217  
        218       /**
        219        * Get  the excel  exporter  class from  Spring.
        220        *
        221        * @re turn the e xcel expor ter object
        222        */
        223       public  ExcelExpo rter getEx celExporte r() {
        224           fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r",
        225                ExcelExp orter.clas s);
        226           re turn excel Exporter;
        227       }
        228  
        229       public  ReportHel per getRep ortHelper( ) {
        230           fi nal Report Helper rep ortHelper  = this.get Bean("repo rtHelper",
        231                ReportHe lper.class );
        232           re turn repor tHelper;
        233       }
        234  
        235           //  private L ist<HashMa p<String,  Object>> g etResults( final Http Session
        236       // ses sion,
        237       privat e List<Map <String, O bject>> ge tResults(f inal HttpS ession ses sion,
        238                final Pa ginator pa ginator) t hrows Audi tException , DirectSe rviceExcep tion {
        239           //  Get the i nformation  entered b y the user  in the GU I
        240           fi nal String  ssn = (St ring) sess ion
        241                .getAttr ibute("doc umentDiscl osureQuery SSN");
        242           fi nal String  lastName  = (String)  session
        243                .getAttr ibute("doc umentDiscl osureQuery LastName") ;
        244           fi nal String  firstName  = (String ) session
        245                .getAttr ibute("doc umentDiscl osureQuery FirstName" );
        246           fi nal String  userId =  (String) s ession
        247                .getAttr ibute("doc umentDiscl osureQuery UserId");
        248           fi nal String  facility  = (String)  session
        249                .getAttr ibute("doc umentDiscl osureQuery Facility") ;
        250           fi nal String  purposeOf Use = (Str ing) sessi on
        251                .getAttr ibute("pur poseOfUse" );
        252  
        253           fi nal Date s d = (Date)  session
        254                .getAttr ibute("doc umentDiscl osureQuery StartDate" );
        255           fi nal Date e d = (Date)  session
        256                .getAttr ibute("doc umentDiscl osureQuery EndDate");
        257           fi nal String  organizat ion = (Str ing) sessi on
        258                .getAttr ibute("doc umentDiscl osureQuery Organizati on");
        259           fi nal String  documentD isclosureS ource = (S tring) ses sion.getAt tribute("d ocumentDis closureSou rce");
        260           fi nal int pa tientTypes  = (Intege r) session
        261                .getAttr ibute("pat ientTypes" );
        262           //  sorting
        263           fi nal String  documentD isclosureS ortValue =  (String)  session
        264                .getAttr ibute("doc umentDiscl osureSortV alue");
        265           fi nal String  documentD isclosureS ortDirecti on = (Stri ng) sessio n
        266                .getAttr ibute("doc umentDiscl osureSortD irection") ;
        267  
        268           fi nal GetAud its getAud itsRequest  = new Get Audits();
        269           if  (NullChec ker.isNotE mpty(sd))  {
        270                getAudit sRequest.s etFromDate (Gregorian DateUtil
        271                    .get GregorianC alendarByD ate(sd));
        272           }
        273           if  (NullChec ker.isNotE mpty(ed))  {
        274                getAudit sRequest.s etToDate(G regorianDa teUtil
        275                    .get GregorianC alendarByD ate(ed));
        276           }
        277  
        278           //  Set Patie nt Types
        279           ge tAuditsReq uest.setPa tientTypes (patientTy pes);
        280  
        281           /*
        282            *  // Set Pa tient Ids  StringValu esType pat ientIdsTyp e = new
        283            *  StringVal uesType();  patientId sType.setN otIn(false );
        284            *  patientId sType.getV alue().add (icn);
        285            *  getAudits Request.se tPatientId s(patientI dsType);
        286            * /
        287           /*
        288            *  // Set Pa tient Ids  if (NullCh ecker.isNo tEmpty(icn )) { final
        289            *  StringVal uesType pa tientIds =  new Strin gValuesTyp e();
        290            *  patientId s.getValue ().add(icn ); patient Ids.setNot In(false);
        291            *  getAudits Request.se tPatientId s(patientI ds); }
        292            * /
        293           //  Set SSN
        294           if  (NullChec ker.isNotE mpty(ssn))  {
        295                final St ringValues Type patie ntSSNs = n ew StringV aluesType( );
        296                patientS SNs.getVal ue().add(s sn);
        297                patientS SNs.setNot In(false);
        298                getAudit sRequest.s etPatientS SNs(patien tSSNs);
        299           }
        300           //  Set Last  Name
        301           if  (NullChec ker.isNotE mpty(lastN ame)) {
        302                final St ringValues Type patie ntLastName s = new St ringValues Type();
        303                patientL astNames.g etValue(). add(lastNa me);
        304                patientL astNames.s etNotIn(fa lse);
        305                getAudit sRequest.s etPatientL astNames(p atientLast Names);
        306           }
        307           //  Set First  Name
        308           if  (NullChec ker.isNotE mpty(first Name)) {
        309                final St ringValues Type patie ntFirstNam es = new S tringValue sType();
        310                patientF irstNames. getValue() .add(first Name);
        311                patientF irstNames. setNotIn(f alse);
        312                getAudit sRequest.s etPatientG ivenNames( patientFir stNames);
        313           }
        314           // Set User I D
        315           if  (NullChec ker.isNotE mpty(userI d)) {
        316                final St ringValues Type userI dValue = n ew StringV aluesType( );
        317                userIdVa lue.getVal ue().add(u serId);
        318                userIdVa lue.setNot In(false);
        319                getAudit sRequest.s etUserIds( userIdValu e);
        320           }
        321           //  Set Purpo se of Use
        322           if  (!NullChe cker.isNul lOrEmpty(p urposeOfUs e)) {
        323                final St ringValues Type purpo seForUses  = new Stri ngValuesTy pe();
        324                purposeF orUses.get Value().ad d(purposeO fUse);
        325                purposeF orUses.set NotIn(fals e);
        326                getAudit sRequest.s etPurposeF orUses(pur poseForUse s);
        327           }
        328  
        329           //  Set Facil ity Ids
        330           if  (NullChec ker.isNotE mpty(facil ity)) {
        331                final St ringValues Type facil ityIds = n ew StringV aluesType( );
        332                facility Ids.setNot In(false);
        333                facility Ids.getVal ue().add(f acility);
        334                getAudit sRequest.s etPatientF acilityNum bers(facil ityIds);
        335           }
        336  
        337           //  Set Organ ization Ty pes
        338           if  (NullChec ker.isNotE mpty(organ ization))  {
        339                final St ringValues Type organ izationIds  = new Str ingValuesT ype();
        340                organiza tionIds.se tNotIn(fal se);
        341                organiza tionIds.ge tValue().a dd(organiz ation);
        342                getAudit sRequest.s etOrganiza tionIds(or ganization Ids);
        343           }  else {
        344                // input  orgs are  empty - in tent is to  retrieve  all orgs e xcept VA
        345                final St ringValues Type organ izationIds  = new Str ingValuesT ype();
        346                organiza tionIds.se tNotIn(tru e);
        347                organiza tionIds.ge tValue().a dd(
        348                    this .getCmsHel per().getC ompleteHom eCommunity Id());
        349                getAudit sRequest.s etOrganiza tionIds(or ganization Ids);
        350           }
        351  
        352           //  sorting
        353           if  (NullChec ker.isNotE mpty(docum entDisclos ureSortVal ue)) {
        354                final So rtFieldTyp e sortFiel d = new So rtFieldTyp e();
        355                sortFiel d
        356                    .set Field(Fiel dType.from Value(docu mentDisclo sureSortVa lue));
        357                if ("DES C".equalsI gnoreCase( documentDi sclosureSo rtDirectio n)) {
        358                    sort Field.setD irection(S ortDirecti on.DESC);
        359                } else {
        360                    sort Field.setD irection(S ortDirecti on.ASC);
        361                }
        362                final So rtFieldsTy pe sortFie ldsType =  new SortFi eldsType() ;
        363                sortFiel dsType.get SortField( ).add(sort Field);
        364                getAudit sRequest.s etSortFiel ds(sortFie ldsType);
        365           }
        366  
        367           /*
        368            *  StringVal uesType or gTypes = n ew StringV aluesType( ); if
        369            *  (NullChec ker.isNotE mpty(organ ization) & &
        370            *  "external ".equals(o rganizatio n)) { orgT ypes.getVa lue().add( "%" +
        371            *  this.getC msHelper() .getHomeCo mmunity(). getOrgOid( ));
        372            *  orgTypes. setNotIn(t rue); } el se {
        373            *  orgTypes. getValue() .add(organ ization);  orgTypes.s etNotIn(fa lse); }
        374            *  getAudits Request.se tOrganizat ionIds(org Types);
        375            *
        376            *  // Set Re mote Organ ization Ty pes String ValuesType  remoteOrg Types =
        377            *  new Strin gValuesTyp e(); remot eOrgTypes. setNotIn(f alse);
        378            *  getAudits Request.se tRemoteOrg anizationI ds(remoteO rgTypes);
        379            * /
        380           //  Set Actio n Value Ty pes
        381           fi nal Action ValuesType  actionsTy pe = new A ctionValue sType();
        382           ac tionsType. getValue() .add(Actio nType.RETR IEVE_DOCUM ENT);
        383           ac tionsType. setNotIn(f alse);
        384           ge tAuditsReq uest.setAc tions(acti onsType);
        385           //  Set Page  informatio n
        386           fi nal PageIn foType pag eInfoType  = new Page InfoType() ;
        387           pa geInfoType .setPageNu mber(pagin ator.getCu rrentPage( ));
        388           pa geInfoType .setPageSi ze(paginat or.getReco rdsPerPage ());
        389           ge tAuditsReq uest.setPa geInfo(pag eInfoType) ;
        390  
        391           fi nal List<M ap<String,  Object>>  results =  new ArrayL ist<Map<St ring, Obje ct>>();
        392           tr y {
        393                final Ge tAuditsRes ponse quer yResponse;
        394                session. setAttribu te("docume ntDisclosu reSource",  documentD isclosureS ource);
        395                if (docu mentDisclo sureSource .equals("d irect")) {
        396                    quer yResponse  = this.dir ectAuditMa nager.getA udits(getA uditsReque st);
        397                } else {
        398                    quer yResponse  = this.ada pterAuditM anager.get Audits(get AuditsRequ est);
        399                }
        400                if (Null Checker.is NotEmpty(q ueryRespon se)
        401                    && N ullChecker .isNotEmpt y(queryRes ponse.getA udits())
        402                    && N ullChecker .isNotEmpt y(queryRes ponse.getA udits()
        403                         .getAudit( ))) {
        404                    fina l List<Aud itType> au ditTypeLis t = queryR esponse.ge tAudits()
        405                         .getAudit( );
        406                    int  pageSize =  paginator .getRecord sPerPage() ;
        407                    for  (final Aud itType aud itType : a uditTypeLi st) {
        408                         final Map< String, Ob ject> resu ltMap = ne w HashMap< String, Ob ject>();
        409                         // Replace  SSN with  Mask
        410                         ReportData Processor. addSsnToRe sultMap(re sultMap, a uditType.g etPatientS SN());
        411                                               // final H ashMap<Str ing, Objec t> resultM ap = new
        412                         // HashMap <String, O bject>();
        413                         resultMap. put("patie ntICN", Re portDataPr ocessor
        414                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        415                                 .g etPatientI d()));
        416                         resultMap. put("audit Time", Gre gorianDate Util
        417                             .getDa teFromGreg orianCalen dar(auditT ype
        418                                 .g etAuditTim e()));
        419                         resultMap. put("audit TimeFormat ted", this .getReport Helper().g etFormatte dDateTime( GregorianD ateUtil
        420                             .getDa teFromGreg orianCalen dar(auditT ype
        421                                 .g etAuditTim e())));
        422  
        423                         resultMap. put("purpo seForUse",  ReportDat aProcessor
        424                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        425                                 .g etPurposeF orUse()));
        426  
        427                         resultMap
        428                             .put(" userId", R eportDataP rocessor
        429                                 .n ullEmptyRe placeWithU nknown(aud itType
        430                                      .getUser Id()));
        431  
        432                         resultMap. put("lastN ame", Repo rtDataProc essor
        433                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        434                                 .g etPatientL astName()) );
        435                         resultMap. put("first Name", Rep ortDataPro cessor
        436                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        437                                 .g etPatientG ivenName() ));
        438                         resultMap. put("patie ntFacility Name", Rep ortDataPro cessor
        439                             .fixSt ation(audi tType.getP atientFaci lityName() ));
        440                         resultMap. put("patie ntFacility Number", R eportDataP rocessor
        441                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        442                                 .g etPatientF acilityNum ber()));
        443                         resultMap. put("organ izationNam e", Report DataProces sor
        444                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        445                                 .g etOrganiza tionName() ));
        446                         resultMap. put("oid",  ReportDat aProcessor
        447                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        448                                 .g etOrganiza tionId())) ;
        449                          resultMap .put("role Name", Rep ortDataPro cessor
        450                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        451                                 .g etRoleName ()));
        452                         /*
        453                          * resultM ap.put( "f acility",  this.getCm sHelper()
        454                          * .getOrg anizationB yHomeCommu nityId(
        455                          * auditTy pe.getOrga nizationId ()));
        456                          */
        457                         resultMap. put("docum entId", Re portDataPr ocessor
        458                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        459                                 .g etDocument Id()));
        460                         resultMap. put("discl osureTitle ", ReportD ataProcess or
        461                             .nullE mptyReplac eWithUnkno wn(auditTy pe
        462                                 .g etDocument Title()));
        463                         results.ad d(resultMa p);
        464                    }
        465  
        466                                      // TODO:  Move sett ing of ses sion varia bles to a  different  method
        467                    // C heck if an y of the p atient mat ch criteri a exists
        468                    if ( NullChecke r.isNotEmp ty(ssn)
        469                         || NullChe cker.isNot Empty(last Name)
        470                         || NullChe cker.isNot Empty(firs tName)) {
        471                         // Default  to unknow n
        472                         String res ultIcn = " ";
        473                         if (NullCh ecker.isNo tEmpty(aud itTypeList )) {
        474                             final  AuditType  result = a uditTypeLi st.get(0);
        475                             result Icn = resu lt.getPati entId();
        476  
        477                             if (Nu llChecker. isNotEmpty (resultIcn )) {
        478                                 fo r (final A uditType a uditType :  auditType List) {
        479                                      if (!res ultIcn.equ als(auditT ype.getPat ientId()))  {
        480                                          resu ltIcn = "M ultiple IC Ns";
        481                                          brea k;
        482                                      }
        483                                 }
        484                             } else  if (NullC hecker.isN otEmpty(re sult
        485                                 .g etPatientG ivenName() )
        486                                 &&  NullCheck er.isNotEm pty(result
        487                                      .getPati entLastNam e())
        488                                 &&  NullCheck er.isNotEm pty(result
        489                                      .getPati entSSN()))  {
        490                                 fi nal String  patientGi venName =  result
        491                                      .getPati entGivenNa me();
        492                                 fi nal String  patientLa stName = r esult
        493                                      .getPati entLastNam e();
        494                                 fi nal String  patientSs n = result .getPatien tSSN();
        495                                 bo olean mult ipleIcns =  false;
        496                                 fo r (final A uditType a uditType :  auditType List) {
        497                                      if (!pat ientGivenN ame.equals (auditType
        498                                          .get PatientGiv enName())
        499                                          || ! patientLas tName.equa ls(auditTy pe
        500                                               .getPatien tLastName( ))
        501                                          || ! patientSsn .equals(au ditType
        502                                               .getPatien tSSN())) {
        503                                          mult ipleIcns =  true;
        504                                          brea k;
        505                                      }
        506                                 }
        507                                 if  (multiple Icns) {
        508                                      resultIc n = "Multi ple ICNs";
        509                                 }  else {
        510                                      resultIc n = this.g etReportHe lper().res olveICN(
        511                                          resu lt.getPati entGivenNa me(),
        512                                          resu lt.getPati entLastNam e(),
        513                                          resu lt.getPati entSSN());
        514                                 }
        515                             }
        516                         } else if  (NullCheck er.isNotEm pty(ssn)
        517                             && Nul lChecker.i sNotEmpty( lastName)
        518                             && Nul lChecker.i sNotEmpty( firstName) ) {
        519                             // Try  to get fr om what wa s typed
        520                             result Icn = this .getReport Helper().r esolveICN(
        521                                 fi rstName, l astName, s sn);
        522                         }
        523                         // Set in  Session
        524                         if (NullCh ecker.isEm pty(result Icn)) {
        525                             result Icn = "Unk nown";
        526                         }
        527                         session.se tAttribute ("document Disclosure QueryICN",
        528                             result Icn);
        529                    }
        530                    //re turn resul ts;
        531                }
        532           }  catch (fin al AuditEx ception ex ) {
        533                throw ne w AuditExc eption();
        534           }  catch (fin al DirectS erviceExce ption ex)  {
        535                throw ne w DirectSe rviceExcep tion();
        536           }
        537  
        538           re turn resul ts;
        539       }
        540  
        541       privat e boolean  isPaginato rPresent(f inal HttpS ession ses sion) {
        542           re turn !Null Checker.is NullOrEmpt y(session. getAttribu te("pagina tor"));
        543       }
        544  
        545       public  void next (final Htt pServletRe quest requ est,
        546           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        547           IO Exception  {
        548           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        549           if  (this.isP aginatorPr esent(sess ion)) {
        550                final Pa ginator pa ginator =  (Paginator ) session. getAttribu te("pagina tor");
        551                paginato r.next(req uest);
        552                session. setAttribu te("pagina tor", pagi nator);
        553                session. setAttribu te("docume ntDisclosu reResults" ,
        554                    this .getResult s(session,  paginator ));
        555                this.for ward(reque st, respon se, "show" );
        556           }  else {
        557                this.for ward(reque st, respon se, "nosho w");
        558           }
        559       }
        560  
        561       public  void prev (final Htt pServletRe quest requ est,
        562           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        563           IO Exception  {
        564           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        565           if  (this.isP aginatorPr esent(sess ion)) {
        566                final Pa ginator pa ginator =  (Paginator ) session. getAttribu te("pagina tor");
        567                paginato r.previous (request);
        568                session. setAttribu te("pagina tor", pagi nator);
        569                session. setAttribu te("docume ntDisclosu reResults" ,
        570                    this .getResult s(session,  paginator ));
        571                this.for ward(reque st, respon se, "show" );
        572           }  else {
        573                this.for ward(reque st, respon se, "nosho w");
        574           }
        575       }
        576  
        577       @EJB(b eanInterfa ce = Adapt erAuditMan ager.class , mappedNa me = "Adap terAuditMa nager")
        578       public  void setA dapterAudi tManager(
        579           fi nal Adapte rAuditMana ger adapte rAuditMana ger) {
        580           th is.adapter AuditManag er = adapt erAuditMan ager;
        581       }
        582  
        583       @Overr ide
        584       public  void unsp ecified(fi nal HttpSe rvletReque st request ,
        585           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        586           IO Exception  {
        587           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        588  
        589           //  sort
        590           fi nal String  documentD isclosureS ortValue =  request
        591                .getPara meter("doc umentDiscl osureSortV alue");
        592           fi nal String  documentD isclosureS ortDirecti on = reque st
        593                .getPara meter("doc umentDiscl osureSortD irection") ;
        594           se ssion.setA ttribute(" documentDi sclosureSo rtValue",
        595                document Disclosure SortValue) ;
        596           se ssion.setA ttribute(" documentDi sclosureSo rtDirectio n",
        597                document Disclosure SortDirect ion);
        598  
        599           if  (this.isP aginatorPr esent(sess ion)) {
        600                Paginato r paginato r = (Pagin ator) sess ion.getAtt ribute("pa ginator");
        601                if (Null Checker.is Empty(pagi nator)) {
        602                    pagi nator = ne w Paginato r(0);
        603                    sess ion.setAtt ribute("pa ginator",  paginator) ;
        604                }
        605                paginato r.reset();
        606                session. setAttribu te("docume ntDisclosu reResults" ,
        607                    this .getResult s(session,  paginator ));
        608  
        609                this.for ward(reque st, respon se, "show" );
        610           }  else {
        611                this.for ward(reque st, respon se, "nosho w");
        612           }
        613       }
        614  
        615       public  void view (final Htt pServletRe quest requ est,
        616           fi nal HttpSe rvletRespo nse respon se) throws  ServletEx ception,
        617           IO Exception  {
        618           fi nal HttpSe ssion sess ion = requ est.getSes sion(false );
        619           fi nal String  icn = req uest.getPa rameter("i cn");
        620           fi nal String  documentU niqueId =  request
        621                .getPara meter("doc umentUniqu eId");
        622           fi nal String  styleShee tViewType  = request
        623                .getPara meter("sty leSheetVie wType");
        624  
        625           St ring docum ent = null ;
        626           tr y {
        627                document  = this.ge tDocumentH elper().ge tDocument( icn,
        628                    docu mentUnique Id, UserHe lper.getUs erName(req uest),
        629                    this .getCmsHel per().getC ompleteHom eCommunity Id());
        630           }  catch (fin al Adapter Exception  ex) {
        631                throw ne w ServletE xception(e x);
        632           }
        633           se ssion.setA ttribute(" document",  document) ;
        634           se ssion.setA ttribute(" icn", icn) ;
        635           se ssion.setA ttribute(" documentUn iqueId", d ocumentUni queId);
        636           se ssion.setA ttribute(" isXmlViewE nabled", t his.getDoc umentHelpe r()
        637                .isXmlVi ewEnabled( ));
        638  
        639           if  ("xml".eq uals(style SheetViewT ype)) {
        640                document  = documen t
        641                    .rep laceAll(
        642                         "<?xml-sty lesheet ty pe=\"text/ xsl\" href =\"CCD.xsl \"?>",
        643                         "");
        644                response .setConten tType("tex t/xml;char set=UTF-8" );
        645                response .getWriter ().write(d ocument);
        646           }  else {
        647                // Updat e session  in the doc ument
        648                final St ring html  = this.get DocumentHe lper().get Html(docum ent,
        649                    styl eSheetView Type);
        650                session. setAttribu te("update dDocument" , html);
        651                this.for ward(reque st, respon se,
        652                    "sho wDocumentD isclosureR eportDocum ent");
        653           }
        654       }
        655  
        656       privat e Facility DAO getFac ilityDAO()  {
        657           re turn this. getBean("F acilityDAO ", Facilit yDAO.class );
        658       }
        659  
        660       privat e UserDocu mentDAO ge tUserDocum entDAO() {
        661           re turn this. getBean("U serDocumen tDAO", Use rDocumentD AO.class);
        662       }
        663   }