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