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 | AbstractDataProcessWorker.java | Fri Dec 7 17:36:24 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\batchprocess | AbstractDataProcessWorker.java | Wed Dec 12 22:26:41 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 252 |
| 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 2006 V HA. All ri ghts reser ved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | ||
| 5 | package go v.va.med.f w.batchpro cess; | |
| 6 | ||
| 7 | import org .apache.co mmons.lang .StringUti ls; | |
| 8 | import org .apache.co mmons.lang .Validate; | |
| 9 | ||
| 10 | import gov .va.med.cc ht.util.ES APIValidat ionType; | |
| 11 | import gov .va.med.cc ht.util.ES APIValidat or; | |
| 12 | import gov .va.med.fw .model.Ent ityKey; | |
| 13 | import gov .va.med.fw .model.Ent ityKeyFact ory; | |
| 14 | import gov .va.med.fw .model.bat chprocess. JobConfig; | |
| 15 | import gov .va.med.fw .model.bat chprocess. JobResult; | |
| 16 | import gov .va.med.fw .model.bat chprocess. JobStatus; | |
| 17 | import gov .va.med.fw .service.A bstractCom ponent; | |
| 18 | ||
| 19 | /** | |
| 20 | * Worker implementa tion for A bstractDat aProcess i nstances t hat need p arallelism | |
| 21 | * (eg, pr ocessing J MS message s across a cluster). | |
| 22 | * | |
| 23 | * Created Sep 21, 2 006 3:13:1 2 PM | |
| 24 | * | |
| 25 | * DNS | |
| 26 | */ | |
| 27 | public abs tract clas s Abstract DataProces sWorker ex tends Abst ractCompon ent { | |
| 28 | pr ivate Proc essStatist icsHandler processSt atisticsHa ndler; | |
| 29 | pr ivate Batc hProcessSe rvice batc hProcessSe rvice; | |
| 30 | ||
| 31 | pu blic final void proc ess(DataPr ocessWorke rInput in) { | |
| 32 | if ( logger.isI nfoEnabled ()) | |
| 33 | logger .info("Pro cessing da ta for pro cess: " + in.getProc essName() | |
| 34 | + " with a payload c ount of: " + in.getP ayloadCoun t() | |
| 35 | + " and a total coun t of: " + in.getTota lCount()); | |
| 36 | try { | |
| 37 | Entity Key jobRes ultKey = n ull; | |
| 38 | if (in .getId() ! = null) | |
| 39 | jobResul tKey = Ent ityKeyFact ory.create EntityKey( in.getId() .toString( ), | |
| 40 | Jo bResult.cl ass); | |
| 41 | // 1) verify if should sti ll process data | |
| 42 | JobRes ult jobRes ult = batc hProcessSe rvice.getJ obResult(L ong.parseL ong(in.get Id().toStr ing())); | |
| 43 | if (sh ouldProces sData(in, jobResult) ) { | |
| 44 | // 2) pr ocess data | |
| 45 | ProcessS tatistics workerStat s = proces sData(in.g etPayload( )); | |
| 46 | workerSt ats.setPro cessName(i n.getProce ssName()); | |
| 47 | long job Id = Long. parseLong( in.getId() .toString( )); | |
| 48 | JobResul tData data = batchPr ocessServi ce.saveAnd OverlayJob Result(job Id, | |
| 49 | wo rkerStats, in.getTot alCount()) ; | |
| 50 | processS tatistics( data); | |
| 51 | } | |
| 52 | } ca tch (Excep tion e) { | |
| 53 | if (lo gger.isErr orEnabled( )) | |
| 54 | logger.e rror("Fail ed process ing data", e); | |
| 55 | } | |
| 56 | } | |
| 57 | ||
| 58 | pr otected fi nal void p rocessStat istics(Job ResultData data) thr ows Except ion { | |
| 59 | Proc essStatist ics jobSta ts = data. getProcess Statistics (); | |
| 60 | JobR esult jobR esult = da ta.getJobR esult(); | |
| 61 | ||
| 62 | if ( JobStatus. CANCELLED. equals(job Result.get Status())) | |
| 63 | jobSta ts.setWasI nterrupted (true); | |
| 64 | ||
| 65 | if ( !JobStatus .IN_PROCES S.equals(j obResult.g etStatus() )) { | |
| 66 | if (lo gger.isInf oEnabled() ) { | |
| 67 | //F ix Fortify Issues | |
| 68 | ESAPIVal idator.val idateStrin gInput(job Stats.toFo rmattedStr ing(), ESA PIValidati onType.Sch eduledJob_ Whitelist) ; | |
| 69 | ||
| 70 | logger.i nfo("Proce ssStatisti cs [" + jo bStats + " ]"); | |
| 71 | } | |
| 72 | if (pr ocessStati sticsHandl er != null ) { | |
| 73 | JobConfi g config = this.batc hProcessSe rvice.getJ obConfig(j obResult.g etName(), | |
| 74 | jo bResult.ge tGroup()); | |
| 75 | if (conf ig != null && String Utils.isNo tBlank(con fig.getEma ilDistribu tionList() )) { | |
| 76 | processSta tisticsHan dler.proce ssStatisti csWithDyna micRecipie nts(jobSta ts, | |
| 77 | conf ig.getEmai lsAsList() ); | |
| 78 | } else { | |
| 79 | processSta tisticsHan dler.proce ssStatisti cs(jobStat s); | |
| 80 | } | |
| 81 | } | |
| 82 | ||
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | pr otected bo olean shou ldProcessD ata(DataPr ocessWorke rInput in, JobResult currentJo bResult) { | |
| 87 | retu rn JobStat us.IN_PROC ESS.getCod e().equals (currentJo bResult.ge tStatus(). getCode()) ; | |
| 88 | } | |
| 89 | ||
| 90 | // TODO: cha nge this t o be prote cted | |
| 91 | // for now, keeping th is public allows for easy test ing of wor ker | |
| 92 | pu blic abstr act Proces sStatistic s processD ata(Object o) throws Exception ; | |
| 93 | ||
| 94 | /* * | |
| 95 | * @return R eturns the processSt atisticsHa ndler. | |
| 96 | * / | |
| 97 | pu blic Proce ssStatisti csHandler getProcess Statistics Handler() { | |
| 98 | retu rn process Statistics Handler; | |
| 99 | } | |
| 100 | ||
| 101 | /* * | |
| 102 | * @param pr ocessStati sticsHandl er | |
| 103 | * The proc essStatist icsHandler to set. | |
| 104 | * / | |
| 105 | pu blic void setProcess Statistics Handler(Pr ocessStati sticsHandl er process Statistics Handler) { | |
| 106 | this .processSt atisticsHa ndler = pr ocessStati sticsHandl er; | |
| 107 | } | |
| 108 | ||
| 109 | /* * | |
| 110 | * @return R eturns the batchProc essService . | |
| 111 | * / | |
| 112 | pu blic Batch ProcessSer vice getBa tchProcess Service() { | |
| 113 | retu rn batchPr ocessServi ce; | |
| 114 | } | |
| 115 | ||
| 116 | /* * | |
| 117 | * @param ba tchProcess Service | |
| 118 | * The batc hProcessSe rvice to s et. | |
| 119 | * / | |
| 120 | pu blic void setBatchPr ocessServi ce(BatchPr ocessServi ce batchPr ocessServi ce) { | |
| 121 | this .batchProc essService = batchPr ocessServi ce; | |
| 122 | } | |
| 123 | ||
| 124 | pu blic void afterPrope rtiesSet() { | |
| 125 | Vali date.notNu ll(this.ba tchProcess Service, " batchProce ssService is require d"); | |
| 126 | } | |
| 127 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.