Produced by Araxis Merge on 3/8/2018 10:14:53 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 | PRE_PPS-N_v3.0.1.zip\PS_PPS_srv\src\main\java\gov\va\med\pharmacy\peps\service\common\capability\impl | WordProcessingFieldHelperImpl.java | Fri Jan 12 15:43:30 2018 UTC |
2 | PRE_PPS-N_v3.0.1.zip\PS_PPS_srv\src\main\java\gov\va\med\pharmacy\peps\service\common\capability\impl | WordProcessingFieldHelperImpl.java | Wed Mar 7 18:50:50 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 284 |
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.med.p harmacy.pe ps.service .common.ca pability.i mpl; | |
2 | ||
3 | import gov .va.med.ph armacy.pep s.common.u tility.Vis taFileNumb er; | |
4 | import gov .va.med.ph armacy.pep s.common.v ista.Vista ProductFil e; | |
5 | import gov .va.med.ph armacy.pep s.domain.c ommon.mode l.EplNdfOu tgoingDiff erences; | |
6 | import gov .va.med.ph armacy.pep s.service. common.cap ability.Wo rdProcessi ngFieldHel per; | |
7 | import gov .va.med.ph armacy.pep s.service. common.upd ate.impl.V ADrugClass NdfFileSyn cProcessor ; | |
8 | import gov .va.med.ph armacy.pep s.service. common.uti lity.NdfUp dateNdfDat aMapping; | |
9 | import gov .va.med.ph armacy.pep s.service. common.uti lity.NdfUp dateProces sFile; | |
10 | ||
11 | import jav a.io.IOExc eption; | |
12 | ||
13 | import org .apache.co mmons.lang .WordUtils ; | |
14 | import org .apache.co mmons.lang 3.StringUt ils; | |
15 | import org .springfra mework.ste reotype.Se rvice; | |
16 | ||
17 | /** | |
18 | * This is the imple mentation class for the WordPr ocessingFi eldHelper interface. | |
19 | * | |
20 | * @author DNS DNS | |
21 | * | |
22 | */ | |
23 | @Service | |
24 | public cla ss WordPro cessingFie ldHelperIm pl impleme nts WordPr ocessingFi eldHelper { | |
25 | ||
26 | /** | |
27 | * The maximum l ength of a String ch unk. | |
28 | */ | |
29 | privat e static f inal Integ er MAX_VIS TA_FIELD_L EN = 250; | |
30 | ||
31 | /** | |
32 | * The line.sepa rator syst em propert y. | |
33 | */ | |
34 | privat e static f inal Strin g LINE_SEP ARATOR = S ystem.line Separator( ); | |
35 | ||
36 | /** | |
37 | * A c haracter t o indicate a blank l ine. | |
38 | */ | |
39 | privat e static f inal Chara cter BLANK _LINE_INDI CATOR = ne w Characte r( | |
40 | (char) 0 xFF); | |
41 | ||
42 | /** | |
43 | * The NdfUpdate NdfDataMap ping objec t. | |
44 | */ | |
45 | privat e NdfUpdat eNdfDataMa pping ndfU pdateNdfDa taMapping = new NdfU pdateNdfDa taMapping( ); | |
46 | ||
47 | /** | |
48 | * Che ck the Vis tA File Nu mber and F ield Numbe r to see i f the valu e is a | |
49 | * Wor d-Processi ng field i n VistA. Currently, VA Drug C lass Descr iption and Product T ext are wo rd process ing fields . | |
50 | * | |
51 | * @re turn boole an true if the field is a Word -Processin g field; o therwise f alse | |
52 | */ | |
53 | @Overr ide | |
54 | public f inal boole an isWordP rocessingF ield(Strin g fileNumb er, String fieldNumb er) { | |
55 | ||
56 | if (Vi staFileNum ber.FIFTY_ 605.getFil eNumber(). equals(fil eNumber) | |
57 | && VADrugCla ssNdfFileS yncProcess or.DESCRIP TION_FIELD _NUMBER.eq uals(field Number)) { | |
58 | retu rn true; | |
59 | } | |
60 | ||
61 | if (Vi staProduct File.FILE_ NUMBER.equ als(fileNu mber) && V istaProduc tFile.PROD UCT_TEXT_F IELD_NUMBE R.equals(f ieldNumber )) { | |
62 | retu rn true; | |
63 | } | |
64 | ||
65 | return false; | |
66 | } | |
67 | ||
68 | /** | |
69 | * Bre aks up lon ger String s into mul tiple Stri ngs that a re a maxim um length | |
70 | * of MAX_VISTA_ FIELD_LEN. These mul tiple Stri ngs are th en formatt ed and | |
71 | * wri tten to th e update f ile. | |
72 | * | |
73 | * In order to p reserve bl ank lines, the metho d replaces all occur rences of | |
74 | * LIN E.SEPARATO R in the S tring with the BLANK _LINE_INDI CATOR + | |
75 | * LIN E.SEPARATO R. This is to preven t the remo val of lin es with ju st a | |
76 | * LIN E.SEPARATO R on it wh ich could equate to a NULL lin es when sp litting by | |
77 | * LIN E.SEPARATO R. This BL ANK_LINE_I NDICATOR i s removed before the string | |
78 | * val ue is writ ten to the file.s | |
79 | * | |
80 | * @pa ram ndfUpd ateFile | |
81 | * Th e NdfUpdat eProcessFi le being u sed. | |
82 | * @pa ram differ ence | |
83 | * Th e current difference being pro cessed. | |
84 | * @pa ram fileNu mber | |
85 | * Th e VistA Fi le Number | |
86 | * @pa ram fieldN umber | |
87 | * Th e VistA Fi eld Number | |
88 | * @th rows IOExc eption | |
89 | * I f an error occurs wr iting to t he NdfUpda teProcessF ile. | |
90 | */ | |
91 | public final voi d formatWo rdProcessi ngField(Nd fUpdatePro cessFile n dfUpdateFi le, | |
92 | EplNdfOu tgoingDiff erences di fference, String fil eNumber, | |
93 | String f ieldNumber ) throws I OException { | |
94 | fi nal String StrBlankL inesIndica ted = diff erence.get NewValue() .replaceAl l( | |
95 | LINE _SEPARATOR , BLANK_LI NE_INDICAT OR + LINE_ SEPARATOR) ; | |
96 | St ring[] str ArraySplit ByLineSepa rator = sp litByLineS eparator(S trBlankLin esIndicate d); | |
97 | in t count = 1; | |
98 | ||
99 | nd fUpdateFil e.putNextR ow(ndfUpda teNdfDataM apping | |
100 | .for matHeaderR owForDATAN (fileNumbe r, count)) ; | |
101 | nd fUpdateFil e.putNextR ow(ndfUpda teNdfDataM apping | |
102 | .for matIenRowF orDATAN(di fference)) ; | |
103 | ||
104 | fo r (int i = 0; i < st rArraySpli tByLineSep arator.len gth; i++) { | |
105 | String[] paraSplit = split(s trArraySpl itByLineSe parator[i] , | |
106 | MAX_VISTA_ FIELD_LEN) ; | |
107 | for (int j = 0; j < paraSpli t.length; j++) { | |
108 | ndfU pdateFile. putNextRow (ndfUpdate NdfDataMap ping | |
109 | .forma tHeaderRow ForDATAN( | |
110 | differen ce.getVist aFileNumbe r(), ++cou nt)); | |
111 | ndfU pdateFile. putNextRow (paraSplit [j].replac eAll( | |
112 | BLANK_ LINE_INDIC ATOR + "", "")); | |
113 | } | |
114 | } | |
115 | } | |
116 | ||
117 | /** | |
118 | * Spl its the su pplied tex t in to ch unks by th e line.sep arator val ue. | |
119 | * | |
120 | * @pa ram text | |
121 | * th e text to split | |
122 | * @re turn an ar ray of Str ings split by the li ne.separat or | |
123 | */ | |
124 | privat e String[] splitByLi neSeparato r(String t ext) { | |
125 | re turn Strin gUtils.spl it(text, L INE_SEPARA TOR); | |
126 | } | |
127 | ||
128 | /** | |
129 | * Spl its a Stri ng into eq ual chunkS ize String s without breaking i n the midd le of a wo rd. | |
130 | * | |
131 | * @pa ram text | |
132 | * th e String t o split | |
133 | * @pa ram chunkS ize | |
134 | * th e size of each split out subst ring | |
135 | * @re turn Strin g[] | |
136 | */ | |
137 | protec ted String [] split(S tring text , int chun kSize) { | |
138 | St ring wrapp edText = W ordUtils.w rap(text, chunkSize, LINE_SEPA RATOR, tru e); | |
139 | St ring[] res ult = spli tByLineSep arator(wra ppedText ) ; | |
140 | ||
141 | re turn resul t; | |
142 | } | |
143 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.