322. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:47 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

322.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXDataSource\main\src\java\gov\va\med\imaging\mixdatasource AbstractMixImageDataSourceService.java Mon Dec 4 21:34:38 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\MIXDataSource\main\src\java\gov\va\med\imaging\mixdatasource AbstractMixImageDataSourceService.java Tue Dec 5 13:27:21 2017 UTC

322.2 Comparison summary

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

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

322.4 Active regular expressions

No regular expressions were active.

322.5 Comparison detail

  1   /**
  2    * 
  3     Package:  MAG - Vis tA Imaging
  4     WARNING:  Per VHA D irective 2 004-038, t his routin e should n ot be modi fied.
  5     Date Cre ated: Nov  11, 2016
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7     Develope r:  vacoti ttoc
  8     Descript ion: 
  9  
  10           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  11           ;;  Property  of the US  Government .
  12           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  13           ;;  Use of un released v ersions of  this soft ware requi res the us er
  14           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  15           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  16           ;;   telephon e (301) 73 4-0100.
  17           ;;
  18           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  19           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  20           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  21           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  22           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  23           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  24  
  25    */
  26   package go v.va.med.i maging.mix datasource ;
  27  
  28   import gov .va.med.Gl obalArtifa ctIdentifi er;
  29   import gov .va.med.SE RIALIZATIO N_FORMAT;
  30   import gov .va.med.im aging.Abst ractImagin gURN;
  31   import gov .va.med.im aging.Imag eURN;
  32   import gov .va.med.im aging.arti factsource .ArtifactS ource;
  33   import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce;
  34   // import  gov.va.med .imaging.c onversion. ImageConve rsionFileP ath;
  35   // import  gov.va.med .imaging.c onversion. ImageConve rsionUtili ty;
  36   // import  gov.va.med .imaging.c onversion. enums.Imag eConversio nSatisfact ion;
  37   import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on;
  38   import gov .va.med.im aging.core .interface s.exceptio ns.ImageNe arLineExce ption;
  39   import gov .va.med.im aging.core .interface s.exceptio ns.ImageNo tFoundExce ption;
  40   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  41   import gov .va.med.im aging.core .interface s.exceptio ns.MethodR emoteExcep tion;
  42   // import  gov.va.med .imaging.c ore.interf aces.excep tions.*;
  43   import gov .va.med.im aging.data source.Abs tractVersi onableData Source;
  44   import gov .va.med.im aging.data source.Ima geDataSour ceSpi;
  45   import gov .va.med.im aging.data source.exc eptions.Un supportedP rotocolExc eption;
  46   import gov .va.med.im aging.exch ange.busin ess.Image;
  47   import gov .va.med.im aging.exch ange.busin ess.ImageF ormatQuali ty;
  48   import gov .va.med.im aging.exch ange.busin ess.ImageF ormatQuali tyList;
  49   import gov .va.med.im aging.exch ange.busin ess.ImageS treamRespo nse;
  50   // import  gov.va.med .imaging.e xchange.bu siness.*;
  51   import gov .va.med.im aging.exch ange.enums .ImageForm at;
  52   import gov .va.med.im aging.exch ange.enums .ImageQual ity;
  53   import gov .va.med.im aging.exch ange.stora ge.ByteBuf ferBackedI mageInputS tream;
  54   import gov .va.med.im aging.exch ange.stora ge.DataSou rceImageIn putStream;
  55   import gov .va.med.im aging.exch ange.stora ge.DataSou rceInputSt ream;
  56   import gov .va.med.im aging.mix. DODImageUR N;
  57   // import  gov.va.med .imaging.e xchange.st orage.Data SourceInpu tStream;
  58   import gov .va.med.im aging.mix. proxy.MixP roxy;
  59   import gov .va.med.im aging.mix. proxy.v1.I mageMixPro xy;
  60   import gov .va.med.im aging.mix. proxy.v1.M ixProxySer vices;
  61   import gov .va.med.im aging.mix. proxy.v1.M ixProxyUti lities;
  62   // import  gov.va.med .imaging.m ix.rest.pr oxy.Abstra ctMixRestI mageProxy;
  63   import gov .va.med.im aging.mix. rest.proxy .MixRestGe tClient;
  64   import gov .va.med.im aging.mix. webservice s.rest.end points.Mix ImageWADOR estUri;
  65   import gov .va.med.im aging.mix. webservice s.rest.end points.Mix RestUri;
  66   import gov .va.med.im aging.prox y.rest.Res tProxyComm on;
  67   import gov .va.med.im aging.prox y.services .ProxyServ iceType;
  68   import gov .va.med.im aging.tran sactioncon text.Trans actionCont ext;
  69   // import  gov.va.med .imaging.p roxy.servi ces.ProxyS erviceType ;
  70   // import  gov.va.med .imaging.m ix.storage .MixStorag eUtility;
  71   import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ;
  72   // import  gov.va.med .imaging.t ransaction context.Tr ansactionC ontextFact ory;
  73   import gov .va.med.im aging.url. mixs.MIXsC onnection;
  74   import gov .va.med.im aging.url. mix.config uration.MI XConfigura tion;
  75   import gov .va.med.im aging.url. mix.config uration.MI XSiteConfi guration;
  76   import gov .va.med.im aging.url. mix.except ions.MIXCo nfiguratio nException ;
  77   import gov .va.med.im aging.url. mix.except ions.MIXCo nnectionEx ception;
  78  
  79   import jav a.io.IOExc eption;
  80   import jav a.io.Input Stream;
  81   import jav a.util.Arr ayList;
  82   import jav a.util.Has hMap;
  83   import jav a.util.Lis t;
  84   import jav a.util.Map ;
  85  
  86   import jav ax.ws.rs.c ore.MediaT ype;
  87  
  88   import org .apache.lo gging.log4 j.LogManag er;
  89   import org .apache.lo gging.log4 j.Logger;
  90  
  91   import com .sun.jerse y.api.clie nt.ClientR esponse;
  92   import com .sun.jerse y.api.clie nt.ClientR esponse.St atus;
  93  
  94   //import c om.sun.jer sey.api.cl ient.Clien tResponse;
  95  
  96   /**
  97    * @author  vacotitto c
  98    *
  99    */
  100   public abs tract clas s Abstract MixImageDa taSourceSe rvice
  101   extends Ab stractVers ionableDat aSource
  102   implements  ImageData SourceSpi
  103   {
  104           pr otected fi nal MIXsCo nnection m ixConnecti on;
  105           pr ivate MIXC onfigurati on mixConf iguration  = null;
  106           pr ivate MIXS iteConfigu ration mix SiteConfig uration =  null;
  107   //      pr ivate Abst ractMixRes tImageProx y amrip;
  108           
  109           pu blic stati c final Li st<ImageFo rmat> acce ptableThum bnailRespo nseTypes;
  110           pu blic stati c final Li st<ImageFo rmat> acce ptableRefe renceRespo nseTypes;
  111           pu blic stati c final Li st<ImageFo rmat> acce ptableDiag nosticResp onseTypes;
  112           
  113           st atic
  114           {
  115                    acce ptableThum bnailRespo nseTypes =  new Array List<Image Format>();
  116                    acce ptableThum bnailRespo nseTypes.a dd(ImageFo rmat.JPEG) ;
  117                    
  118                    acce ptableRefe renceRespo nseTypes =  new Array List<Image Format>();
  119                    acce ptableRefe renceRespo nseTypes.a dd(ImageFo rmat.DICOM JPEG2000);
  120                    
  121                    acce ptableDiag nosticResp onseTypes  = new Arra yList<Imag eFormat>() ;
  122                    acce ptableDiag nosticResp onseTypes. add(ImageF ormat.DICO MJPEG2000) ;
  123   //               acce ptableDiag nosticResp onseTypes. add(ImageF ormat.DICO M); // DIC OM must be  here beca use the re quest type  will be a pplication /dicom whi ch literal ly convert s to this  one
  124           }        
  125           
  126           //  Hashmap t o hold pro xies based  on the al ien site n umber (if  empty stri ng, will r eturn prox y to BIA),  otherwise  will use  wormhole.
  127           pr ivate Hash Map<String , ImageMix Proxy> xch angeProxie s = new Ha shMap<Stri ng, ImageM ixProxy>() ;
  128  
  129           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Abst ractMixIma geDataSour ceService. class);
  130           pr ivate fina l static S tring MIX_ PROXY_SERV ICE_NAME =  "MIX";
  131           pr ivate fina l static S tring DATA SOURCE_VER SION = "1" ;
  132           pu blic final  static St ring SUPPO RTED_PROTO COL = "mix ";
  133           pr ivate MixP roxyServic es mixProx yServices  = null;
  134           pr ivate Tran sactionCon text trans actionCont ext = Tran sactionCon textFactor y.get();
  135  
  136           @S uppressWar nings("unu sed")
  137           
  138           /* *
  139        * The  Provider  will use t he create( ) factory  method pre ferentiall y
  140        * ove r a constr uctor.  Th is allows  for cachin g of Vista StudyGraph DataSource Service
  141        * ins tances acc ording to  the criter ia set her e.
  142        * 
  143        * @pa ram url
  144        * @pa ram protoc ol
  145        * @re turn
  146        * @th rows Conne ctionExcep tion
  147        * @th rows Unsup portedProt ocolExcept ion 
  148        */
  149           pu blic Abstr actMixImag eDataSourc eService(R esolvedArt ifactSourc e resolved ArtifactSo urce, Stri ng protoco l) 
  150           th rows Unsup portedProt ocolExcept ion
  151           {
  152                    supe r(resolved ArtifactSo urce, prot ocol);
  153                    mixC onnection  = new MIXs Connection (getArtifa ctUrl());
  154                    mixC onfigurati on = MixDa taSourcePr ovider.get MixConfigu ration();
  155           }                          
  156           
  157           pr otected Lo gger getLo gger()
  158           {
  159                    retu rn logger;
  160           }
  161           
  162           pr otected ab stract Mix Proxy getP roxy(Image  image)
  163           th rows IOExc eption;
  164           
  165   //      pr otected ab stract Str ing getDat aSourceVer sion();        
  166           
  167   //      /*  (non-Java doc)
  168   //       *  @see gov. va.med.ima ging.datas ource.Imag eDataSourc eSpi#getUr l()
  169   //       * /
  170   //      pu blic URL g etUrl() //  unused!
  171   //      {
  172   //               retu rn mixConn ection.get URL();
  173   //      }
  174  
  175   //      @O verride
  176           pr otected St ring getDa taSourceVe rsion() {
  177                    retu rn DATASOU RCE_VERSIO N;
  178           }
  179  
  180           @O verride
  181           pu blic DataS ourceInput Stream get ImageTXTFi le(Image i mage)
  182           th rows Metho dException , Connecti onExceptio n
  183           {
  184                    retu rn null;
  185           }
  186  
  187           @O verride
  188           pu blic DataS ourceInput Stream get ImageTXTFi le(ImageUR N imageURN )
  189           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  190                    Conn ectionExce ption, Ima geNotFound Exception,  ImageNear LineExcept ion 
  191           {
  192                    retu rn null;
  193           }
  194  
  195           @O verride
  196           pu blic Strin g getImage Informatio n(Abstract ImagingURN  imagingUr n, boolean  includeDe letedImage s)
  197           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  198                    Conn ectionExce ption, Ima geNotFound Exception 
  199           {
  200                    thro w new Unsu pportedOpe rationExce ption("The  MIX Image DataSource  does not  support th e getImage Informatio n method." );
  201           }
  202  
  203           @O verride
  204           pu blic Strin g getImage SystemGlob alNode(Abs tractImagi ngURN imag ingUrn)
  205                             throws  Unsupport edOperatio nException , MethodEx ception,
  206                             Connec tionExcept ion, Image NotFoundEx ception {
  207                    thro w new Unsu pportedOpe rationExce ption("The  MIX Image DataSource  does not  support th e getImage SystemGlob alNode met hod.");
  208           }
  209           
  210           @O verride
  211           pu blic Strin g getImage DevFields( AbstractIm agingURN i magingUrn,  String fl ags)
  212           th rows Unsup portedOper ationExcep tion, Meth odExceptio n,
  213                    Conn ectionExce ption, Ima geNotFound Exception 
  214           {
  215                    thro w new Unsu pportedOpe rationExce ption("The  MIX Image DataSource  does not  support th e getImage DevFields  method.");
  216           }
  217           
  218           @O verride
  219           pu blic Image StreamResp onse getIm age(Image  image, Ima geFormatQu alityList  requestFor matQuality List) 
  220           th rows Metho dException , Connecti onExceptio n
  221           {
  222                    logg er.info("M IXClient g etImage("  + image.ge tIen() + " ) from Ima ge object  Transactio nContext ( " + Transa ctionConte xtFactory. get().getD isplayIden tity() + " ).");
  223                    try 
  224                    {                         
  225                             MixPro xy proxy =  getProxy( image);
  226                             ImageU RN imageUr n = image. getImageUr n();
  227                             //Imag eURN image Urn = Imag eURN.creat e(image.ge tSiteNumbe r(), image .getIen(),  image.get StudyIen() , image.ge tPatientIC N());
  228                             return  getImage( imageUrn,  requestFor matQuality List, prox y);
  229                    }
  230                    catc h(IOExcept ion ioX)
  231                    {
  232                             logger .error("MI XClient er ror gettin g image",  ioX);
  233                             throw  new Method RemoteExce ption(ioX) ;
  234                    }
  235           }
  236  
  237           /*  (non-Java doc)
  238            *  @see gov. va.med.ima ging.datas ource.Imag eDataSourc eSpi#getIm age(gov.va .med.imagi ng.ImageUR N, int, ja va.lang.St ring)
  239            *  This is t he main ge tImage cal l in MIX ! !!
  240            * /
  241           @O verride
  242           pu blic Image StreamResp onse getIm age(Global ArtifactId entifier g ai, ImageF ormatQuali tyList req uestFormat QualityLis t) 
  243           th rows Metho dException , MIXConne ctionExcep tion, Conn ectionExce ption
  244           {                 
  245                    // s ubstitute  if(!(gai i nstanceof  ImageURN))  check
  246                    DODI mageURN dI U = new DO DImageURN( );
  247                    if ( !gai.toStr ing().star tsWith(dIU .getDODPre fix()))
  248                    {
  249                             throw  new Method Exception( "GlobalArt ifactIdent ifier '" +  gai.toStr ing() + "'  is not in stanceof D ODImageURN , cannot r etrieve im age from M IX.");
  250                    }
  251                    Imag eURN image Urn = (Ima geURN)gai;
  252                    logg er.info("M IXClient g etImage("  + imageUrn .toString( ) + ") fro m Image UR N Transact ionContext  (" + Tran sactionCon textFactor y.get().ge tDisplayId entity() +  ").");
  253                    try
  254                    {
  255                             MixPro xy proxy =  getProxy( null);
  256                             return  getImage( imageUrn,  requestFor matQuality List, prox y);
  257                    }
  258                    catc h(IOExcept ion ioX)
  259                    {
  260                             logger .error("MI XClient er ror gettin g image",  ioX);
  261                             throw  new Method RemoteExce ption(ioX) ;
  262                    }                 
  263           }
  264           
  265           //  this is t he common  MIX getIma ge client  call
  266           pr ivate Imag eStreamRes ponse getI mage(
  267                    Imag eURN image Urn, 
  268                    Imag eFormatQua lityList r equestForm atQualityL ist, 
  269                    MixP roxy proxy
  270           th rows Metho dException , MIXConne ctionExcep tion, Conn ectionExce ption
  271           {
  272                    MixD ataSourceC ommon.setD ataSourceM ethodAndVe rsion("get Image", ge tDataSourc eVersion() );
  273                    Stri ng imageUR N = imageU rn.toStrin g(SERIALIZ ATION_FORM AT.NATIVE) ;
  274                    Stri ng aliSite  = MIXConf iguration. DEFAULT_DA S_SITE;
  275                    if(p roxy.getAl ienSiteNum ber() != n ull)
  276                             aliSit e = proxy. getAlienSi teNumber() ;
  277                    
  278                    tran sactionCon text.addDe bugInforma tion("Retr ieving ima ge from al ien site n umber [" +  aliSite +  "]");
  279                    logg er.info("M IXClient g etImage: R etrieving  image [" +  imageURN  + "] from  site [" +  aliSite +  "]");
  280                    // g et desired  imageQual ity
  281                    Imag eFormatQua lityList p runedList  = pruneReq uestList(r equestForm atQualityL ist);
  282                    if ( prunedList .size()==0 )
  283                    {
  284                             String  msg = "MI XClient ge tImage Err or: No/Bad  FormaQual ity list r eceived fo r  [" + im ageURN + " ] from sit e [" + ali Site + "]" ;
  285                             logger .info(msg) ;
  286                             throw  new Method Exception( msg);
  287                    }
  288                    Imag eQuality i Q = pruned List.getFi rstImageQu ality();
  289                    
  290                    // c ompose URL  to client
  291                    Map< String, St ring> urlP arameterKe yValues =  new HashMa p<String,  String>();
  292                    // u rlParamete rKeyValues .put("{rou tingToken} ", routing Token.toRo utingToken String());
  293                    DODI mageURN do dUrn = new  DODImageU RN(imageUr n);
  294                    urlP arameterKe yValues.pu t("{studyU id}", dodU rn.getStud yUID());
  295                    urlP arameterKe yValues.pu t("{series Uid}", dod Urn.getSer iesUID());
  296                    urlP arameterKe yValues.pu t("{instan ceUid}", d odUrn.getI nstanceUID ());
  297  
  298                    Medi aType mT =   MediaTyp e.APPLICAT ION_OCTET_ STREAM_TYP E; // ???? ? APPLICAT ION_OCTET_ STREAM
  299                    
  300                    Stri ng urlPath  = MixImag eWADORestU ri.thumbna ilPath;
  301                    if ( iQ == Imag eQuality.R EFERENCE) 
  302                    {
  303                             urlPat h = MixIma geWADORest Uri.dicomJ 2KReferenc ePath;
  304                    }
  305                    else  if (iQ ==  ImageQual ity.DIAGNO STIC)
  306                    {
  307                             urlPat h = MixIma geWADORest Uri.dicomJ 2KDiagnost icPath;
  308                    }
  309                    Stri ng url="";
  310                    try  {
  311                             url =  getWebReso urceUrl(ur lPath, url ParameterK eyValues);  
  312                    }
  313                    catc h (Connect ionExcepti on ce) {
  314                             throw  new MIXCon nectionExc eption("MI XClient ge tImage: Fa iled to co mpose URL  source!" +  ce.getMes sage());
  315                    }
  316                    Imag eStreamRes ponse imag eStreamRes ponse= nul l;
  317   //               try{
  318                             Client Response c lientRespo nse=null;
  319                             MixRes tGetClient  getClient  = new Mix RestGetCli ent(url, m T, mixConf iguration) ;
  320                             client Response =  getClient .getInputS treamRespo nse();
  321                             InputS tream inpu tStream =n ull;
  322                             if(cli entRespons e.getStatu s() == Sta tus.OK.get StatusCode ())
  323                             {
  324                                      logger.d ebug("getI nputStream Response r eturned su ccessfully ");
  325                                      inputStr eam = clie ntResponse .getEntity InputStrea m();
  326                                      if (inpu tStream !=  null)
  327                                      {
  328                                               imageStrea mResponse  = new Imag eStreamRes ponse(new  ByteBuffer BackedImag eInputStre am(inputSt ream, 0));
  329                                               imageStrea mResponse. setImageQu ality(iQ);
  330                                               imageStrea mResponse. setMediaTy pe(MediaTy pe.APPLICA TION_OCTET _STREAM);
  331                                               transactio nContext.s etDataSour ceImageFor matReceive d(imageStr eamRespons e.getImage Format() = = null ? " " : imageS treamRespo nse.getIma geFormat() .toString( ));
  332                                               transactio nContext.s etDataSour ceImageQua lityReceiv ed(imageSt reamRespon se.getImag eQuality() .toString( ));
  333                                      }
  334                             }                                  
  335                    // s end reques t to Clien t and chec k response
  336   //               MixR estGetClie nt getClie nt = new M ixRestGetC lient(url,  mT, mixCo nfiguratio n);
  337   //               Clie ntResponse  clientRes ponse=null ;
  338   //               Imag eStreamRes ponse imag eStreamRes ponse= nul l;
  339   //               try{  // *** un sure how t o get the  stream!!!!
  340   //                        client Response =  getClient .executeRe quest(Clie ntResponse .class); / / Connecti onExceptio n & Method Exception
  341   //                        if (cl ientRespon se.getClie ntResponse Status() = = ClientRe sponse.Sta tus.OK) {
  342   //                                 imageStr eamRespons e = new Im ageStreamR esponse((D ataSourceI mageInputS tream)clie ntResponse .getEntity InputStrea m(), iQ);
  343   //                                 imageStr eamRespons e.setMedia Type(mT.to String());
  344   //                        }
  345   //               }
  346   //               catc h (Connect ionExcepti on ce) {
  347   //                        throw  new MIXCon nectionExc eption("MI XClient ge tImage: Fa iled to co nnect to R esource!") ;
  348   //               }
  349   //               catc h (MethodE xception m e) {
  350   //                        throw  new MIXCon nectionExc eption("MI XClient ge tImage: Er ror gettin g Resource  response! " + me.get Message()) ;
  351   //               }
  352           re turn image StreamResp onse;
  353           }
  354  
  355           pr otected MI XSiteConfi guration g etMixSiteC onfigurati on(String  alienSiteN umber)
  356           th rows IOExc eption
  357           {
  358   //               MIXS iteConfigu ration mix SiteConfig uration =  null;
  359                    Stri ng reposit oryId = al ienSiteNum ber; // ** * hardcode d! *** get ResolvedAr tifactSour ce().getAr tifactSour ce().getRe positoryId ();
  360                    Stri ng primary SiteNumber  = reposit oryId;
  361                    Stri ng seconda rySiteNumb er = null;
  362                    if(( alienSiteN umber != n ull) && (a lienSiteNu mber.lengt h() > 0))
  363                    {
  364                             second arySiteNum ber = repo sitoryId;
  365                             primar ySiteNumbe r = alienS iteNumber;
  366                    }
  367                    try 
  368                    {
  369                             
  370                             mixSit eConfigura tion = 
  371                                      MixDataS ourceProvi der.getMix Configurat ion().getS iteConfigu ration(pri marySiteNu mber, seco ndarySiteN umber);
  372                    }
  373                    catc h(MIXConfi gurationEx ception ec X)
  374                    {
  375                             throw  new IOExce ption(ecX) ;
  376                    }                 
  377                    retu rn mixSite Configurat ion;
  378           }
  379           
  380           /* *
  381            *  This func tion reduc es the req uested for mat list t o a list a cceptable  by the DOD .
  382            *  If the re quest incl udes forma ts that th e DOD does  not expec t, they wi ll not wor k properly
  383            *  so if the  request c ame from t he Clinica l Display  client, it  must be r educed to  eliminate
  384            *  types lik e TGA, J2K , PDF, DOC , etc.
  385            * /
  386           pr ivate Imag eFormatQua lityList p runeReques tList(Imag eFormatQua lityList r equestList )
  387           {
  388                    Imag eFormatQua lityList p runedList  = new Imag eFormatQua lityList() ;
  389                    for( ImageForma tQuality q uality : r equestList )
  390                    {
  391                             List<I mageFormat > allowabl eFormats =  getAccept ableImageF ormatsForQ uality(qua lity.getIm ageQuality ());
  392                             if(isQ ualityForm atAllowed( quality.ge tImageForm at(), allo wableForma ts))
  393                             {
  394                                      prunedLi st.addUniq ueMime(qua lity);
  395                             }
  396                    }
  397                    retu rn prunedL ist;
  398           }
  399           
  400           pr ivate List <ImageForm at> getAcc eptableIma geFormatsF orQuality( ImageQuali ty quality )
  401           {                 
  402                    if(q uality ==  ImageQuali ty.REFEREN CE) 
  403                             return  acceptabl eReference ResponseTy pes;
  404                    else  if(qualit y == Image Quality.DI AGNOSTIC)
  405                             return  acceptabl eDiagnosti cResponseT ypes;
  406   //               else  if(qualit y == Image Quality.DI AGNOSTICUN COMPRESSED ) -- retir ed for MIX !
  407   //                        return  acceptabl eDiagnosti cResponseT ypes;
  408                    else  // thumbn ail or oth er
  409                             return  acceptabl eThumbnail ResponseTy pes;
  410           }
  411           
  412           pr ivate bool ean isQual ityFormatA llowed(Ima geFormat f ormat, Lis t<ImageFor mat> accep tableForma ts)
  413           {
  414                    for( ImageForma t acceptab leFormat :  acceptabl eFormats)
  415                    {
  416                             if((ac ceptableFo rmat == Im ageFormat. ANYTHING)  ||
  417                                      (accepta bleFormat. getMime(). equalsIgno reCase(for mat.getMim e())))
  418                             {
  419                                      return t rue;
  420                             }
  421                    }                 
  422                    retu rn false;
  423           }        
  424           
  425           pr otected Mi xProxyServ ices getMi xProxyServ ices(Strin g alienSit eNumber)
  426           th rows IOExc eption
  427           {
  428                    if(m ixProxySer vices == n ull)
  429                    {
  430                             boolea n isAlienS iteNumber  = false;
  431                             String  host = mi xConnectio n.getURL() .getHost() ;
  432                             int po rt = mixCo nnection.g etURL().ge tPort();
  433                             MIXSit eConfigura tion mixSi teConfigur ation = ge tMixSiteCo nfiguratio n(alienSit eNumber);
  434                             if(mix SiteConfig uration.co ntainsHost AndPort())
  435                             {
  436                                      host = m ixSiteConf iguration. getHost();
  437                                      port = m ixSiteConf iguration. getPort();
  438                                      isAlienS iteNumber  = true;
  439                             }
  440                             mixPro xyServices  = 
  441                                      MixProxy Utilities. getMixProx yServices( mixSiteCon figuration
  442                                                       cr eateUnique SiteNumber (mixSiteCo nfiguratio n),
  443                                                       MI X_PROXY_SE RVICE_NAME , getDataS ourceVersi on(), 
  444                                                       ho st, 
  445                                                       po rt, 
  446                                                       is AlienSiteN umber ? al ienSiteNum ber : null );
  447                    }
  448                    retu rn mixProx yServices;
  449           }
  450           
  451           /* *
  452            *  This meth od returns  a unique  site numbe r so IDS c an properl y cache th e site res ults uniqu ely
  453            *  the conce rn is if t he VIX is  querying a n alien si te (PACSi)  for IDS,  it shouldn 't store t hat
  454            *  in the ID S cache un der site 2 00 (200 sh ould be th e DAS).
  455            *  
  456            *  if the mi xSiteConfi guration i s for site  200 (DAS) , then 200  is not pr epended
  457            *  
  458            *  
  459            *  @param mi xSiteConfi guration
  460            *  @return
  461            * /
  462           pr ivate Stri ng createU niqueSiteN umber(MIXS iteConfigu ration mix SiteConfig uration)
  463           {
  464                    if(M IXConfigur ation.DEFA ULT_DAS_SI TE.equals( mixSiteCon figuration .getSiteNu mber()))
  465                             return  mixSiteCo nfiguratio n.getSiteN umber();
  466                    retu rn MIXConf iguration. DEFAULT_DA S_SITE + " _" + mixSi teConfigur ation.getS iteNumber( );
  467           }
  468           
  469   //      pr otected St ring getRe solvedArti factSource String()
  470   //      {
  471   //               Arti factSource  artifactS ource = ge tResolvedA rtifactSou rce().getA rtifactSou rce();
  472   //               retu rn artifac tSource.ge tHomeCommu nityId() +  ", " + ar tifactSour ce.getRepo sitoryId() ;   
  473   //      }
  474           
  475           pr otected St ring getRe stServiceP ath()
  476           {
  477                    retu rn MixRest Uri.mixRes tUriV1;
  478           }
  479           pr otected Pr oxyService Type getPr oxyService Type()
  480           {
  481                    retu rn ProxySe rviceType. image;
  482           }
  483           
  484           pr otected St ring getWe bResourceU rl(String  methodUri,  Map<Strin g, String>  urlParame terKeyValu es) // was  protected ...
  485           th rows Conne ctionExcep tion
  486           {
  487                    Stri ngBuilder  url = new  StringBuil der();
  488                     //url.appe nd("https: //das-xxx. DNS     : PORT /haims/");
  489   //               url. append(pro xyServices .getProxyS ervice(get ProxyServi ceType()). getConnect ionURL());  // protoc ol://FQDN: port
  490                    url. append(MIX Configurat ion.defaul tMIXProtoc ol + "://" );
  491                    bool ean gotCon fig = fals e;
  492                    try
  493                    {
  494                             if ((t his.mixCon figuration  != null)  &&
  495                                      (this.mi xConfigura tion.getSi teConfigur ation(MIXC onfigurati on.DEFAULT _DAS_SITE,  MIXConfig uration.DE FAULT_DAS_ SITE) != n ull)) {
  496                                      MIXSiteC onfigurati on mixSite Config = t his.mixCon figuration .getSiteCo nfiguratio n(MIXConfi guration.D EFAULT_DAS _SITE, MIX Configurat ion.DEFAUL T_DAS_SITE );
  497                                      url.appe nd(mixSite Config.get Host() + " :" + mixSi teConfig.g etPort() +  "/" + mix SiteConfig .getMixApp lication()  + "/");
  498                                      gotConfi g=true;
  499                             }
  500                    } ca tch(MIXCon figuration Exception  mce) {
  501                    }
  502                    if ( !gotConfig ) {
  503                             getLog ger().debu g("MIXClie nt WARNING : Using ha rdcoded DO D Configur ation!!!") ;
  504                             url.ap pend(MIXCo nfiguratio n.defaultD ODImageHos t + ":"+ M IXConfigur ation.defa ultDODImag ePort + "/ " + MIXCon figuration .defaultDO DXChangeAp plication) ;
  505                    }
  506                    url. append(get RestServic ePath());
  507                    url. append("/" );
  508                    url. append(Res tProxyComm on.replace MethodUriW ithValues( methodUri,  urlParame terKeyValu es));                
  509                    
  510                    getL ogger().de bug("MIXCl ient WebRe sourceUrl:  " + url.t oString()) ;
  511                    retu rn url.toS tring();
  512           }
  513  
  514   }