Produced by Araxis Merge on 4/2/2019 1:06:55 PM Central Daylight 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 | C:\AraxisMergeCompare\Pri_un\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\service\impl | RfaiUpdateSubmissionServiceImpl.java | Wed Mar 27 19:22:44 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ARS_Backend\ars_app\src\main\java\gov\va\med\ars\service\impl | RfaiUpdateSubmissionServiceImpl.java | Thu Mar 28 17:50:56 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 324 |
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.a rs.service .impl; | |
2 | ||
3 | import jav a.text.Dat eFormat; | |
4 | import jav a.text.Par seExceptio n; | |
5 | import jav a.text.Sim pleDateFor mat; | |
6 | import jav a.util.Dat e; | |
7 | import jav a.util.Lis t; | |
8 | ||
9 | import org .apache.lo g4j.LogMan ager; | |
10 | import org .apache.lo g4j.Logger ; | |
11 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
12 | import org .springfra mework.ste reotype.Se rvice; | |
13 | ||
14 | import gov .va.med.ar s.constant s.ClaimSub missionCon stants; | |
15 | import gov .va.med.ar s.dao.ars. ClaimConta ctReposito ry; | |
16 | import gov .va.med.ar s.dao.ars. ClaimSubmi ssionNoteR epository; | |
17 | import gov .va.med.ar s.dao.ars. EmailTempl ateReposit ory; | |
18 | import gov .va.med.ar s.dao.ars. IClaimSubm issionRepo sitory; | |
19 | import gov .va.med.ar s.exceptio ns.EntityN otFoundExc eption; | |
20 | import gov .va.med.ar s.model.re quest.Upda teRfaiRequ est; | |
21 | import gov .va.med.ar s.service. IRfaiUpdat eSubmissio nService; | |
22 | import gov .va.med.ar s.util.Ema il; | |
23 | import gov .va.med.ar s.util.Ema ilInfo; | |
24 | import gov .va.med.do main.ars.C laimContac t; | |
25 | import gov .va.med.do main.ars.C laimSubmis sion; | |
26 | import gov .va.med.do main.ars.C laimSubmis sionNote; | |
27 | import gov .va.med.do main.ars.E mailTempla te; | |
28 | ||
29 | /** | |
30 | * @author DN S DRAGOD | |
31 | * | |
32 | */ | |
33 | @Service | |
34 | public cla ss RfaiUpd ateSubmiss ionService Impl imple ments IRfa iUpdateSub missionSer vice { | |
35 | ||
36 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(Rfai UpdateSubm issionServ iceImpl.cl ass); | |
37 | ||
38 | Da teFormat d ateFormat = new Simp leDateForm at("MM/dd/ yyyy"); | |
39 | ||
40 | @A utowired | |
41 | IC laimSubmis sionReposi tory rfaiR epo; | |
42 | ||
43 | @A utowired | |
44 | Cl aimSubmiss ionNoteRep ository cl aimSubmiss ionNoteRep o; | |
45 | ||
46 | @A utowired | |
47 | Em ailTemplat eRepositor y emailRep o; | |
48 | ||
49 | @A utowired | |
50 | Cl aimContact Repository claimCont actRepo; | |
51 | ||
52 | @A utowired | |
53 | Em ailInfo in fo; | |
54 | ||
55 | pu blic boole an submitS impleUpdat e(UpdateRf aiRequest updateRfai Request) | |
56 | throws ParseExce ption, Ent ityNotFoun dException { | |
57 | ||
58 | Stri ng oldStat us = null; | |
59 | ||
60 | Clai mSubmissio nNote subm ittedNote = null; | |
61 | ||
62 | try { | |
63 | ||
64 | Date o perationTi me = new D ate(System .currentTi meMillis() ); | |
65 | ||
66 | ClaimS ubmission claimSubmi ssionBeing Updated = rfaiRepo.f indOne(upd ateRfaiReq uest.getSu bmissionId ()); | |
67 | ||
68 | if (cl aimSubmiss ionBeingUp dated == n ull) { | |
69 | throw ne w EntityNo tFoundExce ption(Stri ng.valueOf (updateRfa iRequest.g etSubmissi onId())); | |
70 | } | |
71 | ||
72 | String originalC laimStatus = claimSu bmissionBe ingUpdated .getSubmis sionStatus (); | |
73 | if (up dateRfaiRe quest.getS ubmissionS tatus().eq ualsIgnore Case("SUBM ITTED") | |
74 | && (origin alClaimSta tus.equals IgnoreCase ("COMPLETE ") | |
75 | || o riginalCla imStatus.e qualsIgnor eCase("ERR OR") | |
76 | || o riginalCla imStatus.e qualsIgnor eCase("ABA NDONED") | |
77 | || o riginalCla imStatus.e qualsIgnor eCase("MAN UALLY CLOS ED"))) { | |
78 | return f alse; | |
79 | } | |
80 | ||
81 | oldSta tus = clai mSubmissio nBeingUpda ted.getSub missionSta tus(); | |
82 | ||
83 | if (!c heckIfSubm issionBeUp dated(oldS tatus, upd ateRfaiReq uest.getSu bmissionSt atus())) { | |
84 | return B oolean.FAL SE; | |
85 | } | |
86 | claimS ubmissionB eingUpdate d.setDtp20 3responsed uedate(dat eFormat.pa rse(update RfaiReques t.getRespo nseDate()) ); | |
87 | claimS ubmissionB eingUpdate d.setSubmi ssionStatu s(updateRf aiRequest. getSubmiss ionStatus( )); | |
88 | claimS ubmissionB eingUpdate d.setDatem odified(op erationTim e); | |
89 | ||
90 | logger .info("Sta rt of rfai Repo.save( )"); | |
91 | ||
92 | Date r esponseDat e = dateFo rmat.parse (updateRfa iRequest.g etResponse Date()); | |
93 | ||
94 | rfaiRe po.updateS ubmissionS tatus(upda teRfaiRequ est.getSub missionId( ), | |
95 | updateRfai Request.ge tSubmissio nStatus(), responseD ate, new D ate()); | |
96 | ClaimS ubmissionN ote newCla imSubmissi onNote = n ew ClaimSu bmissionNo te(); | |
97 | ||
98 | newCla imSubmissi onNote.set ClaimSubmi ssion(clai mSubmissio nBeingUpda ted); | |
99 | newCla imSubmissi onNote.set ClaimSubmi ssionNoteT xt(updateR faiRequest .getSubmis sionNote() ); | |
100 | newCla imSubmissi onNote.set ClaimsSubm issionOldS tatus(oldS tatus); | |
101 | newCla imSubmissi onNote.set ClaimsSubm issionNewS tatus(clai mSubmissio nBeingUpda ted.getSub missionSta tus()); | |
102 | newCla imSubmissi onNote.set Datecreate d(operatio nTime); | |
103 | ||
104 | submit tedNote = claimSubmi ssionNoteR epo.save(n ewClaimSub missionNot e); | |
105 | List<C laimContac t> claimCo ntacts = c laimContac tRepo.find AllByclaim Submission s(claimSub missionBei ngUpdated) ; | |
106 | sendSt atusChange Email(clai mSubmissio nBeingUpda ted, claim Contacts); | |
107 | ||
108 | } ca tch (Parse Exception e) { | |
109 | logger .info(Stri ng.format( "Couldn't parse date %s into M M/dd/yyyy format", | |
110 | updateRfai Request.ge tResponseD ate())); | |
111 | logger .warn(e.ge tMessage() , e); | |
112 | throw e; | |
113 | } ca tch (Entit yNotFoundE xception e ) { | |
114 | logger .info(Stri ng.format( "Error att empting to lookup cl aim with C LAIM_SUBMI SSION.SUBM ISSIONID o f %s", | |
115 | updateRfai Request.ge tSubmissio nId())); | |
116 | logger .warn(e.ge tMessage() , e); | |
117 | throw e; | |
118 | } | |
119 | ||
120 | retu rn submitt edNote != null && su bmittedNot e.getClaim Submission NoteId() ! = null; | |
121 | } | |
122 | ||
123 | pr ivate void sendStatu sChangeEma il(ClaimSu bmission c laimSubmis sion, List <ClaimCont act> claim Contacts) { | |
124 | Stri ng templat eType = Em ail.getTem plateName( claimSubmi ssion.getS ubmissionS tatus()); | |
125 | ||
126 | if ( !templateT ype.equals ("Invalid Status")) { | |
127 | EmailT emplate te mplate = e mailRepo.g etEmailTem plateByTyp e(template Type); | |
128 | Email email = ne w Email(); | |
129 | try { | |
130 | email.po stMail(cla imSubmissi on, templa te, info, claimConta cts); | |
131 | } catc h (Excepti on e) { | |
132 | logger.e rror(e.get Message()) ; | |
133 | } | |
134 | } el se { | |
135 | logger .error("Su bmission s tatus is i nvalid"); | |
136 | } | |
137 | } | |
138 | ||
139 | // Submissio n status c an only be changed f rom submit ted to man ually clos ed, | |
140 | // Submissio n status c annot be c hanged if it is comp lete,error ,abandoned or | |
141 | // manually closed alr eady | |
142 | pr ivate Bool ean checkI fSubmissio nBeUpdated (String ol dStatus, S tring newS tatus) { | |
143 | if ( oldStatus. equals(Cla imSubmissi onConstant s.SUBMISSI ON_COMPLET E_STATUS) | |
144 | && newSt atus.equal sIgnoreCas e(ClaimSub missionCon stants.SUB MISSION_CO MPLETE_STA TUS)) { | |
145 | return Boolean.T RUE; | |
146 | } el se if (old Status.equ als(ClaimS ubmissionC onstants.S UBMISSION_ ABANDONED_ STATUS) | |
147 | && newSt atus.equal sIgnoreCas e(ClaimSub missionCon stants.SUB MISSION_AB ANDONED_ST ATUS)) { | |
148 | return Boolean.T RUE; | |
149 | } el se if (old Status.equ als(ClaimS ubmissionC onstants.S UBMISSION_ MANUALLY_C LOSED_STAT US) | |
150 | && newSt atus.equal sIgnoreCas e(ClaimSub missionCon stants.SUB MISSION_MA NUALLY_CLO SED_STATUS )) { | |
151 | return Boolean.T RUE; | |
152 | } el se if (old Status.equ als(ClaimS ubmissionC onstants.S UBMISSION_ ERROR_STAT US) | |
153 | && newSt atus.equal sIgnoreCas e(ClaimSub missionCon stants.SUB MISSION_ER ROR_STATUS )) { | |
154 | return Boolean.T RUE; | |
155 | } el se if (old Status.equ alsIgnoreC ase(ClaimS ubmissionC onstants.S UBMISSION_ SUBMITTED_ STATUS) | |
156 | && (newS tatus.equa lsIgnoreCa se(ClaimSu bmissionCo nstants.SU BMISSION_S UBMITTED_S TATUS)) | |
157 | || newSt atus.equal sIgnoreCas e(ClaimSub missionCon stants.SUB MISSION_MA NUALLY_CLO SED_STATUS )) { | |
158 | return Boolean.T RUE; | |
159 | } el se { | |
160 | return Boolean.F ALSE; | |
161 | } | |
162 | } | |
163 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.