3883. EPMO Open Source Coordination Office Redaction File Detail Report

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

3883.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:50:57 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-server\src\main\java\gov\va\nvap\server\endpoint\psim PersonServiceEndpoint.java Fri Apr 21 20:03:28 2017 UTC

3883.2 Comparison summary

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

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

3883.4 Active regular expressions

No regular expressions were active.

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