Produced by Araxis Merge on 7/3/2018 11:43:41 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 | eHealth_v8.2.0_build_8.2.0.1.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\translators | SectionDateRangeTranslator.java | Tue Jun 26 18:27:16 2018 UTC |
| 2 | eHealth_v8.2.0_build_8.2.0.1.zip\NHIN_adapter\AdapterLIB\src\main\java\gov\va\med\nhin\adapter\datamanager\translators | SectionDateRangeTranslator.java | Fri Jun 29 13:27:36 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 206 |
| 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.datamana ger.transl ators; | |
| 7 | ||
| 8 | import gov .va.med.nh in.adapter .datamanag er.DataDat e; | |
| 9 | import gov .va.med.nh in.adapter .datamanag er.DataQue ry; | |
| 10 | import gov .va.med.nh in.adapter .datamanag er.DataTra nslator; | |
| 11 | import gov .va.med.nh in.adapter .datamanag er.Referen ce; | |
| 12 | import gov .va.med.nh in.adapter .datamanag er.SmartHa shMap; | |
| 13 | import gov .va.med.nh in.adapter .utils.con fig.Proper tiesType; | |
| 14 | import gov .va.med.nh in.adapter .utils.con fig.Proper tyType; | |
| 15 | import jav a.io.IOExc eption; | |
| 16 | import jav a.lang.ref lect.Invoc ationTarge tException ; | |
| 17 | import jav a.util.Dat e; | |
| 18 | import jav a.util.Has hMap; | |
| 19 | import jav a.util.Lis t; | |
| 20 | import org .apache.co mmons.bean utils.Prop ertyUtils; | |
| 21 | import org .slf4j.Log ger; | |
| 22 | import org .slf4j.Log gerFactory ; | |
| 23 | ||
| 24 | /** | |
| 25 | * | |
| 26 | * @author PI I
|
|
| 27 | */ | |
| 28 | public cla ss Section DateRangeT ranslator implements DataTrans lator<Smar tHashMap> { | |
| 29 | ||
| 30 | privat e static f inal Logge r logger = LoggerFac tory.getLo gger(Secti onDateRang eTranslato r.class.ge tName()); | |
| 31 | static private f inal Strin g DATE_FOR MAT = "yyy yMMddHHmms s"; | |
| 32 | ||
| 33 | @Overr ide | |
| 34 | public SmartHash Map transl ate(Object input, Ob ject resul t, Referen ce transla tion, Data Query data Query) thr ows IOExce ption { | |
| 35 | Sm artHashMap r = new S martHashMa p(); | |
| 36 | Pr opertiesTy pe section s = transl ation.getR eference() .getProper ties(); | |
| 37 | fo r(Property Type t : s ections.ge tProperty( )) { | |
| 38 | HashMap< String, Da taDate> ra nge; | |
| 39 | if(!r.co ntainsKey( t.getName( ))) { | |
| 40 | rang e = new Ha shMap<Stri ng, DataDa te>(); | |
| 41 | rang e.put("low ", null); | |
| 42 | rang e.put("hig h", null); | |
| 43 | } else { | |
| 44 | rang e = (HashM ap<String, DataDate> ) r.get(t. getName()) ; | |
| 45 | } | |
| 46 | if(t.get Properties () == null ) { | |
| 47 | logg er.debug(t .getName() + " is no t configur ed with an y lists, m oving on." ); | |
| 48 | cont inue; | |
| 49 | } | |
| 50 | byList: | |
| 51 | for(Prop ertyType l s : t.getP roperties( ).getPrope rty()) { | |
| 52 | if(! ls.getName ().equals( "list")) { continue; } | |
| 53 | try { | |
| 54 | Object ite m = Proper tyUtils.ge tProperty( input, ls. getValue() ); | |
| 55 | if(item == null) { | |
| 56 | logger .debug(ls. getValue() +" is null , moving o n."); | |
| 57 | contin ue; | |
| 58 | } | |
| 59 | if(!(item instanceof List)) { | |
| 60 | logger .debug(ls. getValue() +" is not a list ("+ item.getCl ass().toSt ring()+"), moving on ."); | |
| 61 | contin ue; | |
| 62 | } | |
| 63 | for(Object i : (List ) item) { | |
| 64 | if(!(i instanceo f SmartHas hMap)) { | |
| 65 | lo gger.debug ("Item is not a Smar tHashMap, moving on. "); | |
| 66 | co ntinue; | |
| 67 | } | |
| 68 | SmartH ashMap j = (SmartHas hMap) i; | |
| 69 | try { | |
| 70 | se tValue(fal se, j, ran ge); | |
| 71 | se tValue(tru e, j, rang e); | |
| 72 | } catc h(Exceptio n ex) { | |
| 73 | lo gger.error ("Elements in "+ls.g etValue()+ " list do not have s tart/stop times, mov ing to nex t list.", ex); | |
| 74 | co ntinue byL ist; | |
| 75 | } | |
| 76 | } | |
| 77 | } ca tch(Except ion ex) { | |
| 78 | logger.err or("Unable to access "+ls.getV alue()+" i n input.", ex); | |
| 79 | continue; | |
| 80 | } | |
| 81 | } | |
| 82 | r.put(t. getName(), range); | |
| 83 | } | |
| 84 | (( SmartHashM ap) input) .put("sect ionDateRan ges", r); | |
| 85 | re turn (Smar tHashMap) input; | |
| 86 | } | |
| 87 | privat e void set Value(bool ean isHigh , SmartHas hMap objec t, HashMap <String, D ataDate> r ange) thro ws Illegal AccessExce ption, Inv ocationTar getExcepti on, Invoca tionTarget Exception, NoSuchMet hodExcepti on { | |
| 88 | St ring direc tion = (is High ? "hi gh" : "low "); | |
| 89 | St ring dirQu ery = (is High ? "qu eryEnd" : "queryStar t"); | |
| 90 | Ob ject date = Property Utils.getP roperty(ob ject, dirQ uery); | |
| 91 | if (date inst anceof Dat e) { | |
| 92 | if(range .get(direc tion) == n ull || ! ( range.get( direction) instanceo f Date)) { | |
| 93 | date = new Dat aDate(((Da te)date).g etTime(), DATE_FORMA T); | |
| 94 | rang e.put(dire ction, (Da taDate)dat e); | |
| 95 | } else { | |
| 96 | Date d = (Data Date) rang e.get(dire ction); | |
| 97 | if(( isHigh && d.before(( DataDate)d ate)) || ( !isHigh && d.after(( DataDate)d ate))) { | |
| 98 | date = new DataDate( ((Date)dat e).getTime (), DATE_F ORMAT); | |
| 99 | range.put( direction, (DataDate )date); | |
| 100 | } | |
| 101 | } | |
| 102 | } | |
| 103 | } | |
| 104 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.