3330. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:50:05 PM Eastern 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.

3330.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:50:05 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-ext-svc-facades\src\main\java\gov\va\nvap\extsvc\psim\impl PersonServiceEndpoint.java Fri Apr 21 20:03:26 2017 UTC

3330.2 Comparison summary

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

3330.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

3330.4 Active regular expressions

No regular expressions were active.

3330.5 Comparison detail

        1   /*
        2    * To chan ge this te mplate, ch oose Tools  | Templat es
        3    * and ope n the temp late in th e editor.
        4    */
        5   package go v.va.nvap. extsvc.psi m.impl;
        6  
        7   import gov .va.nvap.c ommon.util .IcnChecks um;
        8   import gov .va.nvap.e xtsvc.psim .intf.Pers onServiceE xception;
        9   import gov .va.nvap.e xtsvc.psim .intf.Pers onServiceI nterface;
        10  
        11   import jav a.io.Strin gReader;
        12   import jav a.io.Strin gWriter;
        13   import jav a.util.Arr ayList;
        14   import jav a.util.Lis t;
        15  
        16   import jav ax.xml.tra nsform.str eam.Stream Result;
        17   import jav ax.xml.tra nsform.str eam.Stream Source;
        18  
        19   import org .apache.co mmons.lang .StringEsc apeUtils;
        20   import org .dom4j.Doc ument;
        21   import org .dom4j.Doc umentExcep tion;
        22   import org .dom4j.Ele ment;
        23   import org .dom4j.io. SAXReader;
        24   import org .springfra mework.ws. client.cor e.WebServi ceTemplate ;
        25  
        26   /**
        27    * 
        28    * @author  vhaislegb erb
        29    */
        30   public cla ss PersonS erviceEndp oint imple ments Pers onServiceI nterface {
        31  
        32           pr ivate stat ic String  GET_CORRES PONDING_ID S = "<m:ge tCorrespon dingIds xm lns:m=\"PS IM\"><vpid str xsi:ty pe=\"xsd:s tring\" "
        33                             + "xml ns:xsi=\"h ttp://www. w3.org/200 1/XMLSchem a-instance \" "
        34                             + "xml ns:soapenc =\"http:// schemas.xm lsoap.org/ soap/encod ing/\" "
        35                             + "xml ns:xsd=\"h ttp://www. w3.org/200 1/XMLSchem a\" >%s</v pidstr>"
        36                             + "</m :getCorres pondingIds >";
        37  
        38           pr ivate stat ic String  GET_CORRES PONDING_ID S_VPIDSTR  = "<IDM_RE QUEST type ='GET_CORR ESPONDING_ IDS'><ARGU MENTS><ARG UMENT name ='sourceId '>"
        39                             + "<ID ENTIFIER t ype='NI'>< ID>%s</ID> <ISSUER>US VHA</ISSUE R><SOURCE> 200M</SOUR CE></IDENT IFIER></AR GUMENT>"
        40                             + "<AR GUMENT nam e='statusL ist'><VALU E>A</VALUE ><VALUE>H< /VALUE></A RGUMENT></ ARGUMENTS> </IDM_REQU EST>";
        41  
        42           pr ivate WebS erviceTemp late psimT emplate;
        43  
        44           @O verride
        45           pu blic List< String> ge tCorrelate dIds(Strin g vpid) {
        46  
        47                    vpid  = this.va lidateAndC hecksum(vp id);
        48  
        49                    new  ArrayList< String>();
        50  
        51                    fina l String v pidString  = String.f ormat(
        52                                      PersonSe rviceEndpo int.GET_CO RRESPONDIN G_IDS_VPID STR, vpid) ;
        53                    fina l String g etCorrespo ndingIdsRe q = String .format(
        54                                      PersonSe rviceEndpo int.GET_CO RRESPONDIN G_IDS,
        55                                      StringEs capeUtils. escapeHtml (vpidStrin g));
        56  
        57                    fina l StringWr iter resul tWriter =  new String Writer();
        58                    fina l StreamSo urce sourc e = new St reamSource (new Strin gReader(
        59                                      getCorre spondingId sReq));
        60                    fina l StreamRe sult resul t = new St reamResult (resultWri ter);
        61                    this .psimTempl ate.sendSo urceAndRec eiveToResu lt(source,  result);
        62  
        63                    retu rn this.ge tVpidsFrom Result(Str ingEscapeU tils
        64                                      .unescap eHtml(resu ltWriter.g etBuffer() .toString( )));
        65           }
        66  
        67           pr ivate List <String> g etVpidsFro mResult(fi nal String  result) {
        68                    fina l List<Str ing> vpids  = new Arr ayList<Str ing>();
        69  
        70                    try  {
        71  
        72                             final  Document d ocument =  new SAXRea der().read (new Strin gReader(
        73                                               result));
        74                             final  List<Eleme nt> identi fiers = do cument
        75                                               .selectNod es("//IDEN TIFIER[@ty pe='NI']/I D");
        76  
        77                             for (f inal Eleme nt id : id entifiers)  {
        78                                      vpids.ad d(id.getTe xtTrim());
        79                             }
        80  
        81                             if (vp ids.isEmpt y()) {
        82                                      // try t o get the  error desc ription fr om the mes sage
        83                                      final El ement erro r = (Eleme nt) docume nt
        84                                                       .s electSingl eNode("//E RROR/TEXT" );
        85                                      final St ring error Message =  String
        86                                                       .f ormat("VAP  Person Se rvice Endp oint Error : %s",
        87                                                                         (error  != null)  ? error.ge tTextTrim( )
        88                                                                                           : "Error g etting VPI Ds from PS IM Service . No error  Message r eturned.") ;
        89                                      throw ne w PersonSe rviceExcep tion(error Message);
        90                             }
        91  
        92                    } ca tch (final  DocumentE xception d ex) {
        93                             throw  new Person ServiceExc eption("Er ror proces sing resul ts.", dex) ;
        94                    }
        95  
        96                    retu rn vpids;
        97           }
        98  
        99           pu blic void  setPsimTem plate(fina l WebServi ceTemplate  psimTempl ate) {
        100                    this .psimTempl ate = psim Template;
        101           }
        102  
        103           pr otected St ring valid ateAndChec ksum(Strin g vpid) {
        104                    if ( vpid != nu ll) {
        105                             if (vp id.length( ) == 10) {
        106                                      vpid = I cnChecksum .addChecks umToIcn(vp id);
        107                             } else  if (vpid. length() ! = 17) {
        108                                      throw ne w IllegalA rgumentExc eption(
        109                                                       St ring.forma t(
        110                                                                         "Inval id ICN '%s '. ICN mus t have a l ength of e ither 10 o r 17 chara cters.",
        111                                                                         vpid)) ;
        112                             }
        113                    }
        114  
        115                    retu rn vpid;
        116           }
        117   }