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\binary | DAOBinaryProvider.java | Thu Feb 22 14:27:22 2018 UTC |
| 2 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceWEB\src\main\java\gov\va\med\nhin\adapter\subscription\web\proxy\provider\binary | DAOBinaryProvider.java | Tue Feb 27 14:30:10 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 252 |
| 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.binary ; | |
| 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.BinaryDA O; | |
| 11 | import jav a.io.Unsup portedEnco dingExcept ion; | |
| 12 | import jav a.math.Big Decimal; | |
| 13 | import jav a.util.Dat e; | |
| 14 | import jav a.util.fun ction.Func tion; | |
| 15 | import jav ax.enterpr ise.contex t.Applicat ionScoped; | |
| 16 | import jav ax.inject. Inject; | |
| 17 | import jav ax.inject. Named; | |
| 18 | import jav ax.transac tion.Trans actional; | |
| 19 | import org .hl7.fhir. dstu3.mode l.Binary; | |
| 20 | import org .hl7.fhir. dstu3.mode l.IdType; | |
| 21 | import sta tic org.hl 7.v3.Respo nseModalit y.T; | |
| 22 | ||
| 23 | /** | |
| 24 | * | |
| 25 | * @author DN S VAZQUD | |
| 26 | */ | |
| 27 | @Named("DA OBinaryPro vider") | |
| 28 | @Applicati onScoped() | |
| 29 | public cla ss DAOBina ryProvider implement s BinaryPr ovider | |
| 30 | { | |
| 31 | @Injec t | |
| 32 | privat e BinaryDA O binaryDA O; | |
| 33 | @Injec t | |
| 34 | privat e FhirCont ext fhirCo ntext; | |
| 35 | ||
| 36 | @Overr ide | |
| 37 | @Trans actional | |
| 38 | public Long crea te(Binary resource) | |
| 39 | { | |
| 40 | Bi naryProvid er.super.c reate(reso urce); | |
| 41 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Bina ry entity | |
| 42 | = create EntityFrom Resource(r esource); | |
| 43 | en tity.setCr eatedTime( new Date() ); | |
| 44 | bi naryDAO.st ore(entity ); | |
| 45 | re turn entit y.getBinar yId().long Value(); | |
| 46 | } | |
| 47 | ||
| 48 | @Overr ide | |
| 49 | public Binary re ad(Long id ) | |
| 50 | { | |
| 51 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Bina ry entity | |
| 52 | = binary DAO.findBy BinaryID(B igDecimal. valueOf(id )); | |
| 53 | re turn creat eResourceF romEntity( entity); | |
| 54 | } | |
| 55 | ||
| 56 | @Overr ide | |
| 57 | public Binary re ad(IdType id) | |
| 58 | { | |
| 59 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Bina ry entity | |
| 60 | = binary DAO.findBy ResourceID (id.getIdP art()); | |
| 61 | re turn creat eResourceF romEntity( entity); | |
| 62 | } | |
| 63 | ||
| 64 | @Overr ide | |
| 65 | @Trans actional | |
| 66 | public boolean r eadWithUpd ate(Long i d, Functio n<Binary, Boolean> f unction) | |
| 67 | { | |
| 68 | re turn Binar yProvider. super.read WithUpdate (id, funct ion); | |
| 69 | } | |
| 70 | ||
| 71 | @Overr ide | |
| 72 | @Trans actional | |
| 73 | public void upda te(Long id , Binary r esource) | |
| 74 | { | |
| 75 | Bi naryProvid er.super.u pdate(id, resource); | |
| 76 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Bina ry entity | |
| 77 | = create EntityFrom Resource(r esource); | |
| 78 | en tity.setBi naryId(Big Decimal.va lueOf(id)) ; | |
| 79 | bi naryDAO.up date(entit y); | |
| 80 | } | |
| 81 | ||
| 82 | @Overr ide | |
| 83 | public Binary de lete(Long id) | |
| 84 | { | |
| 85 | th row new Un supportedO perationEx ception("N ot support ed yet."); //To chan ge body of generated methods, choose Too ls | Templ ates. | |
| 86 | } | |
| 87 | ||
| 88 | privat e gov.va.m ed.nhin.ad apter.subs cription.w eb.entity. Binary cre ateEntityF romResourc e(Binary r esource) | |
| 89 | { | |
| 90 | go v.va.med.n hin.adapte r.subscrip tion.web.e ntity.Bina ry ret = n ew gov.va. med.nhin.a dapter.sub scription. web.entity .Binary(); | |
| 91 | re t.setResou rceId(reso urce.getId Element(). getIdPart( )); | |
| 92 | re t.setLastU pdatedTime (resource. getMeta(). getLastUpd ated()); | |
| 93 | IP arser json Parser = f hirContext .newJsonPa rser(); | |
| 94 | tr y { | |
| 95 | ret.setF hirResourc e(jsonPars er.encodeR esourceToS tring(reso urce).getB ytes("UTF- 8")); | |
| 96 | } | |
| 97 | ca tch (Unsup portedEnco dingExcept ion uee) { | |
| 98 | throw ne w RuntimeE xception(" You're usi ng an unsu pported en coding. F IX IT NOW! !!", uee); | |
| 99 | } | |
| 100 | re turn ret; | |
| 101 | } | |
| 102 | ||
| 103 | privat e Binary c reateResou rceFromEnt ity(gov.va .med.nhin. adapter.su bscription .web.entit y.Binary e ntity) | |
| 104 | { | |
| 105 | Bi nary ret = null; | |
| 106 | if (entity ! = null) { | |
| 107 | IParser jsonParser = fhirCon text.newJs onParser() ; | |
| 108 | try { | |
| 109 | ret = jsonPars er.parseRe source(Bin ary.class, new Strin g(entity.g etFhirReso urce(), "U TF-8")); | |
| 110 | } | |
| 111 | catch (U nsupported EncodingEx ception ue e) { | |
| 112 | thro w new Runt imeExcepti on("You're using an unsupporte d encoding . FIX IT NOW!!!", u ee); | |
| 113 | } | |
| 114 | } | |
| 115 | re turn ret; | |
| 116 | } | |
| 117 | ||
| 118 | public void setB inaryDAO(B inaryDAO b inaryDAO) | |
| 119 | { | |
| 120 | th is.binaryD AO = binar yDAO; | |
| 121 | } | |
| 122 | ||
| 123 | public void setF hirContext (FhirConte xt fhirCon text) | |
| 124 | { | |
| 125 | th is.fhirCon text = fhi rContext; | |
| 126 | } | |
| 127 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.