110. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/21/2017 10:24:36 AM 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.

110.1 Files compared

# Location File Last Modified
1 JLV_2.5.3.0.2_cif.zip\JLV_2.5.3.0.2_src\JLVQoS\src\main\java\gov\va\med\jmeadows\dataservicehandler PDWSServiceHandler.java Wed Jun 7 15:11:34 2017 UTC
2 JLV_2.5.3.0.2_cif.zip\JLV_2.5.3.0.2_src\JLVQoS\src\main\java\gov\va\med\jmeadows\dataservicehandler PDWSServiceHandler.java Wed Jun 21 14:02:16 2017 UTC

110.2 Comparison summary

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

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

110.4 Active regular expressions

No regular expressions were active.

110.5 Comparison detail

  1   /*
  2    * Janus 4 .0 (c)
  3    * Copyrig ht (c) 201 2 Hawaii R esource Gr oup LLC. A ll Rights  Reserved.
  4    * Develop ed for the  Pacific T elehealth  & Technolo gy Hui and  the Pacif ic Joint I nformation  Technolog y Center
  5    * Contrib utors:
  6    *      Ho norable Se nator Dani el K. Inou ye
  7    *      VA  Pacific I slands Hea lth Care S ystem
  8    *      Tr ipler Army  Medical C enter
  9    */
  10  
  11   package go v.va.med.j meadows.da taserviceh andler;
  12  
  13   import gov .va.med.jm eadows.com mon.JMeado wsExceptio n;
  14   import gov .va.med.jm eadows.com mon.PDWSQu eryBean;
  15   import gov .va.med.jm eadows.ent erprise.be ans.Respon sePatientQ uery;
  16   import gov .va.med.pd ws.*;
  17   import gov .va.med.vd s.webservi ce.Patient ;
  18   import gov .va.med.vd s.webservi ce.User;
  19   import org .slf4j.Log ger;
  20   import org .slf4j.Log gerFactory ;
  21  
  22   import jav ax.xml.bin d.JAXBElem ent;
  23   import jav ax.xml.nam espace.QNa me;
  24   import jav ax.xml.ws. BindingPro vider;
  25   import jav ax.xml.ws. handler.Ha ndler;
  26   import jav a.io.Seria lizable;
  27   import jav a.math.Big Integer;
  28   import jav a.net.Malf ormedURLEx ception;
  29   import jav a.text.Sim pleDateFor mat;
  30   import jav a.util.Arr ayList;
  31   import jav a.util.Dat e;
  32   import jav a.util.Lis t;
  33  
  34   public cla ss PDWSSer viceHandle r extends  DataServic eHandler
  35   {
  36       privat e static f inal Logge r logger =  LoggerFac tory.getLo gger(PDWSS erviceHand ler.class) ;
  37       privat e static f inal Strin g AGENCY_D OD = APP_C ONFIG.getA gencyDOD() ;
  38       privat e static f inal Strin g AGENCY_V A = APP_CO NFIG.getAg encyVA();
  39       privat e EntityPa tientInqui ry pdwsSer vice;
  40  
  41       public  PDWSServi ceHandler( String url )
  42       {
  43           se rviceURL =  url;
  44           se rviceName  = "PDWSSer vice";
  45             serviceNam espace = " http://web service.pd ws. URL         /";
  46           qS erviceName  = new QNa me(service Namespace,  serviceNa me);
  47  
  48           pd wsService  = new Enti tyPatientI nquiry();
  49       }
  50  
  51       privat e EntityPa tientSearc hPortType  getEntityP atientSear chPort() t hrows Malf ormedURLEx ception
  52       {
  53           En tityPatien tSearchPor tType port ;
  54  
  55           po rt = pdwsS ervice.get EntityPati entSearchP ortSoap11( );
  56  
  57           Bi ndingProvi der bp = ( BindingPro vider) por t;
  58           bp .getReques tContext() .put(Bindi ngProvider .ENDPOINT_ ADDRESS_PR OPERTY, se rviceURL);
  59           bp .getReques tContext() .put("com. sun.xml.in ternal.ws. connect.ti meout", se rviceConne ctionTimeo utMS);
  60           bp .getReques tContext() .put("com. sun.xml.in ternal.ws. request.ti meout", se rviceReque stTimeoutM S);
  61           bp .getReques tContext() .put("com. sun.xml.ws .connect.t imeout", s erviceConn ectionTime outMS);
  62           bp .getReques tContext() .put("com. sun.xml.ws .request.t imeout", s erviceRequ estTimeout MS);
  63  
  64           //  SOAP mess age loggin g - Enable  to show l ogging in  output win dow
  65           bp .getBindin g().getHan dlerChain( ).add(new  SOAPLoggin gHandler() );
  66           Li st<Handler > handlerL ist = bp.g etBinding( ).getHandl erChain();
  67           ha ndlerList. add(new SO APLoggingH andler());
  68           bp .getBindin g().setHan dlerChain( handlerLis t);
  69  
  70           re turn port;
  71       }
  72  
  73       /**
  74        * Get  patient i d. Returns  empty str ing if id  is not fou nd.
  75        * Thr ows an exc eption if  communicat ions is do wn.
  76        *
  77        * @pa ram queryB ean Query  parameters .
  78        * @re turn Map o f lookup p atients.
  79        */
  80       public  ResponseP atientQuer y lookupPa tient(PDWS QueryBean  queryBean)  throws JM eadowsExce ption, Mal formedURLE xception
  81       {
  82           PR PAIN201305 UV02 reque st = Gener ateRequest (queryBean );
  83           PR PAIN201306 UV02 respo nse = null ;
  84  
  85           tr y {
  86                response  = getEnti tyPatientS earchPort( ).entityPa tientSearc h(request) ;
  87  
  88                if (resp onse != nu ll)
  89                {
  90                    retu rn ParseRe sponseToPa tientList( response);
  91                }
  92  
  93                return n ull;
  94           }
  95           ca tch(Except ion e) {
  96                throw ne w JMeadows Exception( e.getMessa ge());
  97           }
  98       }
  99  
  100       privat e PRPAIN20 1305UV02 G enerateReq uest(PDWSQ ueryBean q ueryBean)
  101       {
  102           Ob jectFactor y factory;
  103           PR PAIN201305 UV02 reque st;
  104           MC CIMT000100 UV01Receiv er receive r;
  105           MC CIMT000100 UV01Sender  sender;
  106           MC CIMT000100 UV01Device  device;
  107           MC CIMT000100 UV01Agent  agent;
  108           MC CIMT000100 UV01Organi zation org anization;
  109           PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess;
  110           PR PAMT201306 UV02QueryB yParameter  queryByPa rameter;
  111           PR PAMT201306 UV02Parame terList pa rameterLis t;
  112           PR PAMT201306 UV02Living SubjectId  livingSubj ectId;
  113           PR PAMT201306 UV02Living SubjectAdm inistrativ eGender ad minGender;
  114           PR PAMT201306 UV02Living SubjectBir thTime bir thTime;
  115           PR PAMT201306 UV02Living SubjectNam e name;
  116           PR PAMT201306 UV02OtherI DsScopingO rganizatio n otherIDs ScopingOrg anization;
  117           QU QIMT021001 UV01DataEn terer data Enterer;
  118           CO CTMT090100 UV01Assign edPerson a ssignedPer son;
  119           CO CTMT090100 UV01Person  person1;
  120           Si mpleDateFo rmat simpl eDateForma t;
  121           En Family enF amily;
  122           En Given enGi ven;
  123           IV LTS ivlts;
  124           IN T i;
  125           II  ii;
  126           CS  cs;
  127           ST  st;
  128           TS  ts;
  129           CD  cd;
  130           CE  ce;
  131           EN  en;
  132  
  133           Us er user =  queryBean. getUser();
  134           St ring agenc y = user.g etAgency() ;
  135           St ring dmisI d = user.g etHostSite ().getDmis Id();
  136           St ring siteI d = user.g etHostSite ().getSite Code();
  137  
  138           fa ctory = ne w ObjectFa ctory();
  139           re quest = fa ctory.crea tePRPAIN20 1305UV02() ;
  140  
  141           // id
  142           ii  = factory .createII( );
  143           ii .setRoot(" 2.16.840.1 .113883.3. 2017");
  144           ii .setExtens ion("DMDC" );
  145           re quest.setI d(ii);
  146  
  147           // creationTi me
  148           ts  = factory .createTS( );
  149           si mpleDateFo rmat = new  SimpleDat eFormat("y yyyMMddhhm mss");
  150           ts .setValue( simpleDate Format.for mat(new Da te()));
  151           re quest.setC reationTim e(ts);
  152  
  153           // interactio nId
  154           ii  = factory .createII( );
  155           ii .setRoot(" 2.16.840.1 .113883.1. 6");
  156           ii .setExtens ion("PRPA_ IN201305UV 02");
  157           re quest.setI nteraction Id(ii);
  158  
  159           // processing Code
  160           cs  = factory .createCS( );
  161           cs .setCode(A PP_CONFIG. getPDWSPro cCode());
  162           re quest.setP rocessingC ode(cs);
  163  
  164           // processing ModeCode
  165           cs  = factory .createCS( );
  166           cs .setCode(" I");
  167           re quest.setP rocessingM odeCode(cs );
  168  
  169           // acceptAckC ode
  170           cs  = factory .createCS( );
  171           cs .setCode(" AL");
  172           re quest.setA cceptAckCo de(cs);
  173  
  174           // receiver
  175           re ceiver = f actory.cre ateMCCIMT0 00100UV01R eceiver();
  176           re quest.getR eceiver(). add(receiv er);
  177  
  178           // receiver/t ypeCode
  179           re ceiver.set TypeCode(C ommunicati onFunction Type.RCV);
  180  
  181           // receiver/d evice
  182           de vice = fac tory.creat eMCCIMT000 100UV01Dev ice();
  183           re ceiver.set Device(dev ice);
  184  
  185           // receiver/d evice/clas sCode
  186           de vice.setCl assCode(En tityClassD evice.DEV) ;
  187  
  188           // receiver/d evice/dete rminerCode
  189           de vice.setDe terminerCo de("INSTAN CE");
  190  
  191           // receiver/d evice/id
  192           ii  = factory .createII( );
  193           ii .setRoot(" 1.3.6.1.4. 1.21367.20 09.1.3.1.1 45");
  194           de vice.getId ().add(ii) ;
  195  
  196           // sender
  197           se nder = fac tory.creat eMCCIMT000 100UV01Sen der();
  198           re quest.setS ender(send er);
  199  
  200           // sender/typ eCode
  201           se nder.setTy peCode(Com munication FunctionTy pe.SND);
  202  
  203           // sender/dev ice
  204           de vice = fac tory.creat eMCCIMT000 100UV01Dev ice();
  205           se nder.setDe vice(devic e);
  206  
  207           // sender/dev ice/classC ode
  208           de vice.setCl assCode(En tityClassD evice.DEV) ;
  209  
  210           // sender/dev ice/determ inerCode
  211           de vice.setDe terminerCo de("INSTAN CE");
  212  
  213           // sender/dev ice/id
  214           ii  = factory .createII( );
  215           ii .setRoot(" 2.16.840.1 .113883.3. 2017.11.7" );
  216           ii .setExtens ion(APP_CO NFIG.getPD WSSndDevId ());
  217           de vice.getId ().add(ii) ;
  218  
  219           // sender/dev ice/asAgen t
  220           ag ent = fact ory.create MCCIMT0001 00UV01Agen t();
  221           de vice.setAs Agent(fact ory.create MCCIMT0001 00UV01Devi ceAsAgent( agent));
  222  
  223           // sender/dev ice/asAgen t/classCod e
  224           ag ent.getCla ssCode().a dd("AGNT") ;
  225  
  226           // sender/dev ice/asAgen t/represen tedOrganiz ation
  227           or ganization  = factory .createMCC IMT000100U V01Organiz ation();
  228           ag ent.setRep resentedOr ganization (factory.c reateMCCIM T000100UV0 1AgentRepr esentedOrg anization( organizati on));
  229  
  230           // sender/dev ice/asAgen t/represen tedOrganiz ation/clas sCode
  231           or ganization .setClassC ode("ORG") ;
  232  
  233           // sender/dev ice/asAgen t/represen tedOrganiz ation/dete rminerCode
  234           or ganization .setDeterm inerCode(" INSTANCE") ;
  235  
  236           // sender/dev ice/asAgen t/represen tedOrganiz ation/id
  237           ii  = factory .createII( );
  238   //         ii.setRoot ("2.16.840 .1.113883. 3.42");
  239   //         ii.setExte nsion(quer yBean.getU ser().getH ostSite(). getSiteCod e());
  240           if  (AGENCY_D OD.equalsI gnoreCase( agency))
  241           {
  242                ii.setRo ot("2.16.8 40.1.11388 3.3.42.100 02.100001. 8");
  243                ii.setEx tension(dm isId);
  244           }
  245           el se if (AGE NCY_VA.equ alsIgnoreC ase(agency ))
  246           {
  247                ii.setRo ot("2.16.8 40.1.11388 3.4.349");
  248                ii.setEx tension(si teId);
  249           }
  250           or ganization .getId().a dd(ii);
  251  
  252           // controlAct Process
  253           co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1305UV02QU QIMT021001 UV01Contro lActProces s();
  254           re quest.setC ontrolActP rocess(con trolActPro cess);
  255  
  256           // controlAct Process/cl assCode
  257           co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT);
  258  
  259           // controlAct Process/mo odCode
  260           co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N);
  261  
  262           // controlAct Process/co de
  263           cd  = factory .createCD( );
  264           cd .setCode(" PRPA_TE201 305UV02");
  265           co ntrolActPr ocess.setC ode(cd);
  266  
  267           // controlAct Process/co deSystem
  268           cd .setCodeSy stem("2.16 .840.1.113 883.1.6");
  269  
  270           // controlAct Process/da taEnterer
  271           da taEnterer  = factory. createQUQI MT021001UV 01DataEnte rer();
  272           co ntrolActPr ocess.getD ataEnterer ().add(dat aEnterer);
  273  
  274           // controlAct Process/da taEnterer/ typeCode
  275           da taEnterer. getTypeCod e().add("E NT");
  276  
  277           // controlAct Process/da taEnterer/ contextCon trolCode
  278           da taEnterer. setContext ControlCod e("AP");
  279  
  280           // controlAct Process/da taEnterer/ assignedPe rson
  281           as signedPers on = facto ry.createC OCTMT09010 0UV01Assig nedPerson( );
  282           da taEnterer. setAssigne dPerson(as signedPers on);
  283  
  284           // controlAct Process/da taEnterer/ assignedPe rson/class Code
  285           as signedPers on.setClas sCode("ASS IGNED");
  286  
  287           // controlAct Process/da taEnterer/ assignedPe rson/id
  288           ii  = factory .createII( );
  289           if  (AGENCY_D OD.equalsI gnoreCase( agency))
  290           {
  291                ii.setRo ot("2.16.8 40.1.11388 3.3.42.127 .100001.79 ");
  292                ii.setEx tension(us er.getUser Ien() + "^ " + dmisId );
  293           }
  294           el se if (AGE NCY_VA.equ alsIgnoreC ase(agency ))
  295           {
  296                ii.setRo ot("2.16.8 40.1.11388 3.4.349");
  297                ii.setEx tension(us er.getUser Ien() + "^ " + siteId );
  298           }
  299           as signedPers on.getId() .add(ii);
  300  
  301           // controlAct Process/da taEnterer/ assignedPe rson/Perso n
  302           pe rson1 = fa ctory.crea teCOCTMT09 0100UV01Pe rson();
  303           as signedPers on.setAssi gnedPerson (factory.c reateCOCTM T090100UV0 1AssignedP ersonAssig nedPerson( person1));
  304  
  305           // controlAct Process/da taEnterer/ assignedPe rson/Perso n/name
  306           en  = factory .createEN( );
  307           en .getConten t().add(qu eryBean.ge tUser().ge tName());
  308           pe rson1.getN ame().add( en);
  309  
  310           // controlAct Process/qu eryByParam eter
  311           qu eryByParam eter = fac tory.creat ePRPAMT201 306UV02Que ryByParame ter();
  312           co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 05UV02QUQI MT021001UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er));
  313  
  314           // controlAct Process/qu eryByParam eter/query Id
  315           ii  = factory .createII( );
  316           ii .setRoot(" 2.16.840.1 .113883.3. 2017");
  317           ii .setExtens ion("33333 4433");
  318           qu eryByParam eter.setQu eryId(ii);
  319  
  320           // controlAct Process/qu eryByParam eter/statu sCode
  321           cs  = factory .createCS( );
  322           cs .setCode(" new");
  323           qu eryByParam eter.setSt atusCode(c s);
  324  
  325           // controlAct Process/qu eryByParam eter/initi alQuantity
  326           i  = factory. createINT( );
  327           i. setValue(B igInteger. valueOf(10 ));
  328           qu eryByParam eter.setIn itialQuant ity(i);
  329  
  330           // controlAct Process/qu eryByParam eter/param eterList
  331           pa rameterLis t = factor y.createPR PAMT201306 UV02Parame terList();
  332           qu eryByParam eter.setPa rameterLis t(paramete rList);
  333  
  334           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctId
  335           if  (!"".equa ls(queryBe an.getPati entId()) & & !"".equa ls(queryBe an.getPati entIdType( )))
  336           {
  337                ii = fac tory.creat eII();
  338                ii.setEx tension(qu eryBean.ge tPatientId ());
  339  
  340                String t ype = quer yBean.getP atientIdTy pe();
  341                if ("SSN ".equalsIg noreCase(t ype))
  342                {
  343                    ii.s etRoot("2. 16.840.1.1 13883.4.1" );
  344                }
  345                else if  ("TIN".equ alsIgnoreC ase(type))
  346                {
  347                    ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.225");
  348                }
  349                else if  ("FIN".equ alsIgnoreC ase(type))
  350                {
  351                    ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.224");
  352                }
  353                else if  ("ITIN".eq ualsIgnore Case(type) )
  354                {
  355                    ii.s etRoot("2. 16.840.1.1 13883.4.2" );
  356                }
  357                else if  ("PIN".equ alsIgnoreC ase(type))
  358                {
  359                    ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.226");
  360                }
  361  
  362                livingSu bjectId =  factory.cr eatePRPAMT 201306UV02 LivingSubj ectId();
  363                livingSu bjectId.ge tValue().a dd(ii);
  364                paramete rList.getL ivingSubje ctId().add (livingSub jectId);
  365  
  366                //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectId/s emanticsTe xt
  367                st = fac tory.creat eST();
  368                st.getCo ntent().ad d("LivingS ubject.id" );
  369                livingSu bjectId.se tSemantics Text(st);
  370           }
  371  
  372           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctAdminist rativeGend er
  373           if  (queryBea n.getGende r() != nul l)
  374           {
  375                adminGen der = fact ory.create PRPAMT2013 06UV02Livi ngSubjectA dministrat iveGender( );
  376                ce = fac tory.creat eCE();
  377                ce.setCo de(queryBe an.getGend er());
  378                adminGen der.getVal ue().add(c e);
  379                paramete rList.getL ivingSubje ctAdminist rativeGend er().add(a dminGender );
  380  
  381                //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectAdmi nistrative Gender/sem anticsText
  382                st = fac tory.creat eST();
  383                st.getCo ntent().ad d("LivingS ubject.adm inistrativ eGender");
  384                adminGen der.setSem anticsText (st);
  385           }
  386  
  387           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e
  388           bi rthTime =  factory.cr eatePRPAMT 201306UV02 LivingSubj ectBirthTi me();
  389           iv lts = fact ory.create IVLTS();
  390           iv lts.setVal ue(queryBe an.getDob( ));
  391           bi rthTime.ge tValue().a dd(ivlts);
  392           pa rameterLis t.getLivin gSubjectBi rthTime(). add(birthT ime);
  393  
  394           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e/semantic sText
  395           st  = factory .createST( );
  396           st .getConten t().add("L ivingSubje ct.birthTi me");
  397           bi rthTime.se tSemantics Text(st);
  398  
  399           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName
  400           na me = facto ry.createP RPAMT20130 6UV02Livin gSubjectNa me();
  401           en  = factory .createEN( );
  402  
  403           if  (queryBea n.getFirst Name() !=  null)
  404           {
  405                enGiven  = factory. createEnGi ven();
  406                enGiven. getContent ().add(que ryBean.get FirstName( ));
  407                en.getCo ntent().ad d(factory. createENGi ven(enGive n));
  408           }
  409  
  410           en Family = f actory.cre ateEnFamil y();
  411           en Family.get Content(). add(queryB ean.getLas tName());
  412           en .getConten t().add(fa ctory.crea teENFamily (enFamily) );
  413  
  414           na me.getValu e().add(en );
  415           pa rameterLis t.getLivin gSubjectNa me().add(n ame);
  416  
  417           // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName/sem anticsText
  418           st  = factory .createST( );
  419           st .getConten t().add("L ivingSubje ct.name");
  420           na me.setSema nticsText( st);
  421  
  422           // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation
  423           ot herIDsScop ingOrganiz ation = fa ctory.crea tePRPAMT20 1306UV02Ot herIDsScop ingOrganiz ation();
  424           pa rameterLis t.getOther IDsScoping Organizati on().add(o therIDsSco pingOrgani zation);
  425  
  426           // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/val ue/id
  427           ii  = factory .createII( );
  428           ii .setRoot(" 2.16.840.1 .113883.4. 1");
  429           ot herIDsScop ingOrganiz ation.getV alue().add (ii);
  430  
  431           // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/sem anticsText
  432           st  = factory .createST( );
  433           st .getConten t().add("O therIDs.sc opingOrgan ization.id ");
  434           ot herIDsScop ingOrganiz ation.setS emanticsTe xt(st);
  435  
  436           re turn reque st;
  437       }
  438  
  439       privat e Response PatientQue ry ParseRe sponseToPa tientList( PRPAIN2013 06UV02 res ponse) thr ows JMeado wsExceptio n
  440       {
  441           Re sponsePati entQuery r espPatQuer y = new Re sponsePati entQuery() ;
  442  
  443           //  Initially  set to fa ilure with  generic e rror messa ge. Will o nly be
  444           //  set to su ccess if t here are n o acknowle dgement er rors and n o
  445           //  errors re trieving p atient lis t, even if  the list  is empty
  446           re spPatQuery .setSucces s(false);
  447           re spPatQuery .setErrorM sg("Error  retrieving  patients. "
  448                    + "< br><br>Ple ase try ag ain."
  449                    + "< br><br>If  the proble m persists , notify y our system  administr ator or he lp desk.") ;
  450  
  451           //  Create li st of resu lt patient s
  452           Li st<Patient > resultPa tList = ne w ArrayLis t<Patient> ();
  453  
  454           if  (response  != null)
  455           {
  456                // Check  the respo nse acknow ledgement  for an app lication e rror
  457                List<MCC IMT000300U V01Acknowl edgement>  ackList =  response.g etAcknowle dgement();
  458                if (ackL ist != nul l)
  459                {
  460                    for  (MCCIMT000 300UV01Ack nowledgeme nt ack : a ckList)
  461                    {
  462                         CS cs = ac k.getTypeC ode();
  463                         if (cs !=  null)
  464                         {
  465                             if(!"A A".equalsI gnoreCase( cs.getCode ()))
  466                             {
  467                                 //  Applicati on error o ccurred
  468                                 Li st<MCCIMT0 00300UV01A cknowledge mentDetail > ackDetai lList = ac k.getAckno wledgement Detail();
  469                                 if  (ackDetai lList != n ull)
  470                                 {
  471                                      for (MCC IMT000300U V01Acknowl edgementDe tail ackDe tail : ack DetailList )
  472                                      {
  473                                          CE c e = ackDet ail.getCod e();
  474                                          if ( (ce != nul l) && (ce. getDisplay Name() !=  null))
  475                                          {
  476                                               respPatQue ry.setErro rMsg(ackDe tail.getTy peCode().t oString()  + ": " + c e.getDispl ayName());
  477                                               return res pPatQuery;
  478                                          }
  479                                      }
  480                                 }
  481                             }
  482                         }
  483                    }
  484                }
  485  
  486                // Parse  message f or list of  patients
  487                PRPAIN20 1306UV02MF MIMT700711 UV01Contro lActProces s ctrlActP roc = resp onse.getCo ntrolActPr ocess();
  488                if (ctrl ActProc !=  null)
  489                {
  490                    // I terate thr ough each  patient
  491                    List <PRPAIN201 306UV02MFM IMT700711U V01Subject 1> subjLis t = ctrlAc tProc.getS ubject();
  492                    if ( subjList ! = null)
  493                    {
  494                         StringBuil der family Name = new  StringBui lder();
  495                         StringBuil der givenN ame = new  StringBuil der();
  496                         StringBuil der prefix Name = new  StringBui lder();
  497                         StringBuil der suffix Name = new  StringBui lder();
  498                         for (PRPAI N201306UV0 2MFMIMT700 711UV01Sub ject1 subj  : subjLis t)
  499                         {
  500                             family Name.setLe ngth(0);
  501                             givenN ame.setLen gth(0);
  502                             prefix Name.setLe ngth(0);
  503                             suffix Name.setLe ngth(0);
  504                             String  edipi = n ull;
  505                             String  ssn = "N/ A";
  506                             String  gender =  "N/A";
  507                             String  dob = "N/ A";
  508  
  509                             PRPAIN 201306UV02 MFMIMT7007 11UV01Regi strationEv ent regEve nt = subj. getRegistr ationEvent ();
  510                             if (re gEvent !=  null)
  511                             {
  512                                 PR PAIN201306 UV02MFMIMT 700711UV01 Subject2 s ubj1 = reg Event.getS ubject1();
  513                                 if  (subj1 !=  null)
  514                                 {
  515                                      PRPAMT20 1310UV02Pa tient pat  = subj1.ge tPatient() ;
  516                                      if (pat  != null)
  517                                      {
  518                                          // R etrieve pa tient EDIP I
  519                                          List <II> iiLis t = pat.ge tId();
  520                                          if ( (iiList !=  null) &&  !iiList.is Empty())
  521                                          {
  522                                               edipi = ii List.get(0 ).getExten sion();
  523                                          }
  524  
  525                                          // R etrieve pa tient's de mographics  informati on (name,  gender, do b, ssn)
  526                                          JAXB Element<PR PAMT201310 UV02Person > jaxbElem entPerson  = pat.getP atientPers on();
  527                                          if ( jaxbElemen tPerson !=  null)
  528                                          {
  529                                               PRPAMT2013 10UV02Pers on person  = jaxbElem entPerson. getValue() ;
  530                                               if (person  != null)
  531                                               {
  532                                                   // Ret rieve pati ent gender
  533                                                   CE ce  = person.g etAdminist rativeGend erCode();
  534                                                   if (ce  != null)
  535                                                   {
  536                                                       ge nder = ce. getCode();
  537                                                   }
  538  
  539                                                   // Ret rieve pati ent date o f birth
  540                                                   TS ts  = person.g etBirthTim e();
  541                                                   if (ts  != null)
  542                                                   {
  543                                                       do b = ts.get Value();
  544                                                   }
  545  
  546                                                   // Ret rieve pati ent name
  547                                                   List<P N> pnList  = person.g etName();
  548                                                   if (pn List != nu ll)
  549                                                   {
  550                                                       fo r (PN pn :  pnList)
  551                                                       {
  552                                                            List<Ser ializable>  serialLis t = pn.get Content();
  553                                                            if (seri alList !=  null)
  554                                                            {
  555                                                                for  (Serializa ble serial  : serialL ist)
  556                                                                {
  557                                                                     if (serial  instanceo f JAXBElem ent)
  558                                                                     {
  559                                                                         Object  obj = ((J AXBElement ) serial). getValue() ;
  560                                                                         if (ob j != null)
  561                                                                         {
  562                                                                             if  (obj inst anceof EnF amily)
  563                                                                             {
  564                                                                                  List<Ser ializable>  serial2Li st = ((EnF amily) obj ).getConte nt();
  565                                                                                  if ((ser ial2List ! = null) &&  !serial2L ist.isEmpt y())
  566                                                                                  {
  567                                                                                      fami lyName.app end(serial 2List.get( 0));
  568                                                                                      fami lyName.app end(" ");
  569                                                                                  }
  570                                                                             }
  571                                                                             el se if (obj  instanceo f EnGiven)
  572                                                                             {
  573                                                                                  List<Ser ializable>  serial2Li st = ((EnG iven) obj) .getConten t();
  574                                                                                  if ((ser ial2List ! = null) &&  !serial2L ist.isEmpt y())
  575                                                                                  {
  576                                                                                      give nName.appe nd(serial2 List.get(0 ));
  577                                                                                      give nName.appe nd(" ");
  578                                                                                  }
  579                                                                             }
  580                                                                             el se if (obj  instanceo f EnPrefix )
  581                                                                             {
  582                                                                                  List<Ser ializable>  serial2Li st = ((EnP refix) obj ).getConte nt();
  583                                                                                  if ((ser ial2List ! = null) &&  !serial2L ist.isEmpt y())
  584                                                                                  {
  585                                                                                      pref ixName.app end(serial 2List.get( 0));
  586                                                                                      pref ixName.app end(" ");
  587                                                                                  }
  588                                                                             }
  589                                                                             el se if (obj  instanceo f EnSuffix )
  590                                                                             {
  591                                                                                  List<Ser ializable>  serial2Li st = ((EnS uffix) obj ).getConte nt();
  592                                                                                  if ((ser ial2List ! = null) &&  !serial2L ist.isEmpt y())
  593                                                                                  {
  594                                                                                      suff ixName.app end(serial 2List.get( 0));
  595                                                                                      suff ixName.app end(" ");
  596                                                                                  }
  597                                                                             }
  598                                                                         }
  599                                                                     }
  600                                                                }
  601                                                            }
  602                                                            else
  603                                                            {
  604                                                                logg er.error(" List<Seria lizable> i s null");
  605                                                            }
  606                                                       }
  607  
  608                                                       //  Format: P refixName  FamilyName ,GivenName  SuffixNam e
  609                                                       //  (comma wi ll be adde d when gen erating na me string)
  610  
  611                                                       //  Add prefi x before f amily name
  612                                                       if  (prefixNa me.length( ) > 0)
  613                                                       {
  614                                                            familyNa me = prefi xName.appe nd(familyN ame);
  615                                                       }
  616  
  617                                                       //  Add suffi x after gi ven name
  618                                                       if  (suffixNa me.length( ) > 0)
  619                                                       {
  620                                                            givenNam e.append(s uffixName) ;
  621                                                       }
  622                                                   }
  623                                                   else
  624                                                   {
  625                                                       lo gger.error ("List<PN>  is null") ;
  626                                                   }
  627  
  628                                                   // Ret rieve pati ent SSN
  629                                                   List<P RPAMT20131 0UV02Other IDs> other IdsList =  person.get AsOtherIDs ();
  630                                                   if (ot herIdsList  != null)
  631                                                   {
  632                                                       fo r (PRPAMT2 01310UV02O therIDs ot herIDs : o therIdsLis t)
  633                                                       {
  634                                                            List<II>  ii2List =  otherIDs. getId();
  635                                                            if (ii2L ist != nul l)
  636                                                            {
  637                                                                for  (II ii : i i2List)
  638                                                                {
  639                                                                     CS cs = ot herIDs.get StatusCode ();
  640                                                                     if (cs !=  null)
  641                                                                     {
  642                                                                         if ("2 .16.840.1. 113883.4.1 ".equalsIg noreCase(i i.getRoot( )) && "act ive".equal sIgnoreCas e(cs.getCo de()))
  643                                                                         {
  644                                                                             ss n = ii.get Extension( );
  645                                                                         }
  646                                                                     }
  647                                                                }
  648                                                            }
  649                                                       }
  650                                                   }
  651                                               }
  652                                          }
  653                                      }
  654                                 }
  655                             }
  656  
  657                             Patien t resultPa t = new Pa tient();
  658  
  659                             // Set  patient i nformation
  660                             result Pat.setEDI PI(edipi);
  661                             result Pat.setSSN (ssn);
  662                             result Pat.setNam e(familyNa me.toStrin g().trim()  + "," + g ivenName.t oString(). trim());
  663                             result Pat.setGen der(gender );
  664                             result Pat.setDob (dob);
  665  
  666                             // Add  to patien t list
  667                             result PatList.ad d(resultPa t);
  668                         }
  669                    }
  670                }
  671           }
  672  
  673           re spPatQuery .setSucces s(true);
  674           re spPatQuery .setErrorM sg(null);
  675           re spPatQuery .setPatien ts(resultP atList);
  676  
  677           re turn respP atQuery;
  678       }
  679   }