219. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:42 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.

219.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingBaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib\image AbstractImageHRefTag.java Mon Dec 4 21:35:30 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingBaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib\image AbstractImageHRefTag.java Mon Dec 4 22:01:16 2017 UTC

219.2 Comparison summary

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

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

219.4 Active regular expressions

No regular expressions were active.

219.5 Comparison detail

  1   /**
  2    * Package : MAG - Vi stA Imagin g
  3    * WARNING : Per VHA  Directive  2004-038,  this routi ne should  not be mod ified.
  4    * Date Cr eated: Feb  4, 2008
  5    * Site Na me:  Washi ngton OI F ield Offic e, Silver  Spring, MD
  6    * @author         
BECKEC
  7    * @versio n 1.0
  8    *
  9    * ------- ---------- ---------- ---------- ---------- ---------- -------
  10    * Propert y of the U S Governme nt.
  11    * No perm ission to  copy or re distribute  this soft ware is gi ven.
  12    * Use of  unreleased  versions  of this so ftware req uires the  user
  13    * to exec ute a writ ten test a greement w ith the Vi stA Imagin g
  14    * Develop ment Offic e of the D epartment  of Veteran s Affairs,
  15    * telepho ne (301) 7 34-0100.
  16    * 
  17    * The Foo d and Drug  Administr ation clas sifies thi s software  as
  18    * a Class  II medica l device.   As such,  it may not  be change d
  19    * in any  way.  Modi fications  to this so ftware may  result in  an
  20    * adulter ated medic al device  under 21CF R820, the  use of whi ch
  21    * is cons idered to  be a viola tion of US  Federal S tatutes.
  22    * ------- ---------- ---------- ---------- ---------- ---------- -------
  23    */
  24   package go v.va.med.i maging.exc hange.busi ness.tagli b.image;
  25  
  26   import gov .va.med.im aging.exch ange.busin ess.Image;
  27  
  28   import jav ax.servlet .ServletRe quest;
  29   import jav ax.servlet .http.Http ServletReq uest;
  30   import jav ax.servlet .jsp.JspEx ception;
  31  
  32   import org .apache.lo gging.log4 j.LogManag er;
  33   import org .apache.lo gging.log4 j.Logger;
  34  
  35   /**
  36    * This ta g will gen erate a St ring that  can be use d as an hr ef to an i mage.
  37    * It need s, by defa ult, only  the applic ation path  (servlet  mapping )  of the WAI  servlet.
  38    * The ima ge specifi cation is  determined  by the su rrounding  AbstractIm ageTag.
  39    * The qua lity and a ccept type  may be se t using ta g properti es, or if  left blank
  40    * will be  defaulted .
  41    * Derived  classes o f this tag  specify t he image q uality (Th umbnail, R eference,  and Diagno stic).
  42    * 
  43    * @author         
BECKEC
  44    */
  45   public abs tract clas s Abstract ImageHRefT ag 
  46   extends Ab stractImag ePropertyT ag
  47   {
  48           //  a derived  class may  specify e ither, or  both, of t hese keys
  49           //  in the pa thInfoPatt ern
  50           pr otected fi nal static  String im ageUrnPara meterKey =  "[imageUr n]";
  51           pr otected fi nal static  String pa tientIcnPa rameterKey  = "[patie ntIcn]";
  52  
  53           pr otected ab stract Str ing getDef aultPathIn foPattern( );
  54           
  55           pr ivate Stri ng host =  null;
  56           pr ivate Stri ng context  = null;
  57           pr ivate Stri ng pathInf oPattern =  getDefaul tPathInfoP attern();
  58           pr ivate Stri ng protoco lOverride;
  59           pr ivate Stri ng targetS ite;
  60           pr ivate bool ean includ eProtocolI nUrl = fal se;
  61           pr ivate bool ean includ eHostInUrl  = false;
  62           pr ivate bool ean includ eContextIn Url = fals e;
  63           
  64           pr ivate Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  65           
  66           /* *
  67            *  Set/Get t he host po rtion of t he URL.  T his proper ty is opti onal
  68            *  and, if n ot specifi ed will de fault to a  null, and  will prod uce relati ve
  69            *  reference s.
  70            *  
  71            *  @return
  72            * /
  73           pu blic Strin g getHost( )
  74       {
  75           re turn host;
  76       }
  77           pu blic void  setHost(St ring host)
  78       {
  79           th is.host =  host;
  80       }
  81           
  82           /* *
  83            *  Set/Get t he context  portion o f the URL.   This pro perty is o ptional
  84            *  and, if n ot specifi ed will de fault to a  null, and  will prod uce relati ve
  85            *  reference s.
  86            *  The conte xt MUST st art with a  '/' chara cter and m ust not en d with a
  87            *  '/'.  Thi s is consi stent with  the behav ior of req uest.getCo ntext() 
  88            *  
  89            *  The value  returned  from here  must be co nsistent w ith the ge tContext()  
  90            *  method of  HttpServl etRequest.
  91            *  
  92            *  @return
  93            * /
  94           pu blic Strin g getConte xt()
  95       {
  96           re turn conte xt == null  ? 
  97                             null :  
  98                             contex t.length()  == 0 ? "/ " :
  99                                      context. charAt(0)  == '/' ?  
  100                                      context  :
  101                                      ("/" + c ontext);
  102       }
  103           pu blic void  setContext (String co ntextBase)
  104       {
  105           th is.context  = context Base;
  106       }
  107  
  108           /* *
  109            *  The href  is formed  by substit uting the  enclosing  image tags  identifyi ng informa tion
  110            *  into the  UrlRegex s tring.  Th e regex sh ould inclu de the fol lowing tag s where th e values
  111            *  are to be  substitut ed:
  112            *  <imageUrn >
  113            *  
  114            *  If this p roperty is  not speci fied then  the follow ing values  is used: 
  115            *  "<imageUr n>"
  116            *  
  117            *  @return
  118            * /
  119           pu blic Strin g getPathI nfoPattern ()
  120       {
  121           re turn pathI nfoPattern  == null | | pathInfo Pattern.le ngth() ==  0 ? getDef aultPathIn foPattern( ) : pathIn foPattern;
  122       }
  123           pu blic void  setPathInf oPattern(S tring urlR egex)
  124       {
  125           th is.pathInf oPattern =  urlRegex;
  126       }
  127  
  128           /* *
  129            *  If set th en tack "h ttp://" on  the front  of the UR L.
  130        * @re turn the i ncludeProt ocolInUrl
  131        */
  132       public  boolean i sIncludePr otocolInUr l()
  133       {
  134           re turn inclu deProtocol InUrl;
  135       }
  136       public  void setI ncludeProt ocolInUrl( boolean in cludeProto colInUrl)
  137       {
  138           th is.include ProtocolIn Url = incl udeProtoco lInUrl;
  139       }
  140           /* *
  141        * @re turn the i ncludeHost InUrl
  142        */
  143       public  boolean i sIncludeHo stInUrl()
  144       {
  145           re turn inclu deHostInUr l;
  146       }
  147       public  void setI ncludeHost InUrl(bool ean includ eHostInUrl )
  148       {
  149           th is.include HostInUrl  = includeH ostInUrl;
  150       }
  151           /* *
  152            *  If genera teComplete Path is se t then the  returned  URL will b e fully
  153            *  defined.
  154            *  
  155        * @re turn the g enerateCom pletePath
  156        */
  157       public  boolean i sIncludeCo ntextInUrl ()
  158       {
  159           re turn inclu deContextI nUrl;
  160       }
  161       public  void setI ncludeCont extInUrl(b oolean inc ludeContex tInUrl)
  162       {
  163           th is.include ContextInU rl = inclu deContextI nUrl;
  164       }
  165       
  166           /* *
  167        * @re turn the p rotocolOve rride
  168        */
  169       public  String ge tProtocolO verride()
  170       {
  171           re turn proto colOverrid e;
  172       }
  173       public  void setP rotocolOve rride(Stri ng protoco lOverride)
  174       {
  175           th is.protoco lOverride  = protocol Override;
  176       }
  177       
  178           /* *
  179        * @re turn the t argetSite
  180        */
  181       public  String ge tTargetSit e()
  182       {
  183           re turn targe tSite;
  184       }
  185       public  void setT argetSite( String tar getSite)
  186       {
  187           th is.targetS ite = targ etSite;
  188       }
  189       
  190           /* *
  191            *  @see gov. va.med.ima ging.excha nge.busine ss.taglib. image.Abst ractImageP ropertyTag #getElemen tValue()
  192            * /
  193           @O verride
  194           pr otected St ring getEl ementValue () 
  195           th rows JspEx ception
  196           {
  197                    Stri ng request Host = nul l;
  198                    int  requestPor t =0;
  199                    Stri ng request Context =  null;
  200                    Stri ng protoco l = null;
  201                    
  202                    try
  203           {
  204                    Serv letRequest  servletRe quest = th is.pageCon text.getRe quest();
  205                    requ estPort =  servletReq uest.getLo calPort();
  206                    prot ocol = ser vletReques t.getProto col();                  // e.g.  HTTP/1.1
  207                    if(p rotocol.in dexOf('/')  > 0)
  208                             protoc ol = proto col.substr ing(0, pro tocol.inde xOf('/'));
  209                    prot ocol = pro tocol.toLo werCase();
  210                    
  211                    Http ServletReq uest req =  (HttpServ letRequest )servletRe quest;
  212                    requ estContext  = req.get ContextPat h();
  213                    requ estHost =  req.getLoc alName();
  214           } 
  215                    catc h (ClassCa stExceptio n e1)
  216           {
  217                             logger .warn("Una ble to cas t request  to HttpSer vletReques t, tag lib rary expec ts to be r unning ove r HTTP, co ntinuing . ..");
  218           } 
  219                    
  220                    // U RL (in J2E E terms) c onsists of :
  221                    // < protocol>: //<host>:< port>/<con text>/<pat h-info>/<a dditional- path-info>
  222                    // t he context  determine s the web  app
  223                    // t he path-in fo was mat ched to th e servlet  mapping
  224                    // a dditional= path-info  is what is  left over
  225                    
  226                    // t he path in fo is the  portion of  the URL t o the righ t of the c ontext, no t includin g the quer y string
  227                    Stri ng pathInf o = buildP athInfo();
  228                    
  229                    // b uild the p ath to the  image ser vlet
  230                    Stri ngBuilder  sb = new S tringBuild er();
  231                    
  232                    if(i sIncludePr otocolInUr l())
  233                    {
  234                             sb.app end(protoc ol);
  235                             sb.app end("://") ;
  236                    }
  237                    
  238                    // i f the host  is explic itly speci fied then  append tha t host nam e
  239                    // e lse if Inc ludeHostIn Url is set , append t he host na me of the  request
  240                    // e lse do not hing and t he URL wil l be relat ive
  241                    if(g etHost() ! = null )
  242                    {
  243                             sb.app end(getHos t());
  244                    }
  245                    else  if(isIncl udeHostInU rl())
  246                    {
  247                             sb.app end(reques tHost);
  248                             sb.app end(":");
  249                             sb.app end(reques tPort);
  250                    }
  251                    
  252                    // i f the cont ext base i s specifie d then use  that valu e
  253                    // e lse if Inc ludeContex tInUrl is  set use th e request  context
  254                    // e lse use th is request 's context
  255                    if(g etContext( ) != null  )
  256                             sb.app end(getCon text());
  257                    else  if(isIncl udeContext InUrl())
  258                             sb.app end(reques tContext);
  259                    
  260                    // a ppend a '/ ' if one i s not ther e already  and a cont ext was sp ecified
  261                    if(s b.length()  != 0 && ' /' != sb.c harAt(sb.l ength()-1) )
  262                             sb.app end("/");
  263                    
  264                    // a lways appe nd the pat h info
  265                    sb.a ppend(path Info);
  266  
  267                    // i f the prot ocol overr ide AND th e target s ite are pr ovided the n
  268                    // t ack them o nto the UR L as query  parameter s
  269                    if(g etProtocol Override()  != null & & getProto colOverrid e().length () > 0 && 
  270                             getTar getSite()  != null &&  getTarget Site().len gth() > 0  )
  271                    {
  272                             sb.app end("?");
  273                             sb.app end("proto colOverrid e=");
  274                             sb.app end(getPro tocolOverr ide());
  275                             sb.app end("&");
  276                             sb.app end("targe tSite=");
  277                             sb.app end(getTar getSite()) ;
  278                    }
  279                    
  280                    retu rn sb.toSt ring();
  281           }
  282           
  283           /* *
  284            *  Build the  pathInfo  portion of  the image  URL using  the patte rn
  285            *  in getPat hInfo and  the image  URN or the  patient I CN values  from the
  286            *  ancestor  Image elem ent.
  287            *  
  288        * @re turn
  289        * @th rows JspEx ception
  290        */
  291       privat e String b uildPathIn fo() 
  292       throws  JspExcept ion
  293       {
  294                String p athInfo =  getPathInf oPattern() ;
  295                    
  296                    Imag e image =  this.getIm age();
  297                    
  298                    if(p athInfo.co ntains(ima geUrnParam eterKey))
  299                    {
  300                             String  imageUrnE xternal =  null;
  301                             imageU rnExternal  = image.g etImageUrn ().toStrin g();
  302                             pathIn fo = pathI nfo.replac e(imageUrn ParameterK ey, imageU rnExternal );
  303                    }
  304                    
  305                    if(p athInfo.co ntains(pat ientIcnPar ameterKey) )
  306                    {
  307                             String  patientIc nExternal  = null;
  308                             
  309                             patien tIcnExtern al = image .getPatien tId();
  310                             pathIn fo = pathI nfo.replac e(patientI cnParamete rKey, pati entIcnExte rnal);
  311                    }
  312                    
  313                return p athInfo;
  314       }
  315  
  316   }