Produced by Araxis Merge on 12/13/2018 10:35:31 AM 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 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\service\jms | DefaultMessageConverter.java | Fri Dec 7 17:36:38 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\service\jms | DefaultMessageConverter.java | Wed Dec 12 22:26:42 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 214 |
| 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 | * Copyrii ght 2007 V HA. All ri ghts reser ved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | ||
| 5 | package go v.va.med.f w.service. jms; | |
| 6 | ||
| 7 | import jav a.io.Seria lizable; | |
| 8 | import jav a.util.Enu meration; | |
| 9 | import jav a.util.Map ; | |
| 10 | ||
| 11 | import jav ax.jms.JMS Exception; | |
| 12 | import jav ax.jms.Map Message; | |
| 13 | import jav ax.jms.Mes sage; | |
| 14 | import jav ax.jms.Ses sion; | |
| 15 | ||
| 16 | import org .apache.co mmons.logg ing.Log; | |
| 17 | import org .apache.co mmons.logg ing.LogFac tory; | |
| 18 | import org .springfra mework.jms .support.c onverter.M essageConv ersionExce ption; | |
| 19 | import org .springfra mework.jms .support.c onverter.S impleMessa geConverte r; | |
| 20 | ||
| 21 | /** | |
| 22 | * Since o utbound HL 7 messages requires a JMS Text Message fr om a Seria lizable | |
| 23 | * HL7Mess age object , custom c onversion is require d here (as opposed t o just | |
| 24 | * using S pring's Si mpleMessag eConverter ). | |
| 25 | * | |
| 26 | * <p> | |
| 27 | * Also al lows for " attempted" String'if ication of JMS paylo ads. | |
| 28 | * | |
| 29 | * Created Jun 20, 2 007 2:00:4 3 PM | |
| 30 | * | |
| 31 | * DNS | |
| 32 | */ | |
| 33 | public cla ss Default MessageCon verter ext ends Simpl eMessageCo nverter { | |
| 34 | pr otected fi nal Log lo gger = Log Factory.ge tLog(getCl ass()); | |
| 35 | pr ivate Stri ngifyPaylo adConverte r stringif yPayloadCo nverter; | |
| 36 | ||
| 37 | @O verride | |
| 38 | pu blic Messa ge toMessa ge(Object object, Se ssion sess ion) throw s JMSExcep tion, | |
| 39 | Messag eConversio nException { | |
| 40 | // C reate a JM S message based on a n input ob ject's cla ss type | |
| 41 | // T he rule he re is as f ollow: | |
| 42 | // a . byte[] = BytesMess age | |
| 43 | // b . String = TextMessa ge | |
| 44 | // c . gov.va.m ed.fw.hl7. Message = TextMessag e | |
| 45 | // d . Map = Ma pMessage | |
| 46 | // e . Serializ able = Obj ectMessage | |
| 47 | // f . Anything else = No t supporte d throw ex ception | |
| 48 | ||
| 49 | if ( object ins tanceof Me ssage) { | |
| 50 | return (Message) object; | |
| 51 | } | |
| 52 | // u se a fully -qualified path to a void colli sion with a | |
| 53 | // j avax.jms.M essage | |
| 54 | else if (objec t instance of gov.va. med.fw.hl7 .Message) { | |
| 55 | return createMes sageForStr ing(((gov. va.med.fw. hl7.Messag e) object) .getMessag eData(), | |
| 56 | session); | |
| 57 | } el se if (obj ect instan ceof Strin g) { | |
| 58 | return createMes sageForStr ing((Strin g) object, session); | |
| 59 | } el se if (obj ect instan ceof byte[ ]) { | |
| 60 | return createMes sageForByt eArray((by te[]) obje ct, sessio n); | |
| 61 | } el se if (obj ect instan ceof Map) { | |
| 62 | MapMes sage mapMe ssage = cr eateMessag eForMap((M ap) object , session) ; | |
| 63 | if (st ringifyPay loadConver ter != nul l) { | |
| 64 | String k ey = null; | |
| 65 | Object v al = null; | |
| 66 | for (Enu meration e = mapMess age.getMap Names(); e .hasMoreEl ements();) { | |
| 67 | key = (Str ing) e.nex tElement() ; | |
| 68 | val = mapM essage.get Object(key ); | |
| 69 | if (!(val instanceof Serializa ble)) | |
| 70 | th row new Me ssageConve rsionExcep tion("JMS Payloads m ust be Ser ializable" ); | |
| 71 | val = toFi nalPayload ((Serializ able) val) ; | |
| 72 | mapMessage .setString (key, val != null ? val.toStri ng() : (St ring) val) ; | |
| 73 | } | |
| 74 | } | |
| 75 | return mapMessag e; | |
| 76 | } | |
| 77 | // d o this tes t last to avoid proc essing abo ve special cases | |
| 78 | else if (objec t instance of Seriali zable) { | |
| 79 | return createMes sageForSer ializable( toFinalPay load((Seri alizable) object), s ession); | |
| 80 | } el se { | |
| 81 | throw new Messag eConversio nException ("Cannot c onvert obj ect [" + o bject | |
| 82 | + "] to JM S message" ); | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | @O verride | |
| 87 | pu blic Objec t fromMess age(Messag e message) throws JM SException , MessageC onversionE xception { | |
| 88 | Obje ct obj = s uper.fromM essage(mes sage); | |
| 89 | if ( stringifyP ayloadConv erter != n ull && obj instanceo f String) { | |
| 90 | obj = stringifyP ayloadConv erter.from String((St ring) obj) ; | |
| 91 | } | |
| 92 | retu rn obj; | |
| 93 | } | |
| 94 | ||
| 95 | pr otected fi nal Serial izable toF inalPayloa d(Serializ able paylo ad) { | |
| 96 | retu rn stringi fyPayloadC onverter = = null ? p ayload : s tringifyPa yloadConve rter | |
| 97 | .toStrin g(payload) ; | |
| 98 | } | |
| 99 | ||
| 100 | pu blic Strin gifyPayloa dConverter getString ifyPayload Converter( ) { | |
| 101 | retu rn stringi fyPayloadC onverter; | |
| 102 | } | |
| 103 | ||
| 104 | pu blic void setStringi fyPayloadC onverter(S tringifyPa yloadConve rter strin gifyPayloa dConverter ) { | |
| 105 | this .stringify PayloadCon verter = s tringifyPa yloadConve rter; | |
| 106 | } | |
| 107 | ||
| 108 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.