Produced by Araxis Merge on 6/11/2019 10:54:11 AM 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 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\batchprocess | SimpleDataFileProcessCompletedHandler.java | Wed May 29 15:26:00 2019 UTC |
| 2 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\batchprocess | SimpleDataFileProcessCompletedHandler.java | Mon Jun 10 19:30:05 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 304 |
| 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.util.Dat e; | |
| 9 | import jav a.util.Lis t; | |
| 10 | import jav a.util.Str ingTokeniz er; | |
| 11 | ||
| 12 | import gov .va.med.fw .service.A bstractCom ponent; | |
| 13 | ||
| 14 | /** | |
| 15 | * Simple implementa tion of Da taFileProc essComplet edHandler that can s upport | |
| 16 | * file de letion or file renam ing. | |
| 17 | * | |
| 18 | * Created Feb 7, 20 06 10:13:3 6 AM | |
| 19 | * | |
| 20 | * @author DNS DN S
|
|
| 21 | */ | |
| 22 | public cla ss SimpleD ataFilePro cessComple tedHandler extends A bstractCom ponent imp lements | |
| 23 | Data ProcessCom pletedHand ler { | |
| 24 | pr ivate bool ean allowF ileDeletio n = true; | |
| 25 | ||
| 26 | pr ivate bool ean should RenameFile ; | |
| 27 | ||
| 28 | pr ivate Stri ng renameI nputFileRo ot; | |
| 29 | ||
| 30 | pr ivate Stri ng renameI nputFileEx tension; | |
| 31 | ||
| 32 | /* | |
| 33 | * (non-Java doc) | |
| 34 | * | |
| 35 | * @seegov.v a.med.fw.b atchproces s.DataFile ProcessCom pletedHand ler# | |
| 36 | * fileProce ssingCompl ete(java.i o.File) | |
| 37 | * / | |
| 38 | pr ivate fina l void fil eProcessin gComplete( File input File, List exception Data) { | |
| 39 | if ( inputFile != null) { | |
| 40 | if (sh ouldDelete File(excep tionData)) { | |
| 41 | if (allo wFileDelet ion && !in putFile.de lete()) | |
| 42 | throw new IllegalSta teExceptio n("Unable to delete input file : " | |
| 43 | + in putFile.ge tName()); | |
| 44 | } else if (shoul dRenameFil e(exceptio nData)) { | |
| 45 | if (!ren ameFile(in putFile)) | |
| 46 | throw new IllegalSta teExceptio n("Unable to rename input file : " | |
| 47 | + in putFile.ge tName()); | |
| 48 | } | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | pr otected bo olean shou ldDeleteFi le(List ex ceptionDat a) { | |
| 53 | retu rn excepti onData.isE mpty(); | |
| 54 | } | |
| 55 | ||
| 56 | pr otected bo olean shou ldRenameFi le(List ex ceptionDat a) { | |
| 57 | retu rn shouldR enameFile; | |
| 58 | } | |
| 59 | ||
| 60 | pr otected bo olean rena meFile(Fil e inputFil e) { | |
| 61 | Stri ng inputFi lePath = i nputFile.g etParent() ; | |
| 62 | Stri ngBuilder inputFileN ameRoot = new String Builder("" ); | |
| 63 | Stri ngTokenize r st = new StringTok enizer(inp utFile.get Name(), ". "); | |
| 64 | int tokenCount = st.coun tTokens(); | |
| 65 | for (int i = 1 ; i < toke nCount; i+ +) { | |
| 66 | inputF ileNameRoo t.append(s t.nextToke n()); | |
| 67 | if (i != (tokenC ount - 1)) | |
| 68 | inputFil eNameRoot. append("." ); | |
| 69 | } | |
| 70 | if ( tokenCount == 1) | |
| 71 | inputF ileNameRoo t.append(i nputFile.g etName()); | |
| 72 | ||
| 73 | Stri ng newFile Name = nul l; | |
| 74 | if ( renameInpu tFileRoot != null) | |
| 75 | newFil eName = re nameInputF ileRoot + renameInpu tFileExten sion; | |
| 76 | else | |
| 77 | newFil eName = in putFileNam eRoot.toSt ring() + r enameInput FileExtens ion; | |
| 78 | File newFile = new File( inputFileP ath + File .separator + newFile Name); | |
| 79 | int i = 1; | |
| 80 | whil e (newFile .exists()) { | |
| 81 | if (lo gger.isWar nEnabled() ) | |
| 82 | logger.w arn("Can n ot rename file to " + newFile. getName() | |
| 83 | + " since it exists al ready. Tr ying one u p number e xtension") ; | |
| 84 | ||
| 85 | newFil e = new Fi le(inputFi lePath + F ile.separa tor + newF ileName + (i++)); | |
| 86 | } | |
| 87 | bool ean result = inputFi le.renameT o(newFile) ; | |
| 88 | inpu tFile.setL astModifie d(new Date ().getTime ()); | |
| 89 | retu rn result; | |
| 90 | } | |
| 91 | ||
| 92 | /* * | |
| 93 | * @return R eturns the renameInp utFileExte nsion. | |
| 94 | * / | |
| 95 | pu blic Strin g getRenam eInputFile Extension( ) { | |
| 96 | retu rn renameI nputFileEx tension; | |
| 97 | } | |
| 98 | ||
| 99 | /* * | |
| 100 | * @param re nameInputF ileExtensi on | |
| 101 | * The rena meInputFil eExtension to set. | |
| 102 | * / | |
| 103 | pu blic void setRenameI nputFileEx tension(St ring renam eInputFile Extension) { | |
| 104 | this .renameInp utFileExte nsion = re nameInputF ileExtensi on; | |
| 105 | } | |
| 106 | ||
| 107 | /* * | |
| 108 | * @return R eturns the renameInp utFileRoot . | |
| 109 | * / | |
| 110 | pu blic Strin g getRenam eInputFile Root() { | |
| 111 | retu rn renameI nputFileRo ot; | |
| 112 | } | |
| 113 | ||
| 114 | /* * | |
| 115 | * @param re nameInputF ileRoot | |
| 116 | * The rena meInputFil eRoot to s et. | |
| 117 | * / | |
| 118 | pu blic void setRenameI nputFileRo ot(String renameInpu tFileRoot) { | |
| 119 | this .renameInp utFileRoot = renameI nputFileRo ot; | |
| 120 | } | |
| 121 | ||
| 122 | pu blic void afterPrope rtiesSet() { | |
| 123 | if ( renameInpu tFileRoot != null || renameInp utFileExte nsion != n ull) | |
| 124 | should RenameFile = true; | |
| 125 | } | |
| 126 | ||
| 127 | /* * | |
| 128 | * @return R eturns the allowFile Deletion. | |
| 129 | * / | |
| 130 | pu blic boole an isAllow FileDeleti on() { | |
| 131 | retu rn allowFi leDeletion ; | |
| 132 | } | |
| 133 | ||
| 134 | /* * | |
| 135 | * @param al lowFileDel etion | |
| 136 | * The allo wFileDelet ion to set . | |
| 137 | * / | |
| 138 | pu blic void setAllowFi leDeletion (boolean a llowFileDe letion) { | |
| 139 | this .allowFile Deletion = allowFile Deletion; | |
| 140 | } | |
| 141 | ||
| 142 | /* | |
| 143 | * (non-Java doc) | |
| 144 | * | |
| 145 | * @see | |
| 146 | * gov.va.me d.fw.batch process.Da taProcessC ompletedHa ndler#data Processing Complete | |
| 147 | * (gov.va.m ed.fw.batc hprocess.D ataProcess ExecutionC ontext) | |
| 148 | * / | |
| 149 | pu blic void dataProces singComple te(DataPro cessExecut ionContext context) { | |
| 150 | Data FileProces sExecution Context ct xt = (Data FileProces sExecution Context) c ontext; | |
| 151 | file Processing Complete(c txt.getCur rentFile() , ctxt.get ExceptionD ata()); | |
| 152 | } | |
| 153 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.