Produced by Araxis Merge on 2/7/2017 12:14:07 PM 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 | cpss.zip\cpss\src\main\java\gov\va\cpss\job | CbssJobBaseTransactionTasklet.java | Wed Feb 1 21:07:26 2017 UTC |
2 | cpss.zip\cpss\src\main\java\gov\va\cpss\job | CbssJobBaseTransactionTasklet.java | Fri Feb 3 20:50:36 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 166 |
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 | package go v.va.cpss. job; | |
2 | ||
3 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_K EY; | |
4 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_M ESSAGE_KEY ; | |
5 | ||
6 | import org .apache.lo g4j.Logger ; | |
7 | import org .springfra mework.bat ch.core.Jo bExecution ; | |
8 | import org .springfra mework.bat ch.core.St epContribu tion; | |
9 | import org .springfra mework.bat ch.core.sc ope.contex t.ChunkCon text; | |
10 | import org .springfra mework.bat ch.core.st ep.tasklet .Tasklet; | |
11 | import org .springfra mework.bat ch.repeat. RepeatStat us; | |
12 | import org .springfra mework.tra nsaction.T ransaction Status; | |
13 | import org .springfra mework.tra nsaction.s upport.Tra nsactionCa llbackWith outResult; | |
14 | import org .springfra mework.tra nsaction.s upport.Tra nsactionTe mplate; | |
15 | ||
16 | /** | |
17 | * Abstrac t base cla ss that im plements l ogic for a tasklet t o do logic in a | |
18 | * transac tion. | |
19 | * | |
20 | * @author D N S | |
21 | */ | |
22 | public abs tract clas s CbssJobB aseTransac tionTaskle t implemen ts Tasklet { | |
23 | ||
24 | pr otected st atic final Logger ta skletLogge r = Logger | |
25 | .getLo gger(CbssJ obBaseTran sactionTas klet.class .getCanoni calName()) ; | |
26 | ||
27 | pr ivate Tran sactionTem plate tran sactionTem plate; | |
28 | ||
29 | pu blic Trans actionTemp late getTr ansactionT emplate() { | |
30 | retu rn transac tionTempla te; | |
31 | } | |
32 | ||
33 | pu blic void setTransac tionTempla te(Transac tionTempla te transac tionTempla te) { | |
34 | this .transacti onTemplate = transac tionTempla te; | |
35 | } | |
36 | ||
37 | @O verride | |
38 | pu blic Repea tStatus ex ecute(Step Contributi on contrib ution, Chu nkContext chunkConte xt) throws Exception { | |
39 | ||
40 | tran sactionTem plate.exec ute(new Tr ansactionC allbackWit houtResult () { | |
41 | @Overr ide | |
42 | protec ted void d oInTransac tionWithou tResult(Tr ansactionS tatus tran sactionSta tus) { | |
43 | ||
44 | if (!exe cuteLogic( chunkConte xt)) { | |
45 | taskletLog ger.error( "Tasklet d etected er ror and pe rformed ro llback"); | |
46 | transactio nStatus.se tRollbackO nly(); | |
47 | } | |
48 | } | |
49 | ||
50 | }); | |
51 | ||
52 | retu rn RepeatS tatus.FINI SHED; | |
53 | } | |
54 | ||
55 | /* * | |
56 | * Custom lo gic provid ed by impl ementing c lass to pe rform cust om logic, | |
57 | * customizi ng the log ic for the implement ing class. | |
58 | * | |
59 | * @return B oolean fla g indicati ng success ful or not . | |
60 | * / | |
61 | ab stract pro tected boo lean execu teLogic(Ch unkContext chunkCont ext); | |
62 | ||
63 | /* * | |
64 | * Set the f ailure in the job ex ecution co ntext. | |
65 | * | |
66 | * @param st atus | |
67 | * The fail ure status . | |
68 | * / | |
69 | pr otected vo id setFail ureStatus( JobExecuti on jobExec ution, fin al String status, fi nal String message) { | |
70 | ||
71 | // L og job fai lure statu s. | |
72 | task letLogger. error("Job completio n failed w ith status : " + stat us); | |
73 | ||
74 | // S et job fai lure. | |
75 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_KEY, st atus); | |
76 | ||
77 | // L og job fai lure messa ge. | |
78 | task letLogger. error("Job completio n failure message: " + message ); | |
79 | ||
80 | // S et job fai lure messa ge. | |
81 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_MESSAGE _KEY, mess age); | |
82 | } | |
83 | ||
84 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.