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 | LoginActivityWidget.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 | 126 |
| 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 jav a.io.IOExc eption; | |||||
| 9 | import jav a.util.Cal endar; | |||||
| 10 | import jav ax.servlet .ServletEx ception; | |||||
| 11 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 12 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 13 | import jav ax.servlet .http.Http Session; | |||||
| 14 | import gov .va.nvap.w eb.dao.Use rAuditDAO; | |||||
| 15 | import jav a.io.Strin gWriter; | |||||
| 16 | import jav a.text.Dat eFormat; | |||||
| 17 | import jav a.text.Sim pleDateFor mat; | |||||
| 18 | import jav a.util.Arr ayList; | |||||
| 19 | import jav a.util.Lis t; | |||||
| 20 | import jav a.util.Sta ck; | |||||
| 21 | import jav a.util.log ging.Level ; | |||||
| 22 | import jav a.util.log ging.Logge r; | |||||
| 23 | import org .json.JSON Exception; | |||||
| 24 | import org .json.JSON Object; | |||||
| 25 | ||||||
| 26 | /** | |||||
| 27 | * | |||||
| 28 | * @author Raul Alfa ro | |||||
| 29 | */ | |||||
| 30 | public cla ss LoginAc tivityWidg et extends gov.va.nv ap.web.app .ResponseD ispatcherH ttpServlet { | |||||
| 31 | ||||||
| 32 | @Overr ide | |||||
| 33 | protec ted void u nspecified (HttpServl etRequest request, H ttpServlet Response r esponse) t hrows Serv letExcepti on, IOExce ption { | |||||
| 34 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 35 | St ack<Coordi nate> logI nActivity = gatherPa st24HourCo unts(); | |||||
| 36 | se ssion.setA ttribute(" results", encodeToJS ON(logInAc tivity)); | |||||
| 37 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 38 | } | |||||
| 39 | ||||||
| 40 | /** | |||||
| 41 | * put s together a stack o f the coor dinates ne eded for t he line gr aph. | |||||
| 42 | * the order wil l be oldes t to most recent cou nt. | |||||
| 43 | * @re turn | |||||
| 44 | */ | |||||
| 45 | privat e Stack<Co ordinate> gatherPast 24HourCoun ts(){ | |||||
| 46 | ||||||
| 47 | Ca lendar cal endarLower Bound = Ca lendar.get Instance() ; | |||||
| 48 | ca lendarLowe rBound.set (Calendar. MINUTE, 0) ; | |||||
| 49 | ca lendarLowe rBound.set (Calendar. SECOND, 0) ; | |||||
| 50 | ca lendarLowe rBound.set (Calendar. MILLISECON D, 0); | |||||
| 51 | Ca lendar cal endarUpper Bound = Ca lendar.get Instance() ; | |||||
| 52 | ca lendarUppe rBound.set (Calendar. MINUTE, 59 ); | |||||
| 53 | ca lendarUppe rBound.set (Calendar. SECOND, 59 ); | |||||
| 54 | ca lendarUppe rBound.set (Calendar. MILLISECON D, calenda rUpperBoun d.getActua lMaximum(C alendar.MI LLISECOND) ); | |||||
| 55 | ||||||
| 56 | Da teFormat d ateFormatL ower = new SimpleDat eFormat("M M/dd hh:00 a"); | |||||
| 57 | ||||||
| 58 | St ring lower Bound; | |||||
| 59 | ||||||
| 60 | // create a s tack to ho ld everyth ing. | |||||
| 61 | St ack<Coordi nate> coor dinates = new Stack< >(); | |||||
| 62 | ||||||
| 63 | fo r(int i=0; i<24;i++) { | |||||
| 64 | lowerBou nd = dateF ormatLower .format(ca lendarLowe rBound.get Time()); | |||||
| 65 | ||||||
| 66 | final Us erAuditDAO dao = get UserAuditD AO(); | |||||
| 67 | Object c ount = (da o.getResul ts(calenda rLowerBoun d.getTime( ), calenda rUpperBoun d.getTime( ))).get(0) ; | |||||
| 68 | ||||||
| 69 | //set th e cord inf o before a dding it t o stack | |||||
| 70 | Coordina te current Coord = ne w Coordina te(); | |||||
| 71 | currentC oord.x = i ; | |||||
| 72 | currentC oord.y = I nteger.par seInt(coun t.toString ()); | |||||
| 73 | currentC oord.timeO ffset = lo werBound; | |||||
| 74 | coordina tes.push(c urrentCoor d); | |||||
| 75 | ||||||
| 76 | //move d own the bo underies f or the nex t loop. | |||||
| 77 | calendar LowerBound .add(Calen dar.HOUR, -1); | |||||
| 78 | calendar UpperBound .add(Calen dar.HOUR, -1); | |||||
| 79 | ||||||
| 80 | } | |||||
| 81 | ||||||
| 82 | re turn coord inates; | |||||
| 83 | } | |||||
| 84 | ||||||
| 85 | /** | |||||
| 86 | * pre pares the coordinate stack to json array | |||||
| 87 | * @pa ram coords | |||||
| 88 | * @re turn | |||||
| 89 | */ | |||||
| 90 | privat e String e ncodeToJSO N(Stack<Co ordinate> coords){ | |||||
| 91 | St ring jsonS tring = "" ; | |||||
| 92 | ||||||
| 93 | tr y { | |||||
| 94 | StringWr iter json = new Stri ngWriter() ; | |||||
| 95 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 96 | List dat a = new Ar rayList<>( ); | |||||
| 97 | List lab els = new ArrayList< >(); | |||||
| 98 | ||||||
| 99 | while(!c oords.empt y()){ | |||||
| 100 | Coor dinate tem p = coords .pop(); | |||||
| 101 | data .add(temp. y); | |||||
| 102 | labe ls.add(tem p.timeOffs et); | |||||
| 103 | } | |||||
| 104 | ||||||
| 105 | obj.put( "data", da ta); | |||||
| 106 | obj.put( "labels", labels); | |||||
| 107 | obj.writ e(json); | |||||
| 108 | ||||||
| 109 | jsonStri ng = json. toString() ; | |||||
| 110 | } catch (JSO NException ex) { | |||||
| 111 | Logger.g etLogger(L oginActivi tyWidget.c lass.getNa me()).log( Level.SEVE RE, null, ex); | |||||
| 112 | } | |||||
| 113 | re turn jsonS tring; | |||||
| 114 | } | |||||
| 115 | ||||||
| 116 | privat e UserAudi tDAO getUs erAuditDAO (){ | |||||
| 117 | re turn this. getBean("U serAuditDA O", UserAu ditDAO.cla ss); | |||||
| 118 | } | |||||
| 119 | ||||||
| 120 | privat e class Co ordinate { | |||||
| 121 | in t x; | |||||
| 122 | in t y; | |||||
| 123 | St ring timeO ffset; | |||||
| 124 | } | |||||
| 125 | ||||||
| 126 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.