Produced by Araxis Merge on 3/1/2018 12:13:18 PM Central 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 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceWEB\src\main\java\gov\va\med\nhin\adapter\subscription\web\proxy\provider\documentreference | DAODocumentReferenceProvider.java | Thu Feb 22 14:27:20 2018 UTC |
| 2 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceWEB\src\main\java\gov\va\med\nhin\adapter\subscription\web\proxy\provider\documentreference | DAODocumentReferenceProvider.java | Tue Feb 27 14:30:11 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 294 |
| 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 | /* | |
| 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.med.n hin.adapte r.subscrip tion.web.p roxy.provi der.docume ntreferenc e; | |
| 7 | ||
| 8 | import ca. uhn.fhir.c ontext.Fhi rContext; | |
| 9 | import ca. uhn.fhir.p arser.IPar ser; | |
| 10 | import gov .va.med.nh in.adapter .subscript ion.web.da o.Document ReferenceD AO; | |
| 11 | import gov .va.med.nh in.adapter .subscript ion.web.re source.EHX DocumentRe ference; | |
| 12 | import jav a.io.Unsup portedEnco dingExcept ion; | |
| 13 | import jav a.math.Big Decimal; | |
| 14 | import jav a.util.Arr ayList; | |
| 15 | import jav a.util.Dat e; | |
| 16 | import jav a.util.Lis t; | |
| 17 | import jav a.util.fun ction.Func tion; | |
| 18 | import jav ax.enterpr ise.contex t.Applicat ionScoped; | |
| 19 | import jav ax.inject. Inject; | |
| 20 | import jav ax.inject. Named; | |
| 21 | import jav ax.transac tion.Trans actional; | |
| 22 | import org .hl7.fhir. dstu3.mode l.IdType; | |
| 23 | ||
| 24 | /** | |
| 25 | * | |
| 26 | * @author DN S VAZQUD | |
| 27 | */ | |
| 28 | @Named("DA ODocumentR eferencePr ovider") | |
| 29 | @Applicati onScoped() | |
| 30 | public cla ss DAODocu mentRefere nceProvide r implemen ts Documen tReference Provider | |
| 31 | { | |
| 32 | @Injec t | |
| 33 | privat e Document ReferenceD AO documen tReference DAO; | |
| 34 | @Injec t | |
| 35 | privat e FhirCont ext fhirCo ntext; | |
| 36 | ||
| 37 | @Overr ide | |
| 38 | @Trans actional | |
| 39 | public Long crea te(EHXDocu mentRefere nce resour ce) | |
| 40 | { | |
| 41 | Do cumentRefe renceProvi der.super. create(res ource); | |
| 42 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce entity | |
| 43 | = cr eateEntity FromResour ce(resourc e); | |
| 44 | en tity.setCr eatedTime( new Date() ); | |
| 45 | do cumentRefe renceDAO.s tore(entit y); | |
| 46 | re turn entit y.getDocum entReferen ceId().lon gValue(); | |
| 47 | } | |
| 48 | ||
| 49 | @Overr ide | |
| 50 | public EHXDocume ntReferenc e read(Lon g id) | |
| 51 | { | |
| 52 | EH XDocumentR eference r et = null; | |
| 53 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce entity | |
| 54 | = do cumentRefe renceDAO.f indByDocum entReferen ceID(BigDe cimal.valu eOf(id)); | |
| 55 | re turn creat eResourceF romEntity( entity); | |
| 56 | } | |
| 57 | ||
| 58 | @Overr ide | |
| 59 | public EHXDocume ntReferenc e read(IdT ype id) | |
| 60 | { | |
| 61 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce entity | |
| 62 | = do cumentRefe renceDAO.f indByResou rceID(id.g etIdPart() ); | |
| 63 | re turn creat eResourceF romEntity( entity); | |
| 64 | } | |
| 65 | ||
| 66 | @Overr ide | |
| 67 | @Trans actional | |
| 68 | public boolean r eadWithUpd ate(Long i d, Functio n<EHXDocum entReferen ce, Boolea n> functio n) | |
| 69 | { | |
| 70 | re turn Docum entReferen ceProvider .super.rea dWithUpdat e(id, func tion); | |
| 71 | } | |
| 72 | ||
| 73 | @Overr ide | |
| 74 | @Trans actional | |
| 75 | public void upda te(Long id , EHXDocum entReferen ce resourc e) | |
| 76 | { | |
| 77 | Do cumentRefe renceProvi der.super. update(id, resource) ; | |
| 78 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce entity | |
| 79 | = cr eateEntity FromResour ce(resourc e); | |
| 80 | en tity.setDo cumentRefe renceId(Bi gDecimal.v alueOf(id) ); | |
| 81 | do cumentRefe renceDAO.u pdate(enti ty); | |
| 82 | } | |
| 83 | ||
| 84 | @Overr ide | |
| 85 | public EHXDocume ntReferenc e delete(L ong id) | |
| 86 | { | |
| 87 | th row new Un supportedO perationEx ception("N ot support ed yet."); //To chan ge body of generated methods, choose Too ls | Templ ates. | |
| 88 | } | |
| 89 | ||
| 90 | @Overr ide | |
| 91 | public List<EHXD ocumentRef erence> fi ndByPatien tIDAndDocu mentRefere nceUpdated OnOrAfter( String pat ientID, Da te date) | |
| 92 | { | |
| 93 | Li st<EHXDocu mentRefere nce> ret = new Array List<>(); | |
| 94 | Li st<gov.va. med.nhin.a dapter.sub scription. web.entity .DocumentR eference> entities | |
| 95 | = do cumentRefe renceDAO.f indByPatie ntIDAndLas tUpdatedTi me(patient ID, date); | |
| 96 | en tities.for Each((enti ty) -> { | |
| 97 | ret.add( createReso urceFromEn tity(entit y)); | |
| 98 | }) ; | |
| 99 | re turn ret; | |
| 100 | } | |
| 101 | ||
| 102 | @Overr ide | |
| 103 | public EHXDocume ntReferenc e findByBi naryRefere nceURL(Str ing url) | |
| 104 | { | |
| 105 | th row new Un supportedO perationEx ception("N ot support ed yet."); //To chan ge body of generated methods, choose Too ls | Templ ates. | |
| 106 | } | |
| 107 | ||
| 108 | privat e gov.va.m ed.nhin.ad apter.subs cription.w eb.entity. DocumentRe ference cr eateEntity FromResour ce(EHXDocu mentRefere nce resour ce) | |
| 109 | { | |
| 110 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce ret = new gov.va .med.nhin. adapter.su bscription .web.entit y.Document Reference( ); | |
| 111 | re t.setResou rceId(reso urce.getId Element(). getIdPart( )); | |
| 112 | re t.setLastU pdatedTime (resource. getMeta(). getLastUpd ated()); | |
| 113 | re t.setPatie ntId(resou rce.getPat ientID()); | |
| 114 | IP arser json Parser = f hirContext .newJsonPa rser(); | |
| 115 | tr y { | |
| 116 | ret.setF hirResourc e(jsonPars er.encodeR esourceToS tring(reso urce).getB ytes("UTF- 8")); | |
| 117 | } | |
| 118 | ca tch (Unsup portedEnco dingExcept ion uee) { | |
| 119 | throw ne w RuntimeE xception(" You're usi ng an unsu pported en coding. F IX IT NOW! !!", uee); | |
| 120 | } | |
| 121 | re turn ret; | |
| 122 | } | |
| 123 | ||
| 124 | privat e EHXDocum entReferen ce createR esourceFro mEntity(go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Docu mentRefere nce entity ) | |
| 125 | { | |
| 126 | EH XDocumentR eference r et = null; | |
| 127 | if (entity ! = null) { | |
| 128 | IParser jsonParser = fhirCon text.newJs onParser() ; | |
| 129 | try { | |
| 130 | ret = jsonPars er.parseRe source(EHX DocumentRe ference.cl ass, new S tring(enti ty.getFhir Resource() , "UTF-8") ); | |
| 131 | } | |
| 132 | catch (U nsupported EncodingEx ception ue e) { | |
| 133 | thro w new Runt imeExcepti on("You're using an unsupporte d encoding . FIX IT NOW!!!", u ee); | |
| 134 | } | |
| 135 | } | |
| 136 | re turn ret; | |
| 137 | } | |
| 138 | ||
| 139 | public void setD ocumentRef erenceDAO( DocumentRe ferenceDAO documentR eferenceDA O) | |
| 140 | { | |
| 141 | th is.documen tReference DAO = docu mentRefere nceDAO; | |
| 142 | } | |
| 143 | ||
| 144 | public void setF hirContext (FhirConte xt fhirCon text) | |
| 145 | { | |
| 146 | th is.fhirCon text = fhi rContext; | |
| 147 | } | |
| 148 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.