Produced by Araxis Merge on 2/7/2017 12:14:06 PM Eastern Standard 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 | cpss.zip\cpss\src\main\java\gov\va\cpss\job\cbs | CbsRuntimeStateImpl.java | Wed Feb 1 21:07:30 2017 UTC |
2 | cpss.zip\cpss\src\main\java\gov\va\cpss\job\cbs | CbsRuntimeStateImpl.java | Fri Feb 3 20:43:15 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 388 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
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.cpss. job.cbs; | |
2 | ||
3 | import jav a.util.Arr ayList; | |
4 | import jav a.util.Ite rator; | |
5 | import jav a.util.Lin kedHashMap ; | |
6 | import jav a.util.Lin kedList; | |
7 | import jav a.util.Lis t; | |
8 | import jav a.util.Map ; | |
9 | import jav a.util.Map .Entry; | |
10 | import jav a.util.Que ue; | |
11 | import jav a.util.Set ; | |
12 | import jav a.util.str eam.Collec tors; | |
13 | import jav a.util.str eam.Stream ; | |
14 | ||
15 | import org .apache.lo g4j.Logger ; | |
16 | ||
17 | import gov .va.cpss.m odel.fps.P SPatient; | |
18 | ||
19 | /** | |
20 | * Impleme ntation of the inter face for t he runtime parameter s used by the | |
21 | * Generat e CBS batc h job duri ng process ing. | |
22 | * | |
23 | * @author DN S P II | |
24 | */ | |
25 | public cla ss CbsRunt imeStateIm pl impleme nts CbsRun timeState { | |
26 | ||
27 | pr ivate stat ic final L ogger para meterLogge r = Logger .getLogger (CbsRuntim eStateImpl .class.get CanonicalN ame()); | |
28 | ||
29 | /* * | |
30 | * Boolean f lag that i ndicates t here is no data to p rocess. | |
31 | * / | |
32 | pr ivate bool ean empty = false; | |
33 | ||
34 | /* * | |
35 | * Boolean f lag that i ndicates i f an error reading N EW data. | |
36 | * / | |
37 | pr ivate bool ean dataEr ror = fals e; | |
38 | ||
39 | /* * | |
40 | * Queue of PSReceived ID releva nt to the job. | |
41 | * / | |
42 | pr ivate Queu e<Long> ps ReceivedId Q = new Li nkedList<> (); | |
43 | ||
44 | /* * | |
45 | * List of p rocessed P SReceived ID. | |
46 | * / | |
47 | pr ivate List <Long> psR eceivedIdP rocessL = new ArrayL ist<>(); | |
48 | ||
49 | /* * | |
50 | * The curre ntly proce ssing PSRe ceived ID. | |
51 | * / | |
52 | pr ivate Long currentPS ReceivedID = null; | |
53 | ||
54 | /* * | |
55 | * Queue of PSSite ID relevant t o the job. | |
56 | * / | |
57 | pr ivate Queu e<Long> ps SiteIdQ = new Linked List<>(); | |
58 | ||
59 | /* * | |
60 | * The curre ntly proce ssing PSSi te. | |
61 | * / | |
62 | pr ivate Long currentPS SiteID = n ull; | |
63 | ||
64 | /* * | |
65 | * The Map o f CBS Acco unt ID to a list of all new PS Patient re cords. | |
66 | * / | |
67 | pr ivate Map< Long, List <PSPatient >> psPatie ntM = new LinkedHash Map<>(); | |
68 | ||
69 | /* * | |
70 | * The curre nt entry i n the Map of CBS Acc ount ID to list of a ll new PSP atient rec ords. | |
71 | * / | |
72 | pr ivate Entr y<Long, Li st<PSPatie nt>> curre ntPSPatien tEntry = n ull; | |
73 | ||
74 | @O verride | |
75 | pu blic void initialize () { | |
76 | empt y = false; | |
77 | data Error = fa lse; | |
78 | psRe ceivedIdQ. clear(); | |
79 | psRe ceivedIdPr ocessL.cle ar(); | |
80 | psSi teIdQ.clea r(); | |
81 | curr entPSRecei vedID = nu ll; | |
82 | curr entPSSiteI D = null; | |
83 | } | |
84 | ||
85 | @O verride | |
86 | pu blic boole an isEmpty () { | |
87 | retu rn empty; | |
88 | } | |
89 | ||
90 | @O verride | |
91 | pu blic void setEmpty(b oolean emp ty) { | |
92 | this .empty = e mpty; | |
93 | } | |
94 | ||
95 | @O verride | |
96 | pu blic boole an isDataE rror() { | |
97 | retu rn dataErr or; | |
98 | } | |
99 | ||
100 | @O verride | |
101 | pu blic void setDataErr or(boolean dataError ) { | |
102 | this .dataError = dataErr or; | |
103 | } | |
104 | ||
105 | @O verride | |
106 | pu blic boole an addPSRe ceivedEntr y(final Lo ng id) { | |
107 | retu rn psRecei vedIdQ.add (id); | |
108 | } | |
109 | ||
110 | @O verride | |
111 | pu blic boole an addPSSi teEntry(fi nal Long p sSite) { | |
112 | retu rn psSiteI dQ.add(psS ite); | |
113 | } | |
114 | ||
115 | @O verride | |
116 | pu blic List< Long> getP SReceivedI DList() { | |
117 | retu rn psRecei vedIdProce ssL; | |
118 | } | |
119 | ||
120 | @O verride | |
121 | pu blic Long getCurrent PSReceived ID() { | |
122 | retu rn current PSReceived ID; | |
123 | } | |
124 | ||
125 | @O verride | |
126 | pu blic Long getCurrent PSSiteID() { | |
127 | retu rn current PSSiteID; | |
128 | } | |
129 | ||
130 | @O verride | |
131 | pu blic Long pollCurren tPSReceive dID() { | |
132 | // P oll the ne xt PSRecei ved ID. | |
133 | curr entPSRecei vedID = ps ReceivedId Q.poll(); | |
134 | // S ave the po lled ID to the proce ssed list. | |
135 | if ( currentPSR eceivedID != null) { | |
136 | psRece ivedIdProc essL.add(c urrentPSRe ceivedID); | |
137 | } | |
138 | retu rn getCurr entPSRecei vedID(); | |
139 | } | |
140 | ||
141 | @O verride | |
142 | pu blic Long pollCurren tPSSiteID( ) { | |
143 | curr entPSSiteI D = psSite IdQ.poll() ; | |
144 | retu rn getCurr entPSSiteI D(); | |
145 | } | |
146 | ||
147 | @O verride | |
148 | pu blic boole an savePSP atientMap( Map<Long, List<PSPat ient>> que ryM) { | |
149 | bool ean succes sful = fal se; | |
150 | ||
151 | if ( queryM.isE mpty()) { | |
152 | ||
153 | parame terLogger. warn("Atte mpted to s ave empty PSPatient map"); | |
154 | } el se { | |
155 | ||
156 | parame terLogger. info("save PSPatientM ap, queryM size = " + queryM.s ize()); | |
157 | ||
158 | parame terLogger. info("save PSPatientM ap, attemp ting mergi ng..."); | |
159 | ||
160 | // Mer ge the new ly queried map into the compos ite map. | |
161 | psPati entM = Str eam.of(psP atientM, q ueryM).map (Map::entr ySet).flat Map(Set::s tream) | |
162 | .collect(C ollectors. toMap(Entr y::getKey, Entry::ge tValue, (a , b) -> { | |
163 | Li st<PSPatie nt> both = new Array List<>(a); | |
164 | bo th.addAll( b); | |
165 | re turn both; | |
166 | })); | |
167 | ||
168 | parame terLogger. info("save PSPatientM ap, psPati entM size = " + psPa tientM.siz e()); | |
169 | ||
170 | succes sful = tru e; | |
171 | } | |
172 | ||
173 | retu rn success ful; | |
174 | } | |
175 | ||
176 | @O verride | |
177 | pu blic Map.E ntry<Long, List<PSPa tient>> ge tCurrentPS PatientM() { | |
178 | retu rn current PSPatientE ntry; | |
179 | } | |
180 | ||
181 | @O verride | |
182 | pu blic Map.E ntry<Long, List<PSPa tient>> po llCurrentP SPatientM( ) { | |
183 | ||
184 | Iter ator<Map.E ntry<Long, List<PSPa tient>>> i = psPatie ntM.entryS et().itera tor(); | |
185 | if ( i.hasNext( )) { | |
186 | curren tPSPatient Entry = i. next(); | |
187 | i.remo ve(); | |
188 | } el se { | |
189 | curren tPSPatient Entry = nu ll; | |
190 | } | |
191 | ||
192 | retu rn getCurr entPSPatie ntM(); | |
193 | } | |
194 | ||
195 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.