Produced by Araxis Merge on 12/13/2018 10:35:25 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\batchprocess | AbstractDataFileProcess.java | Fri Dec 7 17:36:22 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\batchprocess | AbstractDataFileProcess.java | Wed Dec 12 22:26:41 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 458 |
| 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 2005 V HA. All ri ghts reser ved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | ||
| 5 | package go v.va.med.f w.batchpro cess; | |
| 6 | ||
| 7 | import jav a.io.File; | |
| 8 | import jav a.io.Filen ameFilter; | |
| 9 | import jav a.util.Col lections; | |
| 10 | import jav a.util.Lis t; | |
| 11 | ||
| 12 | import org .apache.co mmons.lang .Validate; | |
| 13 | import org .springfra mework.cor e.io.FileS ystemResou rce; | |
| 14 | ||
| 15 | import gov .va.med.fw .io.parser .WildcardF ileFilter; | |
| 16 | import gov .va.med.fw .util.buil der.Builde r; | |
| 17 | ||
| 18 | /** | |
| 19 | * Abstrac t base cla ss for bat ch process ing of bul k data whe re the inp ut source | |
| 20 | * is one or more Fi le(s). | |
| 21 | * | |
| 22 | * Created Feb 1, 20 06 2:41:17 PM | |
| 23 | * | |
| 24 | * DNS | |
| 25 | */ | |
| 26 | public abs tract clas s Abstract DataFilePr ocess exte nds Abstra ctDataProc ess { | |
| 27 | pr ivate Buil der inputF ileReader; | |
| 28 | ||
| 29 | pr ivate Stri ng inputFi leLocation ; | |
| 30 | ||
| 31 | pr ivate File nameFilter inputFile Filter; | |
| 32 | ||
| 33 | pr ivate bool ean handle EachFileSe parately = true; | |
| 34 | ||
| 35 | pr ivate bool ean caseIn sensitive = true; | |
| 36 | ||
| 37 | pr otected Da taProcessE xecutionCo ntext crea teDataProc essExecuti onContext( ) { | |
| 38 | Data FileProces sStatistic s stats = (DataFileP rocessStat istics) cr eateProces sStatistic s(); | |
| 39 | stat s.setProce ssedFilePa th(inputFi leLocation ); | |
| 40 | ||
| 41 | Data ProcessExe cutionCont ext contex t = new Da taFileProc essExecuti onContext( ); | |
| 42 | cont ext.setPro cessStatis tics(stats ); | |
| 43 | retu rn context ; | |
| 44 | } | |
| 45 | ||
| 46 | pr otected Pr ocessStati stics crea teProcessS tatistics( ) { | |
| 47 | retu rn new Dat aFileProce ssStatisti cs(); | |
| 48 | } | |
| 49 | ||
| 50 | pr otected fi nal void e xecuteProc ess(DataPr ocessExecu tionContex t context) throws Ex ception { | |
| 51 | if ( hasExactly OneInputFi leToProces s()) | |
| 52 | super. executePro cess(conte xt); | |
| 53 | else { | |
| 54 | // per form proce ssing one File at a time... | |
| 55 | DataFi leProcessE xecutionCo ntext ctxt = (DataFi leProcessE xecutionCo ntext) con text; | |
| 56 | DataFi leProcessS tatistics dataStats = (DataFil eProcessSt atistics) ctxt | |
| 57 | .getProces sStatistic s(); | |
| 58 | FileSy stemResour ce fileSys temResourc e = new Fi leSystemRe source(inp utFileLoca tion); | |
| 59 | String [] fileNam es = fileS ystemResou rce.getFil e().list(i nputFileFi lter); | |
| 60 | List s pecificFil eData = nu ll; | |
| 61 | fileSy stemResour ce = null; | |
| 62 | if (fi leNames == null) { | |
| 63 | if (logg er.isError Enabled()) | |
| 64 | logger | |
| 65 | .err or("There were probl ems (eg, n ot a direc tory) tryi ng to get input file s at [" | |
| 66 | + inputF ileLocatio n + "] for " + getPr ocessName( )); | |
| 67 | } else { | |
| 68 | if (file Names.leng th == 0) { | |
| 69 | if (logger .isWarnEna bled()) | |
| 70 | lo gger.warn( "There are no input files at [ " + inputF ileLocatio n + "] for " | |
| 71 | + getP rocessName ()); | |
| 72 | } | |
| 73 | ||
| 74 | for (int i = 0; i < fileName s.length; i++) { | |
| 75 | fileSystem Resource = new FileS ystemResou rce(inputF ileLocatio n + File.s eparator | |
| 76 | + fi leNames[i] ); | |
| 77 | ctxt.setCu rrentFile( fileSystem Resource.g etFile()); | |
| 78 | specificFi leData = d oAcquireDa ta(ctxt, f ileSystemR esource); | |
| 79 | processDat a(ctxt, sp ecificFile Data); | |
| 80 | dataStats. addProcess edFile(fil eNames[i]) ; | |
| 81 | if (should UpdateJobR esult(cont ext)) | |
| 82 | th is.updateJ obResult(c ontext); | |
| 83 | if (handle EachFileSe parately) { | |
| 84 | lo gParsedFil e(ctxt); | |
| 85 | ha ndleDataPr ocessCompl eted(ctxt) ; | |
| 86 | } | |
| 87 | } | |
| 88 | } | |
| 89 | ||
| 90 | if (!h andleEachF ileSeparat ely) { | |
| 91 | logParse dFile(ctxt ); | |
| 92 | handleDa taProcessC ompleted(c txt); | |
| 93 | } | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 97 | pr ivate bool ean hasExa ctlyOneInp utFileToPr ocess() { | |
| 98 | bool ean hasExa ctlyOneInp utFileToPr ocess = fa lse; | |
| 99 | File SystemReso urce fileS ystemResou rce = new FileSystem Resource(i nputFileLo cation); | |
| 100 | if ( inputFileF ilter == n ull && !fi leSystemRe source.get File().isD irectory() ) | |
| 101 | hasExa ctlyOneInp utFileToPr ocess = tr ue; | |
| 102 | ||
| 103 | retu rn hasExac tlyOneInpu tFileToPro cess; | |
| 104 | } | |
| 105 | ||
| 106 | /* | |
| 107 | * (non-Java doc) | |
| 108 | * | |
| 109 | * @see | |
| 110 | * gov.va.me d.fw.sched uling.Abst ractSchedu ledProcess #executePr ocess(java | |
| 111 | * .lang.Obj ect) | |
| 112 | * / | |
| 113 | pr otected fi nal List a cquireData (DataProce ssExecutio nContext c ontext) th rows Excep tion { | |
| 114 | File SystemReso urce fileS ystemResou rce = new FileSystem Resource(i nputFileLo cation); | |
| 115 | List data = Co llections. EMPTY_LIST ; | |
| 116 | if ( fileSystem Resource.e xists()) { | |
| 117 | if (co ntext inst anceof Dat aFileProce ssExecutio nContext) { | |
| 118 | ((DataFi leProcessE xecutionCo ntext) con text).setC urrentFile (fileSyste mResource | |
| 119 | .g etFile()); | |
| 120 | } | |
| 121 | data = doAcquire Data(conte xt, new Fi leSystemRe source(inp utFileLoca tion)); | |
| 122 | } el se { | |
| 123 | if (lo gger.isWar nEnabled() ) | |
| 124 | logger.w arn("The i nputFile [ " + inputF ileLocatio n + "] for " + getPr ocessName( ) | |
| 125 | + " does not exist"); | |
| 126 | } | |
| 127 | ||
| 128 | retu rn data; | |
| 129 | } | |
| 130 | ||
| 131 | // subclasse s can over ride (eg, use contex t to proce ss differe nt file th an | |
| 132 | // configure d for) | |
| 133 | pr otected Li st doAcqui reData(Dat aProcessEx ecutionCon text conte xt, | |
| 134 | FileSy stemResour ce fileSys temResourc e) throws Exception { | |
| 135 | retu rn (List) inputFileR eader.buil d(new Obje ct[] { con text, file SystemReso urce }); | |
| 136 | } | |
| 137 | ||
| 138 | pr otected fi nal void l ogParsedFi le(DataFil eProcessEx ecutionCon text conte xt) { | |
| 139 | if ( logger.isI nfoEnabled ()) { | |
| 140 | logger .info("Fil e Parsing completed for inputF ile [" + c ontext.get CurrentFil e() + "]") ; | |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | /* * | |
| 145 | * @return R eturns the inputFile Location. | |
| 146 | * / | |
| 147 | pu blic Strin g getInput FileLocati on() { | |
| 148 | retu rn inputFi leLocation ; | |
| 149 | } | |
| 150 | ||
| 151 | /* * | |
| 152 | * @param in putFileLoc ation | |
| 153 | * The inpu tFileLocat ion to set . | |
| 154 | * / | |
| 155 | pu blic void setInputFi leLocation (String in putFileLoc ation) { | |
| 156 | this .inputFile Location = inputFile Location; | |
| 157 | } | |
| 158 | ||
| 159 | pu blic void afterPrope rtiesSet() { | |
| 160 | supe r.afterPro pertiesSet (); | |
| 161 | Vali date.notNu ll(inputFi leLocation , "A file location i s needed t o acquire data"); | |
| 162 | Vali date.notNu ll(inputFi leReader, "A Builder is needed to parse the data") ; | |
| 163 | ||
| 164 | // I f the inpu t file loc ation cont ains a *, treat it a s a wild c ard | |
| 165 | // e ntry. | |
| 166 | if ( inputFileL ocation.in dexOf("*") != -1) { | |
| 167 | // Get the last index of f ile path s eparator ' /' or '\'i n the file | |
| 168 | // loc ation | |
| 169 | int la stIndex = inputFileL ocation.la stIndexOf( "/"); | |
| 170 | if (la stIndex == -1) | |
| 171 | lastInde x = inputF ileLocatio n.lastInde xOf("\\"); | |
| 172 | ||
| 173 | inputF ileFilter = new Wild cardFileFi lter(input FileLocati on.substri ng(lastInd ex + 1), | |
| 174 | caseInsens itive); | |
| 175 | inputF ileLocatio n = inputF ileLocatio n.substrin g(0, lastI ndex); | |
| 176 | } | |
| 177 | } | |
| 178 | ||
| 179 | /* * | |
| 180 | * @return R eturns the inputFile Reader. | |
| 181 | * / | |
| 182 | pu blic Build er getInpu tFileReade r() { | |
| 183 | retu rn inputFi leReader; | |
| 184 | } | |
| 185 | ||
| 186 | /* * | |
| 187 | * @param in putFileRea der | |
| 188 | * The inpu tFileReade r to set. | |
| 189 | * / | |
| 190 | pu blic void setInputFi leReader(B uilder inp utFileRead er) { | |
| 191 | this .inputFile Reader = i nputFileRe ader; | |
| 192 | } | |
| 193 | ||
| 194 | /* * | |
| 195 | * @return R eturns the handleEac hFileSepar ately. | |
| 196 | * / | |
| 197 | pu blic boole an isHandl eEachFileS eparately( ) { | |
| 198 | retu rn handleE achFileSep arately; | |
| 199 | } | |
| 200 | ||
| 201 | /* * | |
| 202 | * @param ha ndleEachFi leSeparate ly | |
| 203 | * The hand leEachFile Separately to set. | |
| 204 | * / | |
| 205 | pu blic void setHandleE achFileSep arately(bo olean hand leEachFile Separately ) { | |
| 206 | this .handleEac hFileSepar ately = ha ndleEachFi leSeparate ly; | |
| 207 | } | |
| 208 | ||
| 209 | /* * | |
| 210 | * @return R eturns the caseInsen sitive. | |
| 211 | * / | |
| 212 | pu blic boole an isCaseI nsensitive () { | |
| 213 | retu rn caseIns ensitive; | |
| 214 | } | |
| 215 | ||
| 216 | /* * | |
| 217 | * @param ca seInsensit ive | |
| 218 | * The case Insensitiv e to set. | |
| 219 | * / | |
| 220 | pu blic void setCaseIns ensitive(b oolean cas eInsensiti ve) { | |
| 221 | this .caseInsen sitive = c aseInsensi tive; | |
| 222 | } | |
| 223 | ||
| 224 | /* * | |
| 225 | * @return R eturns the updateJob Result. | |
| 226 | * / | |
| 227 | pr otected bo olean shou ldUpdateJo bResult(Da taProcessE xecutionCo ntext cont ext) { | |
| 228 | retu rn true; | |
| 229 | } | |
| 230 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.