8. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/13/2019 2:49:37 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.

8.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\DSM\Direct Implementation\java\client\src\main\java\org\nhindirect\xdm XDMMailClient.java Tue Mar 12 21:59:40 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\DSM-scrubbed\Direct Implementation\java\client\src\main\java\org\nhindirect\xdm XDMMailClient.java Wed Mar 13 13:43:38 2019 UTC

8.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 388
Changed 1 4
Inserted 0 0
Removed 0 0

8.3 Comparison options

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

8.4 Active regular expressions

No regular expressions were active.

8.5 Comparison detail

  1   /* 
  2    * Copyrig ht (c) 201 0, NHIN Di rect Proje ct
  3    * All rig hts reserv ed.
  4    *  
  5    * Redistr ibution an d use in s ource and  binary for ms, with o r without 
  6    * modific ation, are  permitted  provided  that the f ollowing c onditions  are met:
  7    * 
  8    * 1. Redi stribution s of sourc e code mus t retain t he above c opyright 
  9    *    noti ce, this l ist of con ditions an d the foll owing disc laimer.
  10    * 2. Redi stribution s in binar y form mus t reproduc e the abov e copyrigh
  11    *    noti ce, this l ist of con ditions an d the foll owing disc laimer in  the 
  12    *    docu mentation  and/or oth er materia ls provide d with the  distribut ion.  
  13    * 3. Neit her the na me of the  the NHIN D irect Proj ect (nhind irect.org)
  14    *    nor  the names  of its con tributors  may be use d to endor se or prom ote produc ts 
  15    *    deri ved from t his softwa re without  specific  prior writ ten permis sion.
  16    * 
  17    * THIS SO FTWARE IS  PROVIDED B Y THE COPY RIGHT HOLD ERS AND CO NTRIBUTORS  "AS IS" A ND ANY 
  18    * EXPRESS  OR IMPLIE D WARRANTI ES, INCLUD ING, BUT N OT LIMITED  TO, THE I MPLIED 
  19    * WARRANT IES OF MER CHANTABILI TY AND FIT NESS FOR A  PARTICULA R PURPOSE  ARE 
  20    * DISCLAI MED. IN NO  EVENT SHA LL THE COP YRIGHT HOL DER OR CON TRIBUTORS  BE LIABLE  FOR ANY 
  21    * DIRECT,  INDIRECT,  INCIDENTA L, SPECIAL , EXEMPLAR Y, OR CONS EQUENTIAL  DAMAGES 
  22    * (INCLUD ING, BUT N OT LIMITED  TO, PROCU REMENT OF  SUBSTITUTE  GOODS OR  SERVICES; 
  23    * LOSS OF  USE, DATA , OR PROFI TS; OR BUS INESS INTE RRUPTION)  HOWEVER CA USED AND 
  24    * ON ANY  THEORY OF  LIABILITY,  WHETHER I N CONTRACT , STRICT L IABILITY,  OR TORT 
  25    * (INCLUD ING NEGLIG ENCE OR OT HERWISE) A RISING IN  ANY WAY OU T OF THE U SE OF THIS  
  26    * SOFTWAR E, EVEN IF  ADVISED O F THE POSS IBILITY OF  SUCH DAMA GE.
  27    */
  28  
  29   package or g.nhindire ct.xdm;
  30  
  31   import jav a.io.IOExc eption;
  32   import jav a.util.Col lection;
  33   import jav a.util.Lis t;
  34   import jav a.util.Pro perties;
  35   import jav a.util.UUI D;
  36   import jav a.util.log ging.Logge r;
  37  
  38   import jav ax.activat ion.DataHa ndler;
  39   import jav ax.mail.Au thenticato r;
  40   import jav ax.mail.Me ssage;
  41   import jav ax.mail.Me ssagingExc eption;
  42   import jav ax.mail.Mu ltipart;
  43   import jav ax.mail.Pa sswordAuth entication ;
  44   import jav ax.mail.Se ssion;
  45   import jav ax.mail.Tr ansport;
  46   import jav ax.mail.in ternet.Int ernetAddre ss;
  47   import jav ax.mail.in ternet.Mim eBodyPart;
  48   import jav ax.mail.in ternet.Mim eMessage;
  49   import jav ax.mail.in ternet.Mim eMultipart ;
  50  
  51   import org .nhindirec t.xd.commo n.DirectDo cuments;
  52  
  53   /**
  54    * This cl ass handle s the pack aging and  sending of  XDM data  over SMTP.
  55    * 
  56    * @author  vlewis
  57    */
  58   public cla ss XDMMail Client
  59   {
  60  
  61       privat e MimeMess age mmessa ge;
  62       privat e Multipar t mailBody ;
  63       privat e MimeBody Part mainB ody;
  64       privat e MimeBody Part mimeA ttach;
  65  
  66       privat e String s mtpHostNam e;
  67       privat e String s mtpAuthUse r;
  68       privat e String s mtpAuthPwd ;
  69  
  70       @Suppr essWarning s("unused" )
  71       privat e static f inal Logge r LOGGER =  Logger.ge tLogger(XD MMailClien t.class.ge tPackage() .getName() );
  72  
  73       public  XDMMailCl ient(Strin g smtpHost Name, Stri ng smtpAut hUser, Str ing smtpAu thPwd)
  74       {
  75           th is.smtpHos tName = sm tpHostName ;
  76           th is.smtpAut hUser = sm tpAuthUser ;
  77           th is.smtpAut hPwd = smt pAuthPwd;
  78       }
  79  
  80       public  void send Mail(Strin g from, Co llection<S tring> rec ipients, D irectDocum ents docum ents, Stri ng body,
  81                String s uffix) thr ows Messag ingExcepti on
  82       {
  83           St ring messa geId = UUI D.randomUU ID().toStr ing();
  84  
  85           se ndMail(mes sageId, fr om, (List< String>) r ecipients,  body, doc uments, su ffix);
  86       }
  87  
  88       public  void send Mail(Strin g from, Li st<String>  recipient s, String  body, Dire ctDocument s document s, String  suffix)
  89                throws M essagingEx ception
  90       {
  91           St ring messa geId = UUI D.randomUU ID().toStr ing();
  92           se ndMail(mes sageId, fr om, recipi ents, body , document s, suffix) ;
  93       }
  94  
  95       /**
  96        * Cre ate and se nd a messa ge over SM TP.
  97        * 
  98        * @pa ram recipi ents
  99        *             Th e list of  recipient  addresses  for the ma il message .
  100        * @pa ram subjec t
  101        *             Th e subject  of the mai l message.
  102        * @pa ram messag eId
  103        *             Th e message  ID.
  104        * @pa ram body
  105        *             Th e body bod y of the m essage.
  106        * @pa ram messag e
  107        *             Th e data to  be zipped  and attach ed to the  mail messa ge.
  108        * @pa ram from
  109        *             Th e sender o f the mail  message.
  110        * @pa ram suffix
  111        *             Th e suffix o f the data  to be zip ped and at tached to  the mail
  112        *             me ssage.
  113        * @pa ram meta
  114        *             Th e metadata  to be inc luded in t he zip and  attached  to the
  115        *             ma il message .
  116        * @th rows Messa gingExcept ion
  117        */
  118       public  void send Mail(Strin g messageI d, String  from, List <String> r ecipients,  String bo dy,
  119                DirectDo cuments do cuments, S tring suff ix) throws  Messaging Exception
  120       {
  121           bo olean debu g = false;
  122           ja va.securit y.Security .addProvid er(new com .sun.net.s sl.interna l.ssl.Prov ider());
  123  
  124           St ring subje ct = "data ";
  125  
  126           //  Set the h ost SMTP a ddress
  127           Pr operties p rops = new  Propertie s();
  128           pr ops.put("m ail.transp ort.protoc ol", "smtp ");
  129           pr ops.put("m ail.smtp.s tarttls.en able", "tr ue");
  130           pr ops.put("m ail.smtp.h ost", smtp HostName);
  131           pr ops.put("m ail.smtp.a uth", "tru e");
  132  
  133           Au thenticato r auth = n ew SMTPAut henticator ();
  134           Se ssion sess ion = Sess ion.getIns tance(prop s, auth);
  135  
  136           se ssion.setD ebug(debug );
  137  
  138           In ternetAddr ess addres sFrom = ne w Internet Address(fr om);
  139  
  140           In ternetAddr ess[] addr essTo = ne w Internet Address[re cipients.s ize()];
  141           in t i = 0;
  142           fo r (String  recipient  : recipien ts)
  143           {
  144                addressT o[i++] = n ew Interne tAddress(r ecipient);
  145           }
  146  
  147           //  Build mes sage objec t
  148           mm essage = n ew MimeMes sage(sessi on);
  149           mm essage.set From(addre ssFrom);
  150           mm essage.set Recipients (Message.R ecipientTy pe.TO, add ressTo);
  151           mm essage.set Subject(su bject);
  152  
  153           ma ilBody = n ew MimeMul tipart();
  154  
  155           ma inBody = n ew MimeBod yPart();
  156           ma inBody.set DataHandle r(new Data Handler(bo dy, "text/ plain"));
  157           ma ilBody.add BodyPart(m ainBody);
  158  
  159           tr y
  160           {
  161                mimeAtta ch = new M imeBodyPar t();
  162                mimeAtta ch.attachF ile(docume nts.toXdmP ackage(mes sageId).to File());
  163           }
  164           ca tch (IOExc eption e)
  165           {
  166                throw ne w Messagin gException ("Unable t o create/a ttach xdm  file", e);
  167           }
  168  
  169           ma ilBody.add BodyPart(m imeAttach) ;
  170  
  171           mm essage.set Content(ma ilBody);
  172           Tr ansport.se nd(mmessag e);
  173  
  174       }
  175  
  176       /**
  177        * Sim pleAuthent icator is  used to do  simple au thenticati on when th e SMTP
  178        * ser ver requir es it.
  179        */
  180       privat e class SM TPAuthenti cator exte nds javax. mail.Authe nticator
  181       {
  182           /*
  183            *  (non-Java doc)
  184            *  
  185            *  @see java x.mail.Aut henticator #getPasswo rdAuthenti cation()
  186            * /
  187           @O verride
  188           pu blic Passw ordAuthent ication ge tPasswordA uthenticat ion()
  189           {
  190                  String use rname = 
A I ;
  191                  String pas sword = 
A I ;
  192                return n ew Passwor dAuthentic ation(user name, pass word);
  193           }
  194       }
  195  
  196   }