Produced by Araxis Merge on 6/9/2017 3:51:29 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:29 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\user\dashboard | TransactionHistoryWidget.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 | 182 |
| 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 | /* | |||||
| 2 | * To chan ge this li cense head er, choose License H eaders in Project Pr operties. | |||||
| 3 | * To chan ge this te mplate fil e, choose Tools | Te mplates | |||||
| 4 | * and ope n the temp late in th e editor. | |||||
| 5 | */ | |||||
| 6 | package go v.va.nvap. web.user.d ashboard; | |||||
| 7 | ||||||
| 8 | import gov .va.nvap.s ervice.aut h.ServiceA uditDAO; | |||||
| 9 | import jav a.io.IOExc eption; | |||||
| 10 | import jav a.io.Strin gWriter; | |||||
| 11 | import jav a.text.Dat eFormat; | |||||
| 12 | import jav a.text.Sim pleDateFor mat; | |||||
| 13 | import jav a.util.Arr ayList; | |||||
| 14 | import jav a.util.Cal endar; | |||||
| 15 | import jav a.util.Has hMap; | |||||
| 16 | import jav a.util.Lis t; | |||||
| 17 | import jav a.util.Map ; | |||||
| 18 | import jav a.util.log ging.Level ; | |||||
| 19 | import jav a.util.log ging.Logge r; | |||||
| 20 | import jav ax.servlet .ServletEx ception; | |||||
| 21 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 22 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 23 | import jav ax.servlet .http.Http Session; | |||||
| 24 | import org .json.JSON Exception; | |||||
| 25 | import org .json.JSON Object; | |||||
| 26 | ||||||
| 27 | /** | |||||
| 28 | * | |||||
| 29 | * @author Raul Alfa ro | |||||
| 30 | */ | |||||
| 31 | public cla ss Transac tionHistor yWidget ex tends gov. va.nvap.we b.app.Resp onseDispat cherHttpSe rvlet { | |||||
| 32 | ||||||
| 33 | @Overri de | |||||
| 34 | protec ted void u nspecified (HttpServl etRequest request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption { | |||||
| 35 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 36 | ||||||
| 37 | se ssion.setA ttribute(" results", encodeToJS ON( gather Past24Hour Counts() ) ); | |||||
| 38 | ||||||
| 39 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 40 | } | |||||
| 41 | ||||||
| 42 | /** | |||||
| 43 | * get s the coun ts for exc hange call s and eben efits call s per hour in milita ry time. | |||||
| 44 | * Pac kages into GatheredC ounts obje ct if the hours have any data | |||||
| 45 | * @re turn | |||||
| 46 | */ | |||||
| 47 | privat e Map<Stri ng,Gathere dCounts> g atherPast2 4HourCount s(){ | |||||
| 48 | ||||||
| 49 | Ca lendar cal endarLower Bound = Ca lendar.get Instance() ; | |||||
| 50 | ca lendarLowe rBound.set (Calendar. MINUTE, 0) ; | |||||
| 51 | ca lendarLowe rBound.set (Calendar. SECOND, 0) ; | |||||
| 52 | ca lendarLowe rBound.set (Calendar. MILLISECON D, 0); | |||||
| 53 | ca lendarLowe rBound.add (Calendar. HOUR_OF_DA Y, -23); | |||||
| 54 | ||||||
| 55 | Ca lendar cal endarUpper Bound = Ca lendar.get Instance() ; | |||||
| 56 | ca lendarUppe rBound.set (Calendar. MINUTE, 59 ); | |||||
| 57 | ca lendarUppe rBound.set (Calendar. SECOND, 59 ); | |||||
| 58 | ca lendarUppe rBound.set (Calendar. MILLISECON D, calenda rUpperBoun d.getActua lMaximum(C alendar.MI LLISECOND) ); | |||||
| 59 | ||||||
| 60 | Se rviceAudit DAO dao = getService AuditDAO() ; | |||||
| 61 | Li st<Object[ ]> countRe sults = | |||||
| 62 | dao. gatherTran sactionCou nts(calend arLowerBou nd.getTime (), calend arUpperBou nd.getTime ()); | |||||
| 63 | ||||||
| 64 | Ma p<String,G atheredCou nts> prepp edResults = new Hash Map<>(); | |||||
| 65 | ||||||
| 66 | // add all ho urs that h ad activit y | |||||
| 67 | fo r(Object[] currentRo w: countRe sults){ | |||||
| 68 | Gathered Counts cur rentCounts = new Gat heredCount s(); | |||||
| 69 | ||||||
| 70 | currentC ounts.mili taryHour = Integer.p arseInt(cu rrentRow[0 ].toString ()); | |||||
| 71 | currentC ounts.exch angeCount = Integer. parseInt(c urrentRow[ 1].toStrin g()); | |||||
| 72 | currentC ounts.eben efitsCount = Integer .parseInt( currentRow [2].toStri ng()); | |||||
| 73 | ||||||
| 74 | preppedR esults.put (currentRo w[0].toStr ing(), cur rentCounts ); | |||||
| 75 | } | |||||
| 76 | ||||||
| 77 | re turn prepp edResults; | |||||
| 78 | } | |||||
| 79 | ||||||
| 80 | ||||||
| 81 | /** | |||||
| 82 | * con verts any returned G atherCount s into jso n string, fills in b lank hours with 0 co unts. | |||||
| 83 | * The data is o rdered old est to new est | |||||
| 84 | * @pa ram preped Results | |||||
| 85 | * @re turn | |||||
| 86 | */ | |||||
| 87 | privat e String e ncodeToJSO N(Map<Stri ng,Gathere dCounts> p repedResul ts){ | |||||
| 88 | St ring jsonS tring = "" ; | |||||
| 89 | ||||||
| 90 | tr y { | |||||
| 91 | StringWr iter json = new Stri ngWriter() ; | |||||
| 92 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 93 | List ebe nefits = n ew ArrayLi st<>(); | |||||
| 94 | List exc hange = ne w ArrayLis t<>(); | |||||
| 95 | List lab els = new ArrayList< >(); | |||||
| 96 | ||||||
| 97 | Calendar calendar = Calendar .getInstan ce(); | |||||
| 98 | int hour OfDay = ca lendar.get (Calendar. HOUR_OF_DA Y); | |||||
| 99 | ||||||
| 100 | //Prep t he calenda r instance s and form ats that w ill be use d for entr y labels | |||||
| 101 | Calendar calendarL owerBound = getLower Boundary() ; | |||||
| 102 | DateForm at dateFor matLower = new Simpl eDateForma t("MM/dd h h:00 a"); | |||||
| 103 | ||||||
| 104 | //get al l informat ion for pr evious day . filling in blanks with 0 cou nts | |||||
| 105 | //Fillin g in the l abels for each hour | |||||
| 106 | for(int i=hourOfDa y+1; i<24; i++){ | |||||
| 107 | Stri ng key = S tring.valu eOf(i); | |||||
| 108 | ||||||
| 109 | if(p repedResul ts.contain sKey(key)) { | |||||
| 110 | ebenefits. add(preped Results.ge t(key).ebe nefitsCoun t); | |||||
| 111 | exchange.a dd(prepedR esults.get (key).exch angeCount) ; | |||||
| 112 | labels.add (dateForma tLower.for mat(calend arLowerBou nd.getTime ())); | |||||
| 113 | } el se { | |||||
| 114 | ebenefits. add(0); | |||||
| 115 | exchange.a dd(0); | |||||
| 116 | labels.add (dateForma tLower.for mat(calend arLowerBou nd.getTime ())); | |||||
| 117 | } | |||||
| 118 | ||||||
| 119 | //Ho ur is incr emented fo r the foll owing loop to use re trieve the next hour | |||||
| 120 | cale ndarLowerB ound.add(C alendar.HO UR, 1); | |||||
| 121 | } | |||||
| 122 | ||||||
| 123 | //get al l informat ion for cu rrent day. filling i n blanks w ith 0 coun ts | |||||
| 124 | //Fillin g in the l abels for each hour | |||||
| 125 | for(int i=0; i<=ho urOfDay; i ++){ | |||||
| 126 | Stri ng key = S tring.valu eOf(i); | |||||
| 127 | ||||||
| 128 | if(p repedResul ts.contain sKey(key)) { | |||||
| 129 | ebenefits. add(preped Results.ge t(key).ebe nefitsCoun t); | |||||
| 130 | exchange.a dd(prepedR esults.get (key).exch angeCount) ; | |||||
| 131 | labels.add (dateForma tLower.for mat(calend arLowerBou nd.getTime ())); | |||||
| 132 | } el se { | |||||
| 133 | ebenefits. add(0); | |||||
| 134 | exchange.a dd(0); | |||||
| 135 | labels.add (dateForma tLower.for mat(calend arLowerBou nd.getTime ())); | |||||
| 136 | } | |||||
| 137 | //Ho ur is incr emented fo r the foll owing loop to use re trieve the next hour | |||||
| 138 | cale ndarLowerB ound.add(C alendar.HO UR, 1); | |||||
| 139 | } | |||||
| 140 | ||||||
| 141 | obj.put( "ebenefits ", ebenefi ts); | |||||
| 142 | obj.put( "exchange" ,exchange) ; | |||||
| 143 | obj.put( "labels", labels); | |||||
| 144 | obj.writ e(json); | |||||
| 145 | ||||||
| 146 | jsonStri ng = json. toString() ; | |||||
| 147 | } catch (JSO NException ex) { | |||||
| 148 | Logger.g etLogger(T ransaction HistoryWid get.class. getName()) .log(Level .SEVERE, n ull, ex); | |||||
| 149 | } | |||||
| 150 | re turn jsonS tring; | |||||
| 151 | } | |||||
| 152 | ||||||
| 153 | /** | |||||
| 154 | * Pre pares the calendar i nstance fo r the floo r of the s earch hour | |||||
| 155 | * cur rent hour with 0 min utes - 23 hours | |||||
| 156 | * Use d for labe l purposes | |||||
| 157 | * @re turn | |||||
| 158 | */ | |||||
| 159 | privat e Calendar getLowerB oundary(){ | |||||
| 160 | Ca lendar cal endarLower Bound = Ca lendar.get Instance() ; | |||||
| 161 | ||||||
| 162 | ca lendarLowe rBound.set (Calendar. MINUTE, 0) ; | |||||
| 163 | ca lendarLowe rBound.set (Calendar. SECOND, 0) ; | |||||
| 164 | ca lendarLowe rBound.set (Calendar. MILLISECON D, 0); | |||||
| 165 | ca lendarLowe rBound.add (Calendar. HOUR_OF_DA Y, -23); | |||||
| 166 | ||||||
| 167 | re turn calen darLowerBo und; | |||||
| 168 | } | |||||
| 169 | ||||||
| 170 | public ServiceAu ditDAO get ServiceAud itDAO() | |||||
| 171 | { | |||||
| 172 | re turn this. getBean("S erviceAudi tDAO", Ser viceAuditD AO.class); | |||||
| 173 | } | |||||
| 174 | ||||||
| 175 | ||||||
| 176 | privat e class Ga theredCoun ts { | |||||
| 177 | lo ng ebenefi tsCount = 0; | |||||
| 178 | lo ng exchang eCount = 0 ; | |||||
| 179 | in t military Hour; | |||||
| 180 | } | |||||
| 181 | ||||||
| 182 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.