Produced by Araxis Merge on 8/14/2018 11:32:39 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 | cbs-2018-06-18.zip\cbs\src\main\java\gov\va\cpss\job\fps | FpsItemProcessor.java | Tue Jun 19 13:45:46 2018 UTC |
| 2 | cbs-2018-06-18.zip\cbs\src\main\java\gov\va\cpss\job\fps | FpsItemProcessor.java | Tue Aug 14 00:53:19 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 996 |
| Changed | 1 | 3 |
| 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 go v.va.cpss. job.fps; | ||
| 2 | |||
| 3 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.EMP TY_FILE_ER ROR_STATUS ; | ||
| 4 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.INC OMPLETE_FI LE_ERROR_S TATUS; | ||
| 5 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_K EY; | ||
| 6 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_M ESSAGE_KEY ; | ||
| 7 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.PRO CESSING_FA ILURE_STAT US; | ||
| 8 | import sta tic gov.va .cpss.job. fps.FpsPro cessingCon stants.REC EIVED_ID_K EY; | ||
| 9 | import sta tic gov.va .cpss.job. fps.FpsPro cessingCon stants.TOT AL_SITE_CO UNT_KEY; | ||
| 10 | import sta tic gov.va .cpss.job. fps.FpsPro cessingCon stants.TOT AL_STATEME NT_COUNT_K EY; | ||
| 11 | |||
| 12 | import org .apache.lo g4j.Logger ; | ||
| 13 | import org .springfra mework.bat ch.core.Jo bExecution ; | ||
| 14 | import org .springfra mework.bat ch.core.St epExecutio n; | ||
| 15 | import org .springfra mework.bat ch.core.an notation.A fterStep; | ||
| 16 | import org .springfra mework.bat ch.core.an notation.B eforeStep; | ||
| 17 | import org .springfra mework.bat ch.item.It emProcesso r; | ||
| 18 | |||
| 19 | import gov .va.cpss.m odel.fps.P SDetails; | ||
| 20 | import gov .va.cpss.m odel.fps.P SPatient; | ||
| 21 | import gov .va.cpss.m odel.fps.P SRecord; | ||
| 22 | import gov .va.cpss.m odel.fps.P SSite; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * Custom ItemProces sor used b y the Proc ess FPS Da ta batch j ob to proc ess | ||
| 26 | * records parsed fr om the inp ut flat fi le prior t o writing the record s to the | ||
| 27 | * databas e. | ||
| 28 | * | ||
| 29 | * @author D N S */ | ||
| 30 | public cla ss FpsItem Processor implements ItemProce ssor<PSRec ord, PSRec ord> { | ||
| 31 | |||
| 32 | pr ivate stat ic final L ogger proc essorLogge r = Logger .getLogger (FpsItemPr ocessor.cl ass.getCan onicalName ()); | ||
| 33 | |||
| 34 | pr ivate JobE xecution j obExecutio n; | ||
| 35 | |||
| 36 | pr ivate Long receivedI d; | ||
| 37 | |||
| 38 | // PS contai ns a seque nce number . | ||
| 39 | // These are used to v erify the sequence a nd number of PS is c orrect dur ing | ||
| 40 | // processin g. | ||
| 41 | pr ivate int nextExpect edSeqNum = 1; | ||
| 42 | pr ivate int savedSeqNu m; | ||
| 43 | pr ivate int savedTotSe qNum; | ||
| 44 | |||
| 45 | // PS contai ns number of PH. | ||
| 46 | // These are used to v erify the number of PH. | ||
| 47 | pr ivate int nextExpect edStatemen tCount = 1 ; | ||
| 48 | pr ivate int savedState mentCount; | ||
| 49 | pr ivate int savedTotSt atementCou nt; | ||
| 50 | |||
| 51 | pr ivate Stri ng savedFa cilityNum; | ||
| 52 | |||
| 53 | // PH contai ns number of PD. | ||
| 54 | // These are used to v erify the number of PD. | ||
| 55 | pr ivate int nextExpect edDetailsC ount = 1; | ||
| 56 | pr ivate int savedDetai lsCount; | ||
| 57 | pr ivate int savedTotDe tailsCount ; | ||
| 58 | |||
| 59 | @O verride | ||
| 60 | pu blic PSRec ord proces s(PSRecord pojo) thr ows Except ion { | ||
| 61 | |||
| 62 | // I f job has already fa iled then just retur n null. | ||
| 63 | if ( jobExecuti on.getExec utionConte xt().conta insKey(JOB _FAILURE_K EY)) { | ||
| 64 | return null; | ||
| 65 | } | ||
| 66 | |||
| 67 | // T he data is processed as: | ||
| 68 | // P S, then su bsequent 1 -* PH. | ||
| 69 | // P H, then su bsequent 1 -* PD. | ||
| 70 | |||
| 71 | if ( pojo insta nceof PSSi te) { | ||
| 72 | |||
| 73 | // Ver ify the pr evious PS was proper ly process ed. | ||
| 74 | if (!l astPatient Completed( )) { | ||
| 75 | return s topJob(PRO CESSING_FA ILURE_STAT US); | ||
| 76 | } | ||
| 77 | |||
| 78 | // If a PSSite r ow then re set the ch ild keys t o null to prevent | ||
| 79 | // err oneous for eign key r eferences. | ||
| 80 | resetS ite(); | ||
| 81 | savedF acilityNum = (((PSSi te) pojo). getFacilit yNum() == null) ? "" : ((PSSit e) pojo).g etFacility Num().trim (); | ||
| 82 | |||
| 83 | // At this point receivedI d FK shoul d not be n ull. | ||
| 84 | if (re ceivedId ! = null) { | ||
| 85 | |||
| 86 | if (!pro cessSiteRe cord((PSSi te) pojo)) { | ||
| 87 | return sto pJob(PROCE SSING_FAIL URE_STATUS ); | ||
| 88 | } | ||
| 89 | |||
| 90 | } else { | ||
| 91 | |||
| 92 | // Unrec overable e rror so st op the job . | ||
| 93 | return s topJob(PRO CESSING_FA ILURE_STAT US, "Attem pted to pr ocess PS r ow with a null Recei ved FK"); | ||
| 94 | } | ||
| 95 | |||
| 96 | } el se if (poj o instance of PSPatie nt) { | ||
| 97 | |||
| 98 | // Ver ify the pr evious PH was proper ly process ed. | ||
| 99 | if (!l astDetails Completed( )) { | ||
| 100 | return s topJob(PRO CESSING_FA ILURE_STAT US); | ||
| 101 | } | ||
| 102 | |||
| 103 | // If a PSPatien t row then reset the child key s to null to prevent | ||
| 104 | // err oneous for eign key r eferences. | ||
| 105 | resetP atient(); | ||
| 106 | |||
| 107 | if (!p rocessPati entRecord( (PSPatient ) pojo)) { | ||
| 108 | return s topJob(PRO CESSING_FA ILURE_STAT US); | ||
| 109 | } | ||
| 110 | |||
| 111 | } el se if (poj o instance of PSDetai ls) { | ||
| 112 | |||
| 113 | if (!p rocessDeta ilsRecord( (PSDetails ) pojo)) { | ||
| 114 | return s topJob(PRO CESSING_FA ILURE_STAT US); | ||
| 115 | } | ||
| 116 | |||
| 117 | } el se { | ||
| 118 | |||
| 119 | // Unr ecoverable error so stop the j ob. | ||
| 120 | return stopJob(P ROCESSING_ FAILURE_ST ATUS, "Att empted to process un known row" ); | ||
| 121 | } | ||
| 122 | |||
| 123 | retu rn pojo; | ||
| 124 | } | ||
| 125 | |||
| 126 | /* * | ||
| 127 | * Before pr ocessing c apture the job execu tion and t he receive d id for d ata | ||
| 128 | * processin g. | ||
| 129 | * | ||
| 130 | * @param st epExecutio n | ||
| 131 | * / | ||
| 132 | @B eforeStep | ||
| 133 | pu blic void beforeStep (StepExecu tion stepE xecution) { | ||
| 134 | proc essorLogge r.info("Be fore Step Execution" ); | ||
| 135 | |||
| 136 | // S ave the jo b executio n at the b eginning o f the step . | ||
| 137 | // T he executi on context will be u sed to set foreign k ey values as rows | ||
| 138 | // a re process ed. | ||
| 139 | jobE xecution = stepExecu tion.getJo bExecution (); | ||
| 140 | |||
| 141 | // S ave the re ceivedId a t the begi nning of t he step. | ||
| 142 | // I t is obtai ned by the batch pri or to the job and pa ssed as a job | ||
| 143 | // p arameter w hen the jo b starts. | ||
| 144 | rece ivedId = j obExecutio n.getJobPa rameters() .getLong(R ECEIVED_ID _KEY); | ||
| 145 | |||
| 146 | // I nitialize the proces sing count s. | ||
| 147 | jobE xecution.g etExecutio nContext() .putLong(T OTAL_SITE_ COUNT_KEY, 0); | ||
| 148 | jobE xecution.g etExecutio nContext() .putLong(T OTAL_STATE MENT_COUNT _KEY, 0); | ||
| 149 | |||
| 150 | // I nitialize the proces sing verif ication da ta. | ||
| 151 | // P S processi ng | ||
| 152 | next ExpectedSe qNum = 1; | ||
| 153 | save dSeqNum = 0; | ||
| 154 | save dTotSeqNum = 0; | ||
| 155 | // P H processi ng | ||
| 156 | next ExpectedSt atementCou nt = 1; | ||
| 157 | save dStatement Count = 0; | ||
| 158 | save dTotStatem entCount = 0; | ||
| 159 | // P D processi ng | ||
| 160 | next ExpectedDe tailsCount = 1; | ||
| 161 | save dDetailsCo unt = 0; | ||
| 162 | save dTotDetail sCount = 0 ; | ||
| 163 | } | ||
| 164 | |||
| 165 | /* * | ||
| 166 | * After pro cessing ch eck for un expected c onditions that sugge st an erro r. | ||
| 167 | * | ||
| 168 | * @param st epExecutio n | ||
| 169 | * / | ||
| 170 | @A fterStep | ||
| 171 | pu blic void afterStep( StepExecut ion stepEx ecution) { | ||
| 172 | |||
| 173 | // I f no other error det ected then check for other pos sible erro r | ||
| 174 | // c onditions. | ||
| 175 | if ( !jobExecut ion.getExe cutionCont ext().cont ainsKey(JO B_FAILURE_ KEY)) { | ||
| 176 | |||
| 177 | // If read count is zero t hen report a job fai lure. | ||
| 178 | if (st epExecutio n.getReadC ount() == 0) { | ||
| 179 | setFailu reStatusAn dMessage(E MPTY_FILE_ ERROR_STAT US, "Input file is e mpty"); | ||
| 180 | } else if (!last DetailsCom pleted() | | !lastPat ientComple ted() || ! lastSiteCo mpleted()) { | ||
| 181 | setFailu reStatus(I NCOMPLETE_ FILE_ERROR _STATUS); | ||
| 182 | } | ||
| 183 | |||
| 184 | } | ||
| 185 | |||
| 186 | proc essorLogge r.info("Af ter Step E xecution") ; | ||
| 187 | } | ||
| 188 | |||
| 189 | /* * | ||
| 190 | * Verify th e last sit e processi ng was com pleted. | ||
| 191 | * | ||
| 192 | * @return B oolean ind icating if processin g complete d. | ||
| 193 | * / | ||
| 194 | pr ivate bool ean lastSi teComplete d() { | ||
| 195 | |||
| 196 | bool ean succes sful = tru e; | ||
| 197 | |||
| 198 | if ( savedTotSe qNum != sa vedSeqNum) { | ||
| 199 | succes sful = fal se; | ||
| 200 | setFai lureMessag e( | ||
| 201 | "PS count (" + saved SeqNum + " ) of (" + savedTotSe qNum + ") indicates incomplete sequence" ); | ||
| 202 | } el se { | ||
| 203 | succes sful = las tPatientCo mpleted(); | ||
| 204 | } | ||
| 205 | |||
| 206 | retu rn success ful; | ||
| 207 | } | ||
| 208 | |||
| 209 | /* * | ||
| 210 | * Verify th e last pat ient proce ssing was completed. | ||
| 211 | * | ||
| 212 | * @return B oolean ind icating if processin g complete d. | ||
| 213 | * / | ||
| 214 | pr ivate bool ean lastPa tientCompl eted() { | ||
| 215 | |||
| 216 | bool ean succes sful = tru e; | ||
| 217 | |||
| 218 | if ( savedState mentCount != savedTo tStatement Count) { | ||
| 219 | succes sful = fal se; | ||
| 220 | setFai lureMessag e("PH coun t (" + sav edStatemen tCount + " ) of (" + savedTotSt atementCou nt | ||
| 221 | + ") indic ates incom plete stat ement"); | ||
| 222 | } el se { | ||
| 223 | succes sful = las tDetailsCo mpleted(); | ||
| 224 | } | ||
| 225 | |||
| 226 | retu rn success ful; | ||
| 227 | } | ||
| 228 | |||
| 229 | /* * | ||
| 230 | * Verify th e last det ails proce ssing was completed. | ||
| 231 | * | ||
| 232 | * @return B oolean ind icating if processin g complete d. | ||
| 233 | * / | ||
| 234 | pr ivate bool ean lastDe tailsCompl eted() { | ||
| 235 | |||
| 236 | bool ean succes sful = tru e; | ||
| 237 | |||
| 238 | if ( savedDetai lsCount != savedTotD etailsCoun t) { | ||
| 239 | succes sful = fal se; | ||
| 240 | setFai lureMessag e("PD coun t (" + sav edDetailsC ount + ") of (" + sa vedTotDeta ilsCount | ||
| 241 | + ") indic ates incom plete deta ils"); | ||
| 242 | } | ||
| 243 | |||
| 244 | retu rn success ful; | ||
| 245 | } | ||
| 246 | |||
| 247 | pr ivate bool ean validP atientAcco unt(String patientAc count) { | ||
| 248 | fina l String t rimmedPati entAccount = (patien tAccount = = null) ? "" : patie ntAccount. trim(); | ||
| 249 | if ( trimmedPat ientAccoun t.length() < 11) { | ||
| 250 | // Min imum lengt h (1 (fac- num) + 9 ( ssn) + 1 ( last name) == 11) | ||
| 251 | setFai lureMessag e("Invalid PatientAc count: Doe s not meet minimum l ength requ irement.") ; | ||
| 252 | return false; | ||
| 253 | } | ||
| 254 | |||
| 255 | if ( (savedFaci lityNum == null) || (savedFaci lityNum.le ngth() < 1 ) | ||
| 256 | || !trim medPatient Account.st artsWith(s avedFacili tyNum)) { | ||
| 257 | setFai lureMessag e("Invalid PatientAc count: Fac ility numb er does no t match PS record.") ; | ||
| 258 | return false; | ||
| 259 | } | ||
| 260 | |||
| 261 | retu rn true; | ||
| 262 | } | ||
| 263 | |||
| 264 | /* * | ||
| 265 | * Process s ite record . | ||
| 266 | * / | ||
| 267 | pr ivate bool ean proces sSiteRecor d(PSSite s ite) { | ||
| 268 | bool ean succes sful = tru e; | ||
| 269 | |||
| 270 | site .setPsRece ivedId(rec eivedId); | ||
| 271 | |||
| 272 | // V erify the sequence n umber is t he expecte d value. | ||
| 273 | if ( site.getSe qNum() == nextExpect edSeqNum) { | ||
| 274 | |||
| 275 | // If the sequen ce number is 1 then save the e xpected to tal sequen ce | ||
| 276 | // num ber or ver ify the to tal sequen ce number. | ||
| 277 | if (si te.getSeqN um() == 1) { | ||
| 278 | savedTot SeqNum = s ite.getTot SeqNum(); | ||
| 279 | |||
| 280 | } else if (site. getTotSeqN um() != sa vedTotSeqN um) { | ||
| 281 | successf ul = false ; | ||
| 282 | setFailu reMessage( "Attempted to proces s PS with invalid to tal seq nu m (" + sit e.getTotSe qNum() | ||
| 283 | + ") but exp ected (" + savedTotS eqNum + ") "); | ||
| 284 | } | ||
| 285 | |||
| 286 | // Ver ify the se quence num ber is val id. | ||
| 287 | if (si te.getSeqN um() <= si te.getTotS eqNum()) { | ||
| 288 | |||
| 289 | // Set t he next ex pected seq uence numb er. | ||
| 290 | if (site .getSeqNum () < site. getTotSeqN um()) { | ||
| 291 | ++nextExpe ctedSeqNum ; | ||
| 292 | } else { | ||
| 293 | nextExpect edSeqNum = 1; | ||
| 294 | } | ||
| 295 | |||
| 296 | // Final ly, save d ata. | ||
| 297 | // The s equence nu mber. | ||
| 298 | savedSeq Num = site .getSeqNum (); // Thi s PS seque nce | ||
| 299 | savedTot StatementC ount = sit e.getTotSt atement(); // The nu mber | ||
| 300 | // o f | ||
| 301 | // e xpected | ||
| 302 | // P H | ||
| 303 | if (save dTotStatem entCount = = 0) { | ||
| 304 | successful = false; | ||
| 305 | setFailure Message("A ttempted t o process PS with in valid tota l statemen t count (0 )"); | ||
| 306 | } | ||
| 307 | |||
| 308 | } else { | ||
| 309 | successf ul = false ; | ||
| 310 | setFailu reMessage( "Attempted to proces s PS with invalid se q num (" + site.getS eqNum() + ") of (" | ||
| 311 | + site.getTo tSeqNum() + ")"); | ||
| 312 | } | ||
| 313 | |||
| 314 | } el se { | ||
| 315 | succes sful = fal se; | ||
| 316 | setFai lureMessag e("Attempt ed to proc ess PS wit h invalid seq num (" + site.ge tSeqNum() + ") but e xpected (" | ||
| 317 | + nextExpe ctedSeqNum + ")"); | ||
| 318 | } | ||
| 319 | |||
| 320 | retu rn success ful; | ||
| 321 | } | ||
| 322 | |||
| 323 | /* * | ||
| 324 | * Process p atient rec ord. | ||
| 325 | * / | ||
| 326 | pr ivate bool ean proces sPatientRe cord(PSPat ient patie nt) { | ||
| 327 | |||
| 328 | bool ean succes sful = tru e; | ||
| 329 | |||
| 330 | // I ncrement t he count o f patient. | ||
| 331 | ++sa vedStateme ntCount; | ||
| 332 | |||
| 333 | // V erify the statement count is t he expecte d value. | ||
| 334 | if ( savedState mentCount == nextExp ectedState mentCount) { | ||
| 335 | |||
| 336 | // Ver ify the st atement co unt is val id. | ||
| 337 | if (sa vedStateme ntCount <= savedTotS tatementCo unt) { | ||
| 338 | |||
| 339 | // Set t he next ex pected sta tement cou nt. | ||
| 340 | if (save dStatement Count < sa vedTotStat ementCount ) { | ||
| 341 | ++nextExpe ctedStatem entCount; | ||
| 342 | } else { | ||
| 343 | nextExpect edStatemen tCount = 1 ; | ||
| 344 | } | ||
| 345 | |||
| 346 | // Final ly, save d ata. | ||
| 347 | savedTot DetailsCou nt = patie nt.getNumO fLines(); // The num ber of | ||
| 348 | // expected PD | ||
| 349 | |||
| 350 | if (save dTotDetail sCount == 0) { | ||
| 351 | successful = false; | ||
| 352 | setFailure Message("A ttempted t o process PH with in valid tota l details count (0)" ); | ||
| 353 | } else { | ||
| 354 | successful = validPa tientAccou nt(patient .getPatien tAccount() ); | ||
| 355 | } | ||
| 356 | } else { | ||
| 357 | successf ul = false ; | ||
| 358 | setFailu reMessage( "Attempted to proces s PH with invalid co unt (" + s avedStatem entCount + ") of (" | ||
| 359 | + savedTotSt atementCou nt + ")"); | ||
| 360 | } | ||
| 361 | |||
| 362 | } el se { | ||
| 363 | succes sful = fal se; | ||
| 364 | setFai lureMessag e("Attempt ed to proc ess PH wit h unexpect ed count ( " + savedS tatementCo unt | ||
| 365 | + ") but e xpected (" + nextExp ectedState mentCount + ")"); | ||
| 366 | } | ||
| 367 | |||
| 368 | retu rn success ful; | ||
| 369 | } | ||
| 370 | |||
| 371 | /* * | ||
| 372 | * Process d etails rec ord. | ||
| 373 | * / | ||
| 374 | pr ivate bool ean proces sDetailsRe cord(PSDet ails detai ls) { | ||
| 375 | |||
| 376 | bool ean succes sful = tru e; | ||
| 377 | |||
| 378 | // I ncrement t he count o f details. | ||
| 379 | ++sa vedDetails Count; | ||
| 380 | |||
| 381 | // V erify the details co unt is the expected value. | ||
| 382 | if ( savedDetai lsCount == nextExpec tedDetails Count) { | ||
| 383 | |||
| 384 | // Ver ify the de tails coun t is valid . | ||
| 385 | if (sa vedDetails Count <= s avedTotDet ailsCount) { | ||
| 386 | |||
| 387 | // Set t he next ex pected det ails count . | ||
| 388 | if (save dDetailsCo unt < save dTotDetail sCount) { | ||
| 389 | ++nextExpe ctedDetail sCount; | ||
| 390 | } else { | ||
| 391 | nextExpect edDetailsC ount = 1; | ||
| 392 | } | ||
| 393 | |||
| 394 | } else { | ||
| 395 | successf ul = false ; | ||
| 396 | setFailu reMessage( "Attempted to proces s PD with invalid co unt (" + s avedDetail sCount + " ) of (" | ||
| 397 | + savedTotDe tailsCount + ")"); | ||
| 398 | } | ||
| 399 | |||
| 400 | } el se { | ||
| 401 | succes sful = fal se; | ||
| 402 | setFai lureMessag e("Attempt ed to proc ess PD wit h unexpect ed count ( " + savedD etailsCoun t + ") but expected (" | ||
| 403 | + nextExpe ctedDetail sCount + " )"); | ||
| 404 | } | ||
| 405 | |||
| 406 | retu rn success ful; | ||
| 407 | } | ||
| 408 | |||
| 409 | /* * | ||
| 410 | * Reset the site valu es from th e job exec ution to p repare to process ne xt | ||
| 411 | * site. | ||
| 412 | * / | ||
| 413 | pr ivate void resetSite () { | ||
| 414 | |||
| 415 | // R eset PH co unts. | ||
| 416 | next ExpectedSt atementCou nt = 1; | ||
| 417 | save dStatement Count = 0; | ||
| 418 | save dTotStatem entCount = 0; | ||
| 419 | |||
| 420 | rese tPatient() ; | ||
| 421 | } | ||
| 422 | |||
| 423 | /* * | ||
| 424 | * Reset the patient v alues from the job e xecution t o prepare to process | ||
| 425 | * next pati ent. | ||
| 426 | * / | ||
| 427 | pr ivate void resetPati ent() { | ||
| 428 | |||
| 429 | // R eset PD co unts. | ||
| 430 | next ExpectedDe tailsCount = 1; | ||
| 431 | save dDetailsCo unt = 0; | ||
| 432 | save dTotDetail sCount = 0 ; | ||
| 433 | } | ||
| 434 | |||
| 435 | /* * | ||
| 436 | * Forcefull y stop the job proce ssing beca use an err or was det ected. | ||
| 437 | * | ||
| 438 | * @return R eturn a nu ll record to stop st ep process ing. | ||
| 439 | * / | ||
| 440 | pr ivate PSRe cord stopJ ob(final S tring stat us) { | ||
| 441 | // L og message . | ||
| 442 | proc essorLogge r.error("P rocessor e xecution e ncountered unrecover able error and force d stop"); | ||
| 443 | // S et failure and messa ge. | ||
| 444 | setF ailureStat us(status) ; | ||
| 445 | // S top job. | ||
| 446 | jobE xecution.s top(); | ||
| 447 | |||
| 448 | retu rn null; | ||
| 449 | } | ||
| 450 | |||
| 451 | /* * | ||
| 452 | * Forcefull y stop the job proce ssing beca use an err or was det ected. | ||
| 453 | * | ||
| 454 | * @return R eturn a nu ll record to stop st ep process ing. | ||
| 455 | * / | ||
| 456 | pr ivate PSRe cord stopJ ob(final S tring stat us, final String mes sage) { | ||
| 457 | |||
| 458 | // S et failure . | ||
| 459 | stop Job(status ); | ||
| 460 | |||
| 461 | // S et failure message. | ||
| 462 | setF ailureMess age(messag e); | ||
| 463 | |||
| 464 | retu rn null; | ||
| 465 | } | ||
| 466 | |||
| 467 | /* * | ||
| 468 | * Set the f ailure and message i n the job execution context. | ||
| 469 | * / | ||
| 470 | pr ivate void setFailur eStatusAnd Message(fi nal String status, f inal Strin g message) { | ||
| 471 | // S et job fai lure. | ||
| 472 | setF ailureStat us(status) ; | ||
| 473 | // S et job fai lure messa ge. | ||
| 474 | setF ailureMess age(messag e); | ||
| 475 | } | ||
| 476 | |||
| 477 | /* * | ||
| 478 | * Set the f ailure in the job ex ecution co ntext. | ||
| 479 | * / | ||
| 480 | pr ivate void setFailur eStatus(fi nal String status) { | ||
| 481 | // L og job fai lure statu s. | ||
| 482 | proc essorLogge r.error("J ob failed with statu s: " + sta tus); | ||
| 483 | |||
| 484 | // S et job fai lure. | ||
| 485 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_KEY, st atus); | ||
| 486 | } | ||
| 487 | |||
| 488 | /* * | ||
| 489 | * Set the f ailure mes sage in th e job exec ution cont ext. | ||
| 490 | * / | ||
| 491 | pr ivate void setFailur eMessage(f inal Strin g message) { | ||
| 492 | // L og job fai lure messa ge. | ||
| 493 | proc essorLogge r.error("J ob failure message: " + messag e); | ||
| 494 | |||
| 495 | // S et job fai lure messa ge. | ||
| 496 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_MESSAGE _KEY, mess age); | ||
| 497 | } | ||
| 498 | |||
| 499 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.