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\admin\organization | OrganizationHandler.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 247 |
| 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.admin. organizati on; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s vc.consent mgmt.stub. data.Organ ization; | |||||
| 5 | import gov .va.nvap.w eb.dao.Org anizationD AO; | |||||
| 6 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 7 | import jav a.io.IOExc eption; | |||||
| 8 | import jav a.io.Strin gWriter; | |||||
| 9 | import jav a.text.Par seExceptio n; | |||||
| 10 | import jav a.util.Arr ayList; | |||||
| 11 | import jav a.util.Has hMap; | |||||
| 12 | import jav a.util.Lin kedHashMap ; | |||||
| 13 | import jav a.util.Lis t; | |||||
| 14 | import jav a.util.Map ; | |||||
| 15 | import jav a.util.log ging.Level ; | |||||
| 16 | import jav a.util.log ging.Logge r; | |||||
| 17 | import jav ax.servlet .ServletEx ception; | |||||
| 18 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 19 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 20 | import jav ax.servlet .http.Http Session; | |||||
| 21 | import org .apache.po i.ss.userm odel.Workb ook; | |||||
| 22 | import org .json.JSON Exception; | |||||
| 23 | import org .json.JSON Object; | |||||
| 24 | ||||||
| 25 | /** | |||||
| 26 | * | |||||
| 27 | * @author Johann So nnenberg | |||||
| 28 | */ | |||||
| 29 | public cla ss Organiz ationHandl er extends gov.va.nv ap.web.app .ResponseD ispatcherH ttpServlet { | |||||
| 30 | ||||||
| 31 | privat e Organiza tionDAO ge tOrganizat ionDAO() { | |||||
| 32 | re turn this. getBean("O rganizatio nDAO", Org anizationD AO.class); | |||||
| 33 | } | |||||
| 34 | ||||||
| 35 | @Overr ide | |||||
| 36 | protec ted void u nspecified (HttpServl etRequest request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption { | |||||
| 37 | // this is th e list pag e | |||||
| 38 | th is.forward (request, response, "list"); | |||||
| 39 | } | |||||
| 40 | ||||||
| 41 | /* DEP RECATED PE R VAP-328 | |||||
| 42 | public void add( HttpServle tRequest r equest, Ht tpServletR esponse re sponse) th rows Servl etExceptio n, IOExcep tion { | |||||
| 43 | th is.forward (request, response, "add"); | |||||
| 44 | }*/ | |||||
| 45 | ||||||
| 46 | public void edit (HttpServl etRequest request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption { | |||||
| 47 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 48 | ||||||
| 49 | fi nal String orgId = r equest.get Parameter( "id"); | |||||
| 50 | ||||||
| 51 | Or ganization o = this. getOrganiz ationDAO() .getOrgani zation(Lon g.valueOf( orgId)); | |||||
| 52 | ||||||
| 53 | se ssion.setA ttribute(" organizati on", o); | |||||
| 54 | ||||||
| 55 | th is.forward (request, response, "edit"); | |||||
| 56 | } | |||||
| 57 | ||||||
| 58 | public void getA ll(HttpSer vletReques t request, HttpServl etResponse response) throws Se rvletExcep tion, IOEx ception, P arseExcept ion { | |||||
| 59 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 60 | ||||||
| 61 | fi nal String maxRows = request.g etParamete r("length" ); | |||||
| 62 | fi nal String startRow = request. getParamet er("start" ); | |||||
| 63 | fi nal String draw = re quest.getP arameter(" draw"); | |||||
| 64 | fi nal String sortBy = request.ge tParameter ("order[0] [column]") ; | |||||
| 65 | St ring sortO rder; | |||||
| 66 | if (!NullChe cker.isNul lOrEmpty(r equest.get Parameter( "order[0][ dir]")) && request.g etParamete r("order[0 ][dir]").e quals("des c")) { | |||||
| 67 | sortOrde r = "desc" ; | |||||
| 68 | } else { | |||||
| 69 | sortOrde r = "asc"; | |||||
| 70 | } | |||||
| 71 | ||||||
| 72 | // get all th e organiza tions | |||||
| 73 | Ha shMap hm = this.getO rganizatio nDAO().lis tAllOrgani zations(In teger.pars eInt(maxRo ws), Integ er.parseIn t(startRow ), sortBy, sortOrder ); | |||||
| 74 | hm .put("draw ", draw); | |||||
| 75 | ||||||
| 76 | // encode it all into J SON | |||||
| 77 | se ssion.setA ttribute(" results", encodeInto JSON(hm)); | |||||
| 78 | th is.forward (request, response, "resultsJS ON"); | |||||
| 79 | } | |||||
| 80 | ||||||
| 81 | /* DEP RECATED PE R VAP-328 | |||||
| 82 | public void addC omplete(Ht tpServletR equest req uest, Http ServletRes ponse resp onse) thro ws Excepti on { | |||||
| 83 | Or ganization o = new O rganizatio n(); | |||||
| 84 | ||||||
| 85 | fi nal String [] trusted Sources = request.ge tParameter Values("is TrustedCli nicalSourc e"); | |||||
| 86 | fi nal char t rustedSour ce = null != trusted Sources && trustedSo urces.leng th > 0 ? ' Y' : 'N'; //we only have one t rusted sou rce flag. basically if its che cked we wa nt Y(es) o therwise N (o) | |||||
| 87 | fi nal String [] consume rs = reque st.getPara meterValue s("orgCons umerOnly") ; | |||||
| 88 | fi nal char c onsumerOnl y = null ! = consumer s && consu mers.lengt h > 0 ? 'Y ' : 'N'; | |||||
| 89 | ||||||
| 90 | // load up th e object | |||||
| 91 | o. setOrgName (request.g etParamete r("orgName ")); | |||||
| 92 | o. setOrgPhon eNumber(re quest.getP arameter(" orgPhone") ); | |||||
| 93 | o. setOrgComm unityIdPre fix(reques t.getParam eter("orgP refix")); | |||||
| 94 | o. setOrgCont act(reques t.getParam eter("orgC ontact")); | |||||
| 95 | o. setOrgDoma in(request .getParame ter("orgDo main")); | |||||
| 96 | o. setOrgNumb er(request .getParame ter("orgNu mber")); | |||||
| 97 | o. setOrgOid( request.ge tParameter ("orgOid") ); | |||||
| 98 | o. setOrgCons umerOnly(c onsumerOnl y); | |||||
| 99 | o. setActive( 'Y'); //th is is add so obvious ly we want this new one to be active (or else why are we add ing it?) | |||||
| 100 | o. setIsTrust edClinical Source(tru stedSource ); | |||||
| 101 | ||||||
| 102 | // save it | |||||
| 103 | th is.getOrga nizationDA O().create (o); | |||||
| 104 | ||||||
| 105 | // set the me ssage to s how on the list page | |||||
| 106 | re quest.setA ttribute(" message", "Partner O rganizatio n saved su ccessfully ."); | |||||
| 107 | ||||||
| 108 | th is.forward (request, response, "list"); | |||||
| 109 | } */ | |||||
| 110 | ||||||
| 111 | public void edit Complete(H ttpServlet Request re quest, Htt pServletRe sponse res ponse) thr ows Except ion { | |||||
| 112 | Or ganization o = this. getOrganiz ationDAO() .getOrgani zation(Lon g.valueOf( request.ge tParameter ("orgId")) ); | |||||
| 113 | ||||||
| 114 | fi nal String [] trusted Sources = request.ge tParameter Values("is TrustedCli nicalSourc e"); | |||||
| 115 | fi nal char t rustedSour ce = null != trusted Sources && trustedSo urces.leng th > 0 ? ' Y' : 'N'; //we only have one t rusted sou rce flag. basically if its che cked we wa nt Y(es) o therwise N (o) | |||||
| 116 | ||||||
| 117 | o. setOrgName (request.g etParamete r("orgName ")); | |||||
| 118 | o. setOrgNumb er(request .getParame ter("orgNu mber")); | |||||
| 119 | o. setOrgCont act(reques t.getParam eter("orgC ontact")); | |||||
| 120 | o. setOrgPhon eNumber(re quest.getP arameter(" orgPhone") ); | |||||
| 121 | o. setIsTrust edClinical Source(tru stedSource ); | |||||
| 122 | ||||||
| 123 | // save it | |||||
| 124 | th is.getOrga nizationDA O().update (o); | |||||
| 125 | ||||||
| 126 | // set the me ssage to s how on the list page | |||||
| 127 | re quest.setA ttribute(" message", "Partner O rganizatio n saved su ccessfully ."); | |||||
| 128 | ||||||
| 129 | th is.forward (request, response, "list"); | |||||
| 130 | } | |||||
| 131 | ||||||
| 132 | public void expo rtToExcel( HttpServle tRequest r equest, Ht tpServletR esponse re sponse) th rows Excep tion { | |||||
| 133 | // get all th e organiza tions | |||||
| 134 | fi nal String sortBy = request.ge tParameter ("sortBy") ; | |||||
| 135 | St ring sortO rder; | |||||
| 136 | if (!NullChe cker.isNul lOrEmpty(r equest.get Parameter( "sortOrder ")) && req uest.getPa rameter("s ortOrder") .equals("d esc")) { | |||||
| 137 | sortOrde r = "desc" ; | |||||
| 138 | } else { | |||||
| 139 | sortOrde r = "asc"; | |||||
| 140 | } | |||||
| 141 | Ha shMap hm = this.getO rganizatio nDAO().lis tAllOrgani zations(-1 , 0, sortB y, sortOrd er); | |||||
| 142 | ||||||
| 143 | fi nal List<M ap<String, Object>> results = new ArrayL ist<Map<St ring, Obje ct>>(); | |||||
| 144 | ||||||
| 145 | fi nal ArrayL ist<Organi zation> or gs = (Arra yList<Orga nization>) hm.get("r esults"); | |||||
| 146 | ||||||
| 147 | // loop over all of the organizat ions and p ut them in a form th e Excel Ex porter lik es | |||||
| 148 | fo r (Organiz ation org : orgs) { | |||||
| 149 | final Ma p<String, Object> re sultMap = new HashMa p<String, Object>(); | |||||
| 150 | ||||||
| 151 | resultMa p.put("act ive", org. getActive( ) == 'Y' ? "Yes" : " No"); | |||||
| 152 | resultMa p.put("pho ne", org.g etOorgPhon eNumber()) ; | |||||
| 153 | resultMa p.put("pre fix", org. getOrgComm unityIdPre fix()); | |||||
| 154 | resultMa p.put("con sumer", or g.getOrgCo nsumerOnly () == 'Y' ? "Yes" : "No"); | |||||
| 155 | resultMa p.put("con tact", org .getOrgCon tact()); | |||||
| 156 | resultMa p.put("dom ain", org. getOrgDoma in()); | |||||
| 157 | resultMa p.put("nam e", org.ge tOrgName() ); | |||||
| 158 | resultMa p.put("num ber", org. getOrgNumb er()); | |||||
| 159 | resultMa p.put("org anizationI d", org.ge tOrgOid()) ; | |||||
| 160 | resultMa p.put("tru stedSource ", org.get IsTrustedC linicalSou rce() == ' Y' ? "Yes" : "No"); | |||||
| 161 | ||||||
| 162 | results. add(result Map); | |||||
| 163 | } | |||||
| 164 | ||||||
| 165 | // options fo r workbook | |||||
| 166 | St ring heade r = "Partn er Organiz ations"; | |||||
| 167 | fi nal Map<St ring, Stri ng> report Map = new LinkedHash Map<String , String>( ); | |||||
| 168 | ||||||
| 169 | // Set the h eading par ameters | |||||
| 170 | fi nal Map<St ring, List <Object>> headingPar ameters = new Linked HashMap<St ring, List <Object>>( ); | |||||
| 171 | ||||||
| 172 | // put togeth er the rep ortMap | |||||
| 173 | if (NullChec ker.isNull OrEmpty(re sults)) { | |||||
| 174 | reportMa p.put("", "No record s were fou nd."); | |||||
| 175 | } else { | |||||
| 176 | reportMa p.put("act ive", "Act ive"); | |||||
| 177 | reportMa p.put("pho ne", "Phon e"); | |||||
| 178 | reportMa p.put("pre fix", "Pre fix"); | |||||
| 179 | reportMa p.put("con sumer", "C onsumer On ly"); | |||||
| 180 | reportMa p.put("con tact", "Co ntact"); | |||||
| 181 | reportMa p.put("dom ain", "Dom ain"); | |||||
| 182 | reportMa p.put("nam e", "Name" ); | |||||
| 183 | reportMa p.put("num ber", "Num ber"); | |||||
| 184 | reportMa p.put("org anizationI d", "Organ ization ID "); | |||||
| 185 | reportMa p.put("tru stedSource ", "Truste d Clinical Source"); | |||||
| 186 | } | |||||
| 187 | ||||||
| 188 | // create wor kbook | |||||
| 189 | fi nal Workbo ok wb = th is.getExce lExporter( ).exportTo Excel(head er, header , reportMa p, results , headingP arameters, null); | |||||
| 190 | ||||||
| 191 | // write Exce l to Strea m | |||||
| 192 | th is.getExce lExporter( ).writeExc elToStream ("Partner_ Organizati ons", wb, response); | |||||
| 193 | } | |||||
| 194 | ||||||
| 195 | /** | |||||
| 196 | * Get the excel exporter class from Spring. | |||||
| 197 | */ | |||||
| 198 | privat e ExcelExp orter getE xcelExport er() { | |||||
| 199 | fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r", | |||||
| 200 | ExcelExp orter.clas s); | |||||
| 201 | re turn excel Exporter; | |||||
| 202 | } | |||||
| 203 | ||||||
| 204 | privat e String e ncodeIntoJ SON(HashMa p results) throws Pa rseExcepti on { | |||||
| 205 | tr y { | |||||
| 206 | StringWr iter json = new Stri ngWriter() ; | |||||
| 207 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 208 | Long cou nt = (Long ) results. get("count "); | |||||
| 209 | List<Org anization> orgs = (L ist<Organi zation>) r esults.get ("results" ); | |||||
| 210 | Integer draw = Int eger.parse Int((Strin g) results .get("draw ")); | |||||
| 211 | ||||||
| 212 | obj.put( "draw", dr aw); | |||||
| 213 | obj.put( "recordsTo tal", coun t); | |||||
| 214 | obj.put( "recordsFi ltered", c ount); | |||||
| 215 | ||||||
| 216 | List<Lis t> data = new ArrayL ist<List>( ); //overa rching "da ta" | |||||
| 217 | ||||||
| 218 | for (Org anization o : orgs) { | |||||
| 219 | List <String> d ataItem = new ArrayL ist<String >(); //eac h "row" | |||||
| 220 | ||||||
| 221 | data Item.add(o .getActive () == 'Y' ? "Yes" : "No"); | |||||
| 222 | data Item.add(o .getOorgPh oneNumber( )); | |||||
| 223 | data Item.add(o .getOrgCom munityIdPr efix()); | |||||
| 224 | data Item.add(o .getOrgCon sumerOnly( ) == 'Y' ? "Yes" : " No"); | |||||
| 225 | data Item.add(o .getOrgCon tact()); | |||||
| 226 | data Item.add(o .getOrgDom ain()); | |||||
| 227 | data Item.add(o .getOrgNam e()); | |||||
| 228 | data Item.add(o .getOrgNum ber()); | |||||
| 229 | data Item.add(o .getOrgOid ()); | |||||
| 230 | data Item.add(o .getIsTrus tedClinica lSource() == 'Y' ? " Yes" : "No "); | |||||
| 231 | data Item.add(" <a href='O rganizatio nHandler.d o_sec?edit =true&id=" + o.getOr gId().toSt ring() + " '><button title='Edi t Partner Organizati on'>Edit</ button></a >"); | |||||
| 232 | ||||||
| 233 | data .add(dataI tem); | |||||
| 234 | } | |||||
| 235 | ||||||
| 236 | obj.put( "data", da ta); | |||||
| 237 | ||||||
| 238 | obj.writ e(json); | |||||
| 239 | ||||||
| 240 | return j son.toStri ng(); | |||||
| 241 | } catch (JSO NException ex) { | |||||
| 242 | Logger.g etLogger(O rganizatio n.class.ge tName()).l og(Level.S EVERE, nul l, ex); | |||||
| 243 | } | |||||
| 244 | ||||||
| 245 | re turn ""; | |||||
| 246 | } | |||||
| 247 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.