Produced by Araxis Merge on 10/3/2017 11:15:43 AM 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 | ehmp.zip\ehmp\ehmp\product\production\soap-handler\src\main\java\us\vistacore\vxsync\term\hmp | FileTermDataSource.java | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\soap-handler\src\main\java\us\vistacore\vxsync\term\hmp | FileTermDataSource.java | Mon Oct 2 19:56:14 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 222 |
| 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 us .vistacore .vxsync.te rm.hmp; | |
| 2 | ||
| 3 | import jav a.io.Buffe redReader; | |
| 4 | import jav a.io.File; | |
| 5 | import jav a.io.FileR eader; | |
| 6 | import jav a.io.IOExc eption; | |
| 7 | import jav a.net.URIS yntaxExcep tion; | |
| 8 | import jav a.util.Has hMap; | |
| 9 | import jav a.util.Map ; | |
| 10 | import jav a.util.Pro perties; | |
| 11 | import jav a.util.Set ; | |
| 12 | ||
| 13 | /** | |
| 14 | * The int ent of thi s class is to read/p arse a fla t file con taining ma pping data . Its not a full | |
| 15 | * blown C SV parser yet becaus e it doesn 't account for quote s. | |
| 16 | * | |
| 17 | * This is only capa ble of ser ving one m apping tab le. If yo u have mor e than one mapping t able | |
| 18 | * use mul tiple inst ances of t his. | |
| 19 | * | |
| 20 | * FUTURET ODO: There can be mu ltiple map pings (pri mary and s econdary), these are not being dealt wit h yet. | |
| 21 | * | |
| 22 | * Created by Intell iJ IDEA. | |
| 23 | * User: DN S BRAYB | |
| 24 | * Date: 6 /10/11 | |
| 25 | * Time: 1 0:26 AM | |
| 26 | */ | |
| 27 | public cla ss FileTer mDataSourc e extends AbstractTe rmDataSour ce impleme nts ITermD ataSource { | |
| 28 | ||
| 29 | privat e File fPa th; | |
| 30 | privat e Properti es fMapSet Info; | |
| 31 | privat e HashMap< String, St ring> fMap pings; | |
| 32 | ||
| 33 | public FileTermD ataSource( File path, String na me, String SourceCod eSystemID, String Ta rgetCodeSy stemID, in t SourceCo nceptField Idx, | |
| 34 | int Target ConceptFie ldIdx, int StartRow, String de limiterReg ex) throws IOExcepti on, URISyn taxExcepti on { | |
| 35 | fP ath = path ; | |
| 36 | ||
| 37 | Pr operties p rops = new Propertie s(); | |
| 38 | pr ops.setPro perty("sta rt.row", S tartRow + ""); | |
| 39 | pr ops.setPro perty("fie ld.delimit er.pattern ", delimit erRegex); | |
| 40 | pr ops.setPro perty("fie ld.source. idx", Sour ceConceptF ieldIdx + ""); | |
| 41 | pr ops.setPro perty("fie ld.target. idx", Targ etConceptF ieldIdx + ""); | |
| 42 | pr ops.setPro perty("tab le.size", "N/A"); | |
| 43 | ||
| 44 | // FUTURETOD O: Should we let thi s lazy loa d? | |
| 45 | in it(); | |
| 46 | } | |
| 47 | ||
| 48 | @Overr ide | |
| 49 | public void clos e() throws IOExcepti on { | |
| 50 | // NOOP | |
| 51 | } | |
| 52 | ||
| 53 | privat e void ini t() throws IOExcepti on { | |
| 54 | if (fMapping s != null) { | |
| 55 | return; | |
| 56 | } | |
| 57 | ||
| 58 | in t rowNum = 1; | |
| 59 | in t startRow = Integer .parseInt( fMapSetInf o.getPrope rty("start .row")); | |
| 60 | in t targetFi eldIdx = I nteger.par seInt(fMap SetInfo.ge tProperty( "field.tar get.idx")) ; | |
| 61 | in t sourceFi eldIdx = I nteger.par seInt(fMap SetInfo.ge tProperty( "field.sou rce.idx")) ; | |
| 62 | St ring delim iter = fMa pSetInfo.g etProperty ("field.de limiter.pa ttern"); | |
| 63 | ||
| 64 | Ha shMap<Stri ng,String> map = new HashMap<S tring,Stri ng>(); | |
| 65 | Bu fferedRead er br = ne w Buffered Reader(new FileReade r(fPath)); | |
| 66 | tr y { | |
| 67 | St ring line = br.readL ine(); | |
| 68 | wh ile (line != null) { | |
| 69 | if (rowN um++ < sta rtRow) { | |
| 70 | line = br.read Line(); | |
| 71 | cont inue; | |
| 72 | } | |
| 73 | String[] tokens = line.split (delimiter ); | |
| 74 | ||
| 75 | // bound s checking | |
| 76 | String s rcCode = s ourceField Idx <= tok ens.length ? tokens[ sourceFiel dIdx-1] : null; | |
| 77 | String t argetCode = targetFi eldIdx <= tokens.len gth ? toke ns[targetF ieldIdx-1] : null; | |
| 78 | ||
| 79 | if (srcC ode != nul l && targe tCode != n ull && src Code.lengt h() > 0 && targetCod e.length() > 0) { | |
| 80 | // F UTURETODO: Here is w here we ne ed to stor e multiple mappings potentiall y, | |
| 81 | // c urrently w e are just blindly r eplacing a ny existin g mapping with a new one. | |
| 82 | map. put(srcCod e, targetC ode); | |
| 83 | } | |
| 84 | ||
| 85 | line = b r.readLine (); | |
| 86 | } | |
| 87 | } finally { | |
| 88 | br.c lose(); | |
| 89 | } | |
| 90 | ||
| 91 | fM appings = map; | |
| 92 | } | |
| 93 | ||
| 94 | public int getMa ppingCount () { | |
| 95 | re turn fMapp ings.size( ); | |
| 96 | } | |
| 97 | ||
| 98 | @O verride | |
| 99 | pu blic Set<S tring> get CodeSystem List() { | |
| 100 | retu rn null; | |
| 101 | } | |
| 102 | ||
| 103 | @O verride | |
| 104 | pu blic Map<S tring, Obj ect> getCo deSystemMa p() { | |
| 105 | retu rn null; | |
| 106 | } | |
| 107 | ||
| 108 | @O verride | |
| 109 | pu blic Map<S tring, Obj ect> getCo nceptData( String urn ) { | |
| 110 | retu rn null; | |
| 111 | } | |
| 112 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.