Produced by Araxis Merge on 6/18/2018 3:36:59 PM Eastern 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 | CTT_DM2_v7.zip\CTT_ISAAC\hl7-messaging\src\main\java\gov\vha\isaac\ochre\deployment\publish | HL7DateHelper.java | Tue Jun 12 16:42:13 2018 UTC |
| 2 | CTT_DM2_v7.zip\CTT_ISAAC\hl7-messaging\src\main\java\gov\vha\isaac\ochre\deployment\publish | HL7DateHelper.java | Thu Jun 14 16:12:22 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 462 |
| 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 | * Copyrig ht Notice | |
| 3 | * | |
| 4 | * This is a work of the U.S. Government and is no t subject to copyrig ht | |
| 5 | * protect ion in the United St ates. Fore ign copyri ghts may a pply. | |
| 6 | * | |
| 7 | * License d under th e Apache L icense, Ve rsion 2.0 (the "Lice nse"); | |
| 8 | * you may not use t his file e xcept in c ompliance with the L icense. | |
| 9 | * You may obtain a copy of th e License at | |
| 10 | * | |
| 11 | * http:// www.apache .org/licen ses/LICENS E-2.0 | |
| 12 | * | |
| 13 | * Unless required b y applicab le law or agreed to in writing , software | |
| 14 | * distrib uted under the Licen se is dist ributed on an "AS IS " BASIS, | |
| 15 | * WITHOUT WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied. | |
| 16 | * See the License f or the spe cific lang uage gover ning permi ssions and | |
| 17 | * limitat ions under the Licen se. | |
| 18 | */ | |
| 19 | package go v.vha.isaa c.ochre.de ployment.p ublish; | |
| 20 | ||
| 21 | import jav a.text.Dat eFormat; | |
| 22 | import jav a.text.Par seExceptio n; | |
| 23 | import jav a.text.Sim pleDateFor mat; | |
| 24 | import jav a.util.Cal endar; | |
| 25 | import jav a.util.Dat e; | |
| 26 | import jav a.util.Tim eZone; | |
| 27 | ||
| 28 | /** | |
| 29 | * @author PII | |
| 30 | * | |
| 31 | * Formats d ate string | |
| 32 | */ | |
| 33 | public cla ss HL7Date Helper | |
| 34 | { | |
| 35 | pr ivate stat ic SimpleD ateFormat dateTimeFo rmat; | |
| 36 | ||
| 37 | /* * | |
| 38 | * The <code >getHL7Dat eFormat</c ode> metho d takes da te and tim e input an d | |
| 39 | * returns a date stri ng that ma tches the HL7 date s tandard, i ncluding t he | |
| 40 | * time offs et from GM T. If the incoming d ate string ends with '_NOW', t his | |
| 41 | * method re turns the string '00 0000000000 00.000-000 0', which is interpr eted | |
| 42 | * by MFS as 'now' (cu rrent date and time) . | |
| 43 | * | |
| 44 | * @param in comingDate String | |
| 45 | * should b e in the f orm 'MM/dd /yyyy@hh:m m' or in t he form | |
| 46 | * 'MM/dd/y yyy'. | |
| 47 | * @return | |
| 48 | * / | |
| 49 | pu blic stati c String g etHL7DateF ormat(Stri ng incomin gDateStrin g) { | |
| 50 | Stri ng hl7Date Output = n ull; | |
| 51 | Date Format inc omingDateF ormat; | |
| 52 | ||
| 53 | if ( incomingDa teString.i ndexOf("@" ) >= 0) { | |
| 54 | incomi ngDateForm at = new S impleDateF ormat("MM/ dd/yyyy@hh :mm"); | |
| 55 | } el se { | |
| 56 | incomi ngDateForm at = new S impleDateF ormat("MM/ dd/yyyy"); | |
| 57 | } | |
| 58 | Date Format out goingDateF ormat = ne w SimpleDa teFormat(" yyyyMMddhh mmss.SSSZ" ); | |
| 59 | ||
| 60 | if ( (incomingD ateString. endsWith(" _NOW")) | (incomingD ateString. endsWith(" _now"))) { | |
| 61 | hl7Dat eOutput = "000000000 00000.000- 0000"; | |
| 62 | return hl7DateOu tput; | |
| 63 | } | |
| 64 | ||
| 65 | try { | |
| 66 | Date m yDate = in comingDate Format.par se(incomin gDateStrin g); | |
| 67 | ||
| 68 | hl7Dat eOutput = outgoingDa teFormat.f ormat(myDa te); | |
| 69 | } ca tch (Parse Exception pe) { | |
| 70 | pe.pri ntStackTra ce(); | |
| 71 | } | |
| 72 | retu rn hl7Date Output; | |
| 73 | } | |
| 74 | ||
| 75 | /* * | |
| 76 | * The <code >getNumeri cDateForma t</code> m ethod take s date and time inpu t | |
| 77 | * and retur ns a date string in the form y yyyMMddhhm m. The inc oming date | |
| 78 | * string ma y be in th e form MM/ dd/yyyy@hh :mm or MM/ dd/yyyy@hh :mm_NOW. | |
| 79 | * | |
| 80 | * @param in comingDate String | |
| 81 | * Date str ing | |
| 82 | * @return D ate string in the fo rm yyyyMMd dhhmmss | |
| 83 | * / | |
| 84 | pu blic stati c String g etNumericD ateFormat( String inc omingDateS tring) { | |
| 85 | Stri ng dateOut put = null ; | |
| 86 | Date Format inc omingDateF ormat; | |
| 87 | ||
| 88 | if ( incomingDa teString.i ndexOf("@" ) >= 0) { | |
| 89 | incomi ngDateForm at = new S impleDateF ormat("MM/ dd/yyyy@hh :mm"); | |
| 90 | } el se { | |
| 91 | incomi ngDateForm at = new S impleDateF ormat("MMM /dd/yyyy") ; | |
| 92 | } | |
| 93 | ||
| 94 | Date Format out goingDateF ormat = ne w SimpleDa teFormat(" yyyyMMddhh mmss"); | |
| 95 | ||
| 96 | try { | |
| 97 | Date m yDate = in comingDate Format.par se(incomin gDateStrin g); | |
| 98 | ||
| 99 | dateOu tput = out goingDateF ormat.form at(myDate) ; | |
| 100 | } ca tch (Parse Exception pe) { | |
| 101 | pe.pri ntStackTra ce(); | |
| 102 | } | |
| 103 | retu rn dateOut put; | |
| 104 | } | |
| 105 | ||
| 106 | /* * | |
| 107 | * The <code >getCurren tDate</cod e> method returns a date strin g in the | |
| 108 | * format MM /dd/yyyy. | |
| 109 | * | |
| 110 | * @return d ate string MM/dd/yyy y | |
| 111 | * / | |
| 112 | pu blic stati c String g etCurrentD ate() { | |
| 113 | Stri ng current Date = nul l; | |
| 114 | ||
| 115 | Cale ndar calen dar = Cale ndar.getIn stance(Tim eZone.getD efault()); | |
| 116 | ||
| 117 | Stri ng dateFor mat = "MM/ dd/yyyy"; | |
| 118 | java .text.Simp leDateForm at simpleD ateFormat = new Simp leDateForm at(dateFor mat); | |
| 119 | ||
| 120 | simp leDateForm at.setTime Zone(TimeZ one.getDef ault()); | |
| 121 | ||
| 122 | curr entDate = simpleDate Format.for mat(calend ar.getTime ()); | |
| 123 | ||
| 124 | retu rn current Date; | |
| 125 | } | |
| 126 | ||
| 127 | /* * | |
| 128 | * The <code >getCurren tDateTime< /code> met hod return s a date a nd time st ring | |
| 129 | * in the fo rmat MM/dd /yyyy@hh:m m. | |
| 130 | * | |
| 131 | * @return d ate string MM/dd/yyy y@hh:mm | |
| 132 | * / | |
| 133 | pu blic stati c String g etCurrentD ateTime() { | |
| 134 | Stri ng current DateTime = null; | |
| 135 | ||
| 136 | Cale ndar calen dar = Cale ndar.getIn stance(Tim eZone.getD efault()); | |
| 137 | ||
| 138 | Stri ng dateFor mat = "MM/ dd/yyyy@HH :mm"; | |
| 139 | java .text.Simp leDateForm at simpleD ateFormat = new Simp leDateForm at(dateFor mat); | |
| 140 | ||
| 141 | simp leDateForm at.setTime Zone(TimeZ one.getDef ault()); | |
| 142 | ||
| 143 | curr entDateTim e = simple DateFormat .format(ca lendar.get Time()); | |
| 144 | ||
| 145 | retu rn current DateTime; | |
| 146 | } | |
| 147 | ||
| 148 | /* * | |
| 149 | * The <code >getCurren tYear</cod e> method returns th e current year as | |
| 150 | * 'yyyy'. | |
| 151 | * | |
| 152 | * @return S tring curr ent year i n the form 'yyyy' | |
| 153 | * / | |
| 154 | pu blic stati c String g etCurrentY ear() { | |
| 155 | date TimeFormat = new Sim pleDateFor mat("yyyy" ); | |
| 156 | Stri ng current Year = dat eTimeForma t.format(n ew Date()) ; | |
| 157 | retu rn current Year; | |
| 158 | } | |
| 159 | ||
| 160 | /* * | |
| 161 | * The <code >getCurren tMonth</co de> method returns t he current month as | |
| 162 | * 'MM'. | |
| 163 | * | |
| 164 | * @return S tring curr ent month in the for m 'MM' | |
| 165 | * / | |
| 166 | pu blic stati c String g etCurrentM onth() { | |
| 167 | date TimeFormat = new Sim pleDateFor mat("MM"); | |
| 168 | Stri ng current Month = da teTimeForm at.format( new Date() ); | |
| 169 | retu rn current Month; | |
| 170 | } | |
| 171 | ||
| 172 | /* * | |
| 173 | * The <code >getCurren tDay</code > method r eturns the current d ay of the | |
| 174 | * month as 'dd'. | |
| 175 | * | |
| 176 | * @return S tring curr ent day in the form 'dd' | |
| 177 | * / | |
| 178 | pu blic stati c String g etCurrentD ay() { | |
| 179 | date TimeFormat = new Sim pleDateFor mat("dd"); | |
| 180 | Stri ng current Day = date TimeFormat .format(ne w Date()); | |
| 181 | retu rn current Day; | |
| 182 | } | |
| 183 | ||
| 184 | /* * | |
| 185 | * The <code >getCurren tHour</cod e> method returns th e current hour of th e | |
| 186 | * day as 'h h' using a 24-hour c lock. | |
| 187 | * | |
| 188 | * @return S tring curr ent hour o f the day in the for m 'hh' | |
| 189 | * / | |
| 190 | pu blic stati c String g etCurrentH our() { | |
| 191 | date TimeFormat = new Sim pleDateFor mat("hh"); | |
| 192 | Stri ng current Hour = dat eTimeForma t.format(n ew Date()) ; | |
| 193 | retu rn current Hour; | |
| 194 | } | |
| 195 | ||
| 196 | /* * | |
| 197 | * The <code >getCurren tMinute</c ode> metho d returns the curren t minute o f | |
| 198 | * the curre nt hour as 'mm'. | |
| 199 | * | |
| 200 | * @return S tring curr ent minute of the cu rrent hour in the fo rm 'mm' | |
| 201 | * / | |
| 202 | pu blic stati c String g etCurrentM inute() { | |
| 203 | date TimeFormat = new Sim pleDateFor mat("mm"); | |
| 204 | Stri ng current Minute = d ateTimeFor mat.format (new Date( )); | |
| 205 | retu rn current Minute; | |
| 206 | } | |
| 207 | ||
| 208 | /* * | |
| 209 | * The <code >getCurren tSecond</c ode> metho d returns the curren t second o f | |
| 210 | * the curre nt minute as 'ss'. | |
| 211 | * | |
| 212 | * @return S tring curr ent second of the cu rrent minu te in the form 'ss' | |
| 213 | * / | |
| 214 | pu blic stati c String g etCurrentS econd() { | |
| 215 | date TimeFormat = new Sim pleDateFor mat("ss"); | |
| 216 | Stri ng current Second = d ateTimeFor mat.format (new Date( )); | |
| 217 | retu rn current Second; | |
| 218 | } | |
| 219 | ||
| 220 | /* * | |
| 221 | * The <code >getCurren tMilliseco nd</code> method ret urns the c urrent | |
| 222 | * milliseco nd of the current se cond as 'S SS'. | |
| 223 | * | |
| 224 | * @return S tring curr ent millis econd of t he current second in the form | |
| 225 | * ' SSS' | |
| 226 | * / | |
| 227 | pu blic stati c String g etCurrentM illisecond () { | |
| 228 | date TimeFormat = new Sim pleDateFor mat("SSS") ; | |
| 229 | Stri ng current Millisecon d = dateTi meFormat.f ormat(new Date()); | |
| 230 | retu rn current Millisecon d; | |
| 231 | } | |
| 232 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.