Produced by Araxis Merge on 4/5/2017 4:21:45 PM Central 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 | C:\working_scrub\Unredacted\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterEJB\src\main\java\gov\va\med\nhin\adapter\docquery | ParamStringToQueryParamDataTranslator.java | Fri Feb 10 15:41:44 2017 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\AdapterEJB\src\main\java\gov\va\med\nhin\adapter\docquery | ParamStringToQueryParamDataTranslator.java | Mon Apr 3 14:23:10 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 216 |
| 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.med.n hin.adapte r.docquery ; | |
| 2 | ||
| 3 | import jav a.util.Lis t; | |
| 4 | ||
| 5 | import gov .va.med.nh in.adapter .datamanag er.DataQue ry; | |
| 6 | import gov .va.med.nh in.adapter .datamanag er.DataTra nslator; | |
| 7 | import gov .va.med.nh in.adapter .datamanag er.Referen ce; | |
| 8 | ||
| 9 | /** | |
| 10 | * | |
| 11 | * @author DN S VAZQUD | |
| 12 | */ | |
| 13 | public cla ss ParamSt ringToQuer yParamData Translator implement s DataTran slator | |
| 14 | { | |
| 15 | pu blic Objec t translat e(Object i nput, Obje ct result, Reference translato r, DataQue ry dataQue ry) | |
| 16 | { | |
| 17 | Obje ct ret = n ull; | |
| 18 | ||
| 19 | if(i nput != nu ll) | |
| 20 | { | |
| 21 | if(!(i nput insta nceof List || input instanceof String)) | |
| 22 | { | |
| 23 | throw ne w RuntimeE xception(" input must be a stri ng or a li st of stri ngs."); | |
| 24 | } | |
| 25 | ||
| 26 | String Buffer buf fer = new StringBuff er(); | |
| 27 | ||
| 28 | if(inp ut instanc eof List) | |
| 29 | { | |
| 30 | List<Str ing> input AsList = ( List) inpu t; | |
| 31 | ||
| 32 | for(Stri ng item : inputAsLis t) | |
| 33 | { | |
| 34 | addToResul t(buffer, parseParam FormattedS tring(item )); | |
| 35 | } | |
| 36 | } | |
| 37 | else | |
| 38 | { | |
| 39 | addToRes ult(buffer , parsePar amFormatte dString((S tring) inp ut)); | |
| 40 | } | |
| 41 | ||
| 42 | ret = buffer.toS tring(); | |
| 43 | } | |
| 44 | ||
| 45 | retu rn ret; | |
| 46 | } | |
| 47 | ||
| 48 | pu blic Strin g parsePar amFormatte dString(St ring param FormattedS tring) | |
| 49 | { | |
| 50 | Stri ngBuffer r et = new S tringBuffe r(); | |
| 51 | ||
| 52 | if(p aramFormat tedString != null) | |
| 53 | { | |
| 54 | if(par amFormatte dString.st artsWith(" (")) | |
| 55 | { | |
| 56 | String w orking = p aramFormat tedString. substring( 1); | |
| 57 | int endI ndex = wor king.index Of(")"); | |
| 58 | if(endIn dex != -1) | |
| 59 | { | |
| 60 | working = working.su bstring(0, endIndex) ; | |
| 61 | } | |
| 62 | String[] multiValu eString = working.sp lit(","); | |
| 63 | if(multi ValueStrin g != null) | |
| 64 | { | |
| 65 | for(int i = 0; i < m ultiValueS tring.leng th; i++) | |
| 66 | { | |
| 67 | St ring singl eValue = m ultiValueS tring[i]; | |
| 68 | if (singleVal ue != null ) | |
| 69 | { | |
| 70 | sing leValue = singleValu e.trim(); | |
| 71 | } | |
| 72 | si ngleValue = processS ingleValue (singleVal ue); | |
| 73 | ad dToResult( ret, singl eValue); | |
| 74 | } | |
| 75 | } | |
| 76 | } | |
| 77 | else | |
| 78 | { | |
| 79 | addToRes ult(ret, p rocessSing leValue(pa ramFormatt edString)) ; | |
| 80 | } | |
| 81 | } | |
| 82 | ||
| 83 | retu rn ret.toS tring(); | |
| 84 | } | |
| 85 | ||
| 86 | pr ivate Stri ng process SingleValu e(String s ingleValue ) | |
| 87 | { | |
| 88 | if(s ingleValue .startsWit h("'")) | |
| 89 | { | |
| 90 | single Value = si ngleValue. substring( 1); | |
| 91 | int en dTickIndex = singleV alue.index Of("'"); | |
| 92 | if(end TickIndex != -1) | |
| 93 | { | |
| 94 | singleVa lue = sing leValue.su bstring(0, endTickIn dex); | |
| 95 | } | |
| 96 | } | |
| 97 | ||
| 98 | retu rn singleV alue; | |
| 99 | } | |
| 100 | ||
| 101 | pr ivate void addToResu lt(StringB uffer buff er, String singleVal ue) | |
| 102 | { | |
| 103 | if(b uffer.leng th() > 0) | |
| 104 | { | |
| 105 | buffer .append(", "); | |
| 106 | } | |
| 107 | buff er.append( singleValu e); | |
| 108 | } | |
| 109 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.