Produced by Araxis Merge on 2/7/2017 12:14:06 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\fps | FpsFlatFileItemReader.java | Wed Feb 1 21:07:30 2017 UTC |
2 | cpss.zip\cpss\src\main\java\gov\va\cpss\job\fps | FpsFlatFileItemReader.java | Fri Feb 3 20:44:04 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 240 |
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.fps; | |
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 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.FIL E_OPEN_ERR OR_STATUS; | |
6 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.REA D_FAILURE_ STATUS; | |
7 | ||
8 | import org .apache.lo g4j.Logger ; | |
9 | import org .springfra mework.bat ch.core.Ex itStatus; | |
10 | import org .springfra mework.bat ch.core.Jo bExecution ; | |
11 | import org .springfra mework.bat ch.core.St epExecutio n; | |
12 | import org .springfra mework.bat ch.core.St epExecutio nListener; | |
13 | import org .springfra mework.bat ch.item.Pa rseExcepti on; | |
14 | import org .springfra mework.bat ch.item.Un expectedIn putExcepti on; | |
15 | import org .springfra mework.bat ch.item.fi le.FlatFil eItemReade r; | |
16 | ||
17 | import gov .va.cpss.m odel.fps.P SRecord; | |
18 | ||
19 | /** | |
20 | * Impleme ntation of FlatFileI temReader used by th e Process FPS Data b atch job | |
21 | * test to read data from flat file. NOT E: This cl ass is not used in p roduction | |
22 | * but is a reader t o facilita te verific ation unit integrati on tests. See | |
23 | * FpsFtpI temReader for reader class use d in produ ction that connects to the ftp | |
24 | * server. | |
25 | * | |
26 | * @author DN S P II | |
27 | */ | |
28 | public cla ss FpsFlat FileItemRe ader exten ds FlatFil eItemReade r<PSRecord > implemen ts StepExe cutionList ener { | |
29 | ||
30 | pr ivate JobE xecution j obExecutio n; | |
31 | ||
32 | pr ivate fina l Logger r eaderLogge r; | |
33 | ||
34 | pu blic FpsFl atFileItem Reader() { | |
35 | read erLogger = Logger.ge tLogger(th is.getClas s().getCan onicalName ()); | |
36 | } | |
37 | ||
38 | @O verride | |
39 | pr otected vo id doOpen( ) throws E xception { | |
40 | try { | |
41 | super. doOpen(); | |
42 | } ca tch (Excep tion e) { | |
43 | ||
44 | String Builder er ror = new StringBuil der(); | |
45 | error. append("Un able to op en for rea d because of "); | |
46 | error. append(e.g etClass(). getSimpleN ame()); | |
47 | error. append("\n Message: " ); | |
48 | error. append(e.g etMessage( )); | |
49 | ||
50 | setFai lureStatus AndMessage (FILE_OPEN _ERROR_STA TUS, error .toString( )); | |
51 | } | |
52 | } | |
53 | ||
54 | @O verride | |
55 | pu blic PSRec ord read() throws Ex ception, U nexpectedI nputExcept ion, Parse Exception { | |
56 | try { | |
57 | return super.rea d(); | |
58 | } ca tch (Excep tion e) { | |
59 | ||
60 | String Builder er ror = new StringBuil der(); | |
61 | error. append("Un able to re ad item be cause of " ); | |
62 | error. append(e.g etClass(). getSimpleN ame()); | |
63 | error. append("\n Message: " ); | |
64 | error. append(e.g etMessage( )); | |
65 | error. append("\n Cause: "); | |
66 | error. append(e.g etCause(). getMessage ().trim()) ; | |
67 | ||
68 | setFai lureStatus AndMessage (READ_FAIL URE_STATUS , error.to String()); | |
69 | } | |
70 | // N ull respon se will ca use step t o end. | |
71 | retu rn null; | |
72 | } | |
73 | ||
74 | @O verride | |
75 | pu blic void beforeStep (StepExecu tion stepE xecution) { | |
76 | // S ave the jo b executio n at the b eginning o f the step . | |
77 | // T he executi on context will be u sed to set exit stat us if a fa ilure | |
78 | // d uring read processin g. | |
79 | jobE xecution = stepExecu tion.getJo bExecution (); | |
80 | } | |
81 | ||
82 | @O verride | |
83 | pu blic ExitS tatus afte rStep(Step Execution stepExecut ion) { | |
84 | // D o not do a nything sp ecial here . | |
85 | retu rn null; | |
86 | } | |
87 | ||
88 | /* * | |
89 | * Set the f ailure and message i n the job execution context. | |
90 | * / | |
91 | pr ivate void setFailur eStatusAnd Message(fi nal String status, f inal Strin g message) { | |
92 | // S et job fai lure. | |
93 | setF ailureStat us(status) ; | |
94 | ||
95 | // S et job fai lure messa ge. | |
96 | setF ailureMess age(messag e); | |
97 | } | |
98 | ||
99 | /* * | |
100 | * Set the f ailure in the job ex ecution co ntext. | |
101 | * / | |
102 | pr ivate void setFailur eStatus(fi nal String status) { | |
103 | // L og job fai lure statu s. | |
104 | read erLogger.e rror("Read failed wi th status: " + statu s); | |
105 | ||
106 | // S et job fai lure. | |
107 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_KEY, st atus); | |
108 | } | |
109 | ||
110 | /* * | |
111 | * Set the f ailure mes sage in th e job exec ution cont ext. | |
112 | * / | |
113 | pr ivate void setFailur eMessage(f inal Strin g message) { | |
114 | // L og job fai lure messa ge. | |
115 | read erLogger.e rror("Read failure m essage: " + message) ; | |
116 | ||
117 | // S et job fai lure messa ge. | |
118 | jobE xecution.g etExecutio nContext() .putString (JOB_FAILU RE_MESSAGE _KEY, mess age); | |
119 | } | |
120 | ||
121 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.