Produced by Araxis Merge on 6/9/2017 3:50:56 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:50:56 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-server\src\main\java\gov\va\nvap\server\endpoint\announce | BatchAnnouncerMessageConsumer.java | Fri Apr 21 20:03:28 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 180 |
| 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. server.end point.anno unce; | |||||
| 2 | ||||||
| 3 | import gov .va.med.nh in.adapter .announce. BatchAnnou nceType; | |||||
| 4 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 5 | import gov .va.nvap.p rivacy.Org anizationT ype; | |||||
| 6 | import gov .va.nvap.s erver.endp oint.adapt er.announc e.transfor mer.Announ cementToAn nouncePati entRequest ; | |||||
| 7 | import gov .va.nvap.s ervice.pdq .PatientDe mographics ; | |||||
| 8 | import gov .va.nvap.s ervice.pdq .PatientDe mographics Query; | |||||
| 9 | import gov .va.nvap.s ervice.pdq .PatientDe mographics Response; | |||||
| 10 | import gov .va.nvap.s ervice.pdq .PdqServic e; | |||||
| 11 | import gov .va.nvap.s vc.consent mgmt.PIPIn terface; | |||||
| 12 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce ment; | |||||
| 13 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce mentOrg; | |||||
| 14 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.Announce rInterface ; | |||||
| 15 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.dat a.PatientA nnouncer; | |||||
| 16 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.jax b.Announce PatientReq uest; | |||||
| 17 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.jax b.Authoriz edOrganiza tionType; | |||||
| 18 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.jax b.PatientT ype; | |||||
| 19 | import gov .va.nvap.s vc.consent mgmt.stub. adapter.an nounce.jax b.UserType ; | |||||
| 20 | import gov .va.nvap.s vc.consent mgmt.stub. data.Organ ization; | |||||
| 21 | ||||||
| 22 | import jav a.util.Arr ayList; | |||||
| 23 | import jav a.util.Col lection; | |||||
| 24 | import jav a.util.Dat e; | |||||
| 25 | import jav a.util.Lis t; | |||||
| 26 | ||||||
| 27 | import jav ax.annotat ion.Resour ce; | |||||
| 28 | import jav ax.ejb.Act ivationCon figPropert y; | |||||
| 29 | import jav ax.ejb.EJB ; | |||||
| 30 | import jav ax.ejb.Mes sageDriven ; | |||||
| 31 | import jav ax.ejb.Mes sageDriven Context; | |||||
| 32 | import jav ax.ejb.Tra nsactionAt tribute; | |||||
| 33 | import jav ax.ejb.Tra nsactionAt tributeTyp e; | |||||
| 34 | import jav ax.jms.Mes sage; | |||||
| 35 | import jav ax.jms.Mes sageListen er; | |||||
| 36 | import jav ax.jms.Obj ectMessage ; | |||||
| 37 | ||||||
| 38 | /** | |||||
| 39 | * Message -Driven Be an impleme ntation cl ass for: B atchAnnoun cer | |||||
| 40 | * | |||||
| 41 | */ | |||||
| 42 | @MessageDr iven(mappe dName = "j ms.vap.Pat ientAnnoun cerBatchQu eue", acti vationConf ig = { | |||||
| 43 | @Act ivationCon figPropert y(property Name = "ac knowledgeM ode", prop ertyValue = "Auto-ac knowledge" ), | |||||
| 44 | @Act ivationCon figPropert y(property Name = "de stinationT ype", prop ertyValue = "javax.j ms.Queue") }) | |||||
| 45 | @Transacti onAttribut e(Transact ionAttribu teType.REQ UIRES_NEW) | |||||
| 46 | public cla ss BatchAn nouncerMes sageConsum er impleme nts Messag eListener { | |||||
| 47 | ||||||
| 48 | pr ivate stat ic final i nt MAX_BAT CH_SIZE = 1000; | |||||
| 49 | ||||||
| 50 | @E JB(name = "Announcer Service", mappedName = "Announ cerService ") | |||||
| 51 | pr ivate Anno uncerInter face annou ncer; | |||||
| 52 | ||||||
| 53 | @E JB(name = "PatientAn nouncer", mappedName = "Patien tAnnouncer ") | |||||
| 54 | pr ivate Pati entAnnounc er patient Announcer; | |||||
| 55 | ||||||
| 56 | @EJB(n ame = "Pip Service", mappedName = "PipSer vice") | |||||
| 57 | privat e PIPInter face pip; | |||||
| 58 | ||||||
| 59 | @EJB(n ame = "Pdq Service", mappedName = "PdqSer vice") | |||||
| 60 | privat e PdqServi ce pdqServ ice; | |||||
| 61 | ||||||
| 62 | pr ivate void announce( final Stri ng[] batch Ids, final String us erName, | |||||
| 63 | final String fac ility, fin al int max BatchSize) throws Ex ception { | |||||
| 64 | try { | |||||
| 65 | for (f inal Strin g batchId : batchIds ) { | |||||
| 66 | Collecti on<Announc ement> ann ouncements = null; | |||||
| 67 | int firs tResult = 0; | |||||
| 68 | do { | |||||
| 69 | announceme nts = this .announcer | |||||
| 70 | .get Unschedule dAnnouncem entsByBatc hId(batchI d, | |||||
| 71 | maxBatch Size, firs tResult); | |||||
| 72 | for (final Announcem ent announ cement : a nnouncemen ts) { | |||||
| 73 | // Con struct the AnnounceP atientRequ est object | |||||
| 74 | fi nal Announ cePatientR equest ann ouncePatie ntRequest = | |||||
| 75 | new Anno uncementTo AnnouncePa tientReque st() | |||||
| 76 | .trans form(annou ncement); | |||||
| 77 | ||||||
| 78 | fi nal List<S tring> org anizations = new Arr ayList<Str ing>(); | |||||
| 79 | if (an nouncement .getTarget Organizati on() != nu ll) { | |||||
| 80 | or ganization s.add(anno uncement.g etTargetOr ganization () | |||||
| 81 | .get OrgNumber( )); | |||||
| 82 | } else { | |||||
| 83 | // Add targe t organiza tions to r equest for ANNOUNCEM ENT_ORGS | |||||
| 84 | Co llection<A nnouncemen tOrg> anno unceOrgs = | |||||
| 85 | pip. getAnnounc ementOrgsB yAnnouncem ent(announ cement); | |||||
| 86 | fo r (final A nnouncemen tOrg annou nceOrg : a nnounceOrg s) { | |||||
| 87 | Organiza tion organ ization = announceOr g.getTarge tOrganizat ion(); | |||||
| 88 | final Au thorizedOr ganization Type autho rizedOrgan ization = | |||||
| 89 | new Author izedOrgani zationType (); | |||||
| 90 | authoriz edOrganiza tion.setOr gNumber(or ganization | |||||
| 91 | .getOrgNum ber()); | |||||
| 92 | authoriz edOrganiza tion.setOr gName(orga nization | |||||
| 93 | .getOrgNam e()); | |||||
| 94 | authoriz edOrganiza tion.setOr gOid(organ ization | |||||
| 95 | .getOrgOid ()); | |||||
| 96 | announce PatientReq uest.getAu thorizedOr ganization s() | |||||
| 97 | .add(autho rizedOrgan ization); | |||||
| 98 | } | |||||
| 99 | } | |||||
| 100 | ||||||
| 101 | fi nal Patien tDemograph icsQuery q uery = new PatientDe mographics Query(); | |||||
| 102 | St ring icn = announcem ent.getPat ientIen(); | |||||
| 103 | if (Nu llChecker. isNullOrEm pty(icn)) { | |||||
| 104 | ic n = announ cement.get PatientCon sentDir(). getPatient Ien(); | |||||
| 105 | } | |||||
| 106 | qu ery.setPat ientId(icn ); | |||||
| 107 | tr y{ | |||||
| 108 | Pa tientDemog raphicsRes ponse pati entDemogra phicsRespo nse = pdqS ervice.get PatientDem ographics( query); | |||||
| 109 | Pa tientDemog raphics de mographics = patient Demographi csResponse .getPatien tDemograph ics(); | |||||
| 110 | an nouncement .setFirstN ame(demogr aphics.get FirstName( )); | |||||
| 111 | an nouncement .setLastNa me(demogra phics.getL astName()) ; | |||||
| 112 | an nouncement .setSsn(de mographics .getSsn()) ; | |||||
| 113 | an nouncement .setPatien tIen(icn); | |||||
| 114 | } catc h(Exceptio n e){ | |||||
| 115 | // fail silen tly becaus e we have lots of pa tient data to try to get for t his batch and just b ecause we can't get one patien t's data, doesn't me an we won' t get othe rs | |||||
| 116 | } | |||||
| 117 | ||||||
| 118 | /* | |||||
| 119 | * patientTy pe.setLast Name(demog prahics.ge tLastName( )); | |||||
| 120 | * patientTy pe | |||||
| 121 | * .setGiven Name(demog prahics.ge tFirstName ()); | |||||
| 122 | * patientTy pe.setSsn( demogprahi cs.getSsn( )); | |||||
| 123 | * / | |||||
| 124 | fi nal Patien tType pati entType = new Patien tType(); | |||||
| 125 | pa tientType. setPatient Id(icn); | |||||
| 126 | an nouncePati entRequest .setPatien t(patientT ype); | |||||
| 127 | ||||||
| 128 | fi nal UserTy pe userTyp e = new Us erType(); | |||||
| 129 | us erType.set UserId(use rName); | |||||
| 130 | us erType.set FacilityNu mber(facil ity); | |||||
| 131 | an nouncePati entRequest .setUser(u serType); | |||||
| 132 | ||||||
| 133 | an nouncement .setSchedu ledTs(new Date()); | |||||
| 134 | th is.announc er.storeAn nouncement (announcem ent); | |||||
| 135 | // Call asyn chronous a nnounce | |||||
| 136 | // TODO: Fix Transacti on Issues | |||||
| 137 | // Call anno unce Async . only aft er the sto re because the | |||||
| 138 | // other thr ead also u pdates the same reco rd. | |||||
| 139 | th is.patient Announcer | |||||
| 140 | .annou nceAsync(a nnouncePat ientReques t); | |||||
| 141 | ||||||
| 142 | } | |||||
| 143 | ||||||
| 144 | firstResul t++; | |||||
| 145 | ||||||
| 146 | } while ((null != announceme nts) | |||||
| 147 | && (announce ments.size () == Batc hAnnouncer MessageCon sumer.MAX_ BATCH_SIZE )); | |||||
| 148 | } | |||||
| 149 | } ca tch (final Throwable t) { | |||||
| 150 | throw new Except ion(t); | |||||
| 151 | } | |||||
| 152 | } | |||||
| 153 | ||||||
| 154 | /* * | |||||
| 155 | * @see Mess ageListene r#onMessag e(Message) | |||||
| 156 | * / | |||||
| 157 | @O verride | |||||
| 158 | pu blic void onMessage( final Mess age messag e) { | |||||
| 159 | // U npack the message | |||||
| 160 | fina l ObjectMe ssage msg = (ObjectM essage) me ssage; | |||||
| 161 | try { | |||||
| 162 | final BatchAnnou nceType an nouncement = (BatchA nnounceTyp e) msg | |||||
| 163 | .getObject (); | |||||
| 164 | final int maxBat chSize = a nnouncemen t.getMaxBa tchSize(); | |||||
| 165 | this.a nnounce( | |||||
| 166 | announceme nt.getBatc hIds(), | |||||
| 167 | announceme nt.getUser (), | |||||
| 168 | announceme nt.getFaci lity(), | |||||
| 169 | maxBatchSi ze < 1 ? B atchAnnoun cerMessage Consumer.M AX_BATCH_S IZE | |||||
| 170 | : ma xBatchSize ); | |||||
| 171 | } ca tch (final Exception e) { | |||||
| 172 | throw new Runtim eException (e); | |||||
| 173 | } | |||||
| 174 | } | |||||
| 175 | ||||||
| 176 | @R esource | |||||
| 177 | pu blic void setContext (final Mes sageDriven Context co ntext) { | |||||
| 178 | } | |||||
| 179 | ||||||
| 180 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.