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 | ArsMailServiceImpl.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 | ArsMailServiceImpl.java | Fri Mar 29 17:28:31 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 240 |
Changed | 2 | 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 | package go v.va.med.a rs.service .impl; | |
2 | ||
3 | import jav a.math.Big Integer; | |
4 | import jav a.util.Cal endar; | |
5 | import jav a.util.Gre gorianCale ndar; | |
6 | import jav a.util.Pro perties; | |
7 | ||
8 | import jav ax.mail.Me ssage; | |
9 | import jav ax.mail.Me ssagingExc eption; | |
10 | import jav ax.mail.Se ssion; | |
11 | import jav ax.mail.Tr ansport; | |
12 | import jav ax.mail.in ternet.Add ressExcept ion; | |
13 | import jav ax.mail.in ternet.Int ernetAddre ss; | |
14 | import jav ax.mail.in ternet.Mim eMessage; | |
15 | ||
16 | import org .apache.lo gging.log4 j.LogManag er; | |
17 | import org .apache.lo gging.log4 j.Logger; | |
18 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
19 | import org .springfra mework.bea ns.factory .annotatio n.Configur able; | |
20 | import org .springfra mework.ste reotype.Se rvice; | |
21 | ||
22 | import gov .va.med.ar s.dao.ars. IClaimSubm issionRepo sitory; | |
23 | import gov .va.med.ar s.exceptio ns.Generic Exception; | |
24 | import gov .va.med.ar s.model.re quest.ArsM ailRequest ; | |
25 | import gov .va.med.ar s.service. IArsMailSe rvice; | |
26 | import gov .va.med.do main.ars.C laimSubmis sion; | |
27 | ||
28 | @Service | |
29 | @Configura ble | |
30 | public cla ss ArsMail ServiceImp l implemen ts IArsMai lService { | |
31 | pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(ArsM ailService Impl.class ); | |
32 | pr ivate stat ic final S tring BREA K = "<br/> "; | |
33 | ||
34 | @A utowired | |
35 | pr ivate ICla imSubmissi onReposito ry claimSu bmissionRe pository; | |
36 | ||
37 | @O verride | |
38 | pu blic Strin g sendArsM ail(ArsMai lRequest r equest) th rows Gener icExceptio n { | |
39 | Stri ng[] recip ients = ne w String[r equest.get EmailTo(). size()]; | |
40 | reci pients = r equest.get EmailTo(). toArray(re cipients); | |
41 | bool ean debug = false; | |
42 | Stri ng ret = " "; | |
43 | ||
44 | // S et the hos t smtp add ress | |
45 | Prop erties pro ps = new P roperties( ); | |
46 | props.put( "mail.smtp .host", " DNS "); | |
47 | props.put( "mail.host ", " DNS "); | |
48 | ||
49 | // c reate some propertie s and get the defaul t Session | |
50 | Sess ion sessio n = Sessio n.getInsta nce(props) ; | |
51 | sess ion.setDeb ug(debug); | |
52 | ||
53 | // c reate a me ssage | |
54 | Mess age msg = new MimeMe ssage(sess ion); | |
55 | ||
56 | // s et the fro m and to a ddress | |
57 | Inte rnetAddres s addressF rom; | |
58 | try { | |
59 | addres sFrom = ne w Internet Address(re quest.getE mailFrom() ); | |
60 | msg.se tFrom(addr essFrom); | |
61 | } ca tch (Excep tion e1) { | |
62 | // TOD O Auto-gen erated cat ch block | |
63 | e1.pri ntStackTra ce(); | |
64 | } | |
65 | ||
66 | Inte rnetAddres s[] addres sTo = new InternetAd dress[reci pients.len gth]; | |
67 | ||
68 | try { | |
69 | for (i nt i = 0; i < recipi ents.lengt h; i++) { | |
70 | if (reci pients[i] != null && !recipien ts[i].equa ls("")) { | |
71 | InternetAd dress addr essTemp = new Intern etAddress( recipients [i]); | |
72 | addressTem p.validate (); | |
73 | addressTo[ i] = addre ssTemp; | |
74 | } | |
75 | } | |
76 | msg.se tRecipient s(Message. RecipientT ype.TO, ad dressTo); | |
77 | ||
78 | ClaimS ubmission claimSubmi ssion = cl aimSubmiss ionReposit ory | |
79 | .findOne(n ew BigInte ger(reques t.getSubmi ssionId()) ); | |
80 | ||
81 | // Set ting the S ubject and Content T ype | |
82 | msg.se tSubject(" ARS Submis sion " + c laimSubmis sion.getSu bmissionid () + " Upd ate"); | |
83 | msg.se tContent(b uildEmailB ody(claimS ubmission) , "text/ht ml"); | |
84 | Transp ort.send(m sg); | |
85 | Gregor ianCalenda r gc = new Gregorian Calendar() ; | |
86 | String dts = (gc .get(Calen dar.MONTH) + 1) + "/ " + gc.get (Calendar. DAY_OF_MON TH) + "/" | |
87 | + gc.get(C alendar.YE AR) + " at " + gc.ge t(Calendar .HOUR_OF_D AY) + ":" + gc.get(C alendar.MI NUTE) | |
88 | + ":" + gc .get(Calen dar.SECOND ); | |
89 | ret += "message sent at " + dts; | |
90 | } ca tch (Addre ssExceptio n ae) { | |
91 | ret += "AddressE xception E RROR: " + ae.getMess age(); | |
92 | logger .error(ae. getMessage (), ae); | |
93 | } ca tch (Messa gingExcept ion me) { | |
94 | ret += "Messagin gException Error: " + me.getMe ssage(); | |
95 | logger .error(me. getMessage (), me); | |
96 | } ca tch (Excep tion e) { | |
97 | ret += "Exceptio n Error: " + e.getMe ssage(); | |
98 | logger .error(e.g etMessage( ), e); | |
99 | } | |
100 | retu rn ret; | |
101 | } | |
102 | ||
103 | pu blic stati c String b uildEmailB ody(ClaimS ubmission claimSubmi ssion) { | |
104 | // c reate the email body | |
105 | Stri ngBuffer e mailBodyBu ffer = new StringBuf fer(); | |
106 | Stri ng emailBo dy = "The submission " + claim Submission .getSubmis sionid() + " for the following claim " | |
107 | + claimS ubmission. getTrn02cl aimIndex() + " has b een update d to " | |
108 | + claimS ubmission. getSubmiss ionStatus( ); | |
109 | emai lBodyBuffe r.append(" Hello,"); | |
110 | emai lBodyBuffe r.append(B REAK); | |
111 | emai lBodyBuffe r.append(B REAK); | |
112 | emai lBodyBuffe r.append(e mailBody); | |
113 | emai lBodyBuffe r.append(B REAK); | |
114 | emai lBodyBuffe r.append(B REAK); | |
115 | emai lBodyBuffe r.append(" Thanks,"); | |
116 | emai lBodyBuffe r.append(B REAK); | |
117 | emai lBodyBuffe r.append(" ARS Roboti c Program" ); | |
118 | emai lBodyBuffe r.append(B REAK); | |
119 | emai lBodyBuffe r.append(B REAK); | |
120 | emailBodyB uffer.appe nd("<a hre f='https:/ / SERVER . DOMAIN : PORT '>ARS Logi n in</a>") ; | |
121 | retu rn emailBo dyBuffer.t oString(); | |
122 | } | |
123 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.