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 | NdcRulesCapabilityImpl.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 | NdcRulesCapabilityImpl.java | Wed Mar 7 18:49:14 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 4 | 892 |
Changed | 3 | 6 |
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 | * Source file creat ed in 2008 by Southw est Resear ch Institu te | |
3 | */ | |
4 | ||
5 | ||
6 | package go v.va.med.p harmacy.pe ps.service .common.ca pability.i mpl; | |
7 | ||
8 | ||
9 | import jav a.math.Big Decimal; | |
10 | import jav a.text.Dec imalFormat ; | |
11 | import jav a.util.Arr ayList; | |
12 | import jav a.util.Col lection; | |
13 | import jav a.util.Lis t; | |
14 | import jav a.util.Loc ale; | |
15 | ||
16 | import org .apache.co mmons.coll ections4.C ollectionU tils; | |
17 | import org .apache.co mmons.lang 3.StringUt ils; | |
18 | import org .apache.lo gging.log4 j.Logger; | |
19 | ||
20 | import gov .va.med.ph armacy.pep s.common.e xception.D omainExcep tion; | |
21 | import gov .va.med.ph armacy.pep s.common.e xception.I temNotFoun dException ; | |
22 | import gov .va.med.ph armacy.pep s.common.e xception.V alidationE xception; | |
23 | import gov .va.med.ph armacy.pep s.common.e xception.V alueObject Validation Exception; | |
24 | import gov .va.med.ph armacy.pep s.common.u tility.PPS Constants; | |
25 | import gov .va.med.ph armacy.pep s.common.v o.EntityTy pe; | |
26 | import gov .va.med.ph armacy.pep s.common.v o.EventCat egory; | |
27 | import gov .va.med.ph armacy.pep s.common.v o.FieldKey ; | |
28 | import gov .va.med.ph armacy.pep s.common.v o.Intended UseVo; | |
29 | import gov .va.med.ph armacy.pep s.common.v o.ItemAudi tHistoryDe tailsVo; | |
30 | import gov .va.med.ph armacy.pep s.common.v o.ItemAudi tHistoryVo ; | |
31 | import gov .va.med.ph armacy.pep s.common.v o.ItemStat us; | |
32 | import gov .va.med.ph armacy.pep s.common.v o.ModDiffe renceVo; | |
33 | import gov .va.med.ph armacy.pep s.common.v o.NdcVo; | |
34 | import gov .va.med.ph armacy.pep s.common.v o.ProductV o; | |
35 | import gov .va.med.ph armacy.pep s.common.v o.SynonymV o; | |
36 | import gov .va.med.ph armacy.pep s.common.v o.UserVo; | |
37 | import gov .va.med.ph armacy.pep s.common.v o.datafiel d.DataFiel d; | |
38 | import gov .va.med.ph armacy.pep s.common.v o.datafiel d.DataFiel ds; | |
39 | import gov .va.med.ph armacy.pep s.common.v o.validato r.ErrorKey ; | |
40 | import gov .va.med.ph armacy.pep s.common.v o.validato r.Errors; | |
41 | import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Int endedUseDo mainCapabi lity; | |
42 | import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Not ificationD omainCapab ility; | |
43 | import gov .va.med.ph armacy.pep s.domain.c ommon.capa bility.Pro ductDomain Capability ; | |
44 | import gov .va.med.ph armacy.pep s.service. common.uti lity.ItemA uditHistor yUtility; | |
45 | ||
46 | ||
47 | /** | |
48 | * Enforce s NDC busi ness rules . | |
49 | */ | |
50 | public cla ss NdcRule sCapabilit yImpl exte nds Defaul tRulesCapa bilityImpl <NdcVo> { | |
51 | privat e static f inal Strin g NDC_DELI MITER = "- "; | |
52 | ||
53 | privat e static f inal Logge r LOG = or g.apache.l ogging.log 4j.LogMana ger.getLog ger(NdcRul esCapabili tyImpl.cla ss); | |
54 | ||
55 | privat e Intended UseDomainC apability intendedUs eDomainCap ability; | |
56 | ||
57 | /** | |
58 | * For saving it em audit h istories. Most rules do not in dependentl y save aud it histori es, but th is one doe s. | |
59 | */ | |
60 | privat e ItemAudi tHistoryUt ility item AuditHisto ryUtility; | |
61 | ||
62 | /** | |
63 | * Enf orce addit ional NDC rules beyo nd simple ValueObjec t validati on. | |
64 | */ | |
65 | @Overr ide | |
66 | protec ted void h andleEnfor ceRules(Nd cVo ndc, U serVo user , boolean canPerform Update) | |
67 | th rows Valid ationExcep tion { | |
68 | ||
69 | Er rors error s = new Er rors(); | |
70 | ||
71 | nd c.setNdc(p adNdcWithL eadingZero (NDC_DELIM ITER, ndc. getNdc())) ; | |
72 | pa dPreviousN dc(ndc); | |
73 | ha ndleNdcPri cingFields (ndc); | |
74 | ||
75 | // getProduc t() should never be null, but check just in case. | |
76 | if (ndc.getP roduct() = = null || ndc.getPro duct().isM inimallyPo pulated()) { | |
77 | LOG.debu g("Retriev ing full p arent prod uct for en forcing ru les."); | |
78 | ndc.setP roduct(ret rieveParen tProduct(n dc)); | |
79 | } | |
80 | ||
81 | if (ndc.getR equestItem Status().i sApproved( ) && ndc.g etProduct( ).getReque stItemStat us().isPen ding()) { | |
82 | errors.a ddError(Er rorKey.PRO DUCT_PENDI NG_NDC_APP ROVED); | |
83 | throw ne w ValueObj ectValidat ionExcepti on(errors) ; | |
84 | } | |
85 | ||
86 | tr y { | |
87 | if (ndc. getProduct ().getItem Status().i sInactive( ) && ndc.g etItemStat us().isAct ive()) { | |
88 | erro rs.addErro r(ErrorKey .PRODUCT_I NACTIVE_ND C_ACTIVE); | |
89 | thro w new Valu eObjectVal idationExc eption(err ors); | |
90 | } | |
91 | } catch (Exc eption e) { | |
92 | // do no thing if t here is an exception . | |
93 | LOG.debu g("Swallow ing except ion.", e); | |
94 | } | |
95 | ||
96 | if (canPerfo rmUpdate) { | |
97 | ||
98 | ItemAudi tHistoryVo audit = n ew ItemAud itHistoryV o(); | |
99 | // This method is called for any modif ication, s o we have to be pret ty vague w ith the re ason. | |
100 | audit.se tReason("C hild NDC " + ndc.get Ndc() + " updated"); | |
101 | audit.se tAuditItem Id(ndc.get Product(). getId()); | |
102 | audit.se tCreatedBy (user.getU sername()) ; | |
103 | audit.se tEventCate gory(Event Category.N ATIONAL_MO DIFICATION ); | |
104 | audit.se tDetailCat egory(Even tCategory. NATIONAL_M ODIFICATIO N); | |
105 | audit.se tAuditItem Type(Entit yType.PROD UCT); | |
106 | audit.se tSiteName( user.getLo cation()); | |
107 | audit.se tUsername( user.getUs ername()); | |
108 | ||
109 | Collecti on<ItemAud itHistoryD etailsVo> collection = new Arr ayList<Ite mAuditHist oryDetails Vo>(); | |
110 | audit.se tDetails(c ollection) ; | |
111 | ||
112 | // Only create a n ew synonym if the ND C is Activ e | |
113 | if (ndc. getItemSta tus().equa ls(ItemSta tus.ACTIVE )) { | |
114 | upda teProductS ynonym(ndc , user, au dit); | |
115 | } | |
116 | updatePr oductGcnSe qNo(ndc, u ser, audit ); | |
117 | ||
118 | if (Coll ectionUtil s.isNotEmp ty(audit.g etDetails( ))) { | |
119 | LOG. debug("Par ent produc t was upda ted. Savin g its Item Audit His tory."); | |
120 | item AuditHisto ryUtility. saveItemAu ditHistory Records(au dit, user) ; | |
121 | } | |
122 | } | |
123 | ||
124 | } | |
125 | ||
126 | /** | |
127 | * Ret rieves the parent pr oduct of t he NDC | |
128 | * | |
129 | * @pa ram ndc nd c | |
130 | * @re turn paren t product | |
131 | * @th rows ItemN otFoundExc eption Ite mNotFoundE xception | |
132 | */ | |
133 | privat e ProductV o retrieve ParentProd uct(NdcVo ndc) throw s ItemNotF oundExcept ion { | |
134 | Pr oductVo pr oduct = (P roductVo) getManaged ItemCapabi lity().ret rieve(ndc. getParentI d(), ndc.g etParent() .getEntity Type()); | |
135 | ||
136 | re turn produ ct; | |
137 | } | |
138 | ||
139 | /** | |
140 | * Pad the NDC v alue with leading ze ros if any of its se gments are not alrea dy of the correct le ngth. | |
141 | * <p> | |
142 | * DF1 44: NDC | |
143 | * <p> | |
144 | * Rul e 3: Provi de leading zeros in each segme nt of the NDC when a segment d oes not ha ve the cor rect numbe r of digit s. | |
145 | * | |
146 | * @pa ram ndc {@ link NdcVo } | |
147 | */ | |
148 | privat e void pad PreviousNd c(NdcVo nd c) { | |
149 | Da taFields<D ataField> vadf = ndc .getVaData Fields(); | |
150 | Da taField<St ring> prev iousNdc = vadf.getDa taField(Fi eldKey.PRE VIOUS_NDC) ; | |
151 | ||
152 | if ((previou sNdc != nu ll) && (pr eviousNdc. getValue() != null) && (!previ ousNdc.get Value().is Empty())) { | |
153 | ||
154 | if ((pre viousNdc.g etValue() != null) & & (previou sNdc.getVa lue().trim ().length( ) > 0)) { | |
155 | prev iousNdc.se lectString Value(padN dcWithLead ingZero(ND C_DELIMITE R, previou sNdc.getVa lue())); | |
156 | ||
157 | } | |
158 | ||
159 | ||
160 | } | |
161 | } | |
162 | ||
163 | ||
164 | /** | |
165 | * Whe n the Unit Price or NDC Price Per Order Unit field s are empt y, enter z ero for th e field va lue before saving th e NDC | |
166 | * ite m. | |
167 | * <p> | |
168 | * For DF200: ND C Price Pe r Dispense Unit, enf orce rules 3-5: | |
169 | * <ul > | |
170 | * <li >Rule 3: T his field is calcula ted by div iding NDC Price per Order Unit (DF202) b y NDC Disp ense Unit per Order Unit | |
171 | * (DF 331).</li> | |
172 | * <li >Rule 4: I f NDC Pric e per Orde r Unit (DF 202) is Em pty or "0. 0", then N DC Price p er Dispens e Unit mus t be set t o | |
173 | * "0. 00".</li> | |
174 | * Rul e 5: If ND C Dispense Unit per Order Unit (DF331) i s Empty or "0.0", th en NDC Pri ce per Dis pense Unit must be s et to | |
175 | * "0. 00".</li> | |
176 | * </u l> | |
177 | * | |
178 | * @pa ram ndc Nd cVo | |
179 | */ | |
180 | privat e void han dleNdcPric ingFields( NdcVo ndc) { | |
181 | Da taFields<D ataField> dataFields = ndc.get VaDataFiel ds(); | |
182 | ||
183 | Da taField<Do uble> unit Price = da taFields.g etDataFiel d(FieldKey .UNIT_PRIC E); | |
184 | ||
185 | if (unitPric e == null) { | |
186 | unitPric e = DataFi eld.newIns tance(Fiel dKey.UNIT_ PRICE); | |
187 | dataFiel ds.setData Field(unit Price); | |
188 | } | |
189 | ||
190 | if (unitPric e.getValue () == null ) { | |
191 | unitPric e.selectVa lue(Double .valueOf(0 )); | |
192 | } | |
193 | ||
194 | Da taField<Do uble> ndcP ricePerOrd erUnit = d ataFields. getDataFie ld(FieldKe y.NDC_PRIC E_PER_ORDE R_UNIT); | |
195 | ||
196 | if (ndcPrice PerOrderUn it == null ) { | |
197 | ndcPrice PerOrderUn it = DataF ield.newIn stance(Fie ldKey.NDC_ PRICE_PER_ ORDER_UNIT ); | |
198 | dataFiel ds.setData Field(ndcP ricePerOrd erUnit); | |
199 | } | |
200 | ||
201 | if (ndcPrice PerOrderUn it.getValu e() == nul l) { | |
202 | ndcPrice PerOrderUn it.selectV alue(Doubl e.valueOf( 0)); | |
203 | } | |
204 | ||
205 | Da taField<Do uble> ndcP ricePerDis penseUnit = dataFiel ds.getData Field(Fiel dKey.NDC_P RICE_PER_D ISPENSE_UN IT); | |
206 | ||
207 | if (ndcPrice PerDispens eUnit == n ull) { | |
208 | ndcPrice PerDispens eUnit = Da taField.ne wInstance( FieldKey.N DC_PRICE_P ER_DISPENS E_UNIT); | |
209 | dataFiel ds.setData Field(ndcP ricePerDis penseUnit) ; | |
210 | } | |
211 | ||
212 | if (ndcPrice PerOrderUn it.getValu e() == 0 | | ndc.getN dcDispUnit sPerOrdUni t() == nul l | |
213 | || ndc.g etNdcDispU nitsPerOrd Unit() == 0) { | |
214 | ndcPrice PerDispens eUnit.sele ctValue(Do uble.value Of(0)); | |
215 | } else { | |
216 | ||
217 | // calcu late the N DC PPOU an d round/fo rmat it to four deci mal digits | |
218 | double c alculatedV alue = ndc PricePerOr derUnit.ge tValue() / ndc.getNd cDispUnits PerOrdUnit (); | |
219 | double r oundedValu e = new Bi gDecimal(c alculatedV alue) | |
220 | .set Scale(PPSC onstants.I 4, BigDeci mal.ROUND_ HALF_UP).d oubleValue (); | |
221 | DecimalF ormat form at = new D ecimalForm at("0.#### "); | |
222 | String f ormatted = format.fo rmat(round edValue); | |
223 | ndcPrice PerDispens eUnit.sele ctValue(Do uble.value Of(formatt ed)); | |
224 | } | |
225 | } | |
226 | ||
227 | /** | |
228 | * Upd ates the p arent prod uct's syno nyms from the NDC. | |
229 | * | |
230 | * @pa ram ndc Nd cVo | |
231 | * @pa ram user U serVo for which to u pdate | |
232 | * @th rows Valid ationExcep tion excep tion | |
233 | */ | |
234 | privat e void upd ateProduct Synonym(Nd cVo ndc, U serVo user , ItemAudi tHistoryVo audit) | |
235 | th rows Valid ationExcep tion { | |
236 | St ring newSy nonym = nd c.getTrade Name().toU pperCase(L ocale.US); | |
237 | ||
238 | // Get curre nt list of synonyms | |
239 | Co llection<S ynonymVo> synonyms = ndc.getPr oduct().ge tSynonyms( ); | |
240 | ||
241 | St ringBuffer synonymNa mes = new StringBuff er(); | |
242 | ||
243 | // Check if NDC's trad e name is already in synonyms | |
244 | fo r (Synonym Vo synonym : synonym s) { | |
245 | if (syno nym.getSyn onymName() != null & & synonym. getSynonym Name().equ als(newSyn onym)) { | |
246 | newS ynonym = n ull; | |
247 | brea k; | |
248 | } | |
249 | synonymN ames.appen d("Synonym Name: " + synonym.g etSynonymN ame() + "< p>"); | |
250 | } | |
251 | ||
252 | // If Trade name was n ot found i n synonyms table | |
253 | if (newSynon ym != null && newSyn onym.lengt h() != 0) { | |
254 | // get t he ndc vad fs | |
255 | DataFields <DataField > vadfs = ndc.get
|
|
256 | ||
257 | // Set s ynonym's p roperties | |
258 | SynonymV o synonymV o = new Sy nonymVo(); | |
259 | synonymV o.setSynon ymName(new Synonym); | |
260 | ||
261 | synonymV o.setNdcCo de(ndc.get Ndc()); | |
262 | ||
263 | // vendo r | |
264 | String v endor = nd c.getVendo r(); | |
265 | ||
266 | if ((ven dor != nul l) && (ven dor.trim() .length() > 0)) { | |
267 | syno nymVo.setS ynonymVend or(vendor) ; | |
268 | } | |
269 | ||
270 | // vendo r stock nu mber | |
271 | String v sn = ndc.g etVendorSt ockNumber( ); | |
272 | ||
273 | if ((vsn != null) && (vsn.tr im().lengt h() > 0)) { | |
274 | syno nymVo.setS ynonymVsn( vsn); | |
275 | } | |
276 | ||
277 | // order unit | |
278 | if (ndc. getOrderUn it() != nu ll) { | |
279 | syno nymVo.setS ynonymOrde rUnit(ndc. getOrderUn it()); | |
280 | } | |
281 | ||
282 | // price per order unit | |
283 | DataFiel d<Double> ndcPPOU = vadfs.getD ataField(F ieldKey.ND C_PRICE_PE R_ORDER_UN IT); | |
284 | ||
285 | if ((ndc PPOU != nu ll) && (nd cPPOU.getV alue() != null) && ( ndcPPOU.ge tValue().d oubleValue () > 0)) { | |
286 | syno nymVo.setS ynonymPric ePerOrderU nit(ndcPPO U.getValue ()); | |
287 | } | |
288 | ||
289 | // price per dispe nse unit | |
290 | DataFiel d<Double> ndcPPDU = vadfs.getD ataField(F ieldKey.ND C_PRICE_PE R_DISPENSE _UNIT); | |
291 | ||
292 | if ((ndc PPDU != nu ll) && (nd cPPDU.getV alue() != null) && ( ndcPPDU.ge tValue().d oubleValue () > 0)) { | |
293 | syno nymVo.setS ynonymPric ePerDispen seUnit(ndc PPDU.getVa lue()); | |
294 | } | |
295 | ||
296 | // NDC's disp unit s per ord unit is an optional field, mak e sure tha t the valu e is not n ull | |
297 | if (ndc. getNdcDisp UnitsPerOr dUnit() != null) { | |
298 | syno nymVo.setS ynonymDisp enseUnitPe rOrderUnit (new Doubl e(ndc.getN dcDispUnit sPerOrdUni t().longVa lue())); | |
299 | } | |
300 | ||
301 | synonymV o.setSynon ymIntended Use(getInt endedUse() ); | |
302 | ||
303 | // Inser t trade na me into sy nonyms tab le | |
304 | ProductD omainCapab ility prod uctDomainC apbility = | |
305 | (Pro ductDomain Capability ) this.get ManagedIte mDomainCap ability(En tityType.P RODUCT); | |
306 | ndc.getP roduct().g etSynonyms ().add(syn onymVo); | |
307 | // Note: we direct ly update the proper ty in the database, skipping a ny normal business l ogic for u pdates. | |
308 | // This works here because s ynonyms ar e not sent to VistA. In the fu ture this update sho uld just u se the | |
309 | // norma l update b usiness lo gic. | |
310 | productD omainCapbi lity.addSi ngleSynony m(synonymV o, ndc.get Product(), user); | |
311 | String s ynonymName sNew = syn onymNames. toString() + "Synony m Name: " + synonymV o.getSynon ymName(); | |
312 | ||
313 | ItemAudi tHistoryDe tailsVo de tail = new ItemAudit HistoryDet ailsVo(); | |
314 | detail.s etColumnNa me("Synony ms"); | |
315 | detail.s etNewValue (synonymNa mesNew); | |
316 | detail.s etEventCat egory(Even tCategory. NATIONAL_M ODIFICATIO N); | |
317 | detail.s etDetailRe ason("New Trade Name added to Product Sy nonym tabl e"); | |
318 | detail.s etOldValue (synonymNa mes.toStri ng()); | |
319 | audit.ad dDetail(de tail); | |
320 | } | |
321 | } | |
322 | ||
323 | /** | |
324 | * Upd ates the G CNSEQNO fo r the NDC' s parent p roduct as appropriat e. | |
325 | * | |
326 | * @pa ram ndc Nd cVo | |
327 | * @pa ram user U serVo for which to u pdate | |
328 | * @th rows Valid ationExcep tion excep tion | |
329 | */ | |
330 | privat e void upd ateProduct GcnSeqNo(N dcVo ndc, UserVo use r, ItemAud itHistoryV o audit) | |
331 | th rows Valid ationExcep tion { | |
332 | Pr oductDomai nCapabilit y productD omainCapbi lity = (Pr oductDomai nCapabilit y) this | |
333 | .getMana gedItemDom ainCapabil ity(Entity Type.PRODU CT); | |
334 | // Put paren t product in a varia ble for co nvenience since we u se it ofte n. | |
335 | fi nal Produc tVo parent Product = ndc.getPro duct(); | |
336 | if (StringUt ils.isBlan k(parentPr oduct.getG cnSequence Number())) { | |
337 | if (ndc. getFdbNdcV o() != nul l && ndc.g etFdbNdcVo ().getGcnS eqno() != null) { | |
338 | pare ntProduct. setGcnSequ enceNumber (ndc.getFd bNdcVo().g etGcnSeqno ().toStrin g()); | |
339 | ||
340 | Item AuditHisto ryDetailsV o detail = new ItemA uditHistor yDetailsVo (); | |
341 | deta il.setColu mnName("GC NSEQNO"); | |
342 | deta il.setNewV alue(paren tProduct.g etGcnSeque nceNumber( )); | |
343 | deta il.setEven tCategory( EventCateg ory.NATION AL_MODIFIC ATION); | |
344 | deta il.setDeta ilReason(" Product GC NSEQNO upd ated from NDC"); | |
345 | deta il.setOldV alue(""); | |
346 | audi t.addDetai l(detail); | |
347 | ||
348 | // N ote: we di rectly upd ate the pr operty in the databa se, skippi ng any nor mal busine ss logic f or updates . | |
349 | // T his works here becau se GCNSEQN O's are al ways sent for every product in the updat e file. In the futur e | |
350 | // t his update should ju st use the normal up date busin ess logic. | |
351 | prod uctDomainC apbility.u pdateGcnSe qNo(parent Product, u ser); | |
352 | } | |
353 | } | |
354 | } | |
355 | ||
356 | @Overr ide | |
357 | public Errors ch eckForWarn ings(NdcVo item, Col lection<Mo dDifferenc eVo> modDi fferences, boolean n ewAdd) | |
358 | th rows Valid ationExcep tion { | |
359 | ||
360 | Er rors warni ngs = supe r.checkFor Warnings(i tem, modDi fferences, newAdd); | |
361 | ||
362 | Pr oductVo pr oduct = re trievePare ntProduct( item); | |
363 | ||
364 | if (item.get RequestIte mStatus(). isPending( ) && produ ct.getRequ estItemSta tus().isPe nding()) { | |
365 | warnings .addError( ErrorKey.P RODUCT_AND _NDC_PENDI NG); | |
366 | } | |
367 | ||
368 | ||
369 | //REMOVED this code on 4/3 bec aue the VA doesn't w ant this w arning mes sage. | |
370 | //Left it here in ca se they ch ange their mind. | |
371 | ||
372 | // if (modDif ferences ! = null && modDiffere nces.size( ) > 0) { | |
373 | // Iterat or itr = m odDifferen ces.iterat or(); | |
374 | // | |
375 | // while (itr.hasNe xt()) { | |
376 | // | |
377 | // Mo dDifferenc eVo modDif ferenceVo = (ModDiff erenceVo) (itr.next( )); | |
378 | // Di fference d ifference = modDiffe renceVo.ge tDifferenc e(); | |
379 | // | |
380 | // if (differen ce.getFiel dKey().equ als(FieldK ey.PRODUCT )) { | |
381 | // ProductV o newValue = (Produc tVo) diffe rence.getN ewValue(); | |
382 | // ProductV o oldValue = (Produc tVo) diffe rence.getO ldValue(); | |
383 | // | |
384 | // if (oldV alue != nu ll && newV alue != nu ll && oldV alue.getGc nSequenceN umber() != null | |
385 | // && n ewValue.ge tGcnSequen ceNumber() != null) { | |
386 | // | |
387 | // if ( !(oldValue .getGcnSeq uenceNumbe r().equals IgnoreCase (newValue. getGcnSequ enceNumber ()))) { | |
388 | // Object[] a rgs = { ol dValue.get GcnSequenc eNumber(), newValue. get DNS ductName() , | |
389 | // newVal ue.getGcnS equenceNum ber() }; | |
390 | // warnings.a ddError(Er rorKey.GCN _SEQNUM_NO MATCH, arg s); | |
391 | // } | |
392 | // } | |
393 | // } | |
394 | // } | |
395 | // } | |
396 | ||
397 | ||
398 | if (item.get Parent().g etGcnSeque nceNumber( ) != null | |
399 | && item. getFdbNdcV o() != nul l) { | |
400 | if (!(it em.getFdbN dcVo().get GcnSeqno() .equals(ne w Long(ite m.getParen t().getGcn SequenceNu mber())))) { | |
401 | String nam e = ((Prod uctVo) ite m.getParen t()).get DNS ductName() ; | |
402 | Obje ct[] args = { item.g etFdbNdcVo ().getGcnS eqno(), na me, item.g etParent() .getGcnSeq uenceNumbe r()}; | |
403 | warn ings.addEr ror(ErrorK ey.GCN_FDB SEQNUM_NOM ATCH, args ); | |
404 | } | |
405 | } | |
406 | ||
407 | re turn warni ngs; | |
408 | } | |
409 | ||
410 | /** | |
411 | * Get Intended user for T rade Name | |
412 | * | |
413 | * | |
414 | * @re turn Inten dedUseVo | |
415 | * @th rows ItemN otFoundExc eption whe n intended use for t rade name not found | |
416 | */ | |
417 | privat e Intended UseVo getI ntendedUse () throws ItemNotFou ndExceptio n { | |
418 | ||
419 | In tendedUseV o intended UseVo = nu ll; | |
420 | Li st<Intende dUseVo> in tendedUseL ist = inte ndedUseDom ainCapabil ity.retrie veDomain() ; | |
421 | ||
422 | fo r (Intende dUseVo int endedUse : intendedU seList) { | |
423 | if (inte ndedUse.is TradeName( )) { | |
424 | inte ndedUseVo = intended Use; | |
425 | brea k; | |
426 | } | |
427 | } | |
428 | ||
429 | // Throw exc eption if item not f ound | |
430 | if (intended UseVo == n ull) { | |
431 | throw ne w DomainEx ception(Do mainExcept ion.DATA_N OT_FOUND, new Object [] {"'Trad e Name' In tended Use selection "}); | |
432 | } | |
433 | ||
434 | re turn inten dedUseVo; | |
435 | } | |
436 | ||
437 | public void setI ntendedUse DomainCapa bility(Int endedUseDo mainCapabi lity inten dedUseDoma inCapabili ty) { | |
438 | th is.intende dUseDomain Capability = intende dUseDomain Capability ; | |
439 | } | |
440 | ||
441 | /** | |
442 | * Set ter for Sp ring. | |
443 | * @pa ram pNotif icationDom ainCapabil ity the de pendency t o set | |
444 | */ | |
445 | public void setN otificatio nDomainCap ability(No tification DomainCapa bility pNo tification DomainCapa bility) { | |
446 | // Note that we don't save the N otificatio nDomainCap ability bu t just cre ate an Ite mAuditHist oryUtility from it. | |
447 | it emAuditHis toryUtilit y = new It emAuditHis toryUtilit y(pNotific ationDomai nCapabilit y); | |
448 | } | |
449 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.