29. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/1/2018 12:13:14 PM Central Standard 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.

29.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterEJB\src\main\java\gov\va\med\nhin\adapter\adaptergateway\docretrieve AdapterGatewayDocRetrieve.java Thu Feb 22 14:26:24 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterEJB\src\main\java\gov\va\med\nhin\adapter\adaptergateway\docretrieve AdapterGatewayDocRetrieve.java Tue Feb 27 14:24:03 2018 UTC

29.2 Comparison summary

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

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

29.4 Active regular expressions

No regular expressions were active.

29.5 Comparison detail

  1   package go v.va.med.n hin.adapte r.adapterg ateway.doc retrieve;
  2  
  3   import jav a.util.con current.Ca llable;
  4   import jav a.util.con current.Ex ecutionExc eption;
  5   import jav a.util.con current.Ex ecutorComp letionServ ice;
  6   import jav a.util.con current.Ex ecutorServ ice;
  7  
  8   import jav ax.ejb.EJB ;
  9   import jav ax.ejb.*;
  10  
  11   import org .apache.co mmons.lang 3.StringUt ils;
  12   import org .slf4j.Log ger;
  13   import org .slf4j.Log gerFactory ;
  14  
  15   import gov .hhs.fha.n hinc.adapt erpolicyen gine.Adapt erPolicyEn ginePortTy pe;
  16   import gov .hhs.fha.n hinc.commo n.eventcom mon.DocRet rieveEvent Type;
  17   import gov .hhs.fha.n hinc.commo n.eventcom mon.DocRet rieveMessa geType;
  18   import gov .hhs.fha.n hinc.commo n.nhinccom mon.Assert ionType;
  19   import gov .hhs.fha.n hinc.commo n.nhinccom mon.HomeCo mmunityTyp e;
  20   import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .CheckPoli cyRequestT ype;
  21   import gov .hhs.fha.n hinc.commo n.nhinccom monadapter .CheckPoli cyResponse Type;
  22   import gov .hhs.fha.n hinc.commo n.nhinccom monentity. Responding GatewayCro ssGatewayR etrieveReq uestType;
  23   import gov .hhs.fha.n hinc.nhinc lib.NhincC onstants;
  24   import gov .hhs.fha.n hinc.trans form.polic y.PolicyEn gineTransf ormer;
  25   import gov .va.med.nh in.adapter .adapterga teway.work manager.Wo rkManagerE xecutorSer viceLocal;
  26   import gov .va.med.nh in.adapter .facilitym anager.Fac ility;
  27   import gov .va.med.nh in.adapter .facilitym anager.Fac ilityManag er;
  28   import gov .va.med.nh in.adapter .facilitym anager.Fac ilityManag erLocal;
  29   import gov .va.med.nh in.adapter .facilitym anager.Ope rationOnOf f;
  30   import gov .va.med.nh in.adapter .logging.C heckPolicy ;
  31   import gov .va.med.nh in.adapter .logging.E ntityRetri eveError;
  32   import gov .va.med.nh in.adapter .logging.E rrorMessag e;
  33   import gov .va.med.nh in.adapter .logging.E ventAuditi ngFactory;
  34   import gov .va.med.nh in.adapter .logging.E ventAuditi ngFactoryI mpl;
  35   import gov .va.med.nh in.adapter .logging.L ogConstant s.Auditing Event;
  36   import gov .va.med.nh in.adapter .logging.M aintLog;
  37   import gov .va.med.nh in.adapter .logging.M essagingHe lper.Query Type;
  38   import gov .va.med.nh in.adapter .policyeng ine.Adapte rPolicyEng inePortTyp eLocal;
  39   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType;
  40   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetRequ estType.Do cumentRequ est;
  41   import ihe .iti.xds_b ._2007.Ret rieveDocum entSetResp onseType;
  42   import jav a.util.Map ;
  43   import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryError;
  44   import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryErrorLi st;
  45   import oas is.names.t c.ebxml_re grep.xsd.r s._3.Regis tryRespons eType;
  46   import org .hl7.fhir. dstu3.mode l.AuditEve nt;
  47   import org .slf4j.MDC ;
  48  
  49   /**
  50    *
  51    * @author   DN S      WELCHR
  52    */
  53   @Transacti onAttribut e(value =  Transactio nAttribute Type.SUPPO RTS)
  54   @Stateless (name = "A dapterGate wayDocRetr ieve")
  55   public cla ss Adapter GatewayDoc Retrieve i mplements  EntityDocR etrievePor tTypeLocal
  56   {
  57       privat e static f inal Logge r logger =  LoggerFac tory.getLo gger(Adapt erGatewayD ocRetrieve .class.get Name());
  58  
  59       public  class Sen dRequestRe sponse
  60       {
  61           pu blic Retri eveDocumen tSetRespon seType ret rieveDocum entSetResp onse;
  62           pu blic SendR equestExce ption sre  = null;
  63  
  64           pu blic boole an hasErro r()
  65           {
  66                return s re != null ;
  67           }
  68       }
  69  
  70       public  class Sen dRequestEx ception ex tends Exce ption
  71       {
  72           pr ivate stat ic final l ong serial VersionUID  = 1L;
  73  
  74           pu blic Strin g remoteHo meCommunit yId;
  75       }
  76  
  77       public  class Sen dRequestCa llable imp lements Ca llable<Sen dRequestRe sponse>
  78       {
  79           pu blic final  RetrieveD ocumentSet RequestTyp e retrieve DocumentSe tRequest;
  80           pu blic final  Assertion Type asser tion;
  81           pu blic final  String re moteHomeCo mmunityId;
  82           pr ivate fina l EventAud itingFacto ry<AuditEv ent> afac;
  83           pr ivate fina l Map<Stri ng, String > mdcmap =  MDC.getCo pyOfContex tMap();
  84  
  85           pu blic SendR equestCall able(Retri eveDocumen tSetReques tType retr ieveDocume ntSetReque st,
  86                                         Asser tionType a ssertion,  String rem oteHomeCom munityId,  EventAudit ingFactory <AuditEven t> afac)
  87           {
  88                this.ret rieveDocum entSetRequ est = retr ieveDocume ntSetReque st;
  89                this.ass ertion = a ssertion;
  90                this.rem oteHomeCom munityId =  remoteHom eCommunity Id;
  91                this.afa c = afac;
  92  
  93                logger.i nfo("RD re quest call able creat ed.");
  94           }
  95  
  96           @O verride
  97           pu blic SendR equestResp onse call( ) throws E xception
  98           {
  99                MDC.setC ontextMap( mdcmap);
  100                logger.i nfo("DR Se nd Request ...");
  101                SendRequ estRespons e ret = ne w SendRequ estRespons e();
  102  
  103                AuditEve nt event =  afac.mess aging().re qres(Audit ingEvent.R DOUT_RD,
  104                                                               Adapt erGatewayD ocRetrieve .class, re moteHomeCo mmunityId) ;
  105  
  106                try {
  107                    bool ean use201 1Spec = fa lse;
  108                    if ( communityS upports201 1Specs(rem oteHomeCom munityId))  {
  109                         use2011Spe c = true;
  110                    }
  111                    ret. retrieveDo cumentSetR esponse
  112                    = nh inDocRetri eveRequest Sender.sen dRequest(r etrieveDoc umentSetRe quest,
  113                                                                   a ssertion,  remoteHome CommunityI d, use2011 Spec, even t);
  114  
  115                    even t.setOutco me(AuditEv ent.AuditE ventOutcom e._0);
  116                    afac .info(even t);
  117  
  118                    logg er.debug(" RD respons e recieved  from SSA" );
  119                }
  120                catch (T hrowable e ) {
  121                    even t.setOutco me(AuditEv ent.AuditE ventOutcom e._8);
  122                    even t.setOutco meDesc(e.g etLocalize dMessage() );
  123                    afac .error(eve nt);
  124  
  125                    Send RequestExc eption sre  = new Sen dRequestEx ception();
  126                    sre. remoteHome CommunityI d = remote HomeCommun ityId;
  127                    sre. initCause( e);
  128                    ret. sre = sre;
  129                    logg er.debug(" Error send ing RD to  SSA: {}",  e.getMessa ge());
  130                }
  131  
  132                return r et;
  133           }
  134       }
  135  
  136       privat e Facility Manager fa cilityMana ger;
  137       privat e AdapterP olicyEngin ePortType  adapterPol icyEngine;
  138       privat e NHINDocR etrieveReq uestSender  nhinDocRe trieveRequ estSender;
  139       privat e Executor Service ex ecutorServ ice;
  140  
  141       @EJB(b eanInterfa ce = Facil ityManager Local.clas s, beanNam e = "Facil ityManager ")
  142       public  void setF acilityMan ager(Facil ityManager  facilityM anager)
  143       {
  144           th is.facilit yManager =  facilityM anager;
  145       }
  146  
  147       @EJB(b eanInterfa ce = Adapt erPolicyEn ginePortTy peLocal.cl ass, beanN ame = "Ada pterPolicy Engine")
  148       public  void setA dapterPoli cyEngine(A dapterPoli cyEnginePo rtType ada pterPolicy Engine)
  149       {
  150           th is.adapter PolicyEngi ne = adapt erPolicyEn gine;
  151       }
  152  
  153       @EJB(b eanInterfa ce = NHIND ocRetrieve RequestSen der.class,  beanName  = "NhincPr oxyNHINDoc RetrieveRe questSende r")
  154       public  void setN hinDocQuer yRequestSe nder(NHIND ocRetrieve RequestSen der nhinDo cQueryRequ estSender)
  155       {
  156           th is.nhinDoc RetrieveRe questSende r = nhinDo cQueryRequ estSender;
  157       }
  158  
  159       //@EJB (beanInter face = Wor kManagerEx ecutorServ iceLocal.c lass, bean Name = "Wo rkManagerE xecutorSer vice")
  160       @EJB(b eanInterfa ce = WorkM anagerExec utorServic eLocal.cla ss, beanNa me = "Outb oundRDWork ManagerExe cutorServi ce")  //ch anged 1/24 /2017
  161       public  void setE xecutorSer vice(Execu torService  executorS ervice)
  162       {
  163           th is.executo rService =  executorS ervice;
  164       }
  165  
  166       @Overr ide
  167       public  RetrieveD ocumentSet ResponseTy pe respond ingGateway CrossGatew ayRetrieve (Respondin gGatewayCr ossGateway RetrieveRe questType  responding GatewayCro ssGatewayR etrieveReq uest)
  168       {
  169  
  170           Ev entAuditin gFactory<A uditEvent>  afac
  171                                                = EventAu ditingFact oryImpl.ge tFactory(A uditEvent. class);
  172           af ac.info(af ac.newEven t(respondi ngGatewayC rossGatewa yRetrieveR equest.get Assertion( ),
  173                                      Auditing Event.RDOU T_BEGIN, g etClass()) );
  174           //  CCR 17798 6
  175           lo gger.debug ("respondi ngGatewayC rossGatewa yRetrieve( ) invoked" );
  176  
  177           Re trieveDocu mentSetRes ponseType  ret = new  RetrieveDo cumentSetR esponseTyp e();
  178           Re trieveDocu mentSetReq uestType r etrieveDoc umentSetRe quest
  179                                             =  respondin gGatewayCr ossGateway RetrieveRe quest.getR etrieveDoc umentSetRe quest();
  180  
  181           //  CCR 17798 6
  182           lo gger.debug ("Retrieve DocumentSe tRequestTy pe retriev eDocumentS etRequest  {} ",
  183                          retrieveD ocumentSet Request);
  184  
  185           As sertionTyp e assertio n = respon dingGatewa yCrossGate wayRetriev eRequest.g etAssertio n();
  186  
  187           //  CCR 17798 6
  188           lo gger.debug (" Asserti onType ass ertion {}  ", asserti on);
  189  
  190           Ex ecutorComp letionServ ice<SendRe questRespo nse> compl etionServi ce
  191                                                               = new  ExecutorC ompletionS ervice<>(e xecutorSer vice);
  192           in t numSubmi tted = 0;
  193  
  194           fo r (Documen tRequest d ocumentReq uest : ret rieveDocum entSetRequ est.getDoc umentReque st()) {
  195                Retrieve DocumentSe tRequestTy pe newRequ est = crea teRetrieve DocumentSe tRequest(d ocumentReq uest);
  196  
  197                logger.d ebug("Retr ieveDocume ntSetReque stType new Request {}  ", newReq uest); //  CCR
  198                // 17798 6
  199                logger.d ebug("Home  Community  Id {} : " , document Request.ge tHomeCommu nityId());
  200  
  201                AuditEve nt event =  afac.mess aging().pa rtnerauth( AuditingEv ent.RDOUT_ PARTNERAUT H,
  202                                                                     getClass() , document Request.ge tHomeCommu nityId());
  203  
  204                if (chec kPolicy(ne wRequest,  assertion,  documentR equest.get HomeCommun ityId(), e vent)) {
  205                    if ( facilityMa nager.isPa rtnerAllow ed(documen tRequest.g etHomeComm unityId(),
  206                                                             Operati onOnOff.ON BOARD)) {
  207                         if (facili tyManager. isPartnerA llowed(doc umentReque st.getHome CommunityI d(),
  208                                                                 Ope rationOnOf f.OUT_DR))  {
  209                             event. setOutcome (AuditEven t.AuditEve ntOutcome. _0);
  210                             afac.i nfo(event) ;
  211  
  212                             SendRe questCalla ble callab le = new S endRequest Callable(n ewRequest,
  213                                                                                         a ssertion,  documentRe quest.getH omeCommuni tyId(), af ac);
  214                             comple tionServic e.submit(c allable);
  215                             ++numS ubmitted;
  216  
  217                             logger .debug("nu mSubmitted  {} ", num Submitted) ;
  218                         }
  219                         else {
  220                             // Out bound DR E rror
  221                             event. setOutcome (AuditEven t.AuditEve ntOutcome. _4);
  222                             event. setOutcome Desc(Error Message.OU T_DR_DISAB LED.getMes sage());
  223                             afac.e rror(event );
  224  
  225                             addErr orToRespon se(ret, "I nternal Re gistry/Rep ository Er ror: " + E rrorMessag e.OUT_DR_D ISABLED.ge tMessage() , document Request.ge tHomeCommu nityId());
  226                             MaintL og.queryEr ror(null,  ErrorMessa ge.OUT_DQ_ DISABLED,  documentRe quest.getH omeCommuni tyId(), lo gger);
  227                         }
  228                    }
  229                    else  {
  230                         // Outboun d no partn er
  231                         event.setO utcome(Aud itEvent.Au ditEventOu tcome._4);
  232                         event.setO utcomeDesc (ErrorMess age.OUT_DR _NOT_A_PAR TNER.getMe ssage());
  233                         afac.error (event);
  234  
  235                         addErrorTo Response(r et, "Inter nal Regist ry/Reposit ory Error:  " + Error Message.OU T_DR_NOT_A _PARTNER.g etMessage( ), documen tRequest.g etHomeComm unityId()) ;
  236                         MaintLog.q ueryError( null, Erro rMessage.O UT_DR_NOT_ A_PARTNER,  documentR equest.get HomeCommun ityId(), l ogger);
  237                    }
  238                }
  239                else {
  240                    afac .error(eve nt.setOutc ome(AuditE vent.Audit EventOutco me._4));
  241                }
  242           }
  243  
  244           fo r (int i =  0; i < nu mSubmitted ; ++i) {
  245                try {
  246                    Send RequestRes ponse resp onse = com pletionSer vice.take( ).get();
  247                    if ( !response. hasError() ) {
  248                         addResultT oResponse( ret, respo nse.retrie veDocument SetRespons e);
  249                    }
  250                    else  {
  251                         SendReques tException  sre = res ponse.sre;
  252                         addErrorTo Response(r et, "Inter nal Regist ry/Reposit ory Error  - HCID = "  + sre.rem oteHomeCom munityId,  sre.remote HomeCommun ityId);
  253                         logger.war n("Error s ending Doc Retrieve f or communi ty id: {}  with excep tion: {} " , sre.remo teHomeComm unityId, s re);
  254                         // CCR 177 986- loggi ng
  255                    }
  256                }
  257                catch (E xecutionEx ception ee ) {
  258                    logg er.error(" An Unknown  error occ ured proce ssing an o utbound do c retrieve  request." , ee);
  259                    Enti tyRetrieve Error.retr ieveError( responding GatewayCro ssGatewayR etrieveReq uest, Erro rMessage.O UT_DR_UKNO WN, ee.get Message()) ;
  260                    afac .error(afa c.newEvent (AuditingE vent.RDOUT _RD, getCl ass())
  261                             .setOu tcome(Audi tEvent.Aud itEventOut come._8)
  262                             .setOu tcomeDesc( ErrorMessa ge.OUT_DR_ UKNOWN.get Message()) );
  263                }
  264                catch (I nterrupted Exception  ie) {
  265                    logg er.error(" Outbound D oc Retriev e Threads  interrupte d.  Return  will not  be complet e.", ie);
  266                    afac .error(afa c.newEvent (AuditingE vent.RDOUT _RD, getCl ass())
  267                             .setOu tcome(Audi tEvent.Aud itEventOut come._8)
  268                             .setOu tcomeDesc( ie.getLoca lizedMessa ge()));
  269                }
  270           }
  271  
  272           af ac.info(Au ditingEven t.RDOUT_EN D, getClas s());
  273           re turn ret;
  274       }
  275  
  276       privat e Retrieve DocumentSe tRequestTy pe createR etrieveDoc umentSetRe quest(Docu mentReques t document Request)
  277       {
  278           Re trieveDocu mentSetReq uestType r et = new R etrieveDoc umentSetRe questType( );
  279           re t.getDocum entRequest ().add(doc umentReque st);
  280           re turn ret;
  281       }
  282  
  283       privat e boolean  checkPolic y(Retrieve DocumentSe tRequestTy pe retriev eDocumentS etRequest,
  284                                      Assertio nType asse rtion, Str ing remote HomeCommun ityId, Aud itEvent ev ent)
  285       {
  286           lo gger.debug ("DR Check  Policy");
  287  
  288           Do cRetrieveM essageType  docRetrie veMessage  = new DocR etrieveMes sageType() ;
  289           do cRetrieveM essage.set RetrieveDo cumentSetR equest(ret rieveDocum entSetRequ est);
  290           do cRetrieveM essage.set Assertion( assertion) ;
  291           lo gger.info( "Request d ocRetrieve Message cr eated");
  292  
  293           Ho meCommunit yType rece ivingHomeC ommunity =  new HomeC ommunityTy pe();
  294           re ceivingHom eCommunity .setHomeCo mmunityId( remoteHome CommunityI d);
  295           lo gger.debug ("Request  receivingH omeCommuni ty: {}", r emoteHomeC ommunityId );
  296  
  297           Ho meCommunit yType send ingHomeCom munity = n ew HomeCom munityType ();
  298           se ndingHomeC ommunity.s etHomeComm unityId(ge tHomeCommu nityId());
  299           lo gger.debug ("Request  sendingHom eCommunity : {}", sen dingHomeCo mmunity.ge tHomeCommu nityId());
  300  
  301           Do cRetrieveE ventType d ocRetrieve Event = ne w DocRetri eveEventTy pe();
  302           do cRetrieveE vent.setMe ssage(docR etrieveMes sage);
  303           do cRetrieveE vent.setDi rection(Nh incConstan ts.POLICYE NGINE_OUTB OUND_DIREC TION);
  304           lo gger.debug ("Request  docRetriev eEvent Dir ection: {} ", NhincCo nstants.PO LICYENGINE _OUTBOUND_ DIRECTION) ;
  305           do cRetrieveE vent.setIn terface(Nh incConstan ts.AUDIT_L OG_ENTITY_ INTERFACE) ;
  306           lo gger.debug ("Request  docRetriev eEvent Int erface: {} ", NhincCo nstants.AU DIT_LOG_EN TITY_INTER FACE);
  307           do cRetrieveE vent.setRe ceivingHom eCommunity (receiving HomeCommun ity);
  308           do cRetrieveE vent.setSe ndingHomeC ommunity(s endingHome Community) ;
  309           lo gger.debug ("Request  docRetriev eEvent cre ated");
  310  
  311           Po licyEngine Transforme r transfor mer = new  PolicyEngi neTransfor mer();
  312           Ch eckPolicyR equestType  checkPoli cyRequest  = transfor mer.transf ormDocRetr ieveToChec kPolicy(do cRetrieveE vent);
  313           lo gger.debug ("checkPol icyRequest  completed ");
  314  
  315           if  (facility Manager.ge tFacilityB yFacilityN umber("200 NSS") == n ull || !re moteHomeCo mmunityId. contains(f acilityMan ager.getFa cilityByFa cilityNumb er("200NSS ").getFull HomeCommun ityId()))  {
  316                logger.i nfo("Going  to checkP olicy in a dapterPoli cyEngine.. .");
  317                EventAud itingFacto ry<AuditEv ent> afac  = EventAud itingFacto ryImpl.get Factory(Au ditEvent.c lass);
  318                afac.mes saging().a ddQuery(ev ent, check PolicyRequ est, Check PolicyRequ estType.cl ass,
  319                                            Qu eryType.RE QUEST, nul l);
  320  
  321                CheckPol icyRespons eType chec kPolicyRes ponse = ad apterPolic yEngine.ch eckPolicy( checkPolic yRequest);
  322                afac.mes saging().a ddQuery(ev ent, check PolicyResp onse, Chec kPolicyRes ponseType. class,
  323                                            Qu eryType.RE QUEST, nul l);
  324                return C heckPolicy .checkPoli cy(checkPo licyReques t, checkPo licyRespon se);
  325           }
  326  
  327           re turn true;
  328       }
  329  
  330       privat e void add ResultToRe sponse(Ret rieveDocum entSetResp onseType r etrieveDoc umentSetRe sponse, Re trieveDocu mentSetRes ponseType  result)
  331       {
  332           lo gger.debug ("In addRe sultToResp onse");
  333           if  (retrieve DocumentSe tResponse. getRegistr yResponse( ) == null)  {
  334                if (resu lt.getRegi stryRespon se() != nu ll) {
  335                    retr ieveDocume ntSetRespo nse.setReg istryRespo nse(result .getRegist ryResponse ());
  336                }
  337                else {
  338                    retr ieveDocume ntSetRespo nse.setReg istryRespo nse(new Re gistryResp onseType() );
  339                }
  340           }
  341  
  342           if  (result.g etRegistry Response() .getRegist ryErrorLis t() != nul l) {
  343                logger.d ebug("Regi stry Error  List is n ot null. A dding erro rs to Regi stry Respo nse");
  344                if (retr ieveDocume ntSetRespo nse.getReg istryRespo nse() == n ull) {
  345                    retr ieveDocume ntSetRespo nse.setReg istryRespo nse(new Re gistryResp onseType() );
  346                }
  347                if (retr ieveDocume ntSetRespo nse.getReg istryRespo nse().getR egistryErr orList() = = null) {
  348                    retr ieveDocume ntSetRespo nse.getReg istryRespo nse().setR egistryErr orList(new  RegistryE rrorList() );
  349                }
  350                retrieve DocumentSe tResponse. getRegistr yResponse( ).getRegis tryErrorLi st().getRe gistryErro r().addAll (result.ge tRegistryR esponse(). getRegistr yErrorList ().getRegi stryError( ));
  351                retrieve DocumentSe tResponse. getRegistr yResponse( ).getRegis tryErrorLi st().setHi ghestSever ity(result .getRegist ryResponse ().getRegi stryErrorL ist().getH ighestSeve rity());
  352           }
  353  
  354           if  (result.g etRegistry Response() .getStatus () != null ) {
  355                if (retr ieveDocume ntSetRespo nse.getReg istryRespo nse() != n ull) {
  356                    retr ieveDocume ntSetRespo nse.getReg istryRespo nse().setS tatus(resu lt.getRegi stryRespon se().getSt atus());
  357                }
  358           }
  359           re trieveDocu mentSetRes ponse.getD ocumentRes ponse().ad dAll(resul t.getDocum entRespons e());
  360       }
  361  
  362       privat e void add ErrorToRes ponse(Retr ieveDocume ntSetRespo nseType re trieveDocu mentSetRes ponse, Str ing errorS tring, fin al String  hcid)
  363       {
  364           lo gger.debug ("In addEr rorToRespo nse");
  365           if  (retrieve DocumentSe tResponse  != null) {
  366                if (retr ieveDocume ntSetRespo nse.getReg istryRespo nse() == n ull) {
  367                    retr ieveDocume ntSetRespo nse.setReg istryRespo nse(new Re gistryResp onseType() );
  368                }
  369  
  370                if (retr ieveDocume ntSetRespo nse.getReg istryRespo nse().getR egistryErr orList() = = null) {
  371                    retr ieveDocume ntSetRespo nse.getReg istryRespo nse().setR egistryErr orList(new  RegistryE rrorList() );
  372                }
  373  
  374                retrieve DocumentSe tResponse. getRegistr yResponse( ).getRegis tryErrorLi st().setHi ghestSever ity("urn:o asis:names :tc:ebxml- regrep:Err orSeverity Type:Error ");
  375  
  376                Registry Error regi stryError  = new Regi stryError( );
  377                registry Error.setE rrorCode(" XDSRegistr yError");
  378                registry Error.setC odeContext (errorStri ng);
  379  
  380                if (Stri ngUtils.is NotBlank(h cid)) {
  381                    regi stryError. setLocatio n(hcid);
  382                }
  383  
  384                registry Error.setS everity("u rn:oasis:n ames:tc:eb xml-regrep :ErrorSeve rityType:E rror");
  385                retrieve DocumentSe tResponse. getRegistr yResponse( ).getRegis tryErrorLi st().getRe gistryErro r().add(re gistryErro r);
  386           }
  387       }
  388  
  389       privat e boolean  communityS upports201 1Specs(Str ing hieCom munityOid)
  390       {
  391           lo gger.debug ("In commu nitySuppor ts2011Spec s");
  392           //  fetch the  facility  informatio n
  393           Fa cility fac ility = fa cilityMana ger.getFac ilityByFul lHomeCommu nityId(hie CommunityO id);
  394           if  (facility  == null)  {
  395                logger.e rror("Erro r getting  facility f rom {}", h ieCommunit yOid);
  396                return f alse;
  397           }
  398           re turn Facil ity.SPEC_V ERSION_201 1.equals(f acility.ge tUseSpecVe rsion());
  399       }
  400  
  401       privat e String g etHomeComm unityId()
  402       {
  403           St ring ret =  null;
  404           Fa cility fac ility = fa cilityMana ger.getFac ilityByFac ilityNumbe r("VA");
  405           if  (facility  != null)  {
  406                ret = fa cility.get HomeCommun ityId();
  407           }
  408           re turn ret;
  409       }
  410   }