2. EPMO Open Source Coordination Office Redaction File Detail Report

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

2.1 Files compared

# Location File Last Modified
1 JLV_2.5.3.0.2_cif.zip\JLV_2.5.3.0.2_src\BHIERelayService\src\main\java\gov\va\med\bhie\webservice BHIERelay.java Wed Jun 7 15:11:32 2017 UTC
2 JLV_2.5.3.0.2_cif.zip\JLV_2.5.3.0.2_src\BHIERelayService\src\main\java\gov\va\med\bhie\webservice BHIERelay.java Wed Jun 21 14:24:07 2017 UTC

2.2 Comparison summary

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

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

2.4 Active regular expressions

No regular expressions were active.

2.5 Comparison detail

  1   /**
  2    * Janus 4 .0 (c)
  3    * Copyrig ht (c) 201 1 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    *     Hon orable Sen ator Danie l K. Inouy e
  7    *     VA  Pacific Is lands Heal th Care Sy stem
  8    *     Tri pler Army  Medical Ce nter
  9    */
  10   package go v.va.med.b hie.webser vice;
  11  
  12   import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception;
  13   import com .fasterxml .jackson.d atabind.De serializat ionFeature ;
  14   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  15   import gov .va.med.bh ie.beans.* ;
  16   import gov .va.med.bh ie.common. AppConfig;
  17   import gov .va.med.bh ie.common. ClinicalDo mainLoincC ode;
  18   import gov .va.med.bh ie.dao.Dao Exception;
  19   import gov .va.med.bh ie.dao.pat ient.NoteD ao;
  20   import gov .va.med.bh ie.dao.pat ient.V4Dao ;
  21   import gov .va.med.bh ie.dao.pat ient.VLERD ao;
  22   import gov .va.med.bh ie.dataser vice.BHIEC acheClient ;
  23   import gov .va.med.bh ie.dataser vice.Snare worksHandl er;
  24   import gov .va.med.bh ie.resultc ollection. ResultColl ection;
  25   import gov .va.med.bh ie.resultc ollection. V4ResultCo llection;
  26   import gov .va.med.bh ie.util.DB Logger;
  27   import org .apache.co mmons.coll ections4.C ollectionU tils;
  28   import org .slf4j.Log ger;
  29   import org .slf4j.Log gerFactory ;
  30  
  31   import jav ax.annotat ion.Resour ce;
  32   import jav ax.jws.Han dlerChain;
  33   import jav ax.jws.Web Method;
  34   import jav ax.jws.Web Param;
  35   import jav ax.jws.Web Service;
  36   import jav ax.mail.Me ssagingExc eption;
  37   import jav ax.mail.in ternet.Mim eUtility;
  38   import jav ax.xml.ws. WebService Context;
  39   import jav ax.xml.ws. handler.Me ssageConte xt;
  40   import jav a.io.ByteA rrayOutput Stream;
  41   import jav a.io.IOExc eption;
  42   import jav a.io.Outpu tStream;
  43   import jav a.text.Sim pleDateFor mat;
  44   import jav a.util.Arr ayList;
  45   import jav a.util.Dat e;
  46   import jav a.util.Lis t;
  47   import jav a.util.Loc ale;
  48  
  49   import sta tic gov.va .med.bhie. common.Cli nicalDomai nLoincCode .VLERCCDA;
  50  
  51   //import g ov.va.med. foundation s.utilitie s.ARMLog;
  52  
  53   /**
  54    * BHIE Re lay web se rvice.
  55    *
  56    * @author  brunos
  57    * @author  <a href=" mailto:kwe ller@hawai irg.com">k weller</a>
  58    * @versio n 1.0
  59    *
  60    */
  61   @WebServic e
  62   @HandlerCh ain(file =  "SoapHand lerChain.x ml")
  63   public cla ss BHIERel ay {
  64  
  65       /**
  66        * Log ger.
  67        */
  68       privat e static f inal Logge r LOGGER =  LoggerFac tory.getLo gger(BHIER elay.class );
  69  
  70       /**
  71        * Web  context.
  72        */
  73       @Resou rce
  74       privat e WebServi ceContext  wsContext;
  75  
  76  
  77       /**
  78        * Get  deploymen t forms.
  79        *
  80        * @pa ram queryB ean query  bean
  81        * @re turn deplo yment list  collectio n
  82        */
  83       @WebMe thod(opera tionName =  "getDeplo ymentForms ")
  84       public  V4ResultC ollection  getDeploym entForms(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean)  {
  85           re turn getV4 (ClinicalD omainLoinc Code.DEPLO YMENT_FORM S, queryBe an);
  86       }
  87       
  88       /**
  89        * Get  patient e ncounter n otes.
  90        *
  91        * @pa ram queryB ean query  bean
  92        * @re turn note  collection
  93        */
  94       @WebMe thod(opera tionName =  "getEncou nterNotes" )
  95       public  V4ResultC ollection  getEncount erNotes(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) {
  96           re turn getV4 (ClinicalD omainLoinc Code.ENCOU NTER_NOTES , queryBea n);
  97       }
  98  
  99       /**
  100        * Get  HAIMS doc uments.
  101        *
  102        * @pa ram queryB ean query  bean
  103        * @re turn note  collection
  104        */
  105       @WebMe thod(opera tionName =  "getHAIMS Documents" )
  106       public  V4ResultC ollection  getHAIMSDo cuments(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) {
  107           St ring oid =  AppConfig .getInstan ce().getPr operties() .getProper ty(
  108                    "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". haims");
  109           Li st<String>  includedS ources = n ew ArrayLi st<String> ();
  110           in cludedSour ces.add(oi d);
  111           qu eryBean.se tIncludedS ources(inc ludedSourc es);
  112           re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean);
  113       }
  114  
  115       /**
  116        * Get  MHS Genes is documen ts.
  117        *
  118        * @pa ram queryB ean query  bean
  119        * @re turn note  collection
  120        */
  121       @WebMe thod(opera tionName =  "getMhsGe nesisDocum ents")
  122       public  V4ResultC ollection  getMhsGene sisDocumen ts(@WebPar am(name =  "queryBean ") QueryBe an queryBe an) {
  123           St ring oid =  AppConfig .getInstan ce().getPr operties() .getProper ty(
  124                    "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis");
  125           Li st<String>  includedS ources = n ew ArrayLi st<String> ();
  126           in cludedSour ces.add(oi d);
  127           qu eryBean.se tIncludedS ources(inc ludedSourc es);
  128           re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean);
  129       }
  130  
  131   //    /**
  132   //     * G et inpatie nt notes ( Essentris  notes).
  133   //     *
  134   //     * @ param quer yBean quer y bean
  135   //     * @ return not e collecti on
  136   //     */
  137   //    @Web Method(ope rationName  = "getInp atientNote s")
  138   //    publ ic V4Resul tCollectio n getInpat ientNotes( @WebParam( name = "qu eryBean")  QueryBean  queryBean)  {
  139   //         return get V4(Clinica lDomainLoi ncCode.INP ATIENT_NOT ES, queryB ean);
  140   //    }
  141  
  142       /**
  143        * Get  note imag e.
  144        *
  145        * @pa ram eventI d event ID
  146        * @re turn note  image
  147        */
  148       @WebMe thod(opera tionName =  "getNoteI mage")
  149       public  NoteImage  getNoteIm age(@WebPa ram(name =  "eventId" ) String e ventId) {
  150           No teDao note Dao = new  NoteDao();
  151           tr y {
  152                NoteImag e rtc;
  153                rtc = no teDao.getN oteImage(e ventId);
  154                if (!"fa lse".equal sIgnoreCas e((String)  AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) {
  155                    rtc  = NoteFixe r.fixNoteI mage(rtc,  "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) );
  156                }
  157  
  158                if (rtc  != null) {
  159                    Stri ng content Type = rtc .getConten tType();
  160                    /* f latten pdf  note type s to remov e fillable  pdf */
  161                    if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType)
  162                             || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) {
  163                         rtc = Note Fixer.flat tenNoteFor m(rtc);
  164                    }
  165                }
  166  
  167  
  168                return r tc;
  169           }  catch (Dao Exception  e) {
  170                logError (e);
  171                throw ne w RuntimeE xception(e );
  172           }
  173       }
  174  
  175       /**
  176        * Get  note imag e encoded.
  177        *
  178        * @pa ram url No te image u rl.
  179        * @re turn note  image
  180        */
  181       @WebMe thod(opera tionName =  "getNoteI mageEncode dFromUrl")
  182       public  NoteImage Encoded ge tNoteImage EncodedFro mUrl(@WebP aram(name  = "url") S tring url)  {
  183           No teDao note Dao = new  NoteDao();
  184           tr y {
  185                NoteImag e rtc;
  186                rtc = no teDao.getN oteImageFr omUrl(url) ;
  187                if (!"fa lse".equal sIgnoreCas e((String)  AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) {
  188                    rtc  = NoteFixe r.fixNoteI mage(rtc,  "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) );
  189                }
  190  
  191                String c ontentType  = rtc.get ContentTyp e();
  192                /* flatt en pdf not e types to  remove fi llable pdf  */
  193                if (rtc  != null &&  "applicat ion/octet- stream".eq ualsIgnore Case(conte ntType)
  194                         || "applic ation/pdf" .equalsIgn oreCase(co ntentType) ) {
  195                    rtc  = NoteFixe r.flattenN oteForm(rt c);
  196                }
  197  
  198                NoteImag eEncoded r tc2 = new  NoteImageE ncoded();
  199                rtc2.set ContentDis position(r tc.getCont entDisposi tion());
  200                rtc2.set ContentTyp e(rtc.getC ontentType ());
  201  
  202                ByteArra yOutputStr eam baos =  null;
  203                OutputSt ream b64os  = null;
  204                try {
  205                    baos  = new Byt eArrayOutp utStream() ;
  206                    b64o s = MimeUt ility.enco de(baos, " base64");
  207                    b64o s.write(rt c.getNoteB ytes());
  208                    b64o s.close();
  209                    rtc2 .setNoteBy tesEncoded (new Strin g(baos.toB yteArray() , "UTF-8") );
  210                } finall y {
  211                    if ( b64os != n ull) {
  212                         b64os.clos e();
  213                    }
  214                    if ( baos != nu ll) {
  215                         baos.close ();
  216                    }
  217                }
  218                return r tc2;
  219           }  catch (IOE xception e ) {
  220                logError (e);
  221                throw ne w RuntimeE xception(e );
  222           }  catch (Mes sagingExce ption e) {
  223                logError (e);
  224                throw ne w RuntimeE xception(e );
  225           }  catch (Dao Exception  e) {
  226                logError (e);
  227                throw ne w RuntimeE xception(e );
  228           }
  229       }
  230  
  231       /**
  232        * Get  note imag e encoded.
  233        *
  234        * @pa ram eventI d event ID
  235        * @re turn note  image
  236        */
  237       @WebMe thod(opera tionName =  "getNoteI mageEncode d")
  238       public  NoteImage Encoded ge tNoteImage Encoded(@W ebParam(na me = "even tId") Stri ng eventId ) {
  239           No teDao note Dao = new  NoteDao();
  240           tr y {
  241                NoteImag e rtc;
  242                rtc = no teDao.getN oteImage(e ventId);
  243                if (!"fa lse".equal sIgnoreCas e((String)  AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) {
  244                    rtc  = NoteFixe r.fixNoteI mage(rtc,  "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) );
  245                }
  246  
  247                if (rtc  != null) {
  248                    Stri ng content Type = rtc .getConten tType();
  249                    /* f latten pdf  note type s to remov e fillable  pdf */
  250                    if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType)
  251                             || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) {
  252                         rtc = Note Fixer.flat tenNoteFor m(rtc);
  253                    }
  254                }
  255  
  256                NoteImag eEncoded r tc2 = new  NoteImageE ncoded();
  257                rtc2.set ContentDis position(r tc.getCont entDisposi tion());
  258                rtc2.set ContentTyp e(rtc.getC ontentType ());
  259  
  260                ByteArra yOutputStr eam baos =  null;
  261                OutputSt ream b64os  = null;
  262                try {
  263                    baos  = new Byt eArrayOutp utStream() ;
  264                    b64o s = MimeUt ility.enco de(baos, " base64");
  265                    b64o s.write(rt c.getNoteB ytes());
  266                    b64o s.close();
  267                    rtc2 .setNoteBy tesEncoded (new Strin g(baos.toB yteArray() , "UTF-8") );
  268                } finall y {
  269                    if ( b64os != n ull) {
  270                         b64os.clos e();
  271                    }
  272                    if ( baos != nu ll) {
  273                         baos.close ();
  274                    }
  275                }
  276                return r tc2;
  277           }  catch (IOE xception e ) {
  278                logError (e);
  279                throw ne w RuntimeE xception(e );
  280           }  catch (Mes sagingExce ption e) {
  281                logError (e);
  282                throw ne w RuntimeE xception(e );
  283           }  catch (Dao Exception  e) {
  284                logError (e);
  285                throw ne w RuntimeE xception(e );
  286           }
  287       }
  288  
  289       /**
  290        * Get  note imag e.
  291        *
  292        * @pa ram url No te image u rl.
  293        * @re turn note  image
  294        */
  295       @WebMe thod(opera tionName =  "getNoteI mageFromUr l")
  296       public  NoteImage  getNoteIm ageFromUrl (@WebParam (name = "u rl") Strin g url) {
  297           No teDao note Dao = new  NoteDao();
  298           tr y {
  299                NoteImag e rtc;
  300                rtc = no teDao.getN oteImageFr omUrl(url) ;
  301                if (!"fa lse".equal sIgnoreCas e((String)  AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) {
  302                    rtc  = NoteFixe r.fixNoteI mage(rtc,  "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) );
  303                }
  304  
  305                if (rtc  != null) {
  306                    Stri ng content Type = rtc .getConten tType();
  307                    /* f latten pdf  note type s to remov e fillable  pdf */
  308                    if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType)
  309                             || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) {
  310                         rtc = Note Fixer.flat tenNoteFor m(rtc);
  311                    }
  312                }
  313  
  314  
  315  
  316                return r tc;
  317           }  catch (Dao Exception  e) {
  318                logError (e);
  319                throw ne w RuntimeE xception(e );
  320           }
  321       }
  322  
  323       /**
  324        * Get  outpatien t procedur es.
  325        * 
  326        * @pa ram queryB ean query  bean
  327        * @re turn colle ction
  328        */
  329       @WebMe thod(opera tionName =  "getOutpa tientProce dures")
  330       public  V4ResultC ollection  getOutpati entProcedu res(@WebPa ram(name =  "queryBea n") QueryB ean queryB ean) {
  331           re turn getV4 (ClinicalD omainLoinc Code.PROCE DURES, que ryBean);
  332       }
  333  
  334       /**
  335        * Get  patient a dmissions.
  336        *
  337        * @pa ram queryB ean query  bean
  338        * @re turn admis sions coll ection
  339        */
  340       @WebMe thod(opera tionName =  "getPatie ntAdmissio ns")
  341       public  V4ResultC ollection  getPatient Admissions (@WebParam (name = "q ueryBean")  QueryBean  queryBean ) {
  342           re turn getV4 (ClinicalD omainLoinc Code.ADMIS SIONSV4, q ueryBean);
  343       }
  344       
  345       /**
  346        * Get  patient a llergies.
  347        *
  348        * @pa ram queryB ean query  bean
  349        * @re turn aller gy collect ion
  350        */
  351       @WebMe thod(opera tionName =  "getPatie ntAllergie s")
  352       public  V4ResultC ollection  getPatient Allergies( @WebParam( name = "qu eryBean")  QueryBean  queryBean)  {
  353           re turn getV4 (ClinicalD omainLoinc Code.ALLER GIESV4, qu eryBean);
  354       }
  355  
  356       /**
  357        * Get  patient a ppointment s.
  358        *
  359        * @pa ram queryB ean query  bean
  360        * @re turn appoi ntment col lection
  361        */
  362       @WebMe thod(opera tionName =  "getPatie ntAppointm ents")
  363       public  V4ResultC ollection  getPatient Appointmen ts(@WebPar am(name =  "queryBean ") QueryBe an queryBe an) {
  364           re turn getV4 (ClinicalD omainLoinc Code.APPOI NTMENTS, q ueryBean);
  365       }
  366   //
  367   //    /**
  368   //     * G et consult  orders.
  369   //     *
  370   //     * @ param quer yBean quer y bean
  371   //     * @ return lab  order col lection
  372   //     */
  373   //    @Web Method(ope rationName  = "getPat ientConsul tOrders")
  374   //    publ ic V4Resul tCollectio n getPatie ntConsultO rders(@Web Param(name  = "queryB ean") Quer yBean quer yBean) {
  375   //         return get V4(Clinica lDomainLoi ncCode.CON SULT_ORDER S, queryBe an);
  376   //    }
  377  
  378       /**
  379        * Get  patient c onsults.
  380        *
  381        * @pa ram queryB ean query  bean
  382        * @re turn consu lt collect ion
  383        */
  384       @WebMe thod(opera tionName =  "getPatie ntConsults ")
  385       public  V4ResultC ollection  getPatient Consults(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean)  {
  386           // call notes , and filt er out in  jMeadows
  387           re turn getV4 (ClinicalD omainLoinc Code.NOTES , queryBea n);
  388       }
  389  
  390       /**
  391        * Get  patient d emographic s.
  392        *
  393        * @pa ram queryB ean query  bean
  394        * @re turn demog raphic col lection
  395        */
  396       @WebMe thod(opera tionName =  "getPatie ntDemograp hics")
  397       public  V4ResultC ollection  getPatient Demographi cs(@WebPar am(name =  "queryBean ") QueryBe an queryBe an) {
  398           re turn getV4 (ClinicalD omainLoinc Code.PATIE NT_DEMOGRA PHICSV4, q ueryBean);
  399       }
  400  
  401       /**
  402        * Get  discharge  summaries .
  403        *
  404        * @pa ram queryB ean query  bean
  405        * @re turn summa ry collect ion
  406        */
  407       @WebMe thod(opera tionName =  "getPatie ntDischarg eSummaries ")
  408       public  V4ResultC ollection  getPatient DischargeS ummaries(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean)  {
  409           re turn getV4 (ClinicalD omainLoinc Code.INPAT IENT_NOTES , queryBea n);
  410       }
  411  
  412       /**
  413        * Get  patient e ncounters.
  414        *
  415        * @pa ram queryB ean query  bean
  416        * @re turn encou nter colle ction
  417        */
  418       @WebMe thod(opera tionName =  "getPatie ntEncounte rs")
  419       public  V4ResultC ollection  getPatient Encounters (@WebParam (name = "q ueryBean")  QueryBean  queryBean ) {
  420           re turn getV4 (ClinicalD omainLoinc Code.ENCOU NTERS, que ryBean);
  421       }
  422  
  423       /**
  424        * Get  patient f amily hist ory list.
  425        *
  426        * @pa ram queryB ean query  bean
  427        * @re turn famil y history  list colle ction
  428        */
  429       @WebMe thod(opera tionName =  "getPatie ntFamilyHi story")
  430       public  V4ResultC ollection  getPatient FamilyHist ory(@WebPa ram(name =  "queryBea n") QueryB ean queryB ean) {
  431           re turn getV4 (ClinicalD omainLoinc Code.FAMIL Y_HISTORIE S, queryBe an);
  432       }
  433       
  434       /**
  435        * Get  patient i mmunizatio ns.
  436        *
  437        * @pa ram queryB ean query  bean
  438        * @re turn immun ization co llection
  439        */
  440       @WebMe thod(opera tionName =  "getPatie ntImmuniza tions")
  441       public  V4ResultC ollection  getPatient Immunizati ons(@WebPa ram(name =  "queryBea n") QueryB ean queryB ean) {
  442           re turn getV4 (ClinicalD omainLoinc Code.IMMUN IZATIONS,  queryBean) ;
  443       }
  444  
  445       /**
  446        * Get  patient i nsurance.
  447        * 
  448        * @pa ram queryB ean query  bean
  449        * @re turn colle ction
  450        */
  451       @WebMe thod(opera tionName =  "getPatie ntInsuranc es")
  452       public  V4ResultC ollection  getPatient Insurances (@WebParam (name = "q ueryBean")  QueryBean  queryBean ) {
  453           re turn getV4 (ClinicalD omainLoinc Code.INSUR ANCES, que ryBean);
  454       }
  455  
  456           /* *
  457        * Get  chemistry  labs.
  458        *
  459        * @pa ram queryB ean query  bean
  460        * @re turn chemi stry colle ction
  461        */
  462       @WebMe thod(opera tionName =  "getPatie ntLabChemi stries")
  463       public  V4ResultC ollection  getPatient LabChemist ries(@WebP aram(name  = "queryBe an") Query Bean query Bean) {
  464           re turn getV4 (ClinicalD omainLoinc Code.LAB_C HEMISTRIES , queryBea n);
  465  
  466       }
  467  
  468  
  469       /**
  470        * Get  patient A P tests.
  471        *
  472        * @pa ram queryB ean query  bean
  473        * @re turn AP te st collect ion
  474        */
  475       @WebMe thod(opera tionName =  "getPatie ntLabAnato micPatholo gies")
  476       public  V4ResultC ollection  getPatient LabAnatomi cPathologi es(@WebPar am(name =  "queryBean ") QueryBe an queryBe an) {
  477           re turn getV4 (ClinicalD omainLoinc Code.LAB_A NATOMIC_PA THOLOGIES,  queryBean );
  478  
  479       }
  480  
  481       /**
  482        * Get  patient m icros.
  483        *
  484        * @pa ram queryB ean query  bean
  485        * @re turn micro  collectio n
  486        */
  487       @WebMe thod(opera tionName =  "getPatie ntLabMicro biologies" )
  488       public  V4ResultC ollection  getPatient LabMicrobi ologies(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) {
  489           re turn getV4 (ClinicalD omainLoinc Code.LAB_M ICROBIOLOG IES, query Bean);
  490  
  491       }
  492  
  493  
  494   //    /**
  495   //     * G et lab ord ers.
  496   //     *
  497   //     * @ param quer yBean quer y bean
  498   //     * @ return lab  order col lection
  499   //     */
  500   //    @Web Method(ope rationName  = "getPat ientLabOrd ers")
  501   //    publ ic V4Resul tCollectio n getPatie ntLabOrder s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) {
  502   //         return get V4(Clinica lDomainLoi ncCode.LAB _ORDERS, q ueryBean);
  503   //    }
  504  
  505   //    /**
  506   //     * G et medicat ion orders .
  507   //     *
  508   //     * @ param quer yBean quer y bean
  509   //     * @ return med ication or der collec tion
  510   //     */
  511   //    @Web Method(ope rationName  = "getPat ientMedica tionOrders ")
  512   //    publ ic V4Resul tCollectio n getPatie ntMedicati onOrders(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean)  {
  513   //         return get V4(Clinica lDomainLoi ncCode.MED ICATION_OR DERS, quer yBean);
  514   //    }
  515   //
  516  
  517       /**
  518        * Get  patient m anagement.  (patient  flags)
  519        *
  520        * @pa ram queryB ean query  bean
  521        * @re turn patie ntManageme nt list co llection
  522        */
  523       @WebMe thod(opera tionName =  "getPatie ntManageme nt")
  524       public  V4ResultC ollection  getPatient Management (@WebParam (name = "q ueryBean")  QueryBean  queryBean ) {
  525           re turn getV4 (ClinicalD omainLoinc Code.PATIE NT_MANAGEM ENT, query Bean);
  526       }
  527  
  528       /**
  529        * Get  patient m edications .
  530        *
  531        * @pa ram queryB ean query  bean
  532        * @re turn medic ation coll ection
  533        */
  534       @WebMe thod(opera tionName =  "getPatie ntMedicati ons")
  535       public  V4ResultC ollection  getPatient Medication s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) {
  536           re turn getV4 (ClinicalD omainLoinc Code.MEDIC ATIONS, qu eryBean);
  537       }
  538  
  539       /**
  540        * Get  patient n otes.
  541        *
  542        * @pa ram queryB ean query  bean
  543        * @re turn note  collection
  544        */
  545       @WebMe thod(opera tionName =  "getPatie ntNotes")
  546       public  V4ResultC ollection  getPatient Notes(@Web Param(name  = "queryB ean") Quer yBean quer yBean) {
  547           re turn getV4 (ClinicalD omainLoinc Code.NOTES , queryBea n);
  548       }
  549  
  550       /**
  551        * Get  patient o rders.
  552        *
  553        * @pa ram queryB ean query  bean
  554        * @re turn radio logy order  collectio n
  555        */
  556       @WebMe thod(opera tionName =  "getPatie ntOrders")
  557       public  V4ResultC ollection  getPatient Orders(@We bParam(nam e = "query Bean") Que ryBean que ryBean) {
  558           re turn getV4 (ClinicalD omainLoinc Code.ALL_O RDERS, que ryBean);
  559       }
  560  
  561       /**
  562        * Get  patient o ther histo ry list.
  563        *
  564        * @pa ram queryB ean query  bean
  565        * @re turn other  history l ist collec tion
  566        */
  567       @WebMe thod(opera tionName =  "getPatie ntOtherHis tory")
  568       public  V4ResultC ollection  getPatient OtherHisto ry(@WebPar am(name =  "queryBean ") QueryBe an queryBe an) {
  569           re turn getV4 (ClinicalD omainLoinc Code.OTHER _PAST_MEDI CAL_HISTOR IES, query Bean);
  570       }
  571  
  572       /**
  573        * Get  patient p roblem lis t.
  574        *
  575        * @pa ram queryB ean query  bean
  576        * @re turn probl em list co llection
  577        */
  578       @WebMe thod(opera tionName =  "getPatie ntProblemL ist")
  579       public  V4ResultC ollection  getPatient ProblemLis t(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) {
  580           re turn getV4 (ClinicalD omainLoinc Code.PROBL EMS, query Bean);
  581       }
  582  
  583       /**
  584        * Get  Questionn aire.
  585        *
  586        * @pa ram queryB ean query  bean
  587        * @re turn quest ionnaire l ist collec tion
  588        */
  589       @WebMe thod(opera tionName =  "getPatie ntQuestion naires")
  590       public  V4ResultC ollection  getPatient Questionna ires(@WebP aram(name  = "queryBe an") Query Bean query Bean) {
  591           re turn getV4 (ClinicalD omainLoinc Code.QUEST IONNAIRES,  queryBean );
  592       }
  593  
  594   //    /**
  595   //     * G et radiolo gy orders.
  596   //     *
  597   //     * @ param quer yBean quer y bean
  598   //     * @ return rad iology ord er collect ion
  599   //     */
  600   //    @Web Method(ope rationName  = "getPat ientRadiol ogyOrders" )
  601   //    publ ic V4Resul tCollectio n getPatie ntRadiolog yOrders(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) {
  602   //         return get V4(Clinica lDomainLoi ncCode.RAD IOLOGY_ORD ERS, query Bean);
  603   //    }
  604  
  605       /**
  606        * Get  patient r adiology r eports.
  607        *
  608        * @pa ram queryB ean query  bean
  609        * @re turn repor t collecti on
  610        */
  611       @WebMe thod(opera tionName =  "getPatie ntRadiolog yReports")
  612       public  V4ResultC ollection  getPatient RadiologyR eports(@We bParam(nam e = "query Bean") Que ryBean que ryBean) {
  613           re turn getV4 (ClinicalD omainLoinc Code.RADIO LOGY_REPOR TSV4, quer yBean);
  614       }
  615  
  616       /**
  617        * Get  patient s ocial hist ory list.
  618        *
  619        * @pa ram queryB ean query  bean
  620        * @re turn socia l history  list colle ction
  621        */
  622       @WebMe thod(opera tionName =  "getPatie ntSocialHi story")
  623       public  V4ResultC ollection  getPatient SocialHist ory(@WebPa ram(name =  "queryBea n") QueryB ean queryB ean) {
  624           re turn getV4 (ClinicalD omainLoinc Code.SOCIA L_HISTORIE S, queryBe an);
  625       }
  626  
  627       /**
  628        * Get  patient v itals.
  629        *
  630        * @pa ram queryB ean query  bean
  631        * @re turn vital  collectio n
  632        */
  633       @WebMe thod(opera tionName =  "getPatie ntVitals")
  634       public  V4ResultC ollection  getPatient Vitals(@We bParam(nam e = "query Bean") Que ryBean que ryBean) {
  635           re turn getV4 (ClinicalD omainLoinc Code.VITAL S, queryBe an);
  636       }
  637  
  638       /**
  639        * Get  VLER pati ent admiss ions.
  640        * 
  641        * @pa ram queryB ean query  bean
  642        * @re turn colle ction
  643        */
  644       @WebMe thod(opera tionName =  "getVLERP atientAdmi ssions")
  645       public  V4ResultC ollection  getVLERPat ientAdmiss ions(@WebP aram(name  = "queryBe an") Query Bean query Bean) {
  646           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RADMISSION S, queryBe an);
  647       }
  648       
  649       /**
  650        * Get  VLER pati ent allerg ies.
  651        *
  652        * @pa ram queryB ean query  bean
  653        * @re turn aller gy collect ion
  654        */
  655       @WebMe thod(opera tionName =  "getVLERP atientAlle rgies")
  656       public  V4ResultC ollection  getVLERPat ientAllerg ies(@WebPa ram(name =  "queryBea n") QueryB ean queryB ean) {
  657           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RALLERGIES , queryBea n);
  658       }
  659  
  660       /**
  661        * Get  VLER pati ent appoin tments.
  662        *
  663        * @pa ram queryB ean query  bean
  664        * @re turn appoi ntment col lection
  665        */
  666       @WebMe thod(opera tionName =  "getVLERP atientAppo intments")
  667       public  V4ResultC ollection  getVLERPat ientAppoin tments(@We bParam(nam e = "query Bean") Que ryBean que ryBean) {
  668           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RAPPOINTME NTS, query Bean);
  669       }
  670       
  671       /**
  672        * Get  VLER CCDA  document.
  673        * 
  674        * @pa ram queryB ean query  bean.
  675        * @re turn colle ction
  676        */
  677       @WebMe thod(opera tionName =  "getVLERP atientCCDA ")
  678       public  V4ResultC ollection  getVLERPat ientCCDA(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean)  {
  679           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RCCDA, que ryBean);
  680       }
  681  
  682       /**
  683        * Get  VLER CCDA  document  as JSON st ring.
  684        * 
  685        * @pa ram queryB ean query  bean
  686        * @re turn JSON  CCDA
  687        */
  688       @WebMe thod(opera tionName =  "getVLERP atientCCDA Raw")
  689       public  String ge tVLERPatie ntCCDARaw( @WebParam( name = "qu eryBean")  QueryBean  queryBean)  {
  690           St ring rtc =  "";
  691           V4 ResultColl ection rco ll = getVL ER(VLERCCD A, queryBe an);
  692           Ob jectMapper  objectMap per = new  ObjectMapp er();
  693           tr y {
  694                rtc = ob jectMapper .writeValu eAsString( rcoll);
  695           }  catch (Jso nProcessin gException  e) {
  696                rtc = "" ;
  697           }
  698           re turn rtc;
  699       }
  700  
  701       /**
  702        * Get  VLER pati ent demogr aphics.
  703        * 
  704        * @pa ram queryB ean query  bean.
  705        * @re turn colle ction
  706        */
  707       @WebMe thod(opera tionName =  "getVLERP atientDemo graphics")
  708       public  V4ResultC ollection  getVLERPat ientDemogr aphics(@We bParam(nam e = "query Bean") Que ryBean que ryBean) {
  709           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPATIENT_D EMOGRAPHIC S, queryBe an);
  710       }
  711       
  712       /**
  713        * Get  VLER pati ent Immuni zations.
  714        *
  715        * @pa ram queryB ean query  bean
  716        * @re turn immun ization co llection
  717        */
  718       @WebMe thod(opera tionName =  "getVLERP atientImmu nizations" )
  719       public  V4ResultC ollection  getVLERPat ientImmuni zations(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) {
  720           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RIMMUNIZAT IONS, quer yBean);
  721       }
  722       
  723       /**
  724        * Get  VLER pati ent insura nce.
  725        * 
  726        * @pa ram queryB ean query  bean
  727        * @re turn colle ction
  728        */
  729       @WebMe thod(opera tionName =  "getVLERP atientInsu rances")
  730       public  V4ResultC ollection  getVLERPat ientInsura nces(@WebP aram(name  = "queryBe an") Query Bean query Bean) {
  731           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RINSURANCE , queryBea n);
  732       }
  733       
  734       /**
  735        * Get  VLER pati ent Medica tions.
  736        *
  737        * @pa ram queryB ean query  bean
  738        * @re turn medic ation coll ection
  739        */
  740       @WebMe thod(opera tionName =  "getVLERP atientMedi cations")
  741       public  V4ResultC ollection  getVLERPat ientMedica tions(@Web Param(name  = "queryB ean") Quer yBean quer yBean) {
  742           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RMEDICATIO NS, queryB ean);
  743       }
  744       
  745       /**
  746        * Get  VLER pati ent proble m list.
  747        *
  748        * @pa ram queryB ean query  bean
  749        * @re turn probl em list co llection
  750        */
  751       @WebMe thod(opera tionName =  "getVLERP atientProb lemList")
  752       public  V4ResultC ollection  getVLERPat ientProble mList(@Web Param(name  = "queryB ean") Quer yBean quer yBean) {
  753           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPROBLEMS,  queryBean );
  754       }
  755       
  756       /**
  757        * Get  VLER resu lts.
  758        *
  759        * @pa ram queryB ean query  bean
  760        * @re turn resul ts collect ion
  761        */
  762       @WebMe thod(opera tionName =  "getVLERP atientResu lts")
  763       public  V4ResultC ollection  getVLERPat ientResult s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) {
  764           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RRESULTS,  queryBean) ;
  765       }
  766       
  767       /**
  768        * Get  VLER pati ent vitals .
  769        *
  770        * @pa ram queryB ean query  bean
  771        * @re turn vital s collecti on
  772        */
  773       @WebMe thod(opera tionName =  "getVLERP atientVita ls")
  774       public  V4ResultC ollection  getVLERPat ientVitals (@WebParam (name = "q ueryBean")  QueryBean  queryBean ) {
  775           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RVITALS, q ueryBean);
  776       }
  777       
  778       /**
  779        * Get  VLER pati ent proced ures.
  780        *
  781        * @pa ram queryB ean query  bean
  782        * @re turn proce dures coll ection
  783        */
  784       @WebMe thod(opera tionName =  "getVLERP atientProc edures")
  785       public  V4ResultC ollection  getVLERPat ientProced ures(@WebP aram(name  = "queryBe an") Query Bean query Bean) {
  786           re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPROCEDURE S, queryBe an);
  787       }
  788       
  789       /**
  790        * Log  request.
  791        *
  792        * @pa ram queryB ean query  bean
  793        * @re turn start  time
  794        */
  795       privat e long log Request(Qu eryBean qu eryBean) {
  796           if  (wsContex t != null)  {
  797                MessageC ontext msg ctx = wsCo ntext.getM essageCont ext();
  798                SimpleDa teFormat s df = new S impleDateF ormat("yyy yMMddHHmms s", Locale .getDefaul t());
  799  
  800                if (quer yBean == n ull) {
  801                    LOGG ER.error(" begin {} ( queryBean  is null) " , msgctx.g et(Message Context.WS DL_OPERATI ON));
  802                } else {
  803                    LOGG ER.info("b egin " + m sgctx.get( MessageCon text.WSDL_ OPERATION)  + " (" +  DBLogger.c leanString (queryBean .getPatien tId()) + " ) ");
  804                    if ( LOGGER.isD ebugEnable d()) {
  805                         if (queryB ean.getSta rtDate() ! = null) {
  806                             LOGGER .debug("in fo " + msg ctx.get(Me ssageConte xt.WSDL_OP ERATION) +  " (" + DB Logger.cle anString(q ueryBean.g etPatientI d()) + ")  startDate  = " + sdf. format(que ryBean.get StartDate( ).getTime( )));
  807                         }
  808                         if (queryB ean.getEnd Date() !=  null) {
  809                             LOGGER .debug("in fo " + msg ctx.get(Me ssageConte xt.WSDL_OP ERATION) +  " (" + DB Logger.cle anString(q ueryBean.g etPatientI d()) + ")  endDate =  " + sdf.fo rmat(query Bean.getEn dDate().ge tTime()));
  810                         }
  811                         if (queryB ean.getInc ludedSourc es() != nu ll) {
  812                             List<S tring> src  = queryBe an.getIncl udedSource s();
  813                             if (Co llectionUt ils.isNotE mpty(src))  {
  814                                 in t srcSize  = src.size ();
  815                                 fo r (int i =  0; i < sr cSize; ++i ) {
  816                                      LOGGER.d ebug("info  " + msgct x.get(Mess ageContext .WSDL_OPER ATION) + "  (" + DBLo gger.clean String(que ryBean.get PatientId( )) + ") in clude src  = " + DBLo gger.clean String(src .get(i)));
  817                                 }
  818                             }
  819                         }
  820                         if (queryB ean.getExc ludedSourc es() != nu ll) {
  821                             List<S tring> src  = queryBe an.getExcl udedSource s();
  822                             if (Co llectionUt ils.isNotE mpty(src))  {
  823                                 in t srcSize  = src.size ();
  824                                 fo r (int i =  0; i < sr cSize; ++i ) {
  825                                      LOGGER.d ebug("info  " + msgct x.get(Mess ageContext .WSDL_OPER ATION) + "  (" + DBLo gger.clean String(que ryBean.get PatientId( )) + ") ex clude src  = " + DBLo gger.clean String(src .get(i)));
  826                                 }
  827                             }
  828                         }
  829                    }
  830                }
  831           }
  832           re turn Syste m.currentT imeMillis( );
  833       }
  834  
  835       /**
  836        * Log  response.
  837        *
  838        * @pa ram queryB ean query  bean
  839        * @pa ram except ion except ion
  840        * @pa ram rtc co llection
  841        * @pa ram count  count in r eturn coll ection
  842        * @pa ram stime  start time
  843        * @pa ram cached  cached
  844        */
  845       privat e void log Response(S tring oper ation, Que ryBean que ryBean, St ring excep tion, Resu ltCollecti on rtc, in t count, l ong stime,  String ca ched) {
  846           lo ng etime =  System.cu rrentTimeM illis();
  847           St ring patie ntId = "Pa tient ID w as not set ";
  848           St ring query Info = "";
  849           in t scount =  0;
  850           in t ecount =  0;
  851  
  852           if  (wsContex t != null)  {
  853                if (quer yBean != n ull) {
  854                    pati entId = qu eryBean.ge tPatientId ();
  855                    BHIE Limit limi t = BHIELi mit.getIns tance();
  856                    quer yInfo = li mit.getKey (queryBean , "");
  857                }
  858                
  859                if (rtc  == null) {
  860                    BHIE Status.upd ateStatist ics(operat ion, "fals e", true,  etime - st ime);
  861                    LOGG ER.info("e nd {} mill iseconds { } ({}) rtc =null exce ption={}",   (etime -  stime), o peration,   DBLogger. cleanStrin g(patientI d), except ion);
  862                    Stri ng dsource  = AppConf ig.getInst ance().get DataSource ();
  863                    DBLo gger dbl =  new DBLog ger(dsourc e);
  864                    dbl. logEvent(p atientId,  "BHIERelay ." + opera tion, exce ption, eti me - stime , 0, "fals e", queryI nfo);
  865                    dbl. close();
  866                } else {
  867                    BHIE Status.upd ateStatist ics(operat ion, cache d, false,  etime - st ime);
  868                    Stri ng errorms g = ""; // rtc.getErr or();
  869                    if ( rtc.getSta tusList()  != null) {
  870                         scount = r tc.getStat usList().s ize();
  871                    }
  872                    if ( rtc.getErr orList() ! = null) {
  873                         ecount = r tc.getErro rList().si ze();
  874  
  875                         List<gov.v a.med.bhie .beans.Err or> src =  rtc.getErr orList();
  876                         if (Collec tionUtils. isNotEmpty (src)) {
  877                             int sr cSize = sr c.size();
  878                             for (i nt i = 0;  i < srcSiz e; ++i) {
  879                                 if  (src.get( i).getErro rCode() !=  null && s rc.get(i). getErrorCo de().lengt h() > 0) {
  880                                      errormsg  = src.get (i).getErr orCode();
  881                                      break;
  882                                 }
  883                             }
  884                         }
  885                         if (ecount  > 0 && (e rrormsg ==  null || e rrormsg.is Empty()))  {
  886                             errorm sg = Integ er.toStrin g(ecount)  + " errors  returned" ;
  887                         }
  888                    }
  889                    if ( errormsg = = null) {
  890                         errormsg =  "";
  891                    }
  892                    LOGG ER.info("e nd {} mill iseconds { } ({}) Com plete rtc. size()={}  errorsize= {} statuss ize={}", ( etime - st ime), oper ation, DBL ogger.clea nString(pa tientId),  count, eco unt, scoun t);
  893                    Stri ng dsource  = AppConf ig.getInst ance().get DataSource ();
  894                    DBLo gger dbl =  new DBLog ger(dsourc e);
  895                    dbl. logEvent(p atientId,  "BHIERelay ." + opera tion, erro rmsg, etim e - stime,  count, ca ched);
  896                    dbl. close();
  897                    if ( LOGGER.isD ebugEnable d()) {
  898                         if (rtc.ge tQueryComp lete() !=  null && rt c.getQuery Complete() .length()  > 0) {
  899                             LOGGER .debug("rt c info " +  operation  + " (" +  DBLogger.c leanString (patientId ) + ") que ryComplete  = " + DBL ogger.clea nString(rt c.getQuery Complete() ));
  900                         }
  901                         if (rtc.ge tQueryComp lete() !=  null && rt c.getError List().siz e() > 0) {
  902                             LOGGER .debug("rt c info " +  operation  + " (" +  DBLogger.c leanString (patientId ) + ") Err or = " + D BLogger.cl eanString( errormsg)) ;
  903                         }
  904                         if (rtc.ge tStatusLis t() != nul l) {
  905                             LOGGER .debug("co mplete inf o " + oper ation + "  (" + DBLog ger.cleanS tring(pati entId) + " ) StatusLi st.size()  = " + rtc. getStatusL ist().size ());
  906                             List<S iteStatus>  src = rtc .getStatus List();
  907                             if (Co llectionUt ils.isNotE mpty(src))  {
  908                                 in t srcSize  = src.size ();
  909                                 fo r (int i =  0; i < sr cSize; ++i ) {
  910                                      if (src. get(i).get ExpectedCo unt() != n ull && src .get(i).ge tExpectedC ount().len gth() > 0)  {
  911                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") S tatus[" +  i + "] exp ected coun t=" + DBLo gger.clean String(src .get(i).ge tExpectedC ount()));
  912                                      }
  913                                      if (src. get(i).get RetrievedC ount() !=  null && sr c.get(i).g etRetrieve dCount().l ength() >  0) {
  914                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") S tatus[" +  i + "] ret rieved cou nt=" + DBL ogger.clea nString(sr c.get(i).g etRetrieve dCount())) ;
  915                                      }
  916                                      if (src. get(i).get SiteId() ! = null &&  src.get(i) .getSiteId ().length( ) > 0) {
  917                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") S tatus[" +  i + "] sit e id=" + D BLogger.cl eanString( src.get(i) .getSiteId ()));
  918                                      }
  919                                      if (src. get(i).get SiteName()  != null & & src.get( i).getSite Name().len gth() > 0)  {
  920                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") S tatus[" +  i + "] sit e name=" +  DBLogger. cleanStrin g(src.get( i).getSite Name()));
  921                                      }
  922                                      if (src. get(i).get SiteStatus () != null  && src.ge t(i).getSi teStatus() .length()  > 0) {
  923                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") S tatus[" +  i + "] sit e status="  + DBLogge r.cleanStr ing(src.ge t(i).getSi teStatus() ));
  924                                      }
  925                                 }
  926                             }
  927                         }
  928                         if (rtc.ge tErrorList () != null ) {
  929                             LOGGER .debug("co mplete inf o " + oper ation + "  (" + DBLog ger.cleanS tring(pati entId) + " ) ErrorLis t.size() =  " + rtc.g etErrorLis t().size() );
  930                             List<g ov.va.med. bhie.beans .Error> sr c = rtc.ge tErrorList ();
  931       
  932                             if (Co llectionUt ils.isNotE mpty(src))  {
  933                                 in t srcSize  = src.size ();
  934                                 fo r (int i =  0; i < sr cSize; ++i ) {
  935                                      if (src. get(i).get ErrorCode( ) != null  && src.get (i).getErr orCode().l ength() >  0) {
  936                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") E rror[" + i  + "] Erro r code=" +  DBLogger. cleanStrin g(src.get( i).getErro rCode()));
  937                                      }
  938                                      if (src. get(i).get ErrorValue () != null  && src.ge t(i).getEr rorValue() .length()  > 0) {
  939                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") E rror[" + i  + "] Erro r value="  + DBLogger .cleanStri ng(src.get (i).getErr orValue()) );
  940                                      }
  941                                      if (src. get(i).get ErrorLocat ion() != n ull && src .get(i).ge tErrorLoca tion().len gth() > 0)  {
  942                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") E rror[" + i  + "] Erro r loc=" +  DBLogger.c leanString (src.get(i ).getError Location() ));
  943                                      }
  944                                      if (src. get(i).get ErrorSever ity() != n ull && src .get(i).ge tErrorSeve rity().len gth() > 0)  {
  945                                          LOGG ER.debug(" rtc info "  + operati on + " ("  + DBLogger .cleanStri ng(patient Id) + ") E rror[" + i  + "] Erro r sev=" +  DBLogger.c leanString (src.get(i ).getError Severity() ));
  946                                      }
  947                                 }
  948                             }
  949                         }
  950                    }
  951                }
  952           }
  953       }
  954       
  955       /**
  956        * Log  response.
  957        *
  958        * @pa ram queryB ean query  bean
  959        * @pa ram except ion except ion
  960        * @pa ram rtc co llection
  961        * @pa ram count  count in r eturn coll ection
  962        * @pa ram stime  start time
  963        * @pa ram cached  cached
  964        */
  965       privat e void log VLERRespon se(String  operation,  QueryBean  queryBean , String e xception,  V4ResultCo llection r tc, int co unt, long  stime, Str ing cached ) {
  966           // TODO: Refa ctor both  logRespons e methods  into one.
  967           lo ng etime =  System.cu rrentTimeM illis();
  968           St ring patie ntId = "Pa tient ID w as not set ";
  969           St ring query Info = "";
  970           in t scount =  0;
  971           in t ecount =  0;
  972  
  973           if  (wsContex t != null)  {
  974                if (quer yBean != n ull) {
  975                    pati entId = qu eryBean.ge tPatientId ();
  976                    BHIE Limit limi t = BHIELi mit.getIns tance();
  977                    quer yInfo = li mit.getKey (queryBean , "");
  978                }
  979                
  980                if (rtc  == null) {
  981                    BHIE Status.upd ateStatist ics(operat ion, "fals e", true,  etime - st ime);
  982                    LOGG ER.info("e nd {} mill iseconds { } ({}) rtc =null exce ption={} " , (etime -  stime), o peration,  DBLogger.c leanString (patientId ), DBLogge r.cleanStr ing(except ion));
  983                    Stri ng dsource  = AppConf ig.getInst ance().get DataSource ();
  984                    DBLo gger dbl =  new DBLog ger(dsourc e);
  985                    dbl. logEvent(p atientId,  "BHIERelay ." + opera tion, exce ption, eti me - stime , 0, "fals e", queryI nfo);
  986                    dbl. close();
  987                } else {
  988                    Stri ng errorms g = "";
  989                    if ( rtc.getErr orList() ! = null &&  !rtc.getEr rorList(). isEmpty())  {
  990                         errormsg =  rtc.getEr rorListv4( ).get(0);
  991                    }
  992                    BHIE Status.upd ateStatist ics(operat ion, cache d, false,  etime - st ime);
  993                    if ( rtc.getSta tusList()  != null) {
  994                         scount = r tc.getStat usList().s ize();
  995                    }
  996                    LOGG ER.info("e nd {} mill iseconds { } ({}) Com plete rtc. size()={}  errorsize= {} statuss ize={}", ( etime - st ime), oper ation, DBL ogger.clea nString(pa tientId),  count, eco unt, scoun t);
  997                    Stri ng dsource  = AppConf ig.getInst ance().get DataSource ();
  998                    DBLo gger dbl =  new DBLog ger(dsourc e);
  999                    dbl. logEvent(p atientId,  "BHIERelay ." + opera tion, erro rmsg, etim e - stime,  count, ca ched);
  1000                    dbl. close();
  1001                    if ( LOGGER.isD ebugEnable d()) {
  1002                         if (rtc.ge tQueryComp lete() !=  null && rt c.getQuery Complete() .length()  > 0) {
  1003                             LOGGER .debug("rt c info " +  operation  + " (" +  DBLogger.c leanString (patientId ) + ") que ryComplete  = " + DBL ogger.clea nString(rt c.getQuery Complete() ));
  1004                         }
  1005                         if (rtc.ge tQueryComp lete() !=  null && er rormsg.len gth() > 0)  {
  1006                             LOGGER .debug("rt c info " +  operation  + " (" +  DBLogger.c leanString (patientId ) + ") Err or = " + D BLogger.cl eanString( errormsg)) ;
  1007                         }
  1008                    }
  1009                }
  1010           }
  1011       }
  1012       
  1013       /**
  1014        * Get  VLER data .
  1015        * 
  1016        * @pa ram LOINC  LOINC code
  1017        * @pa ram queryB ean query  bean
  1018        * @re turn colle ction
  1019        */
  1020       privat e V4Result Collection  getVLER(C linicalDom ainLoincCo de LOINC,  QueryBean  queryBean)  {
  1021           V4 ResultColl ection rtc  = null;
  1022           lo ng stime =  logReques t(queryBea n);
  1023  
  1024           tr y {
  1025                VLERDao  dao = new  VLERDao();
  1026                int coun t = 0;
  1027                if(query Bean.getEx cludedSour ces() != n ull)
  1028                    quer yBean.getE xcludedSou rces().cle ar();
  1029                if(query Bean.getIn cludedSour ces() != n ull)
  1030                    quer yBean.getI ncludedSou rces().cle ar();
  1031                if(query Bean.getSt artDate()  != null)
  1032                    quer yBean.setS tartDate(n ull);
  1033                if(query Bean.getEn dDate() !=  null)
  1034                    quer yBean.setE ndDate(nul l);
  1035  
  1036                rtc = V4 Limit.getI nstance(). getV4Cache ("VLER" +  VLERCCDA.g etLoincCod e(), query Bean);
  1037                if (rtc  == null) {
  1038                    rtc  = dao.getV LERData(qu eryBean);
  1039                    if ( rtc != nul l) {
  1040                         count = ge tSize(LOIN C, rtc);
  1041                         if (AppCon fig.getIns tance().ge tRelayEndp ointCount( ) > 1) {
  1042                             String  key = V4L imit.getIn stance().g etKey("VLE R" + VLERC CDA.getLoi ncCode(),  queryBean) ;
  1043                             String  rcoll = " ";
  1044                             Object Mapper obj ectMapper  = new Obje ctMapper() ;
  1045                             try {
  1046                                 rc oll = obje ctMapper.w riteValueA sString(rt c);
  1047                             } catc h (JsonPro cessingExc eption e)  {
  1048                                 rc oll = "";
  1049                             }                      
  1050                             distri buteCache( "V4ResultC ollection" , key, rco ll);
  1051                         } else {
  1052                             V4Limi t.getInsta nce().putV 4Cache("VL ER" + VLER CCDA.getLo incCode(),  queryBean , rtc);
  1053                         }
  1054                    }
  1055                    logV LERRespons e(VLERCCDA .getLoincC ode(), que ryBean, "" , rtc, cou nt, stime,  "false");
  1056                } else {
  1057                    logV LERRespons e(VLERCCDA .getLoincC ode(), que ryBean, "" , rtc, get Size(LOINC , rtc), st ime, "true ");
  1058                }
  1059           }  catch (Dao Exception  e) {
  1060                logRespo nse(LOINC. getLoincCo de(), quer yBean, e.g etLocalize dMessage() , null, 0,  stime, "f alse");
  1061                logError (e);
  1062                throw ne w RuntimeE xception(e );
  1063           }
  1064           if  (rtc != n ull) {
  1065                rtc.setV ler(true);
  1066           }
  1067           re turn rtc;
  1068       }
  1069       
  1070       /**
  1071        * Get  BDA V4 da ta.
  1072        * 
  1073        * @pa ram loinc  loinc
  1074        * @pa ram queryB ean query  bean
  1075        * @re turn colle ction 
  1076        */
  1077       privat e V4Result Collection  getV4(Cli nicalDomai nLoincCode  loinc, Qu eryBean qu eryBean) {
  1078           V4 ResultColl ection rtc  = null;
  1079           lo ng stime =  logReques t(queryBea n);
  1080  
  1081           tr y {
  1082                V4Dao da o = new V4 Dao();
  1083                int coun t = 0;
  1084                rtc = da o.getV4Dat a(loinc, q ueryBean);
  1085                if (rtc  != null) {
  1086                    coun t = getSiz e(loinc, r tc);
  1087                }
  1088                logVLERR esponse(lo inc.getLoi ncCode(),  queryBean,  "", rtc,  count, sti me, "false ");
  1089           }  catch (Dao Exception  e) {
  1090                logRespo nse(loinc. getLoincCo de(), quer yBean, e.g etLocalize dMessage() , null, 0,  stime, "f alse");
  1091                logError (e);
  1092                throw ne w RuntimeE xception(e );
  1093           }
  1094           re turn rtc;
  1095       }
  1096       
  1097       /**
  1098        * Get  size of d ata list.
  1099        * 
  1100        * @pa ram LOINC  LOINC
  1101        * @pa ram rtc da ta
  1102        * @re turn size
  1103        */
  1104       privat e int getS ize(Clinic alDomainLo incCode LO INC, V4Res ultCollect ion rtc) {
  1105           in t count =  0;
  1106           if  (rtc != n ull && rtc .getDataRe cordList()  != null)  {
  1107                if (LOIN C == Clini calDomainL oincCode.A DMISSIONSV 4 && rtc.g etDataReco rdList().g etAdmissio ns() != nu ll) {
  1108                    coun t = rtc.ge tDataRecor dList().ge tAdmission s().size() ;
  1109                } else i f (LOINC = = Clinical DomainLoin cCode.VLER ADMISSIONS  && rtc.ge tDataRecor dList().ge tAdmission s() != nul l) {
  1110                    coun t = rtc.ge tDataRecor dList().ge tAdmission s().size() ;
  1111                } else i f (LOINC = = Clinical DomainLoin cCode.ALLE RGIESV4 &&  rtc.getDa taRecordLi st().getAl lergy() !=  null) {
  1112                    coun t = rtc.ge tDataRecor dList().ge tAllergy() .size();
  1113                } else i f (LOINC = = Clinical DomainLoin cCode.VLER ALLERGIES  && rtc.get DataRecord List().get Allergy()  != null) {
  1114                    coun t = rtc.ge tDataRecor dList().ge tAllergy() .size();
  1115                } else i f (LOINC = = Clinical DomainLoin cCode.APPO INTMENTS & & rtc.getD ataRecordL ist().getA ppointment s() != nul l) {
  1116                    coun t = rtc.ge tDataRecor dList().ge tAppointme nts().size ();
  1117                } else i f (LOINC = = Clinical DomainLoin cCode.VLER APPOINTMEN TS && rtc. getDataRec ordList(). getAppoint ments() !=  null) {
  1118                    coun t = rtc.ge tDataRecor dList().ge tAppointme nts().size ();
  1119   //             } else  if (LOINC  == Clinic alDomainLo incCode.CO NSULT_ORDE RS && rtc. getDataRec ordList(). getConsult Orders() ! = null) {
  1120   //                 co unt = rtc. getDataRec ordList(). getConsult Orders().s ize();
  1121                } else i f (LOINC = = Clinical DomainLoin cCode.PATI ENT_DEMOGR APHICSV4 & & rtc.getD ataRecordL ist().getD emographic s() != nul l) {
  1122                    coun t = rtc.ge tDataRecor dList().ge tDemograph ics().size ();
  1123                } else i f (LOINC = = Clinical DomainLoin cCode.VLER PATIENT_DE MOGRAPHICS  && rtc.ge tDataRecor dList().ge tDemograph ics() != n ull) {
  1124                    coun t = rtc.ge tDataRecor dList().ge tDemograph ics().size ();
  1125                } else i f (LOINC = = Clinical DomainLoin cCode.PATI ENT_MANAGE MENT && rt c.getDataR ecordList( ).getPatie ntManageme nt() != nu ll) {
  1126                    coun t = rtc.ge tDataRecor dList().ge tPatientMa nagement() .size();
  1127                } else i f (LOINC = = Clinical DomainLoin cCode.DEPL OYMENT_FOR MS && rtc. getDataRec ordList(). getDeploym entForms()  != null)  {
  1128                    coun t = rtc.ge tDataRecor dList().ge tDeploymen tForms().s ize();
  1129                } else i f (LOINC = = Clinical DomainLoin cCode.ENCO UNTER_NOTE S && rtc.g etDataReco rdList().g etEncounte rNotes() ! = null) {
  1130                    coun t = rtc.ge tDataRecor dList().ge tEncounter Notes().si ze();
  1131                } else i f (LOINC = = Clinical DomainLoin cCode.ENCO UNTERS &&  rtc.getDat aRecordLis t().getEnc ounters()  != null) {
  1132                    coun t = rtc.ge tDataRecor dList().ge tEncounter s().size() ;
  1133                } else i f (LOINC = = Clinical DomainLoin cCode.IMMU NIZATIONS  && rtc.get DataRecord List().get Immunizati ons() != n ull) {
  1134                    coun t = rtc.ge tDataRecor dList().ge tImmunizat ions().siz e();
  1135                } else i f (LOINC = = Clinical DomainLoin cCode.VLER IMMUNIZATI ONS && rtc .getDataRe cordList() .getImmuni zations()  != null) {
  1136                    coun t = rtc.ge tDataRecor dList().ge tImmunizat ions().siz e();
  1137                } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ ANATOMIC_P ATHOLOGIES  && rtc.ge tDataRecor dList().ge tLabApResu lts() != n ull) {
  1138                    coun t = rtc.ge tDataRecor dList().ge tLabApResu lts().size ();
  1139                } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ CHEMISTRIE S && rtc.g etDataReco rdList().g etLabChemR esults() ! = null) {
  1140                    coun t = rtc.ge tDataRecor dList().ge tLabChemRe sults().si ze();
  1141                } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ MICROBIOLO GIES && rt c.getDataR ecordList( ).getLabMi croResults () != null ) {
  1142                    coun t = rtc.ge tDataRecor dList().ge tLabMicroR esults().s ize();
  1143   //             } else  if (LOINC  == Clinic alDomainLo incCode.LA B_ORDERS & & rtc.getD ataRecordL ist().getL abOrders()  != null)  {
  1144   //                 co unt = rtc. getDataRec ordList(). getLabOrde rs().size( );
  1145   //             } else  if (LOINC  == Clinic alDomainLo incCode.ME DICATION_O RDERS && r tc.getData RecordList ().getMedi cationOrde rs() != nu ll) {
  1146   //                 co unt = rtc. getDataRec ordList(). getMedicat ionOrders( ).size();
  1147                } else i f (LOINC = = Clinical DomainLoin cCode.MEDI CATIONS &&  rtc.getDa taRecordLi st().getMe dications( ) != null)  {
  1148                    coun t = rtc.ge tDataRecor dList().ge tMedicatio ns().size( );
  1149                } else i f (LOINC = = Clinical DomainLoin cCode.VLER MEDICATION S && rtc.g etDataReco rdList().g etMedicati ons() != n ull) {
  1150                    coun t = rtc.ge tDataRecor dList().ge tMedicatio ns().size( );
  1151                } else i f (LOINC = = Clinical DomainLoin cCode.NOTE S && rtc.g etDataReco rdList().g etNotes()  != null) {
  1152                    coun t = rtc.ge tDataRecor dList().ge tNotes().s ize();
  1153                } else i f (LOINC = = Clinical DomainLoin cCode.INSU RANCES &&  rtc.getDat aRecordLis t().getPay ers() != n ull) {
  1154                    coun t = rtc.ge tDataRecor dList().ge tPayers(). size();
  1155                } else i f (LOINC = = Clinical DomainLoin cCode.VLER INSURANCE  && rtc.get DataRecord List().get Payers() ! = null) {
  1156                    coun t = rtc.ge tDataRecor dList().ge tPayers(). size();
  1157                } else i f (LOINC = = Clinical DomainLoin cCode.PROB LEMS && rt c.getDataR ecordList( ).getProbl ems() != n ull) {
  1158                    coun t = rtc.ge tDataRecor dList().ge tProblems( ).size();
  1159                } else i f (LOINC = = Clinical DomainLoin cCode.VLER PROBLEMS & & rtc.getD ataRecordL ist().getP roblems()  != null) {
  1160                    coun t = rtc.ge tDataRecor dList().ge tProblems( ).size();
  1161                } else i f (LOINC = = Clinical DomainLoin cCode.PROC EDURES &&  rtc.getDat aRecordLis t().getPro cedures()  != null) {
  1162                    coun t = rtc.ge tDataRecor dList().ge tProcedure s().size() ;
  1163                } else i f (LOINC = = Clinical DomainLoin cCode.VLER PROCEDURES  && rtc.ge tDataRecor dList().ge tProcedure s() != nul l) {
  1164                    coun t = rtc.ge tDataRecor dList().ge tProcedure s().size() ;
  1165                } else i f (LOINC = = Clinical DomainLoin cCode.QUES TIONNAIRES  && rtc.ge tDataRecor dList().ge tQuestionn aires() !=  null) {
  1166                    coun t = rtc.ge tDataRecor dList().ge tQuestionn aires().si ze();
  1167   //             } else  if (LOINC  == Clinic alDomainLo incCode.RA DIOLOGY_OR DERS && rt c.getDataR ecordList( ).getRadio logyOrders () != null ) {
  1168   //                 co unt = rtc. getDataRec ordList(). getRadiolo gyOrders() .size();
  1169                } else i f (LOINC = = Clinical DomainLoin cCode.RADI OLOGY_REPO RTSV4 && r tc.getData RecordList ().getRadi ologyRepor ts() != nu ll) {
  1170                    coun t = rtc.ge tDataRecor dList().ge tRadiology Reports(). size();
  1171   //             } else  if (LOINC  == Clinic alDomainLo incCode.VL ERRESULTS  && rtc.get DataRecord List().get Results()  != null) {
  1172   //                 co unt = rtc. getDataRec ordList(). getResults ().size();
  1173                } else i f (LOINC = = Clinical DomainLoin cCode.VITA LS && rtc. getDataRec ordList(). getVitals( ) != null)  {
  1174                    coun t = rtc.ge tDataRecor dList().ge tVitals(). size();
  1175                }
  1176           }
  1177           re turn count ;
  1178       }
  1179       
  1180       /**
  1181        * Get  user reco rd from sn areworks.
  1182        * 
  1183        * @pa ram certif icate user s certific ate
  1184        * @pa ram user u ser
  1185        * @pa ram creden tial crede ntial
  1186        * @re turn user
  1187        */
  1188       @WebMe thod(opera tionName =  "getSnare worksUser" )
  1189       public  SnareUser  getSnarew orksUser(@ WebParam(n ame = "cer tificate")  String ce rtificate,  @WebParam (name = "u ser") Stri ng user, @ WebParam(n ame = "cre dential")  String cre dential) {
  1190           Sn areUser rt c = null;
  1191           St ring host  = AppConfi g.getInsta nce().getP roperties( ).getPrope rty("SNARE WORKS_HOST ", "172.18 .53.16");
  1192           St ring port  = AppConfi g.getInsta nce().getP roperties( ).getPrope rty("SNARE WORKS_PORT ", "510");
  1193           LO GGER.debug ("getSnare worksUser  Cert=" + D BLogger.cl eanString( certificat e));
  1194           LO GGER.debug ("getSnare worksUser  User=" + D BLogger.cl eanString( user));
  1195           LO GGER.debug ("getSnare worksUser  Credential =" + DBLog ger.cleanS tring(cred ential));
  1196             int iport  REDACTED ;
  1197           tr y {
  1198                iport =  Integer.pa rseInt(por t);
  1199           }  catch (Num berFormatE xception e ) {
  1200                  iport =  REDACTED ;
  1201           }
  1202           Sn areworksHa ndler snar e = new Sn areworksHa ndler();
  1203           if  (user !=  null && us er.length( ) > 0) {
  1204                rtc = sn are.checkC redentials (user, cre dential, h ost, iport );
  1205           }
  1206           if  (rtc == n ull && cer tificate ! = null &&  certificat e.length()  > 0) {
  1207                rtc = sn are.checkC ert(certif icate, hos t, iport);
  1208           }
  1209           re turn rtc;
  1210       }
  1211  
  1212       /**
  1213        * Res et status  info.
  1214        * 
  1215        */
  1216       @WebMe thod(opera tionName =  "resetSta tus")
  1217       public  void rese tStatus()  {
  1218           BH IEStatus.r esetStatus ();
  1219       }
  1220       
  1221       /**
  1222        * Get  status in fo.
  1223        * 
  1224        * @re turn statu s
  1225        */
  1226       @WebMe thod(opera tionName =  "getStatu s")
  1227       public  String ge tStatus()  {
  1228           re turn BHIES tatus.getS tatus();
  1229       }
  1230       
  1231       /**
  1232        * Add  cache rec ord.
  1233        * 
  1234        * @pa ram type d ocument ty pe
  1235        * @pa ram key ke y
  1236        * @pa ram value  cached rec ord
  1237        * @pa ram timest amp time s tamp
  1238        */
  1239       @WebMe thod(opera tionName =  "addCache ")
  1240       public  void addC ache(@WebP aram(name  = "type")  String typ e, @WebPar am(name =  "key") Str ing key, @ WebParam(n ame = "val ue") Strin g value, @ WebParam(n ame = "tim estamp") S tring time stamp) {
  1241           LO GGER.debug ("addCache  " + DBLog ger.cleanS tring(type ) + ", " +  DBLogger. cleanStrin g(key) + " , " + DBLo gger.clean String(val ue) + ", "  + DBLogge r.cleanStr ing(timest amp));
  1242           if  ("V4Resul tCollectio n".equals( type)) {
  1243                V4Limit. getInstanc e().putV4C ache(key,  value);
  1244           }  else {
  1245                ObjectMa pper objec tMapper =  new Object Mapper();
  1246                objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e);
  1247  
  1248                LOGGER.e rror("addC ache - unk nown type:  {}", DBLo gger.clean String(typ e));
  1249           }
  1250       }
  1251       
  1252   //    /**
  1253   //     * C all addCac he on all  relay serv ices.
  1254   //     *
  1255   //     * @ param type  type of c ache entry
  1256   //     * @ param quer yBean quer y bean
  1257   //     * @ param resu ltCollecti on value t o cache
  1258   //     */
  1259   //    priv ate void d istributeC ache(Strin g type, Qu eryBean qu eryBean, S tring resu ltCollecti on) {
  1260   //         String key  = BHIELim it.getInst ance().get Key(queryB ean, type) ;
  1261   //         distribute Cache(type , key, res ultCollect ion);
  1262   //    }
  1263       
  1264       /**
  1265        * Cal l addCache  on all re lay servic es.
  1266        * 
  1267        * @pa ram type t ype of cac he entry
  1268        * @pa ram key ke y of cache  entry
  1269        * @pa ram result Collection  value to  cache
  1270        */
  1271       privat e void dis tributeCac he(String  type, Stri ng key, St ring resul tCollectio n) {
  1272           St ring endpo ints = App Config.get Instance() .getRelayE ndpoints() ;
  1273           St ring auths  = AppConf ig.getInst ance().get RelayEndpo intAuths() ;
  1274           Si mpleDateFo rmat sdf =  new Simpl eDateForma t("yyyyMMd dHHmmss",  Locale.get Default()) ;
  1275           Da te now = n ew Date();
  1276           St ring tstam p = sdf.fo rmat(now);
  1277           if  (endpoint s != null  && endpoin ts.length( ) > 0) {
  1278                String[]  endpoint  = endpoint s.split("\ \|");
  1279                String[]  auth = nu ll;
  1280                if (auth s != null  && auths.l ength() >  0) {
  1281                    auth  = auths.s plit("\\|" );
  1282                }
  1283                for (int  i = 0; i  < endpoint .length; + +i) {
  1284                    if ( auth != nu ll && auth .length >  i && auth[ i] != null  && auth[i ].length()  > 0) {
  1285                         (new BHIEC acheClient (endpoint[ i], auth[i ], type, k ey, result Collection , tstamp)) .start();
  1286                    } el se {
  1287                         (new BHIEC acheClient (endpoint[ i], "", ty pe, key, r esultColle ction, tst amp)).star t();
  1288                    }
  1289                }
  1290           }
  1291       }
  1292  
  1293       privat e void log Error(Exce ption e){
  1294           LO GGER.error ("BHIERela yService E RROR: " +  e.getMessa ge(), e);
  1295       }
  1296   }