800. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/18/2018 2:02:22 PM 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.

800.1 Files compared

# Location File Last Modified
1 VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingQueryFactory.java Thu Oct 11 13:30:12 2018 UTC
2 VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource VistaImagingQueryFactory.java Wed Oct 17 19:10:09 2018 UTC

800.2 Comparison summary

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

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

800.4 Active regular expressions

No regular expressions were active.

800.5 Comparison detail

  1   package go v.va.med.i maging.vis taimagingd atasource;
  2  
  3   import gov .va.med.He althSummar yURN;
  4   import gov .va.med.im aging.Abst ractImagin gURN;
  5   import gov .va.med.im aging.Cprs Identifier ;
  6   import gov .va.med.im aging.Stri ngUtil;
  7   import gov .va.med.im aging.Stud yURN;
  8   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  9   import gov .va.med.im aging.exch ange.Image AccessLogE vent;
  10   import gov .va.med.im aging.exch ange.Imagi ngLogEvent ;
  11   import gov .va.med.im aging.exch ange.busin ess.StudyF ilter;
  12   import gov .va.med.im aging.exch ange.busin ess.util.E xchangeUti l;
  13   import gov .va.med.im aging.exch ange.enums .ImageAcce ssReasonTy pe;
  14   import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate;
  15   import gov .va.med.im aging.exch ange.enums .StudyLoad Level;
  16   import gov .va.med.im aging.prot ocol.vista .VistaTran slatorUtil ity;
  17   import gov .va.med.im aging.tran sactioncon text.Trans actionCont ext;
  18   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  19   import gov .va.med.im aging.url. vista.Stri ngUtils;
  20   import gov .va.med.im aging.url. vista.Vist aQuery;
  21  
  22   import jav a.text.Sim pleDateFor mat;
  23   import jav a.util.Dat e;
  24   import jav a.util.Has hMap;
  25   import jav a.util.Lis t;
  26   import jav a.util.Map ;
  27  
  28   import org .apache.lo gging.log4 j.LogManag er;
  29   import org .apache.lo gging.log4 j.Logger;
  30  
  31   /**
  32    * 
  33    * @author   PII
  34    *
  35    */
  36   public cla ss VistaIm agingQuery Factory
  37   {
  38           pr ivate stat ic final S tring RPC_ XUS_GET_DI VISIONS =  "XUS DIVIS ION GET";
  39           pu blic final  static St ring MENU_ SUBSCRIPT  = "200.03" ;
  40           pu blic final  static St ring DELEG ATE_SUBSCR IPT = "200 .19";
  41  
  42           //  rpc calls  made to o ther packa ges
  43           pr ivate fina l static S tring RPC_ CONVERT_IC N_TO_DFN =  "VAFCTFU  CONVERT IC N TO DFN";
  44           pr ivate fina l static S tring RPC_ CONVERT_DF N_TO_ICN =  "VAFCTFU  CONVERT DF N TO ICN";
  45           pr ivate fina l static S tring RPC_ GET_VARIAB LE_VALUE =  "XWB GET  VARIABLE V ALUE";
  46           
  47           //  MAG rpc c alls         
  48           pr ivate fina l static S tring RPC_ MAG_GET_GR OUPS = "MA G4 PAT GET  IMAGES";
  49           pr ivate fina l static S tring RPC_ MAG_GET_ST UDY_IMAGES  = "MAGG G ROUP IMAGE S";
  50           pr ivate fina l static S tring RPC_ MAG_REPORT  = "MAGGRP T";
  51           pr ivate fina l static S tring RPC_ MAG_GET_NE TLOC = "MA G GET NETL OC";
  52           pr ivate fina l static S tring RPC_ MAG_MAGGUS ER2 = "MAG GUSER2";
  53           pr ivate fina l static S tring RPC_ MAG_DOD_GE T_STUDIES_ BY_IEN = " MAG DOD GE T STUDIES  IEN";
  54           pr ivate fina l static S tring RPC_ MAG_IMAGE_ CURRENT_IN FO = "MAG  IMAGE CURR ENT INFO";
  55           pr ivate fina l static S tring RPC_ MAG_NEW_SO P_INSTANCE _UID = "MA G NEW SOP  INSTANCE U ID";
  56           pr ivate fina l static S tring RPC_ MAG_ACTION _LOG = "MA GGACTION L OG";
  57           pr ivate fina l static S tring RPC_ MAG_WRKS_U PDATES = " MAGG WRKS  UPDATES";
  58           pr ivate fina l static S tring RPC_ MAG_OFFLIN E_IMAGE_AC CESSED = " MAGG OFFLI NE IMAGE A CCESSED";      
  59           pr ivate fina l static S tring RPC_ MAG_INSTAL L = "MAGG  INSTALL";
  60           pr ivate fina l static S tring RPC_ MAG_GET_IM AGE_INFO =  "MAG4 GET  IMAGE INF O";
  61           pr ivate fina l static S tring RPC_ MAG_SYS_GL OBAL_NODE  = "MAGG SY S GLOBAL N ODE";
  62           pr ivate fina l static S tring RPC_ MAG_DEV_FI ELD_VALUES  = "MAGG D EV FIELD V ALUES";
  63           pr ivate fina l static S tring RPC_ MAG_PAT_FI ND = "MAGG  PAT FIND" ;
  64           pr ivate fina l static S tring RPC_ MAG_PAT_IN FO = "MAGG  PAT INFO" ;
  65           pr ivate fina l static S tring RPC_ MAG_PAT_PH OTOS = "MA GG PAT PHO TOS";
  66           pr ivate fina l static S tring RPC_ MAG_CPRS_R AD_EXAM =  "MAGG CPRS  RAD EXAM" ;
  67           pr ivate fina l static S tring RPC_ MAG_CPRS_T IU_NOTE =  "MAG3 CPRS  TIU NOTE" ;
  68           pr ivate fina l static S tring RPC_ MAGN_CPRS_ IMAGE_LIST  = "MAGN C PRS IMAGE  LIST";
  69           pr ivate fina l static S tring RPC_ MAGN_PATIE NT_IMAGE_L IST = "MAG N PATIENT  IMAGE LIST ";    
  70           pr ivate fina l static S tring RPC_ MAG_BROKER _SECURITY  = "MAG BRO KER SECURI TY";
  71           pr ivate fina l static S tring RPC_ MAG_IMAGE_ LIST = "MA G4 IMAGE L IST";
  72           pr ivate fina l static S tring RPC_ MAG_USER_K EYS = "MAG GUSERKEYS" ;
  73           
  74           pr ivate fina l static S tring RPC_ MAG_IMAGE_ ALLOW_ANNO TATE = "MA G ANNOT IM AGE ALLOW" ;
  75           pr ivate fina l static S tring RPC_ MAGJ_GET_T REATING_LI ST = "MAGJ  GET TREAT ING LIST";
  76           
  77           pr ivate fina l static S tring RPC_ MAGG_REASO N_LIST = " MAGG REASO N LIST";
  78           pr ivate fina l static S tring RPC_ MAGG_VERIF Y_ESIG = " MAGG VERIF Y ESIG";
  79           pr ivate fina l static S tring RPC_ MAGGHSLIST  = "MAGGHS LIST";
  80           pr ivate fina l static S tring RPC_ MAGGHS = " MAGGHS";
  81           
  82           pr ivate fina l static S tring RPC_ GET_TIMEOU T_PARAMETE RS = "MAGG  GET TIMEO UT";
  83  
  84  
  85           //  we can le ave QA Che ck off bec ause this  will allow  "bad" ima ges to go  to the VA  but we sti ll
  86           //  will get  a QA error  message w hich will  prevent th ose images  from goin g to the D OD
  87           pr ivate fina l static S tring MAG_ QA_CHECK =  "1"; // 1  indicates  no QA che ck
  88           pr ivate fina l static i nt MAG_MAX _PATIENT_R ESULT_COUN T = 100;
  89           
  90           pr ivate fina l static S impleDateF ormat date Format = n ew SimpleD ateFormat( "yyyyMMddH HmmssSSS") ; // for D ICOM UID g eneration  only
  91           
  92           pr ivate stat ic Logger  getLogger( )
  93           {
  94                    retu rn LogMana ger.getLog ger(VistaI magingQuer yFactory.c lass);
  95           }                 
  96           
  97           /* *
  98            *  
  99            *  @param pa tientICN
  100            *  @return
  101            *  @throws M ethodExcep tion
  102            * /
  103           pu blic stati c VistaQue ry createG etPatientD FNVistaQue ry(String  patientICN
  104           {
  105                    Vist aQuery vm  = new Vist aQuery(RPC _CONVERT_I CN_TO_DFN) ;
  106                    vm.a ddParamete r(VistaQue ry.LITERAL , patientI CN);
  107                    retu rn vm;
  108           }        
  109           
  110           pu blic stati c VistaQue ry createG etPatientI CNVistaQue ry(String  patientDFN
  111           {
  112                    Vist aQuery vm  = new Vist aQuery(RPC _CONVERT_D FN_TO_ICN) ;
  113                    vm.a ddParamete r(VistaQue ry.LITERAL , patientD FN);
  114                    retu rn vm;
  115           }        
  116           
  117           /* *
  118            *  Create a  VistQuery  instance t hat can be  used to e xecute a
  119            *  RPC_MAG_G ET_STUDIES  RPC call  on Vista.
  120            *  The retur n from the  RPC call  is a list  of studies  matching  the
  121            *  class, da tes, packa ge, types,  specialty  and origi n filter f ields.
  122            *  The respo nse is a l ist of car et-delimit ed Strings , each of  which
  123            *  is a stud y descript ion includ ing the st udy IEN.
  124            *  ex:
  125            *  1^Class:  CLIN - 
  126            *  Item~S2^S ite^Note T itle~~W0^P roc DT~S1^ Procedure^ # Img~S2^S hort Desc^ Pkg^Class^ Type^Speci alty^Event ^Origin^Ca p Dt~S1~W0 ^Cap by~~W 0^Image ID ~S2~W0
  127            *  1^WAS^NUR SING NOTE^ 09/28/2001  00:01^NOT E^2^CONSUL T NURSE ME DICAL WOUN D SPEC INP T^NOTE^CLI N^CONSULT^ NURSING^WO UND ASSESS MENT^VA^09 /28/2001 0 1:35^IMAGP ROVIDERONE TWOSIX,ONE TWOSIX^175 2|1752^\\I SW-IMGGOLD BACK\image 1$\DM\00\1 7\DM001753 .JPG^\\ISW -IMGGOLDBA CK\image1$ \DM\00\17\ DM001753.A BS^CONSULT  NURSE MED ICAL WOUND  SPEC INPT ^3010928^1 1^NOTE^09/ 28/2001^36 ^M^A^^^2^1 ^WAS^^^711 ^IMAGPATIE NT1055,105 5^CLIN^^^
  128            *  2^WAS^OPH THALMOLOGY ^08/20/200 1 00:01^OP H^10^Ophth almology^N OTE^CLIN^I MAGE^EYE C ARE^^VA^08 /20/2001 2 2:32^IMAGP ROVIDERONE TWOSIX,ONE TWOSIX^178 3|1783^\\I SW-IMGGOLD BACK\image 1$\DM\00\1 7\DM001784 .DCM^\\ISW -IMGGOLDBA CK\image1$ \DM\00\17\ DM001784.A BS^Ophthal mology^301 0820^11^OP H^08/20/20 01^41^M^A^ ^^10^1^WAS ^^^711^IMA GPATIENT10 55,1055^CL IN^^^^
  129            *  
  130            *  @param pa tientDfn
  131            *  @param fi lter
  132            *  @return
  133            * /
  134           pu blic stati c VistaQue ry createG etGroupsVi staQuery(S tring pati entDfn, St udyFilter  filter)
  135       {
  136                String t oDate = "" ;
  137                    Stri ng fromDat e = "";
  138                    Stri ng studyPa ckage = "" ;
  139                    Stri ng studyCl ass = "";
  140                    Stri ng studyTy pes = "";
  141                    Stri ng studyEv ent = "";
  142                    Stri ng studySp ecialtiy =  "";
  143                    Stri ng studyOr igin = "";
  144                    if(f ilter != n ull) 
  145                    {
  146                             fromDa te = Vista Translator Utility.co nvertDateT oRpcFormat (filter.ge tFromDate( ));
  147                             toDate  = VistaTr anslatorUt ility.conv ertDateToR pcFormat(f ilter.getT oDate());
  148                             studyP ackage = f ilter.getS tudy_packa ge();
  149                             studyC lass = fil ter.getStu dy_class() ;
  150                             studyT ypes = fil ter.getStu dy_type();
  151                             studyE vent = fil ter.getStu dy_event() ;
  152                             studyS pecialtiy  = filter.g etStudy_sp ecialty();
  153                             studyO rigin = fi lter.getOr igin();
  154                    }
  155                    
  156                    Vist aQuery vm  = new Vist aQuery(RPC _MAG_GET_G ROUPS); //  really re turns grou ps
  157                    //                                                            Note: a  Study has  1.. Groups  and a Gro up can hav e 1.. Seri es!
  158                    vm.a ddParamete r(VistaQue ry.LITERAL , patientD fn);
  159                    vm.a ddParamete r(VistaQue ry.LITERAL , studyPac kage); //  PACKAGE
  160                    vm.a ddParamete r(VistaQue ry.LITERAL , studyCla ss); // CL ASS
  161                    vm.a ddParamete r(VistaQue ry.LITERAL , studyTyp es); // TY PES
  162                    vm.a ddParamete r(VistaQue ry.LITERAL , studyEve nt); // EV ENT - trie d WOUND AS SESSMENT
  163                    vm.a ddParamete r(VistaQue ry.LITERAL , studySpe cialtiy);  // SPEC -  tried RADI OLOGY
  164                    vm.a ddParamete r(VistaQue ry.LITERAL , fromDate ); // FROM  DATE
  165                    vm.a ddParamete r(VistaQue ry.LITERAL , toDate);  // TO DAT E
  166                    vm.a ddParamete r(VistaQue ry.LITERAL , studyOri gin); // O RIGIN
  167                return v m;
  168       }
  169           
  170           /* *
  171            *  This vers ion should  be used a t sites wi thout P119  that do n ot have th e new para meter (FLA GS) for de leted imag es
  172            *  
  173            *  @param st udyMap
  174            *  @param pa tientDfn
  175            *  @return
  176            * /
  177           pu blic stati c VistaQue ry createG etStudiesB yIenVistaQ uery(Map<? ,?> studyM ap, String  patientDf n, StudyLo adLevel st udyLoadLev el)
  178           {
  179                    Vist aQuery que ry = new V istaQuery( RPC_MAG_DO D_GET_STUD IES_BY_IEN ); // IN:  Groups; Ou t: Studies
  180                    quer y.addParam eter(Vista Query.LIST , studyMap );
  181                    quer y.addParam eter(Vista Query.LITE RAL, patie ntDfn);
  182                    if(s tudyLoadLe vel.isIncl udeImages( ))
  183                    {
  184                             query. addParamet er(VistaQu ery.LITERA L, "0");
  185                    }
  186                    else
  187                    {
  188                             // onl y include  study deta ils
  189                             query. addParamet er(VistaQu ery.LITERA L, "1");
  190                    }
  191                    retu rn query;
  192           }
  193           
  194           /* *
  195            *  This vers ion should  be used a t sites wi thout P119  that do n ot have th e new para meter (FLA GS) for de leted imag es
  196            *  
  197            *  @param st udyMap
  198            *  @param pa tientDfn
  199            *  @return
  200            * /
  201           pu blic stati c VistaQue ry createG etSingleSt udyFromBot hDataStruc turesByCpr sIdentifie rVistaQuer y(Map<?,?>  studyMap,  String pa tientDfn,S tudyFilter  filter,   StudyLoadL evel study LoadLevel)
  202           {
  203                    Vist aQuery que ry = new V istaQuery( RPC_MAGN_C PRS_IMAGE_ LIST); //  IN: Groups ; Out: Stu dies
  204                    
  205                    Map< String,Str ing> study  = new Has hMap<Strin g,String>( );
  206                    Stud yURN study Urn = (Stu dyURN)filt er.getStud yId();
  207                    Stri ng studyIe n = studyU rn.getImag ingIdentif ier();
  208                    stud y.put("1",  studyIen) ;
  209                    quer y.addParam eter(Vista Query.LIST , study);
  210                    quer y.addParam eter(Vista Query.LITE RAL, "1");
  211                    //lo gVistaQuer yRequest(q uery);
  212                    retu rn query;
  213           }
  214  
  215           /* *
  216            *  This vers ion should  be used a t sites wi thout P119  that do n ot have th e new para meter (FLA GS) for de leted imag es
  217            *  
  218            *  @param st udyMap
  219            *  @param pa tientDfn
  220            *  @return
  221            * /
  222           pu blic stati c VistaQue ry createG etStudiesF romBothDat aStructure sByPatient VistaQuery (Map<?,?>  studyMap,  String pat ientDfn,St udyFilter  filter,  S tudyLoadLe vel studyL oadLevel)
  223           {
  224                    Vist aQuery que ry = new V istaQuery( RPC_MAGN_P ATIENT_IMA GE_LIST);  // IN: Gro ups; Out:  Studies
  225                    
  226                    quer y.addParam eter(Vista Query.LITE RAL, "DFN" );
  227                    quer y.addParam eter(Vista Query.LITE RAL, patie ntDfn);
  228                    quer y.addParam eter(Vista Query.LITE RAL, "1");
  229                    quer y.addParam eter(Vista Query.LITE RAL, "");
  230                    retu rn query;
  231           }
  232  
  233           /* *
  234            *  This vers ion makes  use of the  studyDele tedImageSt ate and sh ould be us ed by Patc h 119 (and  later)
  235            *  @param st udyMap
  236            *  @param pa tientDfn
  237            *  @param st udyLoadLev el
  238            *  @param st udyDeleted ImageState
  239            *  @return
  240            * /
  241           pu blic stati c VistaQue ry createG etStudiesB yIenVistaQ uery(Map<? ,?> studyM ap, String  patientDf n, 
  242                             StudyL oadLevel s tudyLoadLe vel, Study DeletedIma geState st udyDeleted ImageState )
  243           {
  244                    Vist aQuery que ry = new V istaQuery( RPC_MAG_DO D_GET_STUD IES_BY_IEN ); // IN:  Groups; Ou t: Studies
  245                    quer y.addParam eter(Vista Query.LIST , studyMap );
  246                    quer y.addParam eter(Vista Query.LITE RAL, patie ntDfn);
  247                    if(s tudyLoadLe vel.isIncl udeImages( ))
  248                    {
  249                             query. addParamet er(VistaQu ery.LITERA L, "0");
  250                    }
  251                    else
  252                    {
  253                             // onl y include  study deta ils
  254                             query. addParamet er(VistaQu ery.LITERA L, "1");
  255                    }
  256                    if(s tudyDelete dImageStat e == Study DeletedIma geState.in cludesDele tedImages)
  257                    {
  258                             query. addParamet er(VistaQu ery.LITERA L, "D");     
  259                    }
  260                    else
  261                    {
  262                             query. addParamet er(VistaQu ery.LITERA L, "");
  263                    }
  264                    retu rn query;
  265           }
  266           
  267           /* *
  268            *  Create a  VistaQuery  to get a  single Stu dy report  given the  IEN.
  269            *  
  270            *  @param ie n
  271            *  @return
  272            * /
  273           pu blic stati c VistaQue ry createG etReportVi staQuery(S tring ien)
  274           {
  275                    Vist aQuery vm  = new Vist aQuery(RPC _MAG_REPOR T);
  276                    vm.a ddParamete r(VistaQue ry.LITERAL , ien);
  277                    vm.a ddParamete r(VistaQue ry.LITERAL , MAG_QA_C HECK); //  QA Check
  278                    retu rn vm;
  279           }
  280           
  281           pu blic stati c VistaQue ry createG etStudyIma gesVistaQu ery(String  studyIen)
  282           {
  283                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_GET_ STUDY_IMAG ES);
  284                    msg. addParamet er(VistaQu ery.LITERA L, studyIe n);
  285                    msg. addParamet er(VistaQu ery.LITERA L, MAG_QA_ CHECK); //  NO QA CHE CK
  286                    retu rn msg;
  287           }
  288           
  289           pu blic stati c VistaQue ry createG etNetworkL ocationsVi staQuery()
  290           {
  291                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_GET_ NETLOC);
  292                    msg. addParamet er(VistaQu ery.LITERA L, "ALL");
  293                    retu rn msg;
  294           }
  295           
  296           pu blic stati c VistaQue ry createG etImagingS iteParamet ersQuery(S tring work stationId)
  297           {
  298                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_MAGG USER2);
  299                    msg. addParamet er(VistaQu ery.LITERA L, worksta tionId);
  300                    retu rn msg;
  301           }
  302           
  303           pu blic stati c VistaQue ry createN otifyArchi veOperator Query(Stri ng filenam e, String  imageIen)
  304           {
  305                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_OFFL INE_IMAGE_ ACCESSED);
  306                    msg. addParamet er(VistaQu ery.LITERA L, filenam e);
  307                    msg. addParamet er(VistaQu ery.LITERA L, imageIe n);
  308                    retu rn msg;
  309           }
  310           
  311           pu blic stati c VistaQue ry createG etMagInsta lledVersio nsQuery()
  312           {
  313                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_INST ALL);                
  314                    retu rn msg;
  315           }
  316           
  317           pu blic stati c VistaQue ry createS essionQuer y(String w orkstation Id)
  318           {
  319                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_WRKS _UPDATES);
  320                    msg. addParamet er(VistaQu ery.LITERA L, worksta tionId + " ^^^^^^^^^" );
  321                    retu rn msg;
  322           }
  323           
  324           pu blic stati c VistaQue ry createL ogImageAcc essQuery(b oolean isD odImage, S tring user Duz, 
  325                             String  imageIen,  String pa tientDFN,  String use rSiteNumbe r)
  326           {
  327                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  328                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_ACTI ON_LOG);
  329                    Stri ngBuilder  logParamBu ilder = ne w StringBu ilder();
  330                    if(i sDodImage)
  331                    {
  332                             getLog ger().info ("Creating  query to  log VA acc ess to DOD  image");
  333                             // if  the image  is from th e DOD, the n the pers on looking  at it is  always fro m the VA,  no reason
  334                             // to  look at th e user sit e number f ield
  335                             
  336                             // nee d to put t he DOD Ima ge id into  the prope r place
  337                             // als o need to  put in RDO DVA to ind icate user  is from t he VA acce ssing a DO D image
  338                             // we  don't put  the image  Id into th e IEN fiel d but the  additional  field sin ce this is  a DOD ide ntifier
  339                             logPar amBuilder. append("RV DODVA^" +  userDuz +  "^");
  340                             logPar amBuilder. append("^W rks^" + pa tientDFN +  "^1^");
  341                             logPar amBuilder. append(ima geIen);
  342                             logPar amBuilder. append("|" );
  343                             logPar amBuilder. append(tra nsactionCo ntext.getT ransaction Id());
  344                             logPar amBuilder. append("|" );
  345                             logPar amBuilder. append(tra nsactionCo ntext.getS iteNumber( ));
  346                             logPar amBuilder. append("|" );
  347                    }
  348                    else
  349                    {
  350                             if(Exc hangeUtil. isSiteDOD( userSiteNu mber))
  351                             {
  352                                      // image  is from t he VA but  the user i s from the  DOD, so n o workstat ion to use
  353                                      getLogge r().info(" Creating q uery to lo g DOD acce ss to VA i mage");
  354                                      logParam Builder.ap pend("RVVA DOD^" + us erDuz + "^ ");
  355                                      logParam Builder.ap pend(image Ien + "^DO D^");
  356                                      logParam Builder.ap pend(patie ntDFN + "^ 1^");                                
  357                                      logParam Builder.ap pend("");  // no imag e identifi er since V A image
  358                                      logParam Builder.ap pend("|");
  359                                      logParam Builder.ap pend(trans actionCont ext.getTra nsactionId ());
  360                                      logParam Builder.ap pend("|");
  361                                      logParam Builder.ap pend(trans actionCont ext.getLog gerSiteNum ber());
  362                                      logParam Builder.ap pend("|");
  363                                      logParam Builder.ap pend(trans actionCont ext.getLog gerFullNam e());                           
  364                             }
  365                             else
  366                             {
  367                                      // image  is from t he VA and  the user i s from the  VA (V2V)
  368                                      getLogge r().info(" Creating q uery to lo g VA acces s to VA im age");
  369                                      logParam Builder.ap pend("RVVA VA^" + use rDuz + "^" );
  370                                      logParam Builder.ap pend(image Ien + "^Wr ks^");
  371                                      logParam Builder.ap pend(patie ntDFN + "^ 1^");
  372                                      logParam Builder.ap pend("");  // no imag e identifi er since V A image
  373                                      logParam Builder.ap pend("|");
  374                                      logParam Builder.ap pend(trans actionCont ext.getTra nsactionId ());
  375                                      logParam Builder.ap pend("|");
  376                                      logParam Builder.ap pend(trans actionCont ext.getSit eNumber()) ;
  377                                      logParam Builder.ap pend("|");
  378                                      logParam Builder.ap pend("");  // don't n eed user f ull name s ince using  real pers on DUZ
  379                             }                         
  380                    }
  381                    getL ogger().de bug("Image  Access Lo gging Para meter '" +  logParamB uilder.toS tring() +  "'");
  382                    msg. addParamet er(VistaQu ery.LITERA L, logPara mBuilder.t oString()) ;
  383                    
  384                    retu rn msg;
  385           }
  386           
  387           pu blic stati c VistaQue ry createL ogPatientI dMismatchQ uery(Strin g imageIen , String p atientDFN)
  388           {
  389                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_ACTI ON_LOG);
  390                    Stri ngBuilder  copyParamB uilder = n ew StringB uilder();
  391                    copy ParamBuild er.append( "IMGMM");
  392                    copy ParamBuild er.append( "^^");
  393                    copy ParamBuild er.append( imageIen);
  394                    copy ParamBuild er.append( "^ICN/SSN  mismatch^" );
  395                    copy ParamBuild er.append( patientDFN );
  396                    copy ParamBuild er.append( "^1");
  397                    msg. addParamet er(VistaQu ery.LITERA L, copyPar amBuilder. toString() );
  398                    retu rn msg;
  399           }
  400           
  401           pu blic stati c VistaQue ry createL ogImageCop yQuery(
  402                             ImageA ccessLogEv ent event)
  403           {
  404                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  405                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_ACTI ON_LOG);
  406                    Stri ngBuilder  copyParamB uilder = n ew StringB uilder();
  407                    copy ParamBuild er.append( event.getR easonCode( ));
  408                    copy ParamBuild er.append( "^^");
  409                    copy ParamBuild er.append( event.getD ecodedImag eIen());
  410                    copy ParamBuild er.append( "^Copy Ima ge^");
  411                    copy ParamBuild er.append( event.getP atientDfn( ));
  412                    copy ParamBuild er.append( "^1");
  413                    copy ParamBuild er.append( "^");
  414                    if(( event.getR easonDescr iption() ! = null) &&  (event.ge tReasonDes cription() .length()  > 0))
  415                    {                         
  416                             copyPa ramBuilder .append(ev ent.getRea sonDescrip tion());           
  417                    }
  418                    copy ParamBuild er.append( "|");
  419                    copy ParamBuild er.append( transactio nContext.g etTransact ionId());
  420                    msg. addParamet er(VistaQu ery.LITERA L, copyPar amBuilder. toString() );
  421                    retu rn msg;
  422           }
  423           
  424           pu blic stati c VistaQue ry createL ogImagePri ntQuery(Im ageAccessL ogEvent ev ent)
  425           {
  426                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  427                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_ACTI ON_LOG);
  428                    Stri ngBuilder  copyParamB uilder = n ew StringB uilder();
  429                    copy ParamBuild er.append( event.getR easonCode( ));
  430                    copy ParamBuild er.append( "^^");
  431                    copy ParamBuild er.append( event.getD ecodedImag eIen());
  432                    copy ParamBuild er.append( "^Print Im age^");
  433                    copy ParamBuild er.append( event.getP atientDfn( ));
  434                    copy ParamBuild er.append( "^1");
  435                    copy ParamBuild er.append( "^");
  436                    if(( event.getR easonDescr iption() ! = null) &&  (event.ge tReasonDes cription() .length()  > 0))
  437                    {                         
  438                             copyPa ramBuilder .append(ev ent.getRea sonDescrip tion());
  439                    }
  440                    copy ParamBuild er.append( "|");
  441                    copy ParamBuild er.append( transactio nContext.g etTransact ionId());
  442                    msg. addParamet er(VistaQu ery.LITERA L, copyPar amBuilder. toString() );
  443                    retu rn msg;
  444           }
  445           
  446           /* *
  447            *  Create qu ery to log off from V istA (clos e Imaging  sessions o n server)
  448            *  @return
  449            * /
  450           /*
  451           pu blic stati c VistaQue ry createM agLogoffQu ery()
  452           {
  453                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_LOGO FF);
  454                    retu rn msg;
  455           }* /
  456           
  457           /* *
  458            *  Create Qu ery to get  the HIS u pdate for  an image
  459            *  @param im ageIen
  460            *  @return
  461            * /
  462           pu blic stati c VistaQue ry createG etHisUpdat eQuery(Str ing imageI en)
  463           {
  464                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_IMAG E_CURRENT_ INFO);
  465                    msg. addParamet er(VistaQu ery.LITERA L, imageIe n);
  466                    retu rn msg;
  467           }
  468           
  469           pu blic stati c VistaQue ry createN ewSOPInsta nceUidQuer y(String s iteNumber,  String im ageIen)
  470           {
  471                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_NEW_ SOP_INSTAN CE_UID);
  472                    msg. addParamet er(VistaQu ery.LIST,  "");
  473                    // T ODO if the re is a co ncept of p roduct ID  at VI, it  should pre ceed the s ite#
  474                     msg.addPar ameter(Vis taQuery.LI TERAL, " RTN             ." + siteN umber + ". " + dateFo rmat.forma t(new Date ()) + ".1" );
  475                    msg. addParamet er(VistaQu ery.LITERA L, imageIe n);
  476                    retu rn msg;
  477           }
  478           
  479           pu blic stati c VistaQue ry createG etImageInf ormationQu ery(String  imageId)
  480           {
  481                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_GET_ IMAGE_INFO );
  482                    msg. addParamet er(VistaQu ery.LITERA L, imageId );
  483                    retu rn msg;
  484           }
  485           
  486           pu blic stati c VistaQue ry createG etImageInf ormationQu ery(String  imageId,  boolean in cludeDelet edImages)
  487           {
  488                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_GET_ IMAGE_INFO );
  489                    msg. addParamet er(VistaQu ery.LITERA L, imageId );
  490                    if(i ncludeDele tedImages)
  491                    {
  492                             msg.ad dParameter (VistaQuer y.LITERAL,  "D");       
  493                    }
  494                    else
  495                    {
  496                             msg.ad dParameter (VistaQuer y.LITERAL,  "");
  497                    }
  498                    retu rn msg;
  499           }
  500           
  501           pu blic stati c VistaQue ry createG etSysGloba lNodesQuer y(String i mageId)
  502           {
  503                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_SYS_ GLOBAL_NOD E);
  504                    msg. addParamet er(VistaQu ery.LITERA L, imageId );
  505                    retu rn msg;
  506           }
  507           
  508           pu blic stati c VistaQue ry createG etDevField Values(Str ing imageI d, String  flags)
  509           {                 
  510                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_DEV_ FIELD_VALU ES);
  511                    msg. addParamet er(VistaQu ery.LITERA L, imageId );
  512                    if(f lags == nu ll)
  513                             flags  = "";
  514                    msg. addParamet er(VistaQu ery.LITERA L, flags.t oUpperCase ());
  515                    retu rn msg;
  516           }
  517           
  518           /* *
  519            *  Create qu ery to sea rch for pa tients by  name
  520            *  @param se archName
  521            *  @return
  522            * /
  523           pu blic stati c VistaQue ry createF indPatient Query(Stri ng searchN ame)
  524           {
  525                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_PAT_ FIND);
  526                    msg. addParamet er(VistaQu ery.LITERA L, MAG_MAX _PATIENT_R ESULT_COUN T + "^" +  searchName .toUpperCa se());
  527                    retu rn msg;
  528           }
  529           
  530           /* *
  531            *  Create qu ery to loo k for pati ent info d etails
  532            *  @param pa tientDfn
  533            *  @return
  534            * /
  535           pu blic stati c VistaQue ry createG etPatientI nfoQuery(S tring pati entDfn)
  536           {
  537                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_PAT_ INFO);
  538                    msg. addParamet er(VistaQu ery.LITERA L, patient Dfn + "^^0 ^^1");
  539                    retu rn msg;
  540           }
  541           
  542           /* *
  543            *  Creates a  patient p hoto Id qu ery
  544            *  @param pa tientDfn
  545            *  @return
  546            * /
  547           pu blic stati c VistaQue ry createG etPatientP hotosQuery (String pa tientDfn)
  548           {
  549                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_PAT_ PHOTOS);
  550                    msg. addParamet er(VistaQu ery.LITERA L, patient Dfn);
  551                    retu rn msg;
  552           }
  553           
  554           pu blic stati c VistaQue ry createG etImagesFo rCprsRadEx am(CprsIde ntifier cp rsIdentifi er)
  555           {
  556                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_CPRS _RAD_EXAM) ;
  557                    msg. addParamet er(VistaQu ery.LITERA L, cprsIde ntifier.ge tCprsIdent ifier());
  558                    retu rn msg;
  559           }
  560  
  561           pu blic stati c VistaQue ry createG etImagesFo rCprsRadEx am(CprsIde ntifier cp rsIdentifi er, StudyF ilter filt er)
  562           {
  563                    //WF P-Need to  still add  code here.
  564                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_CPRS _RAD_EXAM) ;
  565                    msg. addParamet er(VistaQu ery.LITERA L, cprsIde ntifier.ge tCprsIdent ifier());
  566                    retu rn msg;
  567           }
  568  
  569           pu blic stati c VistaQue ry createG etImagesFo rCprsTiuNo te(CprsIde ntifier cp rsIdentifi er)
  570           {
  571                    Stri ng tiuId =  StringUti ls.MagPiec e(cprsIden tifier.get CprsIdenti fier(), St ringUtils. CARET, 5);
  572                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_CPRS _TIU_NOTE) ;
  573                    msg. addParamet er(VistaQu ery.LITERA L, tiuId);
  574                    retu rn msg;
  575           }
  576  
  577           pu blic stati c VistaQue ry createG etImagesFo rCprsTiuNo te(CprsIde ntifier cp rsIdentifi er, StudyF ilter filt er)
  578           {
  579                    //WF P-Need to  still add  code here.
  580                    Stri ng tiuId =  StringUti ls.MagPiec e(cprsIden tifier.get CprsIdenti fier(), St ringUtils. CARET, 5);
  581                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_CPRS _TIU_NOTE) ;
  582                    msg. addParamet er(VistaQu ery.LITERA L, tiuId);
  583                    retu rn msg;
  584           }
  585  
  586           pu blic stati c VistaQue ry createG etImagesFo rCprsIdent ifiers(Lis t<CprsIden tifier> cp rsIdentifi ers)
  587           {
  588                    Vist aQuery msg  = new Vis taQuery(RP C_MAGN_CPR S_IMAGE_LI ST);
  589                    Map< String, St ring> cprs Identifier sParameter s = new Ha shMap<Stri ng, String >();
  590                    
  591                    for( CprsIdenti fier item:  cprsIdent ifiers) {
  592                             //getL ogger().de bug("creat eGetImages ForCprsIde ntifiers ( " + cprsId entifiersP arameters. size() + " ) = " + it em.getCprs Identifier ());
  593                             String  cprsIdent ifier = it em.getCprs Identifier ();
  594                             cprsId entifiersP arameters. put(cprsId entifiersP arameters. size() + 1  + "",  cp rsIdentifi er);
  595                    }
  596                    msg. addParamet er(VistaQu ery.LIST,  cprsIdenti fiersParam eters);
  597                    retu rn msg;
  598           }
  599  
  600           pu blic stati c VistaQue ry createG etImagesFo rCprsIdent ifiers(Lis t<CprsIden tifier> cp rsIdentifi ers, Study Filter fil ter)
  601           {
  602  
  603                    Vist aQuery msg  = new Vis taQuery(RP C_MAGN_CPR S_IMAGE_LI ST);
  604                    Map< String, St ring> cprs Identifier sParameter s = new Ha shMap<Stri ng, String >();
  605                    
  606                    Bool ean isTIU  = false;
  607                    
  608                    for( CprsIdenti fier item:  cprsIdent ifiers) {
  609                             //getL ogger().de bug("creat eGetImages ForCprsIde ntifiers ( " + cprsId entifiersP arameters. size() + " ) = " + it em.getCprs Identifier ());
  610                             String  cprsIdent ifier = it em.getCprs Identifier ();
  611  
  612                             //P185
  613                             if (fi lter.isInc ludeAllObj ects())
  614                             {
  615                                      cprsIden tifier = c prsIdentif ier + "~2" ;
  616                             }
  617  
  618                    if ( StringUtil .Piece(cpr sIdentifie r, StringU til.CARET,  4).equals ("TIU"))
  619                    {
  620                             isTIU  = true;
  621                    }
  622                             
  623                             cprsId entifiersP arameters. put(cprsId entifiersP arameters. size() + 1  + "", cpr sIdentifie r);
  624                    }
  625  
  626                    Stri ng imageLe ss = "1";
  627                    if ( filter.isI ncludeImag es() || is TIU)
  628                    {
  629                             imageL ess = "0";
  630                    }
  631  
  632                    getL ogger().de bug("Image Less: " +  imageLess) ;
  633                    
  634                    msg. addParamet er(VistaQu ery.LIST,  cprsIdenti fiersParam eters);
  635                    msg. addParamet er(VistaQu ery.LITERA L, imageLe ss);
  636                    //lo gVistaQuer yRequest(m sg);
  637                    retu rn msg;
  638           }
  639  
  640           pu blic stati c VistaQue ry createG etImageGro upIENVista Query(Stri ng imageIe n) 
  641           {
  642                    //ge tLogger(). info("getC ontextIEN  Transactio nContext ( " + Transa ctionConte xtFactory. get().getD isplayIden tity() + " ).");
  643                    
  644                    Vist aQuery msg  = new Vis taQuery(RP C_GET_VARI ABLE_VALUE );
  645                    Stri ng arg = " ^MAG(2005, " + imageI en + ",0)" ;
  646                    msg. addParamet er(VistaQu ery.REFERE NCE, arg);
  647                    retu rn msg;
  648           }
  649           
  650           pu blic stati c VistaQue ry createM agBrokerSe curityQuer y()
  651           {
  652                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_BROK ER_SECURIT Y);
  653                    
  654                    retu rn msg;
  655           }
  656           
  657           /* *
  658            *  
  659            *  @param pa tientDfn
  660            *  @param st udyFilter
  661            *  @param al lowDeleted Images
  662            *  @return
  663            * /
  664           pu blic stati c VistaQue ry createM agImageLis tQuery(Str ing patien tDfn, Stud yFilter st udyFilter,  
  665                             boolea n allowDel etedImages )
  666           {
  667                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_IMAG E_LIST);
  668                    Stri ng control Parameter  = "E"; //  existing i mages
  669                    Stri ng fromDat e = "";
  670                    Stri ng toDate  = "";
  671                    
  672                    Stri ng studyPa ckage = "" ;
  673                    Stri ng studyCl ass = "";
  674                    Stri ng studyTy pes = "";
  675                    Stri ng studyEv ent = "";
  676                    Stri ng studySp ecialty =  "";
  677                    Stri ng studyOr igin = "";
  678                    int  maximumRes ults = Int eger.MAX_V ALUE;
  679                    if(s tudyFilter  != null) 
  680                    {
  681                             fromDa te = Vista Translator Utility.co nvertDateT oRpcFormat (studyFilt er.getFrom Date());
  682                             toDate  = VistaTr anslatorUt ility.conv ertDateToR pcFormat(s tudyFilter .getToDate ());
  683                             studyP ackage = s tudyFilter .getStudy_ package();
  684                             studyC lass = stu dyFilter.g etStudy_cl ass();
  685                             studyT ypes = stu dyFilter.g etStudy_ty pe();
  686                             studyE vent = stu dyFilter.g etStudy_ev ent();
  687                             studyS pecialty =  studyFilt er.getStud y_specialt y();
  688                             studyO rigin = st udyFilter. getOrigin( );
  689                             maximu mResults =  studyFilt er.getMaxi mumResults ();
  690                    }
  691                    
  692                    
  693                    if(( allowDelet edImages)  && (studyF ilter != n ull) && (s tudyFilter .isInclude Deleted()) )            
  694                             contro lParameter  += "D"; / / deleted  images
  695                    msg. addParamet er(VistaQu ery.LITERA L, control Parameter) ;
  696                    msg. addParamet er(VistaQu ery.LITERA L, fromDat e);
  697                    msg. addParamet er(VistaQu ery.LITERA L, toDate) ;
  698                    if(m aximumResu lts < Inte ger.MAX_VA LUE)
  699                    {
  700                             msg.ad dParameter (VistaQuer y.LITERAL,  maximumRe sults + "" );
  701                    }
  702                    else
  703                    {
  704                             msg.ad dParameter (VistaQuer y.LITERAL,  "");
  705                    }
  706                    Map< String, St ring> filt erParamete rs = new H ashMap<Str ing, Strin g>();
  707                    
  708                    filt erParamete rs.put(fil terParamet ers.size()  + "", "ID FN^^" + pa tientDfn);
  709                    if(! "".equals( studyClass ))
  710                    {
  711                             studyC lass = stu dyClass.re place(',',  '^'); //  need to co nvert , to  ^
  712                             filter Parameters .put(filte rParameter s.size() +  "", "IXCL ASS^^" + s tudyClass) ;
  713                    }
  714                    if(! "".equals( studyPacka ge))
  715                    {
  716                             studyP ackage = s tudyPackag e.replace( ',', '^');  // need t o convert  , to ^                          
  717                             filter Parameters .put(filte rParameter s.size() +  "", "IXPK G^^" + stu dyPackage) ;
  718                    }
  719                    if(! "".equals( studyTypes ))
  720                    {
  721                             studyT ypes = stu dyTypes.re place(',',  '^'); //  need to co nvert , to  ^
  722                             filter Parameters .put(filte rParameter s.size() +  "", "IXTY PE^^" + st udyTypes);
  723                    }
  724                    //TO DO: make s ure Event  == Procedu re - i thi nk so?
  725                    if(! "".equals( studyEvent ))
  726                    {
  727                             studyE vent = stu dyEvent.re place(',',  '^'); //  need to co nvert , to  ^
  728                             filter Parameters .put(filte rParameter s.size() +  "", "IXPR OC^^" + st udyEvent);
  729                    }
  730                    if(! "".equals( studySpeci alty))
  731                    {
  732                             studyS pecialty =  studySpec ialty.repl ace(',', ' ^'); // ne ed to conv ert , to ^     
  733                             filter Parameters .put(filte rParameter s.size() +  "", "IXSP EC^^" + st udySpecial ty);
  734                    }
  735                    if(! "".equals( studyOrigi n))
  736                    {
  737                             studyO rigin = st udyOrigin. replace(', ', '^'); / / need to  convert ,  to ^
  738                             filter Parameters .put(filte rParameter s.size() +  "", "IXOR IGIN^^" +  studyOrigi n);
  739                    }
  740                    msg. addParamet er(VistaQu ery.LIST,  filterPara meters);                      
  741                    retu rn msg;
  742           }
  743           
  744           pu blic stati c VistaQue ry createG etUserKeys Query()
  745           {
  746                    Vist aQuery que ry = new V istaQuery( RPC_MAG_US ER_KEYS);
  747                    retu rn query;
  748           }
  749  
  750           pu blic stati c VistaQue ry createG etDivision sQuery(Str ing access Code) 
  751           {
  752                    Vist aQuery que ry = new V istaQuery( RPC_XUS_GE T_DIVISION S);
  753                    quer y.addParam eter(Vista Query.LITE RAL, acces sCode);
  754                    retu rn query;
  755           }
  756           
  757           pu blic stati c VistaQue ry createA llowAnnota teQuery()
  758           {
  759                    Vist aQuery que ry = new V istaQuery( RPC_MAG_IM AGE_ALLOW_ ANNOTATE);
  760                    retu rn query;
  761           }
  762           
  763           /* *
  764            *  This is a  MAGJ rpc  that gets  the treati ng sites f or a patie nt and for mats the r esult as a  list rath er than a  string. Th is RPC is  available  to 
  765            *  MAG WINDO WS as part  of Patch  122
  766            *  @param pa tientDfn
  767            *  @return
  768            * /
  769           pu blic stati c VistaQue ry createM agJGetTrea tingSitesQ uery(Strin g patientD fn)
  770           {
  771                    getL ogger().in fo("MagJGe tTreatingS ites(" + p atientDfn  + ") Trans actionCont ext (" + T ransaction ContextFac tory.get() .getDispla yIdentity( ) + ").");
  772                    
  773                    Vist aQuery vm  = new Vist aQuery(RPC _MAGJ_GET_ TREATING_L IST);
  774                    vm.a ddParamete r(VistaQue ry.LITERAL , patientD fn);
  775                    
  776                    retu rn vm;
  777           }
  778           
  779           pu blic stati c VistaQue ry createL ogImagingQ uery(Imagi ngLogEvent  logEvent,  String pa tientDfn)
  780           {
  781                    Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  782                    Vist aQuery msg  = new Vis taQuery(RP C_MAG_ACTI ON_LOG);
  783                    Stri ngBuilder  sb = new S tringBuild er();
  784                    sb.a ppend(logE vent.getAc cessType() );
  785                    sb.a ppend("^") ;
  786                    sb.a ppend(tran sactionCon text.getDu z());
  787                    sb.a ppend("^") ;
  788                    
  789                    Abst ractImagin gURN imagi ngUrn = lo gEvent.get ImagingUrn ();
  790                    if(i magingUrn  != null)
  791                    {
  792                             boolea n isDodIma ge = Excha ngeUtil.is SiteDOD(im agingUrn.g etOriginat ingSiteId( ));
  793                             // if  this is a  VA image t hen put th e IEN in p lace here
  794                             if(!is DodImage)
  795                                      sb.appen d(imagingU rn.getImag ingIdentif ier());
  796                    }
  797                    sb.a ppend("^") ;
  798                    sb.a ppend(logE vent.getUs erInterfac e());
  799                    sb.a ppend("^") ;
  800                    sb.a ppend(pati entDfn);
  801                    sb.a ppend("^") ;
  802                    if(l ogEvent.ge tImageCoun t() >= 0)
  803                             sb.app end(logEve nt.getImag eCount());
  804                    sb.a ppend("^") ;
  805                    sb.a ppend(logE vent.getAd ditionalDa ta());
  806                    getL ogger().de bug("Imagi ng log eve nt Paramet er '" + sb .toString( ) + "'");
  807                    msg. addParamet er(VistaQu ery.LITERA L, sb.toSt ring());
  808                    retu rn msg;
  809           }
  810           
  811           pu blic stati c VistaQue ry createG etReasonsL istQuery(L ist<ImageA ccessReaso nType> rea sonTypes)
  812           {
  813                    Vist aQuery que ry = new V istaQuery( RPC_MAGG_R EASON_LIST );
  814                    Stri ngBuilder  reasons =  new String Builder();
  815                    if(r easonTypes  != null)
  816                    {
  817                             for(Im ageAccessR easonType  reasonType  : reasonT ypes)
  818                             {
  819                                      reasons. append(rea sonType.ge tCode());
  820                             }
  821                    }
  822                    else
  823                    {
  824                             // put  all optio ns in
  825                             for(Im ageAccessR easonType  reasonType  : ImageAc cessReason Type.value s())
  826                             {
  827                                      reasons. append(rea sonType);
  828                             }
  829                    }
  830                    quer y.addParam eter(Vista Query.LITE RAL, reaso ns.toStrin g());
  831                    
  832                    retu rn query;
  833           }
  834           
  835           pu blic stati c VistaQue ry createV erifyElect ronicSigna tureQuery( String ele ctronicSig nature)
  836           {                 
  837                    Vist aQuery vm  = new Vist aQuery(RPC _MAGG_VERI FY_ESIG);
  838                    vm.a ddEncrypte dParameter (VistaQuer y.LITERAL,  electroni cSignature );
  839                    retu rn vm;
  840           }
  841           
  842           pu blic stati c VistaQue ry createG etHealthSu mmariesQue ry()
  843           {
  844                    Vist aQuery vm  = new Vist aQuery(RPC _MAGGHSLIS T);
  845                    vm.a ddParamete r(VistaQue ry.LITERAL , ""); //  parameter  does nothi ng
  846                    retu rn vm;
  847           }
  848           
  849           pu blic stati c VistaQue ry createG etHealthSu mmary(Heal thSummaryU RN healthS ummaryUrn,  String pa tientDfn)
  850           {
  851                    Vist aQuery vm  = new Vist aQuery(RPC _MAGGHS);
  852                    vm.a ddParamete r(VistaQue ry.LITERAL , patientD fn + Strin gUtils.CAR ET + healt hSummaryUr n.getSumma ryId());
  853                    retu rn vm;
  854           }
  855           
  856           pu blic stati c VistaQue ry createG etApplicat ionTimeout Parameters (String si teId, Stri ng applica tionName) 
  857           {
  858                    Vist aQuery vm  = new Vist aQuery(RPC _GET_TIMEO UT_PARAMET ERS);
  859                    vm.a ddParamete r(VistaQue ry.LITERAL , applicat ionName);
  860                    retu rn vm;
  861           }        
  862  
  863   }