Produced by Araxis Merge on 6/9/2017 3:51:24 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:51:24 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\announce | BatchManagerQuery.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 246 |
| 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 | package go v.va.nvap. web.announ ce; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce ment; | |||||
| 5 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce mentBatchS ummary; | |||||
| 6 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce rInterface ; | |||||
| 7 | import gov .va.nvap.w eb.app.Res ponseDispa tcherHttpS ervlet; | |||||
| 8 | import gov .va.nvap.w eb.dao.Org anizationD AO; | |||||
| 9 | import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r; | |||||
| 10 | import sta tic gov.va .nvap.web. report.Rep ortDataPro cessor.mas kSsn; | |||||
| 11 | import gov .va.nvap.w eb.user.Us erHelper; | |||||
| 12 | ||||||
| 13 | import jav a.io.IOExc eption; | |||||
| 14 | import jav a.io.Strin gWriter; | |||||
| 15 | import jav a.text.Par seExceptio n; | |||||
| 16 | import jav a.text.Sim pleDateFor mat; | |||||
| 17 | import jav a.util.Arr ayList; | |||||
| 18 | import jav a.util.Dat e; | |||||
| 19 | import jav a.util.Has hMap; | |||||
| 20 | import jav a.util.Lis t; | |||||
| 21 | import jav a.util.log ging.Level ; | |||||
| 22 | import jav a.util.log ging.Logge r; | |||||
| 23 | import jav ax.ejb.EJB ; | |||||
| 24 | ||||||
| 25 | import jav ax.servlet .ServletEx ception; | |||||
| 26 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 27 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 28 | import jav ax.servlet .http.Http Session; | |||||
| 29 | import org .json.JSON Exception; | |||||
| 30 | import org .json.JSON Object; | |||||
| 31 | ||||||
| 32 | /** | |||||
| 33 | * @author Tim Vu / Asha Amrit raj | |||||
| 34 | */ | |||||
| 35 | public cla ss BatchMa nagerQuery extends R esponseDis patcherHtt pServlet { | |||||
| 36 | ||||||
| 37 | /* * | |||||
| 38 | * Serial UI D. | |||||
| 39 | * / | |||||
| 40 | pr ivate stat ic final l ong serial VersionUID = 8860158 6867822756 98L; | |||||
| 41 | ||||||
| 42 | pu blic Conse ntManageme ntHelper g etCmsHelpe r() { | |||||
| 43 | fina l ConsentM anagementH elper cmsH elper = th is.getBean ("cmsHelpe r", | |||||
| 44 | ConsentM anagementH elper.clas s); | |||||
| 45 | retu rn cmsHelp er; | |||||
| 46 | } | |||||
| 47 | ||||||
| 48 | privat e Organiza tionDAO ge tOrganizat ionDAO() { | |||||
| 49 | re turn this. getBean("O rganizatio nDAO", Org anizationD AO.class); | |||||
| 50 | } | |||||
| 51 | ||||||
| 52 | /*publ ic Announc erInterfac e getAnnou ncer() { | |||||
| 53 | fi nal Announ cerInterfa ce announc er = this. getBean("A nnouncerSe rvice", An nouncerInt erface.cla ss); | |||||
| 54 | re turn annou ncer; | |||||
| 55 | }*/ | |||||
| 56 | ||||||
| 57 | @EJB(b eanInterfa ce = Annou ncerInterf ace.class, mappedNam e = "Annou ncerServic e") | |||||
| 58 | pr ivate Anno uncerInter face annou ncer; | |||||
| 59 | ||||||
| 60 | @Overr ide | |||||
| 61 | pr otected vo id unspeci fied(final HttpServl etRequest request, f inal HttpS ervletResp onse respo nse) throw s ServletE xception,I OException { | |||||
| 62 | fina l HttpSess ion sessio n = reques t.getSessi on(false); | |||||
| 63 | ||||||
| 64 | re quest.setA ttribute(" organizati ons", this .getCmsHel per().getA llowedNonC onsumerOnl yOrganizat ions()); | |||||
| 65 | ||||||
| 66 | th is.forward (request, response, "searchFor m"); | |||||
| 67 | } | |||||
| 68 | ||||||
| 69 | public void doSe arch(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) throws ServletExc eption, IO Exception, ParseExce ption | |||||
| 70 | { | |||||
| 71 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 72 | St ring start Date = req uest.getPa rameter("s tartDate") ; | |||||
| 73 | Stri ng endDate = request .getParame ter("endDa te"); | |||||
| 74 | Stri ng remoteO rg = reque st.getPara meter("rem oteOrganiz ation"); | |||||
| 75 | fi nal String draw = re quest.getP arameter(" draw"); | |||||
| 76 | fi nal String maxRows = request.g etParamete r("length" ); | |||||
| 77 | fi nal String startRow = request. getParamet er("start" ); | |||||
| 78 | Da te sd = nu ll; | |||||
| 79 | Da te ed = nu ll; | |||||
| 80 | ||||||
| 81 | Si mpleDateFo rmat sdFor matter = n ew SimpleD ateFormat( "MM/dd/yyy y"); | |||||
| 82 | Si mpleDateFo rmat edFor matter = n ew SimpleD ateFormat( "MM/dd/yyy y HH:mm:ss "); | |||||
| 83 | ||||||
| 84 | if (!NullChec ker.isNull OrEmpty(st artDate)) { | |||||
| 85 | sd = sdF ormatter.p arse(start Date); | |||||
| 86 | } | |||||
| 87 | if (!NullChec ker.isNull OrEmpty(en dDate)) { | |||||
| 88 | ed = edF ormatter.p arse(endDa te + " 23: 59:59"); | |||||
| 89 | } | |||||
| 90 | ||||||
| 91 | fi nal List<A nnouncemen tBatchSumm ary> summa ryList = t his.announ cer.retrie veBatchSum maries(sd, ed, remot eOrg, User Helper.get UserName(r equest), I nteger.par seInt(star tRow), Int eger.parse Int(maxRow s)); //get the resul ts | |||||
| 92 | fi nal List<A nnouncemen tBatchSumm ary> summa ryCount = this.annou ncer.retri eveBatchSu mmaries(sd , ed, remo teOrg, Use rHelper.ge tUserName( request), -1,-1); // get the to tal count | |||||
| 93 | ||||||
| 94 | Ha shMap hm = new HashM ap(); | |||||
| 95 | hm .put("resu lts", summ aryList); | |||||
| 96 | hm .put("coun t", summar yCount.siz e()); | |||||
| 97 | hm .put("draw ", draw); | |||||
| 98 | ||||||
| 99 | // create JSO N here... | |||||
| 100 | se ssion.setA ttribute(" results", encodeInto JSON(hm)); | |||||
| 101 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 102 | } | |||||
| 103 | ||||||
| 104 | privat e String e ncodeIntoJ SON(HashMa p results) throws Pa rseExcepti on | |||||
| 105 | { | |||||
| 106 | tr y{ | |||||
| 107 | StringWr iter json = new Stri ngWriter() ; | |||||
| 108 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 109 | List<Ann ouncementB atchSummar y> summari es = (List <Announcem entBatchSu mmary>) re sults.get( "results") ; | |||||
| 110 | Integer count = (I nteger) re sults.get( "count"); | |||||
| 111 | SimpleDa teFormat d t = new Si mpleDateFo rmat("yyyy -MM-dd kk: mm:ss.S"); | |||||
| 112 | SimpleDa teFormat f inalDateFo rmat = new SimpleDat eFormat("M M/dd/yyyy hh:mm a"); | |||||
| 113 | Integer draw = Int eger.parse Int( (Stri ng) result s.get("dra w")); | |||||
| 114 | ||||||
| 115 | obj.put( "draw", dr aw); | |||||
| 116 | obj.put( "recordsTo tal", coun t); | |||||
| 117 | obj.put( "recordsFi ltered", c ount); | |||||
| 118 | ||||||
| 119 | List<Lis t> data = new ArrayL ist<List>( ); | |||||
| 120 | ||||||
| 121 | for(Anno uncementBa tchSummary s : summa ries) { | |||||
| 122 | List <String> d ataItem = new ArrayL ist<String >(); //eac h "row" | |||||
| 123 | Stri ng created Date = ""; | |||||
| 124 | ||||||
| 125 | if(s .getCreate dDate() != null) { | |||||
| 126 | Date date = dt.parse (s.getCrea tedDate(). toString() ); | |||||
| 127 | createdDat e = finalD ateFormat. format(dat e); | |||||
| 128 | } | |||||
| 129 | ||||||
| 130 | data Item.add(" <input typ e='checkbo x' name='b atchId' ro le='group' aria-labe lledby='ma ster' clas s='chk' va lue='" + s .getBatchI d() +"' ti tle='Check to choose Organizat ion' />"); | |||||
| 131 | data Item.add(s .getTarget Organizati onName()); | |||||
| 132 | data Item.add(c reatedDate ); | |||||
| 133 | data Item.add(s .getNumber Scheduled( ).toString ()); | |||||
| 134 | data Item.add(s .getNumber Completed( ).toString ()); | |||||
| 135 | data Item.add(s .getBatchS ize().toSt ring()); | |||||
| 136 | data Item.add(" <input typ e='button' name='" + dataItem. hashCode() + "' id=' " + dataIt em.hashCod e() + "' d ata-org-id ='" + s.ge tOrgId() + "' data-b atch-id='" + s.getBa tchId() + "' class=' batchDetai l' title=' View Detai ls' value= 'View Deta ils' />"); | |||||
| 137 | ||||||
| 138 | data .add(dataI tem); | |||||
| 139 | } | |||||
| 140 | ||||||
| 141 | obj.put( "data", da ta); | |||||
| 142 | ||||||
| 143 | obj.writ e(json); | |||||
| 144 | ||||||
| 145 | return j son.toStri ng(); | |||||
| 146 | } catch(JSON Exception ex) { | |||||
| 147 | Logger.g etLogger(B atchManage rQuery.cla ss.getName ()).log(Le vel.SEVERE , null, ex ); | |||||
| 148 | } | |||||
| 149 | ||||||
| 150 | re turn ""; | |||||
| 151 | } | |||||
| 152 | ||||||
| 153 | privat e String e ncodeBatch DetailsInt oJSON(Hash Map result s) throws ParseExcep tion { | |||||
| 154 | tr y{ | |||||
| 155 | StringWr iter json = new Stri ngWriter() ; | |||||
| 156 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 157 | List<Ann ouncement> announcem ents = (Li st<Announc ement>) re sults.get( "results") ; | |||||
| 158 | Long cou nt = (Long ) results. get("count "); | |||||
| 159 | ||||||
| 160 | Integer draw = Int eger.parse Int( (Stri ng) result s.get("dra w")); | |||||
| 161 | ||||||
| 162 | obj.put( "draw", dr aw); | |||||
| 163 | obj.put( "recordsTo tal", coun t); | |||||
| 164 | obj.put( "recordsFi ltered", c ount); | |||||
| 165 | ||||||
| 166 | List<Lis t> data = new ArrayL ist<List>( ); //overa rching "da ta" | |||||
| 167 | ||||||
| 168 | for(Anno uncement a : announc ements) { | |||||
| 169 | List <String> d ataItem = new ArrayL ist<String >(); //eac h "row" | |||||
| 170 | ||||||
| 171 | data Item.add(a .getPatien tIen()); | |||||
| 172 | data Item.add(m askSsn(a.g etSsn())); | |||||
| 173 | data Item.add(a .getLastNa me()); | |||||
| 174 | data Item.add(a .getFirstN ame()); | |||||
| 175 | ||||||
| 176 | data .add(dataI tem); | |||||
| 177 | } | |||||
| 178 | ||||||
| 179 | obj.put( "data", da ta); | |||||
| 180 | ||||||
| 181 | obj.writ e(json); | |||||
| 182 | ||||||
| 183 | return j son.toStri ng(); | |||||
| 184 | } catch(JSON Exception ex) { | |||||
| 185 | Logger.g etLogger(B atchManage rQuery.cla ss.getName ()).log(Le vel.SEVERE , null, ex ); | |||||
| 186 | } | |||||
| 187 | ||||||
| 188 | re turn ""; | |||||
| 189 | } | |||||
| 190 | ||||||
| 191 | /** | |||||
| 192 | * Delete re cords from the batch . | |||||
| 193 | * / | |||||
| 194 | pu blic void delete(fin al HttpSer vletReques t request, final Htt pServletRe sponse res ponse) thr ows Servle tException , IOExcept ion { | |||||
| 195 | fina l String[] batchIds = request. getParamet erValues(" batchId"); | |||||
| 196 | ||||||
| 197 | if ( (null != b atchIds) & & (batchId s.length > 0)) { | |||||
| 198 | final List<Strin g> notNull BatchIds = new Array List<Strin g>(); | |||||
| 199 | ||||||
| 200 | for (f inal Strin g batchId : batchIds ) { | |||||
| 201 | if (Null Checker.is NotEmpty(b atchId)) { | |||||
| 202 | notNullBat chIds.add( batchId); | |||||
| 203 | } | |||||
| 204 | } | |||||
| 205 | this.a nnouncer.r emoveAnnou ncementBat ches(notNu llBatchIds ); | |||||
| 206 | } | |||||
| 207 | // D o the sear ch again | |||||
| 208 | this .unspecifi ed(request , response ); | |||||
| 209 | } | |||||
| 210 | ||||||
| 211 | public void getD etailView( final Http ServletReq uest reque st, final HttpServle tResponse response) throws IOE xception, ServletExc eption { | |||||
| 212 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 213 | ||||||
| 214 | Li st<String> batchIds = new Arra yList(); | |||||
| 215 | ba tchIds.add (request.g etParamete r("batchId ")); | |||||
| 216 | Li st<Announc ementBatch Summary> a = this.an nouncer.ge tBatchSumm ary(batchI ds); | |||||
| 217 | St ring orgId = request .getParame ter("orgId "); | |||||
| 218 | St ring annou ncedToOrg = this.get Organizati onDAO().ge tOrganizat ion(Long.p arseLong(o rgId)).get OrgName(); | |||||
| 219 | ||||||
| 220 | se ssion.setA ttribute(" announcedD ate", a.ge t(0).getCr eatedDate( )); | |||||
| 221 | se ssion.setA ttribute(" announcedT oOrg", ann ouncedToOr g); | |||||
| 222 | se ssion.setA ttribute(" batchId", request.ge tParameter ("batchId" )); | |||||
| 223 | se ssion.setA ttribute(" orgId", re quest.getP arameter(" orgId")); | |||||
| 224 | ||||||
| 225 | th is.forward (request, response, "getDetail View"); | |||||
| 226 | } | |||||
| 227 | ||||||
| 228 | public void getD etail(fina l HttpServ letRequest request, final Http ServletRes ponse resp onse) thro ws Servlet Exception, IOExcepti on, ParseE xception { | |||||
| 229 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 230 | St ring batch Id = reque st.getPara meter("bat chId"); | |||||
| 231 | St ring orgId = request .getParame ter("orgId "); | |||||
| 232 | fi nal String draw = re quest.getP arameter(" draw"); | |||||
| 233 | fi nal String maxRows = request.g etParamete r("length" ); | |||||
| 234 | fi nal String startRow = request. getParamet er("start" ); | |||||
| 235 | ||||||
| 236 | Ha shMap hm = this.ann ouncer.get Announceme ntsByBatch IdWithPagi ng(batchId , orgId, I nteger.par seInt(star tRow), Int eger.parse Int(maxRow s)); | |||||
| 237 | ||||||
| 238 | hm .put("resu lts", hm.g et("result s")); | |||||
| 239 | hm .put("coun t", hm.get ("count")) ; | |||||
| 240 | hm .put("draw ", draw); | |||||
| 241 | ||||||
| 242 | se ssion.setA ttribute(" results", encodeBatc hDetailsIn toJSON(hm) ); | |||||
| 243 | ||||||
| 244 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 245 | } | |||||
| 246 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.